blob: 2844b057859ef706410c8d19ce1173cb3d1d6773 [file] [log] [blame]
Simon Glass44ad35a2022-10-20 18:23:03 -06001// 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 */
16static 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}
36BOOTSTD_TEST(test_image_phase, 0);