diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/eth.c | 8 | ||||
-rw-r--r-- | test/dm/usb.c | 163 | ||||
-rwxr-xr-x | test/fs/fs-test.sh | 79 | ||||
-rw-r--r-- | test/overlay/cmd_ut_overlay.c | 16 | ||||
-rw-r--r-- | test/py/README.md | 7 | ||||
-rw-r--r-- | test/py/conftest.py | 35 | ||||
-rw-r--r-- | test/py/multiplexed_log.py | 8 | ||||
-rw-r--r-- | test/py/tests/test_dfu.py | 1 | ||||
-rw-r--r-- | test/py/tests/test_efi_selftest.py | 25 | ||||
-rwxr-xr-x | test/py/tests/test_fit.py | 1 | ||||
-rw-r--r-- | test/py/tests/test_gpt.py | 13 | ||||
-rw-r--r-- | test/py/tests/test_vboot.py | 4 |
12 files changed, 156 insertions, 204 deletions
diff --git a/test/dm/eth.c b/test/dm/eth.c index 122fab924d..67fd660ee4 100644 --- a/test/dm/eth.c +++ b/test/dm/eth.c @@ -110,6 +110,7 @@ static int dm_test_eth_act(struct unit_test_state *uts) char ethaddr[DM_TEST_ETH_NUM][18]; int i; + memset(ethaddr, '\0', sizeof(ethaddr)); net_ping_ip = string_to_ip("1.1.2.2"); /* Prepare the test scenario */ @@ -119,7 +120,7 @@ static int dm_test_eth_act(struct unit_test_state *uts) ut_assertok(device_remove(dev[i], DM_REMOVE_NORMAL)); /* Invalidate MAC address */ - strcpy(ethaddr[i], env_get(addrname[i])); + strncpy(ethaddr[i], env_get(addrname[i]), 17); /* Must disable access protection for ethaddr before clearing */ env_set(".flags", addrname[i]); env_set(addrname[i], NULL); @@ -187,7 +188,8 @@ static int dm_test_eth_rotate(struct unit_test_state *uts) net_ping_ip = string_to_ip("1.1.2.2"); /* Invalidate eth1's MAC address */ - strcpy(ethaddr, env_get("eth1addr")); + memset(ethaddr, '\0', sizeof(ethaddr)); + strncpy(ethaddr, env_get("eth1addr"), 17); /* Must disable access protection for eth1addr before clearing */ env_set(".flags", "eth1addr"); env_set("eth1addr", NULL); @@ -200,7 +202,7 @@ static int dm_test_eth_rotate(struct unit_test_state *uts) if (!retval) { /* Invalidate eth0's MAC address */ - strcpy(ethaddr, env_get("ethaddr")); + strncpy(ethaddr, env_get("ethaddr"), 17); /* Must disable access protection for ethaddr before clearing */ env_set(".flags", "ethaddr"); env_set("ethaddr", NULL); diff --git a/test/dm/usb.c b/test/dm/usb.c index b46ae60602..4fd249bf64 100644 --- a/test/dm/usb.c +++ b/test/dm/usb.c @@ -99,10 +99,10 @@ static int count_usb_devices(void) return count; } -/* test that we can remove an emulated device and it is then not found */ -static int dm_test_usb_remove(struct unit_test_state *uts) +/* test that no USB devices are found after we stop the stack */ +static int dm_test_usb_stop(struct unit_test_state *uts) { - struct udevice *dev, *emul; + struct udevice *dev; /* Scan and check that all devices are present */ state_set_skip_delays(true); @@ -112,164 +112,11 @@ static int dm_test_usb_remove(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 2, &dev)); ut_asserteq(6, count_usb_devices()); ut_assertok(usb_stop()); - ut_asserteq(6, count_usb_devices()); - - /* Remove the second emulation device */ - ut_assertok(uclass_find_device_by_name(UCLASS_USB_EMUL, "flash-stick@1", - &dev)); - ut_assertok(device_unbind(dev)); - - /* Rescan - only the first and third should be present */ - ut_assertok(usb_init()); - ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 0, &dev)); - ut_assertok(usb_emul_find_for_dev(dev, &emul)); - ut_asserteq_str("flash-stick@0", emul->name); - ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 1, &dev)); - ut_assertok(usb_emul_find_for_dev(dev, &emul)); - ut_asserteq_str("flash-stick@2", emul->name); - - ut_asserteq(-ENODEV, uclass_get_device(UCLASS_MASS_STORAGE, 2, &dev)); - - ut_asserteq(5, count_usb_devices()); - ut_assertok(usb_stop()); - ut_asserteq(5, count_usb_devices()); - - return 0; -} -DM_TEST(dm_test_usb_remove, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); - -const char usb_tree_base[] = -" 1 Hub (12 Mb/s, 100mA)\n" -" | sandbox hub 2345\n" -" |\n" -" |\b+-2 Mass Storage (12 Mb/s, 100mA)\n" -" | sandbox flash flash-stick@0\n" -" | \n" -" |\b+-3 Mass Storage (12 Mb/s, 100mA)\n" -" | sandbox flash flash-stick@1\n" -" | \n" -" |\b+-4 Mass Storage (12 Mb/s, 100mA)\n" -" | sandbox flash flash-stick@2\n" -" | \n" -" |\b+-5 Human Interface (12 Mb/s, 100mA)\n" -" sandbox keyboard keyb@3\n" -" \n"; - -/* test that the 'usb tree' command output looks correct */ -static int dm_test_usb_tree(struct unit_test_state *uts) -{ - char *data; - int len; - - state_set_skip_delays(true); - ut_assertok(usb_init()); - console_record_reset_enable(); - usb_show_tree(); - len = membuff_getraw(&gd->console_out, -1, true, &data); - if (len) - data[len] = '\0'; - ut_asserteq_str(usb_tree_base, data); - ut_assertok(usb_stop()); - - return 0; -} -DM_TEST(dm_test_usb_tree, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); - -const char usb_tree_remove[] = -" 1 Hub (12 Mb/s, 100mA)\n" -" | sandbox hub 2345\n" -" |\n" -" |\b+-2 Mass Storage (12 Mb/s, 100mA)\n" -" | sandbox flash flash-stick@0\n" -" | \n" -" |\b+-3 Mass Storage (12 Mb/s, 100mA)\n" -" | sandbox flash flash-stick@2\n" -" | \n" -" |\b+-4 Human Interface (12 Mb/s, 100mA)\n" -" sandbox keyboard keyb@3\n" -" \n"; - -/* - * test that the 'usb tree' command output looks correct when we remove a - * device - */ -static int dm_test_usb_tree_remove(struct unit_test_state *uts) -{ - struct udevice *dev; - char *data; - int len; - - /* Remove the second emulation device */ - ut_assertok(uclass_find_device_by_name(UCLASS_USB_EMUL, "flash-stick@1", - &dev)); - ut_assertok(device_unbind(dev)); - - state_set_skip_delays(true); - ut_assertok(usb_init()); - console_record_reset_enable(); - usb_show_tree(); - len = membuff_getraw(&gd->console_out, -1, true, &data); - if (len) - data[len] = '\0'; - ut_asserteq_str(usb_tree_remove, data); - ut_assertok(usb_stop()); - - return 0; -} -DM_TEST(dm_test_usb_tree_remove, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); - -const char usb_tree_reorder[] = -" 1 Hub (12 Mb/s, 100mA)\n" -" | sandbox hub 2345\n" -" |\n" -" |\b+-2 Mass Storage (12 Mb/s, 100mA)\n" -" | sandbox flash flash-stick@0\n" -" | \n" -" |\b+-3 Mass Storage (12 Mb/s, 100mA)\n" -" | sandbox flash flash-stick@2\n" -" | \n" -" |\b+-4 Human Interface (12 Mb/s, 100mA)\n" -" | sandbox keyboard keyb@3\n" -" | \n" -" |\b+-5 Mass Storage (12 Mb/s, 100mA)\n" -" sandbox flash flash-stick@1\n" -" \n"; - -/* - * test that the 'usb tree' command output looks correct when we reorder two - * devices. - */ -static int dm_test_usb_tree_reorder(struct unit_test_state *uts) -{ - struct udevice *dev, *parent; - char *data; - int len; - - /* Remove the second emulation device */ - ut_assertok(uclass_find_device_by_name(UCLASS_USB_EMUL, "flash-stick@1", - &dev)); - parent = dev->parent; - - /* Reorder the devices in the parent list and uclass list */ - list_del(&dev->sibling_node); - list_add_tail(&dev->sibling_node, &parent->child_head); - - list_del(&dev->uclass_node); - list_add_tail(&dev->uclass_node, &dev->uclass->dev_head); - - state_set_skip_delays(true); - ut_assertok(usb_init()); - console_record_reset_enable(); - usb_show_tree(); - len = membuff_getraw(&gd->console_out, -1, true, &data); - if (len) - data[len] = '\0'; - ut_asserteq_str(usb_tree_reorder, data); - ut_assertok(usb_stop()); + ut_asserteq(0, count_usb_devices()); return 0; } -DM_TEST(dm_test_usb_tree_reorder, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_usb_stop, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); static int dm_test_usb_keyb(struct unit_test_state *uts) { diff --git a/test/fs/fs-test.sh b/test/fs/fs-test.sh index b19486419e..20d5dd8a47 100755 --- a/test/fs/fs-test.sh +++ b/test/fs/fs-test.sh @@ -9,14 +9,18 @@ # It currently tests the fs/sb and native commands for ext4 and fat partitions # Expected results are as follows: # EXT4 tests: -# fs-test.sb.ext4.out: Summary: PASS: 23 FAIL: 0 -# fs-test.ext4.out: Summary: PASS: 23 FAIL: 0 -# fs-test.fs.ext4.out: Summary: PASS: 23 FAIL: 0 -# FAT tests: -# fs-test.sb.fat.out: Summary: PASS: 23 FAIL: 0 -# fs-test.fat.out: Summary: PASS: 20 FAIL: 3 -# fs-test.fs.fat.out: Summary: PASS: 20 FAIL: 3 -# Total Summary: TOTAL PASS: 132 TOTAL FAIL: 6 +# fs-test.sb.ext4.out: Summary: PASS: 24 FAIL: 0 +# fs-test.ext4.out: Summary: PASS: 24 FAIL: 0 +# fs-test.fs.ext4.out: Summary: PASS: 24 FAIL: 0 +# FAT16 tests: +# fs-test.sb.fat16.out: Summary: PASS: 24 FAIL: 0 +# fs-test.fat16.out: Summary: PASS: 21 FAIL: 3 +# fs-test.fs.fat16.out: Summary: PASS: 21 FAIL: 3 +# FAT32 tests: +# fs-test.sb.fat32.out: Summary: PASS: 24 FAIL: 0 +# fs-test.fat32.out: Summary: PASS: 21 FAIL: 3 +# fs-test.fs.fat32.out: Summary: PASS: 21 FAIL: 3 +# Total Summary: TOTAL PASS: 204 TOTAL FAIL: 12 # pre-requisite binaries list. PREREQ_BINS="md5sum mkfs mount umount dd fallocate mkdir" @@ -41,7 +45,7 @@ SMALL_FILE="1MB.file" BIG_FILE="2.5GB.file" # $MD5_FILE will have the expected md5s when we do the test -# They shall have a suffix which represents their file system (ext4/fat) +# They shall have a suffix which represents their file system (ext4/fat16/...) MD5_FILE="${OUT_DIR}/md5s.list" # $OUT shall be the prefix of the test output. Their suffix will be .out @@ -104,15 +108,25 @@ function prepare_env() { } # 1st parameter is the name of the image file to be created -# 2nd parameter is the filesystem - fat ext4 etc +# 2nd parameter is the filesystem - fat16 ext4 etc # -F cant be used with fat as it means something else. function create_image() { # Create image if not already present - saves time, while debugging - if [ "$2" = "ext4" ]; then + case "$2" in + fat16) + MKFS_OPTION="-F 16" + FS_TYPE="fat" + ;; + fat32) + MKFS_OPTION="-F 32" + FS_TYPE="fat" + ;; + ext4) MKFS_OPTION="-F" - else - MKFS_OPTION="" - fi + FS_TYPE="ext4" + ;; + esac + if [ ! -f "$1" ]; then fallocate -l 3G "$1" &> /dev/null if [ $? -ne 0 ]; then @@ -123,8 +137,8 @@ function create_image() { exit $? fi fi - mkfs -t "$2" $MKFS_OPTION "$1" &> /dev/null - if [ $? -ne 0 -a "$2" = "fat" ]; then + mkfs -t "$FS_TYPE" $MKFS_OPTION "$1" &> /dev/null + if [ $? -ne 0 -a "$FS_TYPE" = "fat" ]; then # If we fail and we did fat, try vfat. mkfs -t vfat $MKFS_OPTION "$1" &> /dev/null fi @@ -136,7 +150,7 @@ function create_image() { } # 1st parameter is image file -# 2nd parameter is file system type - fat/ext4 +# 2nd parameter is file system type - fat16/ext4/... # 3rd parameter is name of small file # 4th parameter is name of big file # 5th parameter is fs/nonfs/sb - to dictate generic fs commands or @@ -149,7 +163,7 @@ function test_image() { length="0x00100000" case "$2" in - fat) + fat*) FPATH="" PREFIX="fat" WRITE="write" @@ -215,10 +229,14 @@ ${PREFIX}ls host${SUFFIX} $6 # We want ${PREFIX}size host 0:0 $3 for host commands and # sb size hostfs - $3 for hostfs commands. # 1MB is 0x0010 0000 -# Test Case 2 - size of small file +# Test Case 2a - size of small file ${PREFIX}size host${SUFFIX} ${FPATH}$FILE_SMALL printenv filesize setenv filesize +# Test Case 2b - size of small file via a path using '..' +${PREFIX}size host${SUFFIX} ${FPATH}SUBDIR/../$FILE_SMALL +printenv filesize +setenv filesize # 2.5GB (1024*1024*2500) is 0x9C40 0000 # Test Case 3 - size of big file @@ -333,6 +351,9 @@ function create_files() { mkdir -p "$MOUNT_DIR" sudo mount -o loop,rw "$1" "$MOUNT_DIR" + # Create a subdirectory. + sudo mkdir -p "$MOUNT_DIR/SUBDIR" + # Create big file in this image. # Note that we work only on the start 1MB, couple MBs in the 2GB range # and the last 1 MB of the huge 2.5GB file. @@ -439,16 +460,19 @@ function check_results() { FAIL=0 # Check if the ls is showing correct results for 2.5 gb file - grep -A6 "Test Case 1 " "$1" | egrep -iq "2621440000 *$4" + grep -A7 "Test Case 1 " "$1" | egrep -iq "2621440000 *$4" pass_fail "TC1: ls of $4" # Check if the ls is showing correct results for 1 mb file - grep -A6 "Test Case 1 " "$1" | egrep -iq "1048576 *$3" + grep -A7 "Test Case 1 " "$1" | egrep -iq "1048576 *$3" pass_fail "TC1: ls of $3" # Check size command on 1MB.file - egrep -A3 "Test Case 2 " "$1" | grep -q "filesize=100000" + egrep -A3 "Test Case 2a " "$1" | grep -q "filesize=100000" pass_fail "TC2: size of $3" + # Check size command on 1MB.file via a path using '..' + egrep -A3 "Test Case 2b " "$1" | grep -q "filesize=100000" + pass_fail "TC2: size of $3 via a path using '..'" # Check size command on 2.5GB.file egrep -A3 "Test Case 3 " "$1" | grep -q "filesize=9c400000" @@ -550,7 +574,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. -for fs in ext4 fat; do +for fs in ext4 fat16 fat32; do echo "Creating $fs image if not already present." IMAGE=${IMG}.${fs}.img @@ -563,11 +587,14 @@ for fs in ext4 fat; do # Lets mount the image and test sb hostfs commands mkdir -p "$MOUNT_DIR" - if [ "$fs" = "fat" ]; then + case "$fs" in + fat*) uid="uid=`id -u`" - else + ;; + *) uid="" - fi + ;; + esac sudo mount -o loop,rw,$uid "$IMAGE" "$MOUNT_DIR" sudo chmod 777 "$MOUNT_DIR" diff --git a/test/overlay/cmd_ut_overlay.c b/test/overlay/cmd_ut_overlay.c index 24891ee829..c730a11f51 100644 --- a/test/overlay/cmd_ut_overlay.c +++ b/test/overlay/cmd_ut_overlay.c @@ -226,6 +226,7 @@ int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) void *fdt_overlay = &__dtb_test_fdt_overlay_begin; void *fdt_overlay_stacked = &__dtb_test_fdt_overlay_stacked_begin; void *fdt_base_copy, *fdt_overlay_copy, *fdt_overlay_stacked_copy; + int ret = -ENOMEM; uts = calloc(1, sizeof(*uts)); if (!uts) @@ -236,16 +237,16 @@ int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) fdt_base_copy = malloc(FDT_COPY_SIZE); if (!fdt_base_copy) - return -ENOMEM; + goto err1; uts->priv = fdt_base_copy; fdt_overlay_copy = malloc(FDT_COPY_SIZE); if (!fdt_overlay_copy) - return -ENOMEM; + goto err2; fdt_overlay_stacked_copy = malloc(FDT_COPY_SIZE); if (!fdt_overlay_stacked_copy) - return -ENOMEM; + goto err3; /* * Resize the FDT to 4k so that we have room to operate on @@ -293,11 +294,18 @@ int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } printf("Failures: %d\n", uts->fail_count); + if (!uts->fail_count) + ret = 0; + else + ret = CMD_RET_FAILURE; free(fdt_overlay_stacked_copy); +err3: free(fdt_overlay_copy); +err2: free(fdt_base_copy); +err1: free(uts); - return uts->fail_count ? CMD_RET_FAILURE : 0; + return ret; } diff --git a/test/py/README.md b/test/py/README.md index 829c7efbb2..ea4b66a41c 100644 --- a/test/py/README.md +++ b/test/py/README.md @@ -22,12 +22,17 @@ need to implement various "hook" scripts that are called by the test suite at the appropriate time. On Debian or Debian-like distributions, the following packages are required. -Similar package names should exist in other distributions. +Some packages are required to execute any test, and others only for specific +tests. Similar package names should exist in other distributions. | Package | Version tested (Ubuntu 14.04) | | -------------- | ----------------------------- | | python | 2.7.5-5ubuntu3 | | python-pytest | 2.5.1-1 | +| gdisk | 0.8.8-1ubuntu0.1 | +| dfu-util | 0.5-1 | +| dtc | 1.4.0+dfsg-1 | +| openssl | 1.0.1f-1ubuntu2.22 | The test script supports either: diff --git a/test/py/conftest.py b/test/py/conftest.py index 65e1d75626..6e66a48c15 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -429,12 +429,12 @@ def setup_boardspec(item): for board in mark.args: if board.startswith('!'): if ubconfig.board_type == board[1:]: - pytest.skip('board not supported') + pytest.skip('board "%s" not supported' % ubconfig.board_type) return else: required_boards.append(board) if required_boards and ubconfig.board_type not in required_boards: - pytest.skip('board not supported') + pytest.skip('board "%s" not supported' % ubconfig.board_type) def setup_buildconfigspec(item): """Process any 'buildconfigspec' marker for a test. @@ -455,7 +455,35 @@ def setup_buildconfigspec(item): return for option in mark.args: if not ubconfig.buildconfig.get('config_' + option.lower(), None): - pytest.skip('.config feature not enabled') + pytest.skip('.config feature "%s" not enabled' % option.lower()) + +def tool_is_in_path(tool): + for path in os.environ["PATH"].split(os.pathsep): + fn = os.path.join(path, tool) + if os.path.isfile(fn) and os.access(fn, os.X_OK): + return True + return False + +def setup_requiredtool(item): + """Process any 'requiredtool' marker for a test. + + Such a marker lists some external tool (binary, executable, application) + that the test requires. If tests are being executed on a system that + doesn't have the required tool, the test is marked to be skipped. + + Args: + item: The pytest test item. + + Returns: + Nothing. + """ + + mark = item.get_marker('requiredtool') + if not mark: + return + for tool in mark.args: + if not tool_is_in_path(tool): + pytest.skip('tool "%s" not in $PATH' % tool) def start_test_section(item): anchors[item.name] = log.start_section(item.name) @@ -476,6 +504,7 @@ def pytest_runtest_setup(item): start_test_section(item) setup_boardspec(item) setup_buildconfigspec(item) + setup_requiredtool(item) def pytest_runtest_protocol(item, nextitem): """pytest hook: Called to execute a test. diff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py index bf926c3e77..5bc1bc49d4 100644 --- a/test/py/multiplexed_log.py +++ b/test/py/multiplexed_log.py @@ -365,13 +365,13 @@ $(document).ready(function () { self._terminate_stream() self.f.write('<div class="' + note_type + '">\n') - if anchor: - self.f.write('<a href="#%s">\n' % anchor) self.f.write('<pre>') + if anchor: + self.f.write('<a href="#%s">' % anchor) self.f.write(self._escape(msg)) - self.f.write('\n</pre>\n') if anchor: - self.f.write('</a>\n') + self.f.write('</a>') + self.f.write('\n</pre>\n') self.f.write('</div>\n') def start_section(self, marker, anchor=None): diff --git a/test/py/tests/test_dfu.py b/test/py/tests/test_dfu.py index fba67d585b..8f6877c5c2 100644 --- a/test/py/tests/test_dfu.py +++ b/test/py/tests/test_dfu.py @@ -113,6 +113,7 @@ test_sizes_default = ( first_usb_dev_port = None @pytest.mark.buildconfigspec('cmd_dfu') +@pytest.mark.requiredtool('dfu-util') def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config): """Test the "dfu" command; the host system must be able to enumerate a USB device when "dfu" is running, various DFU transfers are tested, and the diff --git a/test/py/tests/test_efi_selftest.py b/test/py/tests/test_efi_selftest.py new file mode 100644 index 0000000000..76e282a6c7 --- /dev/null +++ b/test/py/tests/test_efi_selftest.py @@ -0,0 +1,25 @@ +# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +# Copyright (c) 2017, Heinrich Schuchardt <xypron.glpk@gmx.de> +# +# SPDX-License-Identifier: GPL-2.0 + +# Test efi API implementation + +import pytest +import u_boot_utils + +@pytest.mark.buildconfigspec('cmd_bootefi_selftest') +def test_efi_selftest(u_boot_console): + """ + Run bootefi selftest + """ + + u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False) + m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key']) + if m != 0: + raise Exception('Failures occured during the EFI selftest') + u_boot_console.run_command(cmd='', wait_for_echo=False, wait_for_prompt=False); + m = u_boot_console.p.expect(['resetting', 'U-Boot']) + if m != 0: + raise Exception('Reset failed during the EFI selftest') + u_boot_console.restart_uboot(); diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py index 7e6b96dae4..4b32bb18b8 100755 --- a/test/py/tests/test_fit.py +++ b/test/py/tests/test_fit.py @@ -111,6 +111,7 @@ sb save hostfs 0 %(loadables2_addr)x %(loadables2_out)s %(loadables2_size)x @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('fit_signature') +@pytest.mark.requiredtool('dtc') def test_fit(u_boot_console): def make_fname(leaf): """Make a temporary filename diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py index e2bbd08e6d..ec25fbbc5a 100644 --- a/test/py/tests/test_gpt.py +++ b/test/py/tests/test_gpt.py @@ -38,15 +38,14 @@ class GptTestDiskImage(object): fd = os.open(self.path, os.O_RDWR | os.O_CREAT) os.ftruncate(fd, 4194304) os.close(fd) - sgdisk = '/sbin/sgdisk' - cmd = (sgdisk, '-U', '375a56f7-d6c9-4e81-b5f0-09d41ca89efe', + cmd = ('sgdisk', '-U', '375a56f7-d6c9-4e81-b5f0-09d41ca89efe', self.path) u_boot_utils.run_and_log(u_boot_console, cmd) - cmd = (sgdisk, '--new=1:2048:2560', self.path) + cmd = ('sgdisk', '--new=1:2048:2560', self.path) u_boot_utils.run_and_log(u_boot_console, cmd) - cmd = (sgdisk, '--new=2:4096:4608', self.path) + cmd = ('sgdisk', '--new=2:4096:4608', self.path) u_boot_utils.run_and_log(u_boot_console, cmd) - cmd = (sgdisk, '-l', self.path) + cmd = ('sgdisk', '-l', self.path) u_boot_utils.run_and_log(u_boot_console, cmd) gtdi = None @@ -64,6 +63,7 @@ def state_disk_image(u_boot_console): @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') +@pytest.mark.requiredtool('sgdisk') def test_gpt_guid(state_disk_image, u_boot_console): """Test the gpt guid command.""" @@ -73,6 +73,7 @@ def test_gpt_guid(state_disk_image, u_boot_console): @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') +@pytest.mark.requiredtool('sgdisk') def test_gpt_save_guid(state_disk_image, u_boot_console): """Test the gpt guid command to save GUID into a string.""" @@ -86,6 +87,7 @@ def test_gpt_save_guid(state_disk_image, u_boot_console): @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') @pytest.mark.buildconfigspec('cmd_gpt_rename') +@pytest.mark.requiredtool('sgdisk') def test_gpt_rename_partition(state_disk_image, u_boot_console): """Test the gpt rename command to write partition names.""" @@ -101,6 +103,7 @@ def test_gpt_rename_partition(state_disk_image, u_boot_console): @pytest.mark.buildconfigspec('cmd_gpt') @pytest.mark.buildconfigspec('cmd_gpt_rename') @pytest.mark.buildconfigspec('cmd_part') +@pytest.mark.requiredtool('sgdisk') def test_gpt_swap_partitions(state_disk_image, u_boot_console): """Test the gpt swap command to exchange two partition names.""" diff --git a/test/py/tests/test_vboot.py b/test/py/tests/test_vboot.py index 6e62820743..c4da79d114 100644 --- a/test/py/tests/test_vboot.py +++ b/test/py/tests/test_vboot.py @@ -31,6 +31,10 @@ import u_boot_utils as util @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('fit_signature') +@pytest.mark.requiredtool('dtc') +@pytest.mark.requiredtool('fdtget') +@pytest.mark.requiredtool('fdtput') +@pytest.mark.requiredtool('openssl') def test_vboot(u_boot_console): """Test verified boot signing with mkimage and verification with 'bootm'. |