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 <michal.simek@xilinx.com>
This commit is contained in:
Michal Simek
2018-05-24 14:19:36 +02:00
parent 4e8d5fdbbe
commit 243be16d82

View File

@@ -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