| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 * | 4 * |
| 5 * Tests for firmware NV storage library. | 5 * Tests for firmware NV storage library. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 char* desc; /* Field description */ | 22 char* desc; /* Field description */ |
| 23 } VbNvField; | 23 } VbNvField; |
| 24 | 24 |
| 25 /* Array of fields to test, terminated with a field with desc==NULL. */ | 25 /* Array of fields to test, terminated with a field with desc==NULL. */ |
| 26 static VbNvField nvfields[] = { | 26 static VbNvField nvfields[] = { |
| 27 {VBNV_DEBUG_RESET_MODE, 0, 1, 0, "debug reset mode"}, | 27 {VBNV_DEBUG_RESET_MODE, 0, 1, 0, "debug reset mode"}, |
| 28 {VBNV_TRY_B_COUNT, 0, 6, 15, "try B count"}, | 28 {VBNV_TRY_B_COUNT, 0, 6, 15, "try B count"}, |
| 29 {VBNV_RECOVERY_REQUEST, 0, 0x42, 0xED, "recovery request"}, | 29 {VBNV_RECOVERY_REQUEST, 0, 0x42, 0xED, "recovery request"}, |
| 30 {VBNV_LOCALIZATION_INDEX, 0, 0x69, 0xB0, "localization index"}, | 30 {VBNV_LOCALIZATION_INDEX, 0, 0x69, 0xB0, "localization index"}, |
| 31 {VBNV_KERNEL_FIELD, 0, 0x12345678, 0xFEDCBA98, "kernel field"}, | 31 {VBNV_KERNEL_FIELD, 0, 0x12345678, 0xFEDCBA98, "kernel field"}, |
| 32 {VBNV_TRIED_FIRMWARE_B, 0, 1, 0, "tried firmware B"}, | 32 {VBNV_TEST_ERROR_FUNC, 0, 1, 7, "verified boot test error func"}, |
| 33 {VBNV_FW_VERIFIED_KERNEL_KEY, 0, 1, 0, "firmware verified kernel key"}, | 33 {VBNV_TEST_ERROR_NUM, 0, 3, 6, "verified boot test error number"}, |
| 34 {0, 0, 0, 0, NULL} | 34 {0, 0, 0, 0, NULL} |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 static void VbNvStorageTest(void) { | 37 static void VbNvStorageTest(void) { |
| 38 | 38 |
| 39 VbNvField* vnf; | 39 VbNvField* vnf; |
| 40 VbNvContext c; | 40 VbNvContext c; |
| 41 uint8_t goodcrc; | 41 uint8_t goodcrc; |
| 42 uint32_t data; | 42 uint32_t data; |
| 43 | 43 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 int main(int argc, char* argv[]) { | 139 int main(int argc, char* argv[]) { |
| 140 int error_code = 0; | 140 int error_code = 0; |
| 141 | 141 |
| 142 VbNvStorageTest(); | 142 VbNvStorageTest(); |
| 143 | 143 |
| 144 if (!gTestSuccess) | 144 if (!gTestSuccess) |
| 145 error_code = 255; | 145 error_code = 255; |
| 146 | 146 |
| 147 return error_code; | 147 return error_code; |
| 148 } | 148 } |
| OLD | NEW |