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 | |
| 9 | #include <common.h> |
| 10 | #include <image.h> |
| 11 | #include <test/suites.h> |
| 12 | #include <test/ut.h> |
| 13 | #include "bootstd_common.h" |
| 14 | |
| 15 | /* Test of image phase */ |
| 16 | static int test_image_phase(struct unit_test_state *uts) |
| 17 | { |
| 18 | int val; |
| 19 | |
| 20 | ut_asserteq_str("U-Boot phase", genimg_get_phase_name(IH_PHASE_U_BOOT)); |
| 21 | ut_asserteq_str("SPL Phase", genimg_get_phase_name(IH_PHASE_SPL)); |
| 22 | ut_asserteq_str("any", genimg_get_phase_name(IH_PHASE_NONE)); |
| 23 | ut_asserteq_str("Unknown Phase", genimg_get_phase_name(-1)); |
| 24 | |
| 25 | ut_asserteq(IH_PHASE_U_BOOT, genimg_get_phase_id("u-boot")); |
| 26 | ut_asserteq(IH_PHASE_SPL, genimg_get_phase_id("spl")); |
| 27 | ut_asserteq(IH_PHASE_NONE, genimg_get_phase_id("none")); |
| 28 | ut_asserteq(-1, genimg_get_phase_id("fred")); |
| 29 | |
| 30 | val = image_ph(IH_PHASE_SPL, IH_TYPE_FIRMWARE); |
| 31 | ut_asserteq(IH_PHASE_SPL, image_ph_phase(val)); |
| 32 | ut_asserteq(IH_TYPE_FIRMWARE, image_ph_type(val)); |
| 33 | |
| 34 | return 0; |
| 35 | } |
| 36 | BOOTSTD_TEST(test_image_phase, 0); |