1 /* Copyright 2020 The ChromiumOS Authors 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 recovery reasons. 6 */ 7 8 #include "2recovery_reasons.h" 9 #include "common/tests.h" 10 get_recovery_reason_string_tests(void)11static void get_recovery_reason_string_tests(void) 12 { 13 int i; 14 15 /* Recovery string should be non-null for any code */ 16 for (i = 0; i < 0x100; i++) 17 TEST_PTR_NEQ(vb2_get_recovery_reason_string(i), NULL, 18 "Non-null reason"); 19 20 /* Validity check on one of the strings */ 21 TEST_EQ(strcmp(vb2_get_recovery_reason_string(VB2_RECOVERY_GBB_HEADER), 22 "Error parsing GBB header"), 0, 23 "Recovery reason validity check"); 24 } 25 main(void)26int main(void) 27 { 28 get_recovery_reason_string_tests(); 29 30 return gTestSuccess ? 0 : 255; 31 } 32