Simon Glass | e3f81ae | 2022-10-20 18:23:03 -0600 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Test for vbe-simple bootmeth. All start with 'vbe_simple' |
| 4 | * |
| 5 | * Copyright 2023 Google LLC |
| 6 | * Written by Simon Glass <sjg@chromium.org> |
| 7 | */ |
| 8 | |
Simon Glass | e3f81ae | 2022-10-20 18:23:03 -0600 | [diff] [blame] | 9 | #include <image.h> |
| 10 | #include <test/suites.h> |
| 11 | #include <test/ut.h> |
| 12 | #include "bootstd_common.h" |
| 13 | |
| 14 | /* Test of image phase */ |
| 15 | static int test_image_phase(struct unit_test_state *uts) |
| 16 | { |
| 17 | int val; |
| 18 | |
| 19 | ut_asserteq_str("U-Boot phase", genimg_get_phase_name(IH_PHASE_U_BOOT)); |
| 20 | ut_asserteq_str("SPL Phase", genimg_get_phase_name(IH_PHASE_SPL)); |
| 21 | ut_asserteq_str("any", genimg_get_phase_name(IH_PHASE_NONE)); |
| 22 | ut_asserteq_str("Unknown Phase", genimg_get_phase_name(-1)); |
| 23 | |
| 24 | ut_asserteq(IH_PHASE_U_BOOT, genimg_get_phase_id("u-boot")); |
| 25 | ut_asserteq(IH_PHASE_SPL, genimg_get_phase_id("spl")); |
| 26 | ut_asserteq(IH_PHASE_NONE, genimg_get_phase_id("none")); |
| 27 | ut_asserteq(-1, genimg_get_phase_id("fred")); |
| 28 | |
| 29 | val = image_ph(IH_PHASE_SPL, IH_TYPE_FIRMWARE); |
| 30 | ut_asserteq(IH_PHASE_SPL, image_ph_phase(val)); |
| 31 | ut_asserteq(IH_TYPE_FIRMWARE, image_ph_type(val)); |
| 32 | |
| 33 | return 0; |
| 34 | } |
| 35 | BOOTSTD_TEST(test_image_phase, 0); |