blob: 39f85f1c5025176a2a3107164be4e1d31a2b7450 [file] [log] [blame]
Linus Walleijbef39252023-02-01 00:16:13 +01001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Executes tests for SEAMA (SEAttle iMAge) command
4 *
5 * Copyright (C) 2021 Linus Walleij <linus.walleij@linaro.org>
6 */
7
Linus Walleijbef39252023-02-01 00:16:13 +01008#include <command.h>
9#include <dm.h>
Linus Walleijbef39252023-02-01 00:16:13 +010010#include <test/test.h>
11#include <test/ut.h>
12
Simon Glassb15512c2025-01-20 14:25:32 -070013#define SEAMA_TEST(_name, _flags) UNIT_TEST(_name, _flags, seama)
Linus Walleijbef39252023-02-01 00:16:13 +010014
15static int seama_test_noargs(struct unit_test_state *uts)
16{
17 /* Test that 'seama' with no arguments fails gracefully */
Linus Walleijbef39252023-02-01 00:16:13 +010018 run_command("seama", 0);
19 ut_assert_nextlinen("seama - Load the SEAMA image and sets envs");
20 ut_assert_skipline();
21 ut_assert_skipline();
22 ut_assert_skipline();
23 ut_assert_skipline();
24 ut_assert_console_end();
25 return 0;
26}
Simon Glass11fcfa32024-08-22 07:57:50 -060027SEAMA_TEST(seama_test_noargs, UTF_CONSOLE);
Linus Walleijbef39252023-02-01 00:16:13 +010028
29static int seama_test_addr(struct unit_test_state *uts)
30{
31 /* Test that loads SEAMA image 0 to address 0x01000000 */
Linus Walleijbef39252023-02-01 00:16:13 +010032 run_command("seama 0x01000000", 0);
33 ut_assert_nextlinen("Loading SEAMA image 0 from nand0");
34 ut_assert_nextlinen("SEMA IMAGE:");
35 ut_assert_nextlinen(" metadata size ");
36 ut_assert_nextlinen(" image size ");
37 ut_assert_nextlinen(" checksum ");
38 ut_assert_nextlinen("Decoding SEAMA image 0x01000040..");
39 ut_assert_console_end();
40 return 0;
41}
Simon Glass11fcfa32024-08-22 07:57:50 -060042SEAMA_TEST(seama_test_addr, UTF_CONSOLE);
Linus Walleijbef39252023-02-01 00:16:13 +010043
44static int seama_test_index(struct unit_test_state *uts)
45{
46 /* Test that loads SEAMA image 0 exlicitly specified */
Linus Walleijbef39252023-02-01 00:16:13 +010047 run_command("seama 0x01000000 0", 0);
48 ut_assert_nextlinen("Loading SEAMA image 0 from nand0");
49 ut_assert_nextlinen("SEMA IMAGE:");
50 ut_assert_nextlinen(" metadata size ");
51 ut_assert_nextlinen(" image size ");
52 ut_assert_nextlinen(" checksum ");
53 ut_assert_nextlinen("Decoding SEAMA image 0x01000040..");
54 ut_assert_console_end();
55 return 0;
56}
Simon Glass11fcfa32024-08-22 07:57:50 -060057SEAMA_TEST(seama_test_index, UTF_CONSOLE);