]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
py: tests: Extend timeout for qspi read twice test
authorMichal Simek <michal.simek@xilinx.com>
Thu, 24 May 2018 12:19:36 +0000 (14:19 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 30 May 2018 06:24:08 +0000 (08:24 +0200)
On some systems reading the whole qspi can take longer than default
timeout.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
test/py/tests/test_qspi.py

index 1c9bf8eba4c07c55c65d14d05f9ffd35bf425cb0..5cd255a8d8dc8ba9cce0b4560713489a98f19ebb 100644 (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