summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile1
-rw-r--r--test/README6
-rw-r--r--test/bloblist.c187
-rw-r--r--test/cmd_ut.c3
-rw-r--r--test/dm/i2c.c2
-rw-r--r--test/dm/misc.c6
-rw-r--r--test/dm/rtc.c9
-rw-r--r--test/dm/sf.c57
-rw-r--r--test/dm/test-fdt.c47
-rw-r--r--test/dm/video.c4
-rwxr-xr-xtest/fs/fs-test.sh14
-rw-r--r--test/py/tests/test_bind.py28
-rw-r--r--test/py/tests/test_efi_selftest.py10
-rwxr-xr-xtest/py/tests/test_fit.py12
-rw-r--r--test/py/tests/test_fs/test_basic.py1
-rw-r--r--test/py/tests/test_fs/test_ext.py1
-rw-r--r--test/py/tests/test_fs/test_mkdir.py1
-rw-r--r--test/py/tests/test_fs/test_unlink.py1
-rw-r--r--test/py/tests/test_handoff.py15
-rw-r--r--test/py/tests/test_ofplatdata.py31
-rw-r--r--test/py/tests/test_vboot.py16
-rw-r--r--test/py/tests/vboot/sign-configs-sha1-pss.its46
-rw-r--r--test/py/tests/vboot/sign-configs-sha1.its18
-rw-r--r--test/py/tests/vboot/sign-configs-sha256-pss.its46
-rw-r--r--test/py/tests/vboot/sign-configs-sha256.its18
-rw-r--r--test/py/tests/vboot/sign-images-sha1-pss.its44
-rw-r--r--test/py/tests/vboot/sign-images-sha1.its16
-rw-r--r--test/py/tests/vboot/sign-images-sha256-pss.its44
-rw-r--r--test/py/tests/vboot/sign-images-sha256.its16
-rw-r--r--test/py/u_boot_console_base.py2
-rw-r--r--test/py/u_boot_console_sandbox.py18
-rwxr-xr-xtest/run12
32 files changed, 641 insertions, 91 deletions
diff --git a/test/Makefile b/test/Makefile
index 1e434730b68..2fe41f489c3 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -2,6 +2,7 @@
#
# (C) Copyright 2012 The Chromium Authors
+obj-$(CONFIG_SANDBOX) += bloblist.o
obj-$(CONFIG_UNIT_TEST) += cmd_ut.o
obj-$(CONFIG_UNIT_TEST) += ut.o
obj-$(CONFIG_SANDBOX) += command_ut.o
diff --git a/test/README b/test/README
index 873a4e19313..4bc9ca3a6ae 100644
--- a/test/README
+++ b/test/README
@@ -10,11 +10,15 @@ Running tests
To run most tests on sandbox, type this:
- test/run
+ make check
in the U-Boot directory. Note that only the pytest suite is run using this
command.
+Some tests take ages to run. To run just the quick ones, type this:
+
+ make qcheck
+
Sandbox
-------
diff --git a/test/bloblist.c b/test/bloblist.c
new file mode 100644
index 00000000000..89bdb012e35
--- /dev/null
+++ b/test/bloblist.c
@@ -0,0 +1,187 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2018, Google Inc. All rights reserved.
+ */
+
+#include <common.h>
+#include <bloblist.h>
+#include <log.h>
+#include <mapmem.h>
+#include <test/suites.h>
+#include <test/test.h>
+#include <test/ut.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Declare a new compression test */
+#define BLOBLIST_TEST(_name, _flags) \
+ UNIT_TEST(_name, _flags, bloblist_test)
+
+enum {
+ TEST_TAG = 1,
+ TEST_TAG2 = 2,
+ TEST_TAG_MISSING = 3,
+
+ TEST_SIZE = 10,
+ TEST_SIZE2 = 20,
+
+ TEST_ADDR = CONFIG_BLOBLIST_ADDR,
+ TEST_BLOBLIST_SIZE = 0x100,
+};
+
+static struct bloblist_hdr *clear_bloblist(void)
+{
+ struct bloblist_hdr *hdr;
+
+ /* Clear out any existing bloblist so we have a clean slate */
+ hdr = map_sysmem(CONFIG_BLOBLIST_ADDR, TEST_BLOBLIST_SIZE);
+ memset(hdr, '\0', TEST_BLOBLIST_SIZE);
+
+ return hdr;
+}
+
+static int bloblist_test_init(struct unit_test_state *uts)
+{
+ struct bloblist_hdr *hdr;
+
+ hdr = clear_bloblist();
+ ut_asserteq(-ENOENT, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+ ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0));
+ hdr->version++;
+ ut_asserteq(-EPROTONOSUPPORT, bloblist_check(TEST_ADDR,
+ TEST_BLOBLIST_SIZE));
+
+ ut_asserteq(-ENOSPC, bloblist_new(TEST_ADDR, 0x10, 0));
+ ut_asserteq(-EFAULT, bloblist_new(1, TEST_BLOBLIST_SIZE, 0));
+ ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0));
+
+ ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+ ut_assertok(bloblist_finish());
+ ut_assertok(bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+ hdr->flags++;
+ ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+
+ return 1;
+}
+BLOBLIST_TEST(bloblist_test_init, 0);
+
+static int bloblist_test_blob(struct unit_test_state *uts)
+{
+ struct bloblist_hdr *hdr;
+ struct bloblist_rec *rec, *rec2;
+ char *data;
+
+ /* At the start there should be no records */
+ hdr = clear_bloblist();
+ ut_assertnull(bloblist_find(TEST_TAG, TEST_BLOBLIST_SIZE));
+ ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0));
+
+ /* Add a record and check that we can find it */
+ data = bloblist_add(TEST_TAG, TEST_SIZE);
+ rec = (void *)(hdr + 1);
+ ut_asserteq_ptr(rec + 1, data);
+ data = bloblist_find(TEST_TAG, TEST_SIZE);
+ ut_asserteq_ptr(rec + 1, data);
+
+ /* Check the 'ensure' method */
+ ut_asserteq_ptr(data, bloblist_ensure(TEST_TAG, TEST_SIZE));
+ ut_assertnull(bloblist_ensure(TEST_TAG, TEST_SIZE2));
+ rec2 = (struct bloblist_rec *)(data + ALIGN(TEST_SIZE, BLOBLIST_ALIGN));
+
+ /* Check for a non-existent record */
+ ut_asserteq_ptr(data, bloblist_ensure(TEST_TAG, TEST_SIZE));
+ ut_asserteq_ptr(rec2 + 1, bloblist_ensure(TEST_TAG2, TEST_SIZE2));
+ ut_assertnull(bloblist_find(TEST_TAG_MISSING, 0));
+
+ return 0;
+}
+BLOBLIST_TEST(bloblist_test_blob, 0);
+
+static int bloblist_test_bad_blob(struct unit_test_state *uts)
+{
+ struct bloblist_hdr *hdr;
+ void *data;
+
+ hdr = clear_bloblist();
+ ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0));
+ data = hdr + 1;
+ data += sizeof(struct bloblist_rec);
+ ut_asserteq_ptr(data, bloblist_ensure(TEST_TAG, TEST_SIZE));
+ ut_asserteq_ptr(data, bloblist_ensure(TEST_TAG, TEST_SIZE));
+
+ return 0;
+}
+BLOBLIST_TEST(bloblist_test_bad_blob, 0);
+
+static int bloblist_test_checksum(struct unit_test_state *uts)
+{
+ struct bloblist_hdr *hdr;
+ char *data, *data2;
+
+ hdr = clear_bloblist();
+ ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0));
+ ut_assertok(bloblist_finish());
+ ut_assertok(bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+
+ /*
+ * Now change things amd make sure that the checksum notices. We cannot
+ * change the size or alloced fields, since that will crash the code.
+ * It has to rely on these being correct.
+ */
+ hdr->flags--;
+ ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+ hdr->flags++;
+
+ hdr->size--;
+ ut_asserteq(-EFBIG, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+ hdr->size++;
+
+ hdr->spare++;
+ ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+ hdr->spare--;
+
+ hdr->chksum++;
+ ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+ hdr->chksum--;
+
+ /* Make sure the checksum changes when we add blobs */
+ data = bloblist_add(TEST_TAG, TEST_SIZE);
+ ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+
+ data2 = bloblist_add(TEST_TAG2, TEST_SIZE2);
+ ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+ ut_assertok(bloblist_finish());
+
+ /* It should also change if we change the data */
+ ut_assertok(bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+ *data += 1;
+ ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+ *data -= 1;
+
+ ut_assertok(bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+ *data2 += 1;
+ ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+ *data2 -= 1;
+
+ /*
+ * Changing data outside the range of valid data should not affect
+ * the checksum.
+ */
+ ut_assertok(bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+ data[TEST_SIZE]++;
+ data2[TEST_SIZE2]++;
+ ut_assertok(bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
+
+ return 0;
+}
+
+BLOBLIST_TEST(bloblist_test_checksum, 0);
+
+int do_ut_bloblist(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+ struct unit_test *tests = ll_entry_start(struct unit_test,
+ bloblist_test);
+ const int n_ents = ll_entry_count(struct unit_test, bloblist_test);
+
+ return cmd_ut_category("bloblist", tests, n_ents, argc, argv);
+}
diff --git a/test/cmd_ut.c b/test/cmd_ut.c
index b7e01a4847e..56924a52726 100644
--- a/test/cmd_ut.c
+++ b/test/cmd_ut.c
@@ -55,6 +55,8 @@ static cmd_tbl_t cmd_ut_sub[] = {
#ifdef CONFIG_SANDBOX
U_BOOT_CMD_MKENT(compression, CONFIG_SYS_MAXARGS, 1, do_ut_compression,
"", ""),
+ U_BOOT_CMD_MKENT(bloblist, CONFIG_SYS_MAXARGS, 1, do_ut_bloblist,
+ "", ""),
#endif
};
@@ -97,6 +99,7 @@ static int do_ut(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
static char ut_help_text[] =
"all - execute all enabled tests\n"
#ifdef CONFIG_SANDBOX
+ "ut bloblist - Test bloblist implementation\n"
"ut compression - Test compressors and bootm decompression\n"
#endif
#ifdef CONFIG_UT_DM
diff --git a/test/dm/i2c.c b/test/dm/i2c.c
index 772f62b265d..cbbd4aa29a1 100644
--- a/test/dm/i2c.c
+++ b/test/dm/i2c.c
@@ -35,7 +35,7 @@ static int dm_test_i2c_find(struct unit_test_state *uts)
*/
ut_assertok(uclass_get_device_by_seq(UCLASS_I2C, busnum, &bus));
ut_assertok(dm_i2c_probe(bus, chip, 0, &dev));
- ut_asserteq(-ENODEV, dm_i2c_probe(bus, no_chip, 0, &dev));
+ ut_asserteq(-ENOENT, dm_i2c_probe(bus, no_chip, 0, &dev));
ut_asserteq(-ENODEV, uclass_get_device_by_seq(UCLASS_I2C, 1, &bus));
return 0;
diff --git a/test/dm/misc.c b/test/dm/misc.c
index 61279665ef2..4d4232adf1e 100644
--- a/test/dm/misc.c
+++ b/test/dm/misc.c
@@ -21,9 +21,9 @@ static int dm_test_misc(struct unit_test_state *uts)
ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "misc-test", &dev));
/* Read / write tests */
- ut_assertok(misc_write(dev, 0, "TEST", 4));
- ut_assertok(misc_write(dev, 4, "WRITE", 5));
- ut_assertok(misc_read(dev, 0, buf, 9));
+ ut_asserteq(4, misc_write(dev, 0, "TEST", 4));
+ ut_asserteq(5, misc_write(dev, 4, "WRITE", 5));
+ ut_asserteq(9, misc_read(dev, 0, buf, 9));
ut_assertok(memcmp(buf, "TESTWRITE", 9));
diff --git a/test/dm/rtc.c b/test/dm/rtc.c
index e2bc648fdcf..71887427647 100644
--- a/test/dm/rtc.c
+++ b/test/dm/rtc.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <dm.h>
+#include <i2c.h>
#include <rtc.h>
#include <asm/io.h>
#include <asm/test.h>
@@ -60,7 +61,7 @@ static int dm_test_rtc_set_get(struct unit_test_state *uts)
ut_assertok(uclass_get_device(UCLASS_RTC, 0, &dev));
ut_assertok(dm_rtc_get(dev, &now));
- ut_assertok(device_find_first_child(dev, &emul));
+ ut_assertok(i2c_emul_find(dev, &emul));
ut_assert(emul != NULL);
/* Tell the RTC to go into manual mode */
@@ -125,7 +126,7 @@ static int dm_test_rtc_reset(struct unit_test_state *uts)
ut_assertok(uclass_get_device(UCLASS_RTC, 0, &dev));
ut_assertok(dm_rtc_get(dev, &now));
- ut_assertok(device_find_first_child(dev, &emul));
+ ut_assertok(i2c_emul_find(dev, &emul));
ut_assert(emul != NULL);
old_base_time = sandbox_i2c_rtc_get_set_base_time(emul, 0);
@@ -154,9 +155,9 @@ static int dm_test_rtc_dual(struct unit_test_state *uts)
ut_assertok(uclass_get_device(UCLASS_RTC, 1, &dev2));
ut_assertok(dm_rtc_get(dev2, &now2));
- ut_assertok(device_find_first_child(dev1, &emul1));
+ ut_assertok(i2c_emul_find(dev1, &emul1));
ut_assert(emul1 != NULL);
- ut_assertok(device_find_first_child(dev2, &emul2));
+ ut_assertok(i2c_emul_find(dev2, &emul2));
ut_assert(emul2 != NULL);
offset = sandbox_i2c_rtc_set_offset(emul1, false, -1);
diff --git a/test/dm/sf.c b/test/dm/sf.c
index 35241b9f574..3788d59052e 100644
--- a/test/dm/sf.c
+++ b/test/dm/sf.c
@@ -6,16 +6,67 @@
#include <common.h>
#include <dm.h>
#include <fdtdec.h>
+#include <mapmem.h>
+#include <os.h>
#include <spi.h>
#include <spi_flash.h>
#include <asm/state.h>
+#include <asm/test.h>
#include <dm/test.h>
#include <dm/util.h>
#include <test/ut.h>
-/* Test that sandbox SPI flash works correctly */
+/* Simple test of sandbox SPI flash */
static int dm_test_spi_flash(struct unit_test_state *uts)
{
+ struct udevice *dev, *emul;
+ int full_size = 0x200000;
+ int size = 0x10000;
+ u8 *src, *dst;
+ int i;
+
+ src = map_sysmem(0x20000, full_size);
+ ut_assertok(os_write_file("spi.bin", src, full_size));
+ ut_assertok(uclass_first_device_err(UCLASS_SPI_FLASH, &dev));
+
+ dst = map_sysmem(0x20000 + full_size, full_size);
+ ut_assertok(spi_flash_read_dm(dev, 0, size, dst));
+ ut_assertok(memcmp(src, dst, size));
+
+ /* Erase */
+ ut_assertok(spi_flash_erase_dm(dev, 0, size));
+ ut_assertok(spi_flash_read_dm(dev, 0, size, dst));
+ for (i = 0; i < size; i++)
+ ut_asserteq(dst[i], 0xff);
+
+ /* Write some new data */
+ for (i = 0; i < size; i++)
+ src[i] = i;
+ ut_assertok(spi_flash_write_dm(dev, 0, size, src));
+ ut_assertok(spi_flash_read_dm(dev, 0, size, dst));
+ ut_assertok(memcmp(src, dst, size));
+
+ /* Try the write-protect stuff */
+ ut_assertok(uclass_first_device_err(UCLASS_SPI_EMUL, &emul));
+ ut_asserteq(0, spl_flash_get_sw_write_prot(dev));
+ sandbox_sf_set_block_protect(emul, 1);
+ ut_asserteq(1, spl_flash_get_sw_write_prot(dev));
+ sandbox_sf_set_block_protect(emul, 0);
+ ut_asserteq(0, spl_flash_get_sw_write_prot(dev));
+
+ /*
+ * Since we are about to destroy all devices, we must tell sandbox
+ * to forget the emulation device
+ */
+ sandbox_sf_unbind_emul(state_get_current(), 0, 0);
+
+ return 0;
+}
+DM_TEST(dm_test_spi_flash, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Functional test that sandbox SPI flash works correctly */
+static int dm_test_spi_flash_func(struct unit_test_state *uts)
+{
/*
* Create an empty test file and run the SPI flash tests. This is a
* long way from being a unit test, but it does test SPI device and
@@ -28,7 +79,7 @@ static int dm_test_spi_flash(struct unit_test_state *uts)
* benefit is worth the extra complexity.
*/
ut_asserteq(0, run_command_list(
- "sb save hostfs - 0 spi.bin 200000;"
+ "host save hostfs - 0 spi.bin 200000;"
"sf probe;"
"sf test 0 10000", -1, 0));
/*
@@ -39,4 +90,4 @@ static int dm_test_spi_flash(struct unit_test_state *uts)
return 0;
}
-DM_TEST(dm_test_spi_flash, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+DM_TEST(dm_test_spi_flash_func, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index e43acb21d5e..0fbd9be765a 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -611,3 +611,50 @@ static int dm_test_fdt_disable_enable_by_path(struct unit_test_state *uts)
}
DM_TEST(dm_test_fdt_disable_enable_by_path, DM_TESTF_SCAN_PDATA |
DM_TESTF_SCAN_FDT);
+
+/* Test a few uclass phandle functions */
+static int dm_test_fdt_phandle(struct unit_test_state *uts)
+{
+ struct udevice *back, *dev, *dev2;
+
+ ut_assertok(uclass_find_first_device(UCLASS_PANEL_BACKLIGHT, &back));
+ ut_asserteq(-ENOENT, uclass_find_device_by_phandle(UCLASS_REGULATOR,
+ back, "missing", &dev));
+ ut_assertok(uclass_find_device_by_phandle(UCLASS_REGULATOR, back,
+ "power-supply", &dev));
+ ut_asserteq(0, device_active(dev));
+ ut_asserteq_str("ldo1", dev->name);
+ ut_assertok(uclass_get_device_by_phandle(UCLASS_REGULATOR, back,
+ "power-supply", &dev2));
+ ut_asserteq_ptr(dev, dev2);
+
+ return 0;
+}
+DM_TEST(dm_test_fdt_phandle, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test device_find_first_child_by_uclass() */
+static int dm_test_first_child(struct unit_test_state *uts)
+{
+ struct udevice *i2c, *dev, *dev2;
+
+ ut_assertok(uclass_first_device_err(UCLASS_I2C, &i2c));
+ ut_assertok(device_find_first_child_by_uclass(i2c, UCLASS_RTC, &dev));
+ ut_asserteq_str("rtc@43", dev->name);
+ ut_assertok(device_find_child_by_name(i2c, "rtc@43", &dev2));
+ ut_asserteq_ptr(dev, dev2);
+ ut_assertok(device_find_child_by_name(i2c, "rtc@61", &dev2));
+ ut_asserteq_str("rtc@61", dev2->name);
+
+ ut_assertok(device_find_first_child_by_uclass(i2c, UCLASS_I2C_EEPROM,
+ &dev));
+ ut_asserteq_str("eeprom@2c", dev->name);
+ ut_assertok(device_find_child_by_name(i2c, "eeprom@2c", &dev2));
+ ut_asserteq_ptr(dev, dev2);
+
+ ut_asserteq(-ENODEV, device_find_first_child_by_uclass(i2c,
+ UCLASS_VIDEO, &dev));
+ ut_asserteq(-ENODEV, device_find_child_by_name(i2c, "missing", &dev));
+
+ return 0;
+}
+DM_TEST(dm_test_first_child, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
diff --git a/test/dm/video.c b/test/dm/video.c
index 7def338058e..5d1faac19c9 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -178,12 +178,12 @@ static int dm_test_video_ansi(struct unit_test_state *uts)
/* test set-cursor: [%d;%df */
vidconsole_put_string(con, "abc"ANSI_ESC"[2;2fab"ANSI_ESC"[4;4fcd");
- ut_asserteq(142, compress_frame_buffer(dev));
+ ut_asserteq(143, compress_frame_buffer(dev));
/* test colors (30-37 fg color, 40-47 bg color) */
vidconsole_put_string(con, ANSI_ESC"[30;41mfoo"); /* black on red */
vidconsole_put_string(con, ANSI_ESC"[33;44mbar"); /* yellow on blue */
- ut_asserteq(265, compress_frame_buffer(dev));
+ ut_asserteq(272, compress_frame_buffer(dev));
return 0;
}
diff --git a/test/fs/fs-test.sh b/test/fs/fs-test.sh
index 86308cfe2db..721af71d44c 100755
--- a/test/fs/fs-test.sh
+++ b/test/fs/fs-test.sh
@@ -194,7 +194,7 @@ function test_image() {
;;
sb)
- PREFIX="sb "
+ PREFIX="host "
WRITE="save"
SUFFIX="fs -"
;;
@@ -217,11 +217,11 @@ function test_image() {
# In u-boot commands, <interface> stands for host or hostfs
# hostfs maps to the host fs.
- # host maps to the "sb bind" that we do
+ # host maps to the "host bind" that we do
$UBOOT << EOF
sb=$5
-setenv bind 'if test "\$sb" != sb; then sb bind 0 "$1"; fi'
+setenv bind 'if test "\$sb" != sb; then host bind 0 "$1"; fi'
run bind
# Test Case 1 - ls
${PREFIX}ls host${SUFFIX} $6
@@ -229,7 +229,7 @@ ${PREFIX}ls host${SUFFIX} $6
${PREFIX}ls host${SUFFIX} invalid_d
#
# We want ${PREFIX}size host 0:0 $3 for host commands and
-# sb size hostfs - $3 for hostfs commands.
+# host size hostfs - $3 for hostfs commands.
# 1MB is 0x0010 0000
# Test Case 2a - size of small file
${PREFIX}size host${SUFFIX} ${FPATH}$FILE_SMALL
@@ -575,7 +575,7 @@ TOTAL_PASS=0
# In each loop, for a given file system image, we test both the
# fs command, like load/size/write, the file system specific command
-# like: ext4load/ext4size/ext4write and the sb load/ls/save commands.
+# like: ext4load/ext4size/ext4write and the host load/ls/save commands.
for fs in ext4 fat16 fat32; do
echo "Creating $fs image if not already present."
@@ -583,11 +583,11 @@ for fs in ext4 fat16 fat32; do
MD5_FILE_FS="${MD5_FILE}.${fs}"
create_image $IMAGE $fs
- # sb commands test
+ # host commands test
echo "Creating files in $fs image if not already present."
create_files $IMAGE $MD5_FILE_FS
- # Lets mount the image and test sb hostfs commands
+ # Lets mount the image and test host hostfs commands
mkdir -p "$MOUNT_DIR"
case "$fs" in
fat*)
diff --git a/test/py/tests/test_bind.py b/test/py/tests/test_bind.py
index f21b7059ea1..dee3fee5661 100644
--- a/test/py/tests/test_bind.py
+++ b/test/py/tests/test_bind.py
@@ -13,7 +13,7 @@ def in_tree(response, name, uclass, drv, depth, last_child):
else:
leaf = leaf + '`'
leaf = leaf + '-- ' + name
- line = ' *{:10.10} [0-9]* \[ [ +] \] {:10.10} {}$'.format(uclass, drv,leaf)
+ line = ' *{:10.10} [0-9]* \[ [ +] \] {:20.20} {}$'.format(uclass, drv, leaf)
prog = re.compile(line)
for l in lines:
if prog.match(l):
@@ -28,31 +28,31 @@ def test_bind_unbind_with_node(u_boot_console):
response = u_boot_console.run_command("bind /bind-test generic_simple_bus")
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test", "simple_bus", "generic_simple", 0, True)
+ assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, True)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
#Unbind child #1. No error expected and all devices should be there except for bind-test-child1
response = u_boot_console.run_command("unbind /bind-test/bind-test-child1")
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test", "simple_bus", "generic_simple", 0, True)
+ assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert "bind-test-child1" not in tree
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, True)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
#bind child #1. No error expected and all devices should be there
response = u_boot_console.run_command("bind /bind-test/bind-test-child1 phy_sandbox")
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test", "simple_bus", "generic_simple", 0, True)
+ assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, True)
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, False)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, False)
#Unbind child #2. No error expected and all devices should be there except for bind-test-child2
response = u_boot_console.run_command("unbind /bind-test/bind-test-child2")
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test", "simple_bus", "generic_simple", 0, True)
+ assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, True)
assert "bind-test-child2" not in tree
@@ -61,9 +61,9 @@ def test_bind_unbind_with_node(u_boot_console):
response = u_boot_console.run_command("bind /bind-test/bind-test-child2 generic_simple_bus")
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test", "simple_bus", "generic_simple", 0, True)
+ assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, True)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
#Unbind parent. No error expected. All devices should be removed and unbound
response = u_boot_console.run_command("unbind /bind-test")
@@ -89,9 +89,9 @@ def test_bind_unbind_with_node(u_boot_console):
response = u_boot_console.run_command("bind /bind-test generic_simple_bus")
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test", "simple_bus", "generic_simple", 0, True)
+ assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, True)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
response = u_boot_console.run_command("unbind /bind-test")
assert response == ''
@@ -138,7 +138,7 @@ def test_bind_unbind_with_uclass(u_boot_console):
response = u_boot_console.run_command("unbind simple_bus {}".format(child_of_child2_index))
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, True)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
assert not in_tree(tree, "generic_simple_bus", "simple_bus", "generic_simple_bus", 2, True)
child_of_child2_line = get_next_line(tree, "bind-test-child2")
assert child_of_child2_line == ""
@@ -161,7 +161,7 @@ def test_bind_unbind_with_uclass(u_boot_console):
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, True)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
child_of_child2_line = get_next_line(tree, "bind-test-child2")
assert child_of_child2_line == ""
diff --git a/test/py/tests/test_efi_selftest.py b/test/py/tests/test_efi_selftest.py
index e0833ffe22c..36b35ee536b 100644
--- a/test/py/tests/test_efi_selftest.py
+++ b/test/py/tests/test_efi_selftest.py
@@ -8,12 +8,14 @@ import u_boot_utils
@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
def test_efi_selftest(u_boot_console):
- """
- Run bootefi selftest
- """
+ """Test the UEFI implementation
+
+ :param u_boot_console: U-Boot console
+ This function executes all selftests that are not marked as on request.
+ """
u_boot_console.run_command(cmd='setenv efi_selftest')
- u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
+ u_boot_console.run_command(cmd='bootefi selftest ${fdtcontroladdr}', wait_for_prompt=False)
m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
if m != 0:
raise Exception('Failures occurred during the EFI selftest')
diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py
index 34696e97679..49d6fea5716 100755
--- a/test/py/tests/test_fit.py
+++ b/test/py/tests/test_fit.py
@@ -99,15 +99,15 @@ base_fdt = '''
# then run the 'bootm' command, then save out memory from the places where
# we expect 'bootm' to write things. Then quit.
base_script = '''
-sb load hostfs 0 %(fit_addr)x %(fit)s
+host load hostfs 0 %(fit_addr)x %(fit)s
fdt addr %(fit_addr)x
bootm start %(fit_addr)x
bootm loados
-sb save hostfs 0 %(kernel_addr)x %(kernel_out)s %(kernel_size)x
-sb save hostfs 0 %(fdt_addr)x %(fdt_out)s %(fdt_size)x
-sb save hostfs 0 %(ramdisk_addr)x %(ramdisk_out)s %(ramdisk_size)x
-sb save hostfs 0 %(loadables1_addr)x %(loadables1_out)s %(loadables1_size)x
-sb save hostfs 0 %(loadables2_addr)x %(loadables2_out)s %(loadables2_size)x
+host save hostfs 0 %(kernel_addr)x %(kernel_out)s %(kernel_size)x
+host save hostfs 0 %(fdt_addr)x %(fdt_out)s %(fdt_size)x
+host save hostfs 0 %(ramdisk_addr)x %(ramdisk_out)s %(ramdisk_size)x
+host save hostfs 0 %(loadables1_addr)x %(loadables1_out)s %(loadables1_size)x
+host save hostfs 0 %(loadables2_addr)x %(loadables2_out)s %(loadables2_size)x
'''
@pytest.mark.boardspec('sandbox')
diff --git a/test/py/tests/test_fs/test_basic.py b/test/py/tests/test_fs/test_basic.py
index c067cc9ba3f..140ca29ac73 100644
--- a/test/py/tests/test_fs/test_basic.py
+++ b/test/py/tests/test_fs/test_basic.py
@@ -13,6 +13,7 @@ import re
from fstest_defs import *
@pytest.mark.boardspec('sandbox')
+@pytest.mark.slow
class TestFsBasic(object):
def test_fs1(self, u_boot_console, fs_obj_basic):
"""
diff --git a/test/py/tests/test_fs/test_ext.py b/test/py/tests/test_fs/test_ext.py
index 38217d08bf6..06cad5516d5 100644
--- a/test/py/tests/test_fs/test_ext.py
+++ b/test/py/tests/test_fs/test_ext.py
@@ -13,6 +13,7 @@ import re
from fstest_defs import *
@pytest.mark.boardspec('sandbox')
+@pytest.mark.slow
class TestFsExt(object):
def test_fs_ext1(self, u_boot_console, fs_obj_ext):
"""
diff --git a/test/py/tests/test_fs/test_mkdir.py b/test/py/tests/test_fs/test_mkdir.py
index d9da97b56b5..b3fe11cf3b5 100644
--- a/test/py/tests/test_fs/test_mkdir.py
+++ b/test/py/tests/test_fs/test_mkdir.py
@@ -11,6 +11,7 @@ This test verifies mkdir operation on file system.
import pytest
@pytest.mark.boardspec('sandbox')
+@pytest.mark.slow
class TestMkdir(object):
def test_mkdir1(self, u_boot_console, fs_obj_mkdir):
"""
diff --git a/test/py/tests/test_fs/test_unlink.py b/test/py/tests/test_fs/test_unlink.py
index 69c1a6e078c..2b817468eda 100644
--- a/test/py/tests/test_fs/test_unlink.py
+++ b/test/py/tests/test_fs/test_unlink.py
@@ -12,6 +12,7 @@ on file system.
import pytest
@pytest.mark.boardspec('sandbox')
+@pytest.mark.slow
class TestUnlink(object):
def test_unlink1(self, u_boot_console, fs_obj_unlink):
"""
diff --git a/test/py/tests/test_handoff.py b/test/py/tests/test_handoff.py
new file mode 100644
index 00000000000..0ee972298ca
--- /dev/null
+++ b/test/py/tests/test_handoff.py
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2016 Google, Inc
+
+import pytest
+
+# Magic number to check that SPL handoff is working
+TEST_HANDOFF_MAGIC = 0x14f93c7b
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('spl')
+def test_handoff(u_boot_console):
+ """Test that of-platdata can be generated and used in sandbox"""
+ cons = u_boot_console
+ response = cons.run_command('sb handoff')
+ assert ('SPL handoff magic %x' % TEST_HANDOFF_MAGIC) in response
diff --git a/test/py/tests/test_ofplatdata.py b/test/py/tests/test_ofplatdata.py
index dd8a09f0324..98103ee71a9 100644
--- a/test/py/tests/test_ofplatdata.py
+++ b/test/py/tests/test_ofplatdata.py
@@ -3,11 +3,40 @@
import pytest
-OF_PLATDATA_OUTPUT = ''
+OF_PLATDATA_OUTPUT = '''
+of-platdata probe:
+bool 1
+byte 05
+bytearray 06 00 00
+int 1
+intarray 2 3 4 0
+longbytearray 09 0a 0b 0c 0d 0e 0f 10 11
+string message
+stringarray "multi-word" "message" ""
+of-platdata probe:
+bool 0
+byte 08
+bytearray 01 23 34
+int 3
+intarray 5 0 0 0
+longbytearray 09 00 00 00 00 00 00 00 00
+string message2
+stringarray "another" "multi-word" "message"
+of-platdata probe:
+bool 0
+byte 00
+bytearray 00 00 00
+int 0
+intarray 0 0 0 0
+longbytearray 00 00 00 00 00 00 00 00 00
+string <NULL>
+stringarray "one" "" ""
+'''
@pytest.mark.buildconfigspec('spl_of_platdata')
def test_ofplatdata(u_boot_console):
"""Test that of-platdata can be generated and used in sandbox"""
cons = u_boot_console
+ cons.restart_uboot_with_flags(['--show_of_platdata'])
output = cons.get_spawn_output().replace('\r', '')
assert OF_PLATDATA_OUTPUT in output
diff --git a/test/py/tests/test_vboot.py b/test/py/tests/test_vboot.py
index e9cbd57fbab..4627ceb0260 100644
--- a/test/py/tests/test_vboot.py
+++ b/test/py/tests/test_vboot.py
@@ -74,7 +74,7 @@ def test_vboot(u_boot_console):
cons.restart_uboot()
with cons.log.section('Verified boot %s %s' % (sha_algo, test_type)):
output = cons.run_command_list(
- ['sb load hostfs - 100 %stest.fit' % tmpdir,
+ ['host load hostfs - 100 %stest.fit' % tmpdir,
'fdt addr 100',
'bootm 100'])
assert(expect_string in ''.join(output))
@@ -126,7 +126,7 @@ def test_vboot(u_boot_console):
handle.write(struct.pack(">I", size))
return struct.unpack(">I", total_size)[0]
- def test_with_algo(sha_algo):
+ def test_with_algo(sha_algo, padding):
"""Test verified boot with the given hash algorithm.
This is the main part of the test code. The same procedure is followed
@@ -144,7 +144,7 @@ def test_vboot(u_boot_console):
# Build the FIT, but don't sign anything yet
cons.log.action('%s: Test FIT with signed images' % sha_algo)
- make_fit('sign-images-%s.its' % sha_algo)
+ make_fit('sign-images-%s%s.its' % (sha_algo , padding))
run_bootm(sha_algo, 'unsigned images', 'dev-', True)
# Sign images with our dev keys
@@ -155,7 +155,7 @@ def test_vboot(u_boot_console):
dtc('sandbox-u-boot.dts')
cons.log.action('%s: Test FIT with signed configuration' % sha_algo)
- make_fit('sign-configs-%s.its' % sha_algo)
+ make_fit('sign-configs-%s%s.its' % (sha_algo , padding))
run_bootm(sha_algo, 'unsigned config', '%s+ OK' % sha_algo, True)
# Sign images with our dev keys
@@ -204,7 +204,7 @@ def test_vboot(u_boot_console):
fit_check_sign = cons.config.build_dir + '/tools/fit_check_sign'
dtc_args = '-I dts -O dtb -i %s' % tmpdir
dtb = '%ssandbox-u-boot.dtb' % tmpdir
- sig_node = '/configurations/conf@1/signature@1'
+ sig_node = '/configurations/conf-1/signature'
# Create an RSA key pair
public_exponent = 65537
@@ -226,8 +226,10 @@ def test_vboot(u_boot_console):
# afterwards.
old_dtb = cons.config.dtb
cons.config.dtb = dtb
- test_with_algo('sha1')
- test_with_algo('sha256')
+ test_with_algo('sha1','')
+ test_with_algo('sha1','-pss')
+ test_with_algo('sha256','')
+ test_with_algo('sha256','-pss')
finally:
# Go back to the original U-Boot with the correct dtb.
cons.config.dtb = old_dtb
diff --git a/test/py/tests/vboot/sign-configs-sha1-pss.its b/test/py/tests/vboot/sign-configs-sha1-pss.its
new file mode 100644
index 00000000000..72a5637e3a1
--- /dev/null
+++ b/test/py/tests/vboot/sign-configs-sha1-pss.its
@@ -0,0 +1,46 @@
+/dts-v1/;
+
+/ {
+ description = "Chrome OS kernel image with one or more FDT blobs";
+ #address-cells = <1>;
+
+ images {
+ kernel {
+ data = /incbin/("test-kernel.bin");
+ type = "kernel_noload";
+ arch = "sandbox";
+ os = "linux";
+ compression = "none";
+ load = <0x4>;
+ entry = <0x8>;
+ kernel-version = <1>;
+ hash-1 {
+ algo = "sha1";
+ };
+ };
+ fdt-1 {
+ description = "snow";
+ data = /incbin/("sandbox-kernel.dtb");
+ type = "flat_dt";
+ arch = "sandbox";
+ compression = "none";
+ fdt-version = <1>;
+ hash-1 {
+ algo = "sha1";
+ };
+ };
+ };
+ configurations {
+ default = "conf-1";
+ conf-1 {
+ kernel = "kernel";
+ fdt = "fdt-1";
+ signature {
+ algo = "sha1,rsa2048";
+ padding = "pss";
+ key-name-hint = "dev";
+ sign-images = "fdt", "kernel";
+ };
+ };
+ };
+};
diff --git a/test/py/tests/vboot/sign-configs-sha1.its b/test/py/tests/vboot/sign-configs-sha1.its
index db2ed793552..d8bc1fa0919 100644
--- a/test/py/tests/vboot/sign-configs-sha1.its
+++ b/test/py/tests/vboot/sign-configs-sha1.its
@@ -5,7 +5,7 @@
#address-cells = <1>;
images {
- kernel@1 {
+ kernel {
data = /incbin/("test-kernel.bin");
type = "kernel_noload";
arch = "sandbox";
@@ -14,28 +14,28 @@
load = <0x4>;
entry = <0x8>;
kernel-version = <1>;
- hash@1 {
+ hash-1 {
algo = "sha1";
};
};
- fdt@1 {
+ fdt-1 {
description = "snow";
data = /incbin/("sandbox-kernel.dtb");
type = "flat_dt";
arch = "sandbox";
compression = "none";
fdt-version = <1>;
- hash@1 {
+ hash-1 {
algo = "sha1";
};
};
};
configurations {
- default = "conf@1";
- conf@1 {
- kernel = "kernel@1";
- fdt = "fdt@1";
- signature@1 {
+ default = "conf-1";
+ conf-1 {
+ kernel = "kernel";
+ fdt = "fdt-1";
+ signature {
algo = "sha1,rsa2048";
key-name-hint = "dev";
sign-images = "fdt", "kernel";
diff --git a/test/py/tests/vboot/sign-configs-sha256-pss.its b/test/py/tests/vboot/sign-configs-sha256-pss.its
new file mode 100644
index 00000000000..7bdcc7e286f
--- /dev/null
+++ b/test/py/tests/vboot/sign-configs-sha256-pss.its
@@ -0,0 +1,46 @@
+/dts-v1/;
+
+/ {
+ description = "Chrome OS kernel image with one or more FDT blobs";
+ #address-cells = <1>;
+
+ images {
+ kernel {
+ data = /incbin/("test-kernel.bin");
+ type = "kernel_noload";
+ arch = "sandbox";
+ os = "linux";
+ compression = "none";
+ load = <0x4>;
+ entry = <0x8>;
+ kernel-version = <1>;
+ hash-1 {
+ algo = "sha256";
+ };
+ };
+ fdt-1 {
+ description = "snow";
+ data = /incbin/("sandbox-kernel.dtb");
+ type = "flat_dt";
+ arch = "sandbox";
+ compression = "none";
+ fdt-version = <1>;
+ hash-1 {
+ algo = "sha256";
+ };
+ };
+ };
+ configurations {
+ default = "conf-1";
+ conf-1 {
+ kernel = "kernel";
+ fdt = "fdt-1";
+ signature {
+ algo = "sha256,rsa2048";
+ padding = "pss";
+ key-name-hint = "dev";
+ sign-images = "fdt", "kernel";
+ };
+ };
+ };
+};
diff --git a/test/py/tests/vboot/sign-configs-sha256.its b/test/py/tests/vboot/sign-configs-sha256.its
index 1b3432ec144..f5591aad305 100644
--- a/test/py/tests/vboot/sign-configs-sha256.its
+++ b/test/py/tests/vboot/sign-configs-sha256.its
@@ -5,7 +5,7 @@
#address-cells = <1>;
images {
- kernel@1 {
+ kernel {
data = /incbin/("test-kernel.bin");
type = "kernel_noload";
arch = "sandbox";
@@ -14,28 +14,28 @@
load = <0x4>;
entry = <0x8>;
kernel-version = <1>;
- hash@1 {
+ hash-1 {
algo = "sha256";
};
};
- fdt@1 {
+ fdt-1 {
description = "snow";
data = /incbin/("sandbox-kernel.dtb");
type = "flat_dt";
arch = "sandbox";
compression = "none";
fdt-version = <1>;
- hash@1 {
+ hash-1 {
algo = "sha256";
};
};
};
configurations {
- default = "conf@1";
- conf@1 {
- kernel = "kernel@1";
- fdt = "fdt@1";
- signature@1 {
+ default = "conf-1";
+ conf-1 {
+ kernel = "kernel";
+ fdt = "fdt-1";
+ signature {
algo = "sha256,rsa2048";
key-name-hint = "dev";
sign-images = "fdt", "kernel";
diff --git a/test/py/tests/vboot/sign-images-sha1-pss.its b/test/py/tests/vboot/sign-images-sha1-pss.its
new file mode 100644
index 00000000000..ded7ae4f552
--- /dev/null
+++ b/test/py/tests/vboot/sign-images-sha1-pss.its
@@ -0,0 +1,44 @@
+/dts-v1/;
+
+/ {
+ description = "Chrome OS kernel image with one or more FDT blobs";
+ #address-cells = <1>;
+
+ images {
+ kernel {
+ data = /incbin/("test-kernel.bin");
+ type = "kernel_noload";
+ arch = "sandbox";
+ os = "linux";
+ compression = "none";
+ load = <0x4>;
+ entry = <0x8>;
+ kernel-version = <1>;
+ signature {
+ algo = "sha1,rsa2048";
+ padding = "pss";
+ key-name-hint = "dev";
+ };
+ };
+ fdt-1 {
+ description = "snow";
+ data = /incbin/("sandbox-kernel.dtb");
+ type = "flat_dt";
+ arch = "sandbox";
+ compression = "none";
+ fdt-version = <1>;
+ signature {
+ algo = "sha1,rsa2048";
+ padding = "pss";
+ key-name-hint = "dev";
+ };
+ };
+ };
+ configurations {
+ default = "conf-1";
+ conf-1 {
+ kernel = "kernel";
+ fdt = "fdt-1";
+ };
+ };
+};
diff --git a/test/py/tests/vboot/sign-images-sha1.its b/test/py/tests/vboot/sign-images-sha1.its
index f69326a39bc..18c759e9e65 100644
--- a/test/py/tests/vboot/sign-images-sha1.its
+++ b/test/py/tests/vboot/sign-images-sha1.its
@@ -5,7 +5,7 @@
#address-cells = <1>;
images {
- kernel@1 {
+ kernel {
data = /incbin/("test-kernel.bin");
type = "kernel_noload";
arch = "sandbox";
@@ -14,29 +14,29 @@
load = <0x4>;
entry = <0x8>;
kernel-version = <1>;
- signature@1 {
+ signature {
algo = "sha1,rsa2048";
key-name-hint = "dev";
};
};
- fdt@1 {
+ fdt-1 {
description = "snow";
data = /incbin/("sandbox-kernel.dtb");
type = "flat_dt";
arch = "sandbox";
compression = "none";
fdt-version = <1>;
- signature@1 {
+ signature {
algo = "sha1,rsa2048";
key-name-hint = "dev";
};
};
};
configurations {
- default = "conf@1";
- conf@1 {
- kernel = "kernel@1";
- fdt = "fdt@1";
+ default = "conf-1";
+ conf-1 {
+ kernel = "kernel";
+ fdt = "fdt-1";
};
};
};
diff --git a/test/py/tests/vboot/sign-images-sha256-pss.its b/test/py/tests/vboot/sign-images-sha256-pss.its
new file mode 100644
index 00000000000..34850cc6c58
--- /dev/null
+++ b/test/py/tests/vboot/sign-images-sha256-pss.its
@@ -0,0 +1,44 @@
+/dts-v1/;
+
+/ {
+ description = "Chrome OS kernel image with one or more FDT blobs";
+ #address-cells = <1>;
+
+ images {
+ kernel {
+ data = /incbin/("test-kernel.bin");
+ type = "kernel_noload";
+ arch = "sandbox";
+ os = "linux";
+ compression = "none";
+ load = <0x4>;
+ entry = <0x8>;
+ kernel-version = <1>;
+ signature {
+ algo = "sha256,rsa2048";
+ padding = "pss";
+ key-name-hint = "dev";
+ };
+ };
+ fdt-1 {
+ description = "snow";
+ data = /incbin/("sandbox-kernel.dtb");
+ type = "flat_dt";
+ arch = "sandbox";
+ compression = "none";
+ fdt-version = <1>;
+ signature {
+ algo = "sha256,rsa2048";
+ padding = "pss";
+ key-name-hint = "dev";
+ };
+ };
+ };
+ configurations {
+ default = "conf-1";
+ conf-1 {
+ kernel = "kernel";
+ fdt = "fdt-1";
+ };
+ };
+};
diff --git a/test/py/tests/vboot/sign-images-sha256.its b/test/py/tests/vboot/sign-images-sha256.its
index e6aa9fc4098..bb0f8ee8a66 100644
--- a/test/py/tests/vboot/sign-images-sha256.its
+++ b/test/py/tests/vboot/sign-images-sha256.its
@@ -5,7 +5,7 @@
#address-cells = <1>;
images {
- kernel@1 {
+ kernel {
data = /incbin/("test-kernel.bin");
type = "kernel_noload";
arch = "sandbox";
@@ -14,29 +14,29 @@
load = <0x4>;
entry = <0x8>;
kernel-version = <1>;
- signature@1 {
+ signature {
algo = "sha256,rsa2048";
key-name-hint = "dev";
};
};
- fdt@1 {
+ fdt-1 {
description = "snow";
data = /incbin/("sandbox-kernel.dtb");
type = "flat_dt";
arch = "sandbox";
compression = "none";
fdt-version = <1>;
- signature@1 {
+ signature {
algo = "sha256,rsa2048";
key-name-hint = "dev";
};
};
};
configurations {
- default = "conf@1";
- conf@1 {
- kernel = "kernel@1";
- fdt = "fdt@1";
+ default = "conf-1";
+ conf-1 {
+ kernel = "kernel";
+ fdt = "fdt-1";
};
};
};
diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index 326b2ac51fb..e044eb3ea1d 100644
--- a/test/py/u_boot_console_base.py
+++ b/test/py/u_boot_console_base.py
@@ -16,7 +16,7 @@ import sys
import u_boot_spawn
# Regexes for text we expect U-Boot to send to the console.
-pattern_u_boot_spl_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}[^\r\n]*\\))')
+pattern_u_boot_spl_signon = re.compile('(U-Boot spl \\d{4}\\.\\d{2}[^\r\n]*\\))')
pattern_u_boot_main_signon = re.compile('(U-Boot \\d{4}\\.\\d{2}[^\r\n]*\\))')
pattern_stop_autoboot_prompt = re.compile('Hit any key to stop autoboot: ')
pattern_unknown_command = re.compile('Unknown command \'.*\' - try \'help\'')
diff --git a/test/py/u_boot_console_sandbox.py b/test/py/u_boot_console_sandbox.py
index 778f6d0983d..836f5a9e2b8 100644
--- a/test/py/u_boot_console_sandbox.py
+++ b/test/py/u_boot_console_sandbox.py
@@ -24,6 +24,7 @@ class ConsoleSandbox(ConsoleBase):
"""
super(ConsoleSandbox, self).__init__(log, config, max_fifo_fill=1024)
+ self.sandbox_flags = []
def get_spawn(self):
"""Connect to a fresh U-Boot instance.
@@ -51,8 +52,25 @@ class ConsoleSandbox(ConsoleBase):
'-d',
self.config.dtb
]
+ cmd += self.sandbox_flags
return Spawn(cmd, cwd=self.config.source_dir)
+ def restart_uboot_with_flags(self, flags):
+ """Run U-Boot with the given command-line flags
+
+ Args:
+ flags: List of flags to pass, each a string
+
+ Returns:
+ A u_boot_spawn.Spawn object that is attached to U-Boot.
+ """
+
+ try:
+ self.sandbox_flags = flags
+ return self.restart_uboot()
+ finally:
+ self.sandbox_flags = []
+
def kill(self, sig):
"""Send a specific Unix signal to the sandbox process.
diff --git a/test/run b/test/run
index fb8ff5da0cb..55a6649a9c5 100755
--- a/test/run
+++ b/test/run
@@ -1,6 +1,7 @@
#!/bin/bash
# Script to run all U-Boot tests that use sandbox.
+# $1: tests to run (empty for all, 'quick' for quick ones only)
# Runs a test and checks the exit code to decide if it passed
# $1: Test name
@@ -12,14 +13,17 @@ run_test() {
[ $? -ne 0 ] && failures=$((failures+1))
}
+# SKip slow tests if requested
+[ "$1" == "quick" ] && mark_expr="not slow"
+
failures=0
# Run all tests that the standard sandbox build can support
-run_test "sandbox" ./test/py/test.py --bd sandbox --build
+run_test "sandbox" ./test/py/test.py --bd sandbox --build -m "${mark_expr}"
# Run tests which require sandbox_spl
run_test "sandbox_spl" ./test/py/test.py --bd sandbox_spl --build \
- -k test_ofplatdata.py
+ -k 'test_ofplatdata or test_handoff'
# Run tests for the flat-device-tree version of sandbox. This is a special
# build which does not enable CONFIG_OF_LIVE for the live device tree, so we can
@@ -36,7 +40,9 @@ export DTC=${DTC_DIR}/dtc
run_test "binman" ./tools/binman/binman -t
run_test "patman" ./tools/patman/patman --test
-run_test "buildman" ./tools/buildman/buildman -t
+
+[ "$1" == "quick" ] && skip=--skip-net-tests
+run_test "buildman" ./tools/buildman/buildman -t ${skip}
run_test "fdt" ./tools/dtoc/test_fdt -t
run_test "dtoc" ./tools/dtoc/dtoc -t