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:
@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 == ''
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
# 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
# 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,
},
)
# 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,
}
"""