Home | History | Annotate | Download | only in tests
      1 /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
      2  * Use of this source code is governed by a BSD-style license that can be
      3  * found in the LICENSE file.
      4  *
      5  * Tests for do-nothing rollback_index functions with disabled TPM
      6  */
      7 
      8 #include <stdint.h>
      9 #include <stdio.h>
     10 #include <stdlib.h>
     11 #include <string.h>
     12 
     13 #define _STUB_IMPLEMENTATION_  /* So we can use memset() ourselves */
     14 
     15 #include "rollback_index.h"
     16 #include "test_common.h"
     17 
     18 int main(int argc, char* argv[])
     19 {
     20 	int is_virt_dev;
     21 	uint32_t version;
     22 
     23 	TEST_EQ(RollbackS3Resume(), 0, "RollbackS3Resume()");
     24 
     25 	is_virt_dev = 1;
     26 	version = 1;
     27 	TEST_EQ(RollbackFirmwareSetup(0, 0, 0, &is_virt_dev, &version),
     28 		0, "RollbackFirmwareSetup()");
     29 	TEST_EQ(is_virt_dev, 0, "rfs is_virt_dev");
     30 	TEST_EQ(version, 0, "rfs version");
     31 
     32 	TEST_EQ(RollbackFirmwareWrite(0), 0, "RollbackFirmwareWrite()");
     33 	TEST_EQ(RollbackFirmwareLock(), 0, "RollbackFirmwareLock()");
     34 
     35 	version = 1;
     36 	TEST_EQ(RollbackKernelRead(&version), 0, "RollbackKernelRead()");
     37 	TEST_EQ(version, 0, "rkr version");
     38 
     39 	TEST_EQ(RollbackKernelWrite(0), 0, "RollbackKernelWrite()");
     40 	TEST_EQ(RollbackKernelLock(0), 0, "RollbackKernelLock()");
     41 
     42 	return gTestSuccess ? 0 : 255;
     43 }
     44