summaryrefslogtreecommitdiff
path: root/test/cmd/seama.c
blob: 39f85f1c5025176a2a3107164be4e1d31a2b7450 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// SPDX-License-Identifier: GPL-2.0+
/*
 * Executes tests for SEAMA (SEAttle iMAge) command
 *
 * Copyright (C) 2021 Linus Walleij <linus.walleij@linaro.org>
 */

#include <command.h>
#include <dm.h>
#include <test/test.h>
#include <test/ut.h>

#define SEAMA_TEST(_name, _flags)	UNIT_TEST(_name, _flags, seama)

static int seama_test_noargs(struct unit_test_state *uts)
{
	/* Test that 'seama' with no arguments fails gracefully */
	run_command("seama", 0);
	ut_assert_nextlinen("seama - Load the SEAMA image and sets envs");
	ut_assert_skipline();
	ut_assert_skipline();
	ut_assert_skipline();
	ut_assert_skipline();
	ut_assert_console_end();
	return 0;
}
SEAMA_TEST(seama_test_noargs, UTF_CONSOLE);

static int seama_test_addr(struct unit_test_state *uts)
{
	/* Test that loads SEAMA image 0 to address 0x01000000 */
	run_command("seama 0x01000000", 0);
	ut_assert_nextlinen("Loading SEAMA image 0 from nand0");
	ut_assert_nextlinen("SEMA IMAGE:");
	ut_assert_nextlinen("  metadata size ");
	ut_assert_nextlinen("  image size ");
	ut_assert_nextlinen("  checksum ");
	ut_assert_nextlinen("Decoding SEAMA image 0x01000040..");
	ut_assert_console_end();
	return 0;
}
SEAMA_TEST(seama_test_addr, UTF_CONSOLE);

static int seama_test_index(struct unit_test_state *uts)
{
	/* Test that loads SEAMA image 0 exlicitly specified */
	run_command("seama 0x01000000 0", 0);
	ut_assert_nextlinen("Loading SEAMA image 0 from nand0");
	ut_assert_nextlinen("SEMA IMAGE:");
	ut_assert_nextlinen("  metadata size ");
	ut_assert_nextlinen("  image size ");
	ut_assert_nextlinen("  checksum ");
	ut_assert_nextlinen("Decoding SEAMA image 0x01000040..");
	ut_assert_console_end();
	return 0;
}
SEAMA_TEST(seama_test_index, UTF_CONSOLE);