mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-22 20:58:22 +00:00
tests: py: dfu: Add variables to store dfu alt numbers for test and dummy files
This patch replaces hardcoded (i.e. 0 and 1) values passed to dfu_{read|write} with variables. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Stephen Warren <swarren@nvidia.com> --- Changes for v3: - Replace per module global variables with ones defined inside a function Changes for v2: - None
This commit is contained in:
parent
65341967ce
commit
c6eb899c4d
1 changed files with 8 additions and 4 deletions
|
@ -99,6 +99,10 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
|
||||||
Nothing.
|
Nothing.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Default alt settings for test and dummy files
|
||||||
|
alt_setting_test_file = 0
|
||||||
|
alt_setting_dummy_file = 1
|
||||||
|
|
||||||
def start_dfu():
|
def start_dfu():
|
||||||
"""Start U-Boot's dfu shell command.
|
"""Start U-Boot's dfu shell command.
|
||||||
|
|
||||||
|
@ -229,15 +233,15 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
|
||||||
|
|
||||||
u_boot_console.log.action('Writing test data to DFU primary ' +
|
u_boot_console.log.action('Writing test data to DFU primary ' +
|
||||||
'altsetting')
|
'altsetting')
|
||||||
dfu_write(0, test_f.abs_fn)
|
dfu_write(alt_setting_test_file, test_f.abs_fn)
|
||||||
|
|
||||||
u_boot_console.log.action('Writing dummy data to DFU secondary ' +
|
u_boot_console.log.action('Writing dummy data to DFU secondary ' +
|
||||||
'altsetting to clear DFU buffers')
|
'altsetting to clear DFU buffers')
|
||||||
dfu_write(1, dummy_f.abs_fn)
|
dfu_write(alt_setting_dummy_file, dummy_f.abs_fn)
|
||||||
|
|
||||||
u_boot_console.log.action('Reading DFU primary altsetting for ' +
|
u_boot_console.log.action('Reading DFU primary altsetting for ' +
|
||||||
'comparison')
|
'comparison')
|
||||||
dfu_read(0, readback_fn)
|
dfu_read(alt_setting_test_file, readback_fn)
|
||||||
|
|
||||||
u_boot_console.log.action('Comparing written and read data')
|
u_boot_console.log.action('Comparing written and read data')
|
||||||
written_hash = test_f.content_hash
|
written_hash = test_f.content_hash
|
||||||
|
@ -266,7 +270,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
|
||||||
|
|
||||||
u_boot_console.log.action(
|
u_boot_console.log.action(
|
||||||
'Overwriting DFU primary altsetting with dummy data')
|
'Overwriting DFU primary altsetting with dummy data')
|
||||||
dfu_write(0, dummy_f.abs_fn)
|
dfu_write(alt_setting_test_file, dummy_f.abs_fn)
|
||||||
|
|
||||||
for size in sizes:
|
for size in sizes:
|
||||||
with u_boot_console.log.section('Data size %d' % size):
|
with u_boot_console.log.section('Data size %d' % size):
|
||||||
|
|
Loading…
Add table
Reference in a new issue