diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/Makefile | 1 | ||||
-rw-r--r-- | test/dm/bootcount.c | 30 | ||||
-rw-r--r-- | test/py/tests/test_avb.py | 14 | ||||
-rw-r--r-- | test/py/tests/test_bind.py | 140 | ||||
-rw-r--r-- | test/py/tests/test_dfu.py | 38 | ||||
-rw-r--r-- | test/py/tests/test_efi_loader.py | 12 | ||||
-rw-r--r-- | test/py/tests/test_fpga.py | 54 | ||||
-rw-r--r-- | test/py/tests/test_fs/conftest.py | 8 | ||||
-rw-r--r-- | test/py/tests/test_mmc_rd.py | 66 | ||||
-rw-r--r-- | test/py/tests/test_net.py | 22 | ||||
-rw-r--r-- | test/py/tests/test_ums.py | 24 |
11 files changed, 220 insertions, 189 deletions
diff --git a/test/dm/Makefile b/test/dm/Makefile index 7dc80be25e..1b089960cb 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -15,6 +15,7 @@ ifneq ($(CONFIG_SANDBOX),) obj-$(CONFIG_SOUND) += audio.o obj-$(CONFIG_BLK) += blk.o obj-$(CONFIG_BOARD) += board.o +obj-$(CONFIG_DM_BOOTCOUNT) += bootcount.o obj-$(CONFIG_CLK) += clk.o obj-$(CONFIG_DM_ETH) += eth.o obj-$(CONFIG_FIRMWARE) += firmware.o diff --git a/test/dm/bootcount.c b/test/dm/bootcount.c new file mode 100644 index 0000000000..0817b7d3ec --- /dev/null +++ b/test/dm/bootcount.c @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) 2018 Theobroma Systems Design und Consulting GmbH + */ + +#include <common.h> +#include <dm.h> +#include <bootcount.h> +#include <asm/test.h> +#include <dm/test.h> +#include <test/ut.h> + +static int dm_test_bootcount(struct unit_test_state *uts) +{ + struct udevice *dev; + u32 val; + + ut_assertok(uclass_get_device(UCLASS_BOOTCOUNT, 0, &dev)); + ut_assertok(dm_bootcount_set(dev, 0)); + ut_assertok(dm_bootcount_get(dev, &val)); + ut_assert(val == 0); + ut_assertok(dm_bootcount_set(dev, 0xab)); + ut_assertok(dm_bootcount_get(dev, &val)); + ut_assert(val == 0xab); + + return 0; +} + +DM_TEST(dm_test_bootcount, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + diff --git a/test/py/tests/test_avb.py b/test/py/tests/test_avb.py index 9683fd80d0..e70a010c9a 100644 --- a/test/py/tests/test_avb.py +++ b/test/py/tests/test_avb.py @@ -51,22 +51,22 @@ def test_avb_mmc_uuid(u_boot_console): part_lines = u_boot_console.run_command('mmc part').splitlines() part_list = {} - cur_partname = "" + cur_partname = '' for line in part_lines: - if "\"" in line: - start_pt = line.find("\"") - end_pt = line.find("\"", start_pt + 1) + if '"' in line: + start_pt = line.find('"') + end_pt = line.find('"', start_pt + 1) cur_partname = line[start_pt + 1: end_pt] - if "guid:" in line: - guid_to_check = line.split("guid:\t") + if 'guid:' in line: + guid_to_check = line.split('guid:\t') part_list[cur_partname] = guid_to_check[1] # lets check all guids with avb get_guid for part, guid in part_list.iteritems(): avb_guid_resp = u_boot_console.run_command('avb get_uuid %s' % part) - assert guid == avb_guid_resp.split("UUID: ")[1] + assert guid == avb_guid_resp.split('UUID: ')[1] @pytest.mark.buildconfigspec('cmd_avb') diff --git a/test/py/tests/test_bind.py b/test/py/tests/test_bind.py index 917839f628..ccf6d62ea8 100644 --- a/test/py/tests/test_bind.py +++ b/test/py/tests/test_bind.py @@ -26,82 +26,82 @@ def in_tree(response, name, uclass, drv, depth, last_child): def test_bind_unbind_with_node(u_boot_console): #bind /bind-test. Device should come up as well as its children - response = u_boot_console.run_command("bind /bind-test generic_simple_bus") + 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_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_bus", 1, True) + tree = u_boot_console.run_command('dm tree') + 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_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") + 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_bus", 0, True) - assert "bind-test-child1" not in tree - assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True) + tree = u_boot_console.run_command('dm tree') + 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_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") + 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_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_bus", 1, False) + tree = u_boot_console.run_command('dm tree') + 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_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") + 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_bus", 0, True) - assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, True) - assert "bind-test-child2" not in tree + tree = u_boot_console.run_command('dm tree') + 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 #Bind child #2. No error expected and all devices should be there - response = u_boot_console.run_command("bind /bind-test/bind-test-child2 generic_simple_bus") + 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_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_bus", 1, True) + tree = u_boot_console.run_command('dm tree') + 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_bus', 1, True) #Unbind parent. No error expected. All devices should be removed and unbound - response = u_boot_console.run_command("unbind /bind-test") + response = u_boot_console.run_command('unbind /bind-test') assert response == '' - tree = u_boot_console.run_command("dm tree") - assert "bind-test" not in tree - assert "bind-test-child1" not in tree - assert "bind-test-child2" not in tree + tree = u_boot_console.run_command('dm tree') + assert 'bind-test' not in tree + assert 'bind-test-child1' not in tree + assert 'bind-test-child2' not in tree #try binding invalid node with valid driver - response = u_boot_console.run_command("bind /not-a-valid-node generic_simple_bus") + response = u_boot_console.run_command('bind /not-a-valid-node generic_simple_bus') assert response != '' - tree = u_boot_console.run_command("dm tree") - assert "not-a-valid-node" not in tree + tree = u_boot_console.run_command('dm tree') + assert 'not-a-valid-node' not in tree #try binding valid node with invalid driver - response = u_boot_console.run_command("bind /bind-test not_a_driver") + response = u_boot_console.run_command('bind /bind-test not_a_driver') assert response != '' - tree = u_boot_console.run_command("dm tree") - assert "bind-test" not in tree + tree = u_boot_console.run_command('dm tree') + assert 'bind-test' not in tree #bind /bind-test. Device should come up as well as its children - response = u_boot_console.run_command("bind /bind-test generic_simple_bus") + 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_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_bus", 1, True) + tree = u_boot_console.run_command('dm tree') + 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_bus', 1, True) - response = u_boot_console.run_command("unbind /bind-test") + response = u_boot_console.run_command('unbind /bind-test') assert response == '' def get_next_line(tree, name): treelines = [x.strip() for x in tree.splitlines() if x.strip()] - child_line = "" + child_line = '' for idx, line in enumerate(treelines): - if ("-- " + name) in line: + if ('-- ' + name) in line: try: child_line = treelines[idx+1] except: @@ -112,68 +112,68 @@ def get_next_line(tree, name): @pytest.mark.buildconfigspec('cmd_bind') def test_bind_unbind_with_uclass(u_boot_console): #bind /bind-test - response = u_boot_console.run_command("bind /bind-test generic_simple_bus") + response = u_boot_console.run_command('bind /bind-test generic_simple_bus') assert response == '' #make sure bind-test-child2 is there and get its uclass/index pair - tree = u_boot_console.run_command("dm tree") - child2_line = [x.strip() for x in tree.splitlines() if "-- bind-test-child2" in x] + tree = u_boot_console.run_command('dm tree') + child2_line = [x.strip() for x in tree.splitlines() if '-- bind-test-child2' in x] assert len(child2_line) == 1 child2_uclass = child2_line[0].split()[0] child2_index = int(child2_line[0].split()[1]) #bind generic_simple_bus as a child of bind-test-child2 - response = u_boot_console.run_command("bind {} {} generic_simple_bus".format(child2_uclass, child2_index, "generic_simple_bus")) + response = u_boot_console.run_command('bind {} {} generic_simple_bus'.format(child2_uclass, child2_index, 'generic_simple_bus')) #check that the child is there and its uclass/index pair is right - tree = u_boot_console.run_command("dm tree") + tree = u_boot_console.run_command('dm tree') - child_of_child2_line = get_next_line(tree, "bind-test-child2") + child_of_child2_line = get_next_line(tree, 'bind-test-child2') assert child_of_child2_line child_of_child2_index = int(child_of_child2_line.split()[1]) - assert in_tree(tree, "generic_simple_bus", "simple_bus", "generic_simple_bus", 2, True) + assert in_tree(tree, 'generic_simple_bus', 'simple_bus', 'generic_simple_bus', 2, True) assert child_of_child2_index == child2_index + 1 #unbind the child and check it has been removed - response = u_boot_console.run_command("unbind simple_bus {}".format(child_of_child2_index)) + 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_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 == "" + tree = u_boot_console.run_command('dm tree') + 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 == '' #bind generic_simple_bus as a child of bind-test-child2 - response = u_boot_console.run_command("bind {} {} generic_simple_bus".format(child2_uclass, child2_index, "generic_simple_bus")) + response = u_boot_console.run_command('bind {} {} generic_simple_bus'.format(child2_uclass, child2_index, 'generic_simple_bus')) #check that the child is there and its uclass/index pair is right - tree = u_boot_console.run_command("dm tree") + tree = u_boot_console.run_command('dm tree') treelines = [x.strip() for x in tree.splitlines() if x.strip()] - child_of_child2_line = get_next_line(tree, "bind-test-child2") + child_of_child2_line = get_next_line(tree, 'bind-test-child2') assert child_of_child2_line child_of_child2_index = int(child_of_child2_line.split()[1]) - assert in_tree(tree, "generic_simple_bus", "simple_bus", "generic_simple_bus", 2, True) + assert in_tree(tree, 'generic_simple_bus', 'simple_bus', 'generic_simple_bus', 2, True) assert child_of_child2_index == child2_index + 1 #unbind the child and check it has been removed - response = u_boot_console.run_command("unbind {} {} generic_simple_bus".format(child2_uclass, child2_index, "generic_simple_bus")) + response = u_boot_console.run_command('unbind {} {} generic_simple_bus'.format(child2_uclass, child2_index, 'generic_simple_bus')) assert response == '' - tree = u_boot_console.run_command("dm tree") - assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True) + tree = u_boot_console.run_command('dm tree') + 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 == "" + child_of_child2_line = get_next_line(tree, 'bind-test-child2') + assert child_of_child2_line == '' #unbind the child again and check it doesn't change the tree - tree_old = u_boot_console.run_command("dm tree") - response = u_boot_console.run_command("unbind {} {} generic_simple_bus".format(child2_uclass, child2_index, "generic_simple_bus")) - tree_new = u_boot_console.run_command("dm tree") + tree_old = u_boot_console.run_command('dm tree') + response = u_boot_console.run_command('unbind {} {} generic_simple_bus'.format(child2_uclass, child2_index, 'generic_simple_bus')) + tree_new = u_boot_console.run_command('dm tree') assert response == '' assert tree_old == tree_new - response = u_boot_console.run_command("unbind /bind-test") + response = u_boot_console.run_command('unbind /bind-test') assert response == '' diff --git a/test/py/tests/test_dfu.py b/test/py/tests/test_dfu.py index a24600376c..5d87eb349b 100644 --- a/test/py/tests/test_dfu.py +++ b/test/py/tests/test_dfu.py @@ -20,28 +20,28 @@ For example: env__usb_dev_ports = ( { - "fixture_id": "micro_b", - "tgt_usb_ctlr": "0", - "host_usb_dev_node": "/dev/usbdev-p2371-2180", + 'fixture_id': 'micro_b', + 'tgt_usb_ctlr': '0', + 'host_usb_dev_node': '/dev/usbdev-p2371-2180', # This parameter is optional /if/ you only have a single board # attached to your host at a time. - "host_usb_port_path": "3-13", + 'host_usb_port_path': '3-13', }, ) -# Optional entries (required only when "alt_id_test_file" and -# "alt_id_dummy_file" are specified). -test_file_name = "/dfu_test.bin" -dummy_file_name = "/dfu_dummy.bin" -# Above files are used to generate proper "alt_info" entry -"alt_info": "/%s ext4 0 2;/%s ext4 0 2" % (test_file_name, dummy_file_name), +# Optional entries (required only when 'alt_id_test_file' and +# 'alt_id_dummy_file' are specified). +test_file_name = '/dfu_test.bin' +dummy_file_name = '/dfu_dummy.bin' +# Above files are used to generate proper 'alt_info' entry +'alt_info': '/%s ext4 0 2;/%s ext4 0 2' % (test_file_name, dummy_file_name), env__dfu_configs = ( # eMMC, partition 1 { - "fixture_id": "emmc", - "alt_info": "/dfu_test.bin ext4 0 1;/dfu_dummy.bin ext4 0 1", - "cmd_params": "mmc 0", + 'fixture_id': 'emmc', + 'alt_info': '/dfu_test.bin ext4 0 1;/dfu_dummy.bin ext4 0 1', + 'cmd_params': 'mmc 0', # This value is optional. # If present, it specified the set of transfer sizes tested. # If missing, a default list of sizes will be used, which covers @@ -49,7 +49,7 @@ env__dfu_configs = ( # Manually specifying test sizes is useful if you wish to test 4 DFU # configurations, but don't want to test every single transfer size # on each, to avoid bloating the overall time taken by testing. - "test_sizes": (63, 64, 65), + 'test_sizes': (63, 64, 65), # This value is optional. # The name of the environment variable that the the dfu command reads # alt info from. If unspecified, this defaults to dfu_alt_info, which is @@ -57,17 +57,17 @@ env__dfu_configs = ( # One example is the Odroid XU3, which automatically generates # $dfu_alt_info, each time the dfu command is run, by concatenating # $dfu_alt_boot and $dfu_alt_system. - "alt_info_env_name": "dfu_alt_system", + 'alt_info_env_name': 'dfu_alt_system', # This value is optional. - # For boards which require the "test file" alt setting number other than + # For boards which require the 'test file' alt setting number other than # default (0) it is possible to specify exact file name to be used as # this parameter. - "alt_id_test_file": test_file_name, + 'alt_id_test_file': test_file_name, # This value is optional. - # For boards which require the "dummy file" alt setting number other + # For boards which require the 'dummy file' alt setting number other # than default (1) it is possible to specify exact file name to be used # as this parameter. - "alt_id_dummy_file": dummy_file_name, + 'alt_id_dummy_file': dummy_file_name, }, ) diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py index a66c6e6f94..d6b214f845 100644 --- a/test/py/tests/test_efi_loader.py +++ b/test/py/tests/test_efi_loader.py @@ -35,17 +35,17 @@ env__net_dhcp_server = True # static IP. If solely relying on DHCP, this variable may be omitted or set to # an empty list. env__net_static_env_vars = [ - ("ipaddr", "10.0.0.100"), - ("netmask", "255.255.255.0"), - ("serverip", "10.0.0.1"), + ('ipaddr', '10.0.0.100'), + ('netmask', '255.255.255.0'), + ('serverip', '10.0.0.1'), ] # Details regarding a file that may be read from a TFTP server. This variable # may be omitted or set to None if TFTP testing is not possible or desired. env__efi_loader_helloworld_file = { - "fn": "lib/efi_loader/helloworld.efi", - "size": 5058624, - "crc32": "c2244b26", + 'fn': 'lib/efi_loader/helloworld.efi', + 'size': 5058624, + 'crc32': 'c2244b26', } """ diff --git a/test/py/tests/test_fpga.py b/test/py/tests/test_fpga.py index 7459ce5867..798f6eed3d 100644 --- a/test/py/tests/test_fpga.py +++ b/test/py/tests/test_fpga.py @@ -24,40 +24,40 @@ env__net_dhcp_server = True # static IP. In this test case we atleast need serverip for performing tftpb # to get required files. env__net_static_env_vars = [ - ("ipaddr", "10.0.0.100"), - ("netmask", "255.255.255.0"), - ("serverip", "10.0.0.1"), + ('ipaddr', '10.0.0.100'), + ('netmask', '255.255.255.0'), + ('serverip', '10.0.0.1'), ] # Details regarding the files that may be read from a TFTP server. . env__fpga_secure_readable_file = { - "fn": "auth_bhdr_ppk1_bit.bin", - "enckupfn": "auth_bhdr_enc_kup_load_bit.bin", - "addr": 0x1000000, - "keyaddr": 0x100000, - "keyfn": "key.txt", + 'fn': 'auth_bhdr_ppk1_bit.bin', + 'enckupfn': 'auth_bhdr_enc_kup_load_bit.bin', + 'addr': 0x1000000, + 'keyaddr': 0x100000, + 'keyfn': 'key.txt', } env__fpga_under_test = { - "dev": 0, - "addr" : 0x1000000, - "bitstream_load": "compress.bin", - "bitstream_load_size": 1831960, - "bitstream_loadp": "compress_pr.bin", - "bitstream_loadp_size": 423352, - "bitstream_loadb": "compress.bit", - "bitstream_loadb_size": 1832086, - "bitstream_loadbp": "compress_pr.bit", - "bitstream_loadbp_size": 423491, - "mkimage_legacy": "download.ub", - "mkimage_legacy_size": 13321468, - "mkimage_legacy_gz": "download.gz.ub", - "mkimage_legacy_gz_size": 53632, - "mkimage_fit": "download-fit.ub", - "mkimage_fit_size": 13322784, - "loadfs": "mmc 0 compress.bin", - "loadfs_size": 1831960, - "loadfs_block_size": 0x10000, + 'dev': 0, + 'addr' : 0x1000000, + 'bitstream_load': 'compress.bin', + 'bitstream_load_size': 1831960, + 'bitstream_loadp': 'compress_pr.bin', + 'bitstream_loadp_size': 423352, + 'bitstream_loadb': 'compress.bit', + 'bitstream_loadb_size': 1832086, + 'bitstream_loadbp': 'compress_pr.bit', + 'bitstream_loadbp_size': 423491, + 'mkimage_legacy': 'download.ub', + 'mkimage_legacy_size': 13321468, + 'mkimage_legacy_gz': 'download.gz.ub', + 'mkimage_legacy_gz_size': 53632, + 'mkimage_fit': 'download-fit.ub', + 'mkimage_fit_size': 13322784, + 'loadfs': 'mmc 0 compress.bin', + 'loadfs_size': 1831960, + 'loadfs_block_size': 0x10000, } """ diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py index 60b4a2d737..43eeb4be0b 100644 --- a/test/py/tests/test_fs/conftest.py +++ b/test/py/tests/test_fs/conftest.py @@ -54,7 +54,7 @@ def pytest_configure(config): supported_fs = config.getoption('fs_type') if supported_fs: - print("*** FS TYPE modified: %s" % supported_fs) + print('*** FS TYPE modified: %s' % supported_fs) supported_fs_basic = intersect(supported_fs, supported_fs_basic) supported_fs_ext = intersect(supported_fs, supported_fs_ext) supported_fs_mkdir = intersect(supported_fs, supported_fs_mkdir) @@ -174,7 +174,7 @@ def tool_is_in_path(tool): Return: True if available, False if not. """ - for path in os.environ["PATH"].split(os.pathsep): + 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 @@ -202,9 +202,9 @@ def mount_fs(fs_type, device, mount_point): check_call('guestmount -a %s -m /dev/sda %s' % (device, mount_point), shell=True) else: - mount_opt = "loop,rw" + mount_opt = 'loop,rw' if re.match('fat', fs_type): - mount_opt += ",umask=0000" + mount_opt += ',umask=0000' check_call('sudo mount -o %s %s %s' % (mount_opt, device, mount_point), shell=True) diff --git a/test/py/tests/test_mmc_rd.py b/test/py/tests/test_mmc_rd.py index c5858cb089..a13bc0a5f6 100644 --- a/test/py/tests/test_mmc_rd.py +++ b/test/py/tests/test_mmc_rd.py @@ -14,45 +14,45 @@ which MMC devices should be tested. For example: env__mmc_rd_configs = ( { - "fixture_id": "emmc-boot0", - "is_emmc": True, - "devid": 0, - "partid": 1, - "sector": 0x10, - "count": 1, + 'fixture_id': 'emmc-boot0', + 'is_emmc': True, + 'devid': 0, + 'partid': 1, + 'sector': 0x10, + 'count': 1, }, { - "fixture_id": "emmc-boot1", - "is_emmc": True, - "devid": 0, - "partid": 2, - "sector": 0x10, - "count": 1, + 'fixture_id': 'emmc-boot1', + 'is_emmc': True, + 'devid': 0, + 'partid': 2, + 'sector': 0x10, + 'count': 1, }, { - "fixture_id": "emmc-data", - "is_emmc": True, - "devid": 0, - "partid": 0, - "sector": 0x10, - "count": 0x1000, + 'fixture_id': 'emmc-data', + 'is_emmc': True, + 'devid': 0, + 'partid': 0, + 'sector': 0x10, + 'count': 0x1000, }, { - "fixture_id": "sd-mbr", - "is_emmc": False, - "devid": 1, - "partid": None, - "sector": 0, - "count": 1, - "crc32": "8f6ecf0d", + 'fixture_id': 'sd-mbr', + 'is_emmc': False, + 'devid': 1, + 'partid': None, + 'sector': 0, + 'count': 1, + 'crc32': '8f6ecf0d', }, { - "fixture_id": "sd-large", - "is_emmc": False, - "devid": 1, - "partid": None, - "sector": 0x10, - "count": 0x1000, + 'fixture_id': 'sd-large', + 'is_emmc': False, + 'devid': 1, + 'partid': None, + 'sector': 0x10, + 'count': 0x1000, }, ) """ @@ -92,9 +92,9 @@ def test_mmc_rd(u_boot_console, env__mmc_rd_config): response = u_boot_console.run_command(cmd) assert 'no card present' not in response if is_emmc: - partid_response = "(part %d)" % partid + partid_response = '(part %d)' % partid else: - partid_response = "" + partid_response = '' good_response = 'mmc%d%s is current device' % (devid, partid_response) assert good_response in response diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py index 2821ce65da..9c395e69fa 100644 --- a/test/py/tests/test_net.py +++ b/test/py/tests/test_net.py @@ -33,27 +33,27 @@ env__net_dhcp_server = True # static IP. If solely relying on DHCP, this variable may be omitted or set to # an empty list. env__net_static_env_vars = [ - ("ipaddr", "10.0.0.100"), - ("netmask", "255.255.255.0"), - ("serverip", "10.0.0.1"), + ('ipaddr', '10.0.0.100'), + ('netmask', '255.255.255.0'), + ('serverip', '10.0.0.1'), ] # Details regarding a file that may be read from a TFTP server. This variable # may be omitted or set to None if TFTP testing is not possible or desired. env__net_tftp_readable_file = { - "fn": "ubtest-readable.bin", - "addr": 0x10000000, - "size": 5058624, - "crc32": "c2244b26", + 'fn': 'ubtest-readable.bin', + 'addr': 0x10000000, + 'size': 5058624, + 'crc32': 'c2244b26', } # Details regarding a file that may be read from a NFS server. This variable # may be omitted or set to None if NFS testing is not possible or desired. env__net_nfs_readable_file = { - "fn": "ubtest-readable.bin", - "addr": 0x10000000, - "size": 5058624, - "crc32": "c2244b26", + 'fn': 'ubtest-readable.bin', + 'addr': 0x10000000, + 'size': 5058624, + 'crc32': 'c2244b26', } """ diff --git a/test/py/tests/test_ums.py b/test/py/tests/test_ums.py index e8eb43c76b..749b160623 100644 --- a/test/py/tests/test_ums.py +++ b/test/py/tests/test_ums.py @@ -23,35 +23,35 @@ For example: # Leave this list empty if you have no block_devs below with writable # partitions defined. env__mount_points = ( - "/mnt/ubtest-mnt-p2371-2180-na", + '/mnt/ubtest-mnt-p2371-2180-na', ) env__usb_dev_ports = ( { - "fixture_id": "micro_b", - "tgt_usb_ctlr": "0", - "host_ums_dev_node": "/dev/disk/by-path/pci-0000:00:14.0-usb-0:13:1.0-scsi-0:0:0:0", + 'fixture_id': 'micro_b', + 'tgt_usb_ctlr': '0', + 'host_ums_dev_node': '/dev/disk/by-path/pci-0000:00:14.0-usb-0:13:1.0-scsi-0:0:0:0', }, ) env__block_devs = ( # eMMC; always present { - "fixture_id": "emmc", - "type": "mmc", - "id": "0", + 'fixture_id': 'emmc', + 'type': 'mmc', + 'id': '0', # The following two properties are optional. # If present, the partition will be mounted and a file written-to and # read-from it. If missing, only a simple block read test will be # performed. - "writable_fs_partition": 1, - "writable_fs_subdir": "tmp/", + 'writable_fs_partition': 1, + 'writable_fs_subdir': 'tmp/', }, # SD card; present since I plugged one in { - "fixture_id": "sd", - "type": "mmc", - "id": "1" + 'fixture_id': 'sd', + 'type': 'mmc', + 'id': '1' }, ) |