From 243be16d82dd68fb538116cbd6a2f50f342baaf5 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 24 May 2018 14:19:36 +0200 Subject: [PATCH] py: tests: Extend timeout for qspi read twice test On some systems reading the whole qspi can take longer than default timeout. Signed-off-by: Michal Simek --- test/py/tests/test_qspi.py | 42 ++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/test/py/tests/test_qspi.py b/test/py/tests/test_qspi.py index 1c9bf8eba4c..5cd255a8d8d 100644 --- a/test/py/tests/test_qspi.py +++ b/test/py/tests/test_qspi.py @@ -98,20 +98,24 @@ def qspi_find_freq_range(u_boot_console): def qspi_read_twice(u_boot_console): expected_read = "Read: OK" + timeout = 10000000 # TODO maybe add alignment and different start for pages for size in random.randint(4, page_size), random.randint(4, total_size), total_size: addr = u_boot_utils.find_ram_base(u_boot_console) + size = size & ~3 # FIXME using 0 is failing for me - output = u_boot_console.run_command('sf read %x 0 %x' % (addr + total_size, size)) - assert expected_read in output + with u_boot_console.temporary_timeout(timeout): + output = u_boot_console.run_command('sf read %x 0 %x' % (addr + total_size, size)) + assert expected_read in output output = u_boot_console.run_command('crc32 %x %x' % (addr + total_size, size)) m = re.search('==> (.+?)$', output) if not m: pytest.fail("CRC32 failed") expected_crc32 = m.group(1) - output = u_boot_console.run_command('sf read %x 0 %x' % (addr + total_size + 10, size)) - assert expected_read in output + with u_boot_console.temporary_timeout(timeout): + output = u_boot_console.run_command('sf read %x 0 %x' % (addr + total_size + 10, size)) + assert expected_read in output output = u_boot_console.run_command('crc32 %x %x' % (addr + total_size + 10, size)) assert expected_crc32 in output @@ -155,6 +159,8 @@ def qspi_write_twice(u_boot_console): # TODO maybe add alignment and different start for pages for size in random.randint(4, page_size), random.randint(page_size, total_size), total_size: offset = random.randint(4, page_size) + offset = offset & ~3 + size = size & ~3 size = size - old_size output = u_boot_console.run_command('crc32 %x %x' % (addr + total_size, size)) m = re.search('==> (.+?)$', output) @@ -177,13 +183,15 @@ def qspi_write_twice(u_boot_console): timeout = 100000000 start = 0 with u_boot_console.temporary_timeout(timeout): - output = u_boot_console.run_command('sf erase %x %x' % (eraseoffset, erasesize)) - assert expected_erase in output + output = u_boot_console.run_command('sf erase %x %x' % (eraseoffset, erasesize)) + assert expected_erase in output - output = u_boot_console.run_command('sf write %x %x %x' % (addr + total_size, old_size, size)) - assert expected_write in output - output = u_boot_console.run_command('sf read %x %x %x' % (addr + total_size + offset, old_size, size)) - assert expected_read in output + with u_boot_console.temporary_timeout(timeout): + output = u_boot_console.run_command('sf write %x %x %x' % (addr + total_size, old_size, size)) + assert expected_write in output + with u_boot_console.temporary_timeout(timeout): + output = u_boot_console.run_command('sf read %x %x %x' % (addr + total_size + offset, old_size, size)) + assert expected_read in output output = u_boot_console.run_command('crc32 %x %x' % (addr + total_size + offset, size)) assert expected_crc32 in output old_size = size @@ -213,17 +221,21 @@ def qspi_write_continues(u_boot_console): expected_crc32 = m.group(1) # print expected_crc32 + timeout = 10000000 old_size = 0 for size in random.randint(4, page_size), random.randint(page_size, total_size), total_size: + size = size & ~3 size = size - old_size - output = u_boot_console.run_command('sf write %x %x %x' % (addr + 0x10000 + old_size, old_size, size)) - assert expected_write in output + with u_boot_console.temporary_timeout(timeout): + output = u_boot_console.run_command('sf write %x %x %x' % (addr + 0x10000 + old_size, old_size, size)) + assert expected_write in output old_size = size - output = u_boot_console.run_command('sf read %x %x %x' % (addr + 0x10000 + total_size, 0, total_size)) - assert expected_read in output + with u_boot_console.temporary_timeout(timeout): + output = u_boot_console.run_command('sf read %x %x %x' % (addr + 0x10000 + total_size, 0, total_size)) + assert expected_read in output - u_boot_console.run_command('md %x' % (addr + 0x10000 + total_size)) + #u_boot_console.run_command('md %x' % (addr + 0x10000 + total_size)) output = u_boot_console.run_command('crc32 %x %x' % (addr + 0x10000 + total_size, total_size)) assert expected_crc32 in output -- 2.47.3