]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
test: py: Create qspi write continue test
authorMichal Simek <michal.simek@xilinx.com>
Tue, 23 Jan 2018 13:51:15 +0000 (14:51 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 31 Jan 2018 12:15:51 +0000 (13:15 +0100)
test_qspi_write_twice() is not checking if read back is rewriting
location around start and end in DDR.
Test is doing these steps:
- erasing qspi
- crc32 over full qspi size in DDR
- sf write with 3 writes
  - first write inside page size
  - second write with size over page size
  - third write with rest of data till total size
- sf read the whole qspi back to different DDR location
- crc32 over it

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

index ed66e3358fa07bd42d8aa710a0802051fa6c1ec5..b5138503d977c7b53fb214ec452752faed3b9fb6 100644 (file)
@@ -182,6 +182,46 @@ def test_qspi_write_twice(u_boot_console):
         qspi_write_twice(u_boot_console)
         i = i + 1
 
+def qspi_write_continues(u_boot_console):
+
+    qspi_erase_block(u_boot_console)
+    expected_write = "Written: OK"
+    expected_read = "Read: OK"
+    addr = u_boot_utils.find_ram_base(u_boot_console)
+
+    output = u_boot_console.run_command('crc32 %x %x' % (addr + 0x10000, total_size))
+    m = re.search('==> (.+?)$', output)
+    if not m:
+        pytest.fail("CRC32 failed")
+    expected_crc32 = m.group(1)
+    # print expected_crc32
+
+    old_size = 0
+    for size in random.randint(4, page_size), random.randint(page_size, total_size), total_size:
+        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
+        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
+
+    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
+
+@pytest.mark.buildconfigspec('cmd_bdi')
+@pytest.mark.buildconfigspec('cmd_sf')
+@pytest.mark.buildconfigspec('cmd_memory')
+def test_qspi_write_continues(u_boot_console):
+    qspi_find_freq_range(u_boot_console)
+    i = 0
+    while i < loop:
+        qspi_pre_commands(u_boot_console, random.randint(min_f, max_f))
+        qspi_write_continues(u_boot_console)
+        i = i + 1
+
 def qspi_erase_all(u_boot_console):
     timeout = 10000000