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 | 5 |
6 #include "cgptlib_test.h" | 6 #include "cgptlib_test.h" |
7 #include <string.h> | 7 #include <string.h> |
8 #include "cgptlib.h" | 8 #include "cgptlib.h" |
9 #include "cgptlib_internal.h" | 9 #include "cgptlib_internal.h" |
10 #include "crc32.h" | 10 #include "crc32.h" |
| 11 #include "crc32_test.h" |
11 #include "gpt.h" | 12 #include "gpt.h" |
12 #include "quick_sort_test.h" | 13 #include "quick_sort_test.h" |
13 #include "utility.h" | 14 #include "utility.h" |
14 | 15 |
15 /* Testing partition layout (sector_bytes=512) | 16 /* Testing partition layout (sector_bytes=512) |
16 * | 17 * |
17 * LBA Size Usage | 18 * LBA Size Usage |
18 * --------------------------------------------------------- | 19 * --------------------------------------------------------- |
19 * 0 1 PMBR | 20 * 0 1 PMBR |
20 * 1 1 primary partition header | 21 * 1 1 primary partition header |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 { TEST_CASE(CorruptCombinationTest), }, | 1145 { TEST_CASE(CorruptCombinationTest), }, |
1145 { TEST_CASE(TestQuickSortFixed), }, | 1146 { TEST_CASE(TestQuickSortFixed), }, |
1146 { TEST_CASE(TestQuickSortRandom), }, | 1147 { TEST_CASE(TestQuickSortRandom), }, |
1147 { TEST_CASE(NoValidKernelEntryTest), }, | 1148 { TEST_CASE(NoValidKernelEntryTest), }, |
1148 { TEST_CASE(CombinationalNextKernelEntryTest), }, | 1149 { TEST_CASE(CombinationalNextKernelEntryTest), }, |
1149 { TEST_CASE(IncreaseTriesTest), }, | 1150 { TEST_CASE(IncreaseTriesTest), }, |
1150 { TEST_CASE(MarkBadKernelEntryTest), }, | 1151 { TEST_CASE(MarkBadKernelEntryTest), }, |
1151 { TEST_CASE(UpdateInvalidKernelTypeTest), }, | 1152 { TEST_CASE(UpdateInvalidKernelTypeTest), }, |
1152 { TEST_CASE(NormalBootCase), }, | 1153 { TEST_CASE(NormalBootCase), }, |
1153 { TEST_CASE(HigherPriorityTest), }, | 1154 { TEST_CASE(HigherPriorityTest), }, |
| 1155 { TEST_CASE(TestCrc32TestVectors), }, |
1154 }; | 1156 }; |
1155 | 1157 |
1156 for (i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); ++i) { | 1158 for (i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); ++i) { |
1157 printf("Running %s() ...\n", test_cases[i].name); | 1159 printf("Running %s() ...\n", test_cases[i].name); |
1158 test_cases[i].retval = test_cases[i].fp(); | 1160 test_cases[i].retval = test_cases[i].fp(); |
1159 if (test_cases[i].retval) { | 1161 if (test_cases[i].retval) { |
1160 printf(COL_RED "[ERROR]\n\n" COL_STOP); | 1162 printf(COL_RED "[ERROR]\n\n" COL_STOP); |
1161 ++error_count; | 1163 ++error_count; |
1162 } else { | 1164 } else { |
1163 printf(COL_GREEN "[PASS]\n\n" COL_STOP); | 1165 printf(COL_GREEN "[PASS]\n\n" COL_STOP); |
1164 } | 1166 } |
1165 } | 1167 } |
1166 | 1168 |
1167 if (error_count) { | 1169 if (error_count) { |
1168 printf("\n--------------------------------------------------\n"); | 1170 printf("\n--------------------------------------------------\n"); |
1169 printf(COL_RED "The following %d test cases are failed:\n" COL_STOP, | 1171 printf(COL_RED "The following %d test cases are failed:\n" COL_STOP, |
1170 error_count); | 1172 error_count); |
1171 for (i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); ++i) { | 1173 for (i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); ++i) { |
1172 if (test_cases[i].retval) | 1174 if (test_cases[i].retval) |
1173 printf(" %s()\n", test_cases[i].name); | 1175 printf(" %s()\n", test_cases[i].name); |
1174 } | 1176 } |
1175 } | 1177 } |
1176 | 1178 |
1177 return (error_count) ? 1 : 0; | 1179 return (error_count) ? 1 : 0; |
1178 } | 1180 } |
OLD | NEW |