diff options
Diffstat (limited to 'test/py/tests')
-rw-r--r-- | test/py/tests/test_fs/conftest.py | 2 | ||||
-rw-r--r-- | test/py/tests/test_fs/test_basic.py | 13 | ||||
-rw-r--r-- | test/py/tests/test_memtest.py | 8 | ||||
-rw-r--r-- | test/py/tests/test_spi.py | 29 | ||||
-rw-r--r-- | test/py/tests/test_trace.py | 8 |
5 files changed, 51 insertions, 9 deletions
diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py index c73fb4abbcb..0205048e73a 100644 --- a/test/py/tests/test_fs/conftest.py +++ b/test/py/tests/test_fs/conftest.py @@ -17,7 +17,7 @@ supported_fs_fat = ['fat12', 'fat16'] supported_fs_mkdir = ['fat12', 'fat16', 'fat32', 'exfat', 'fs_generic'] supported_fs_unlink = ['fat12', 'fat16', 'fat32', 'exfat', 'fs_generic'] supported_fs_symlink = ['ext4'] -supported_fs_rename = ['fat12', 'fat16', 'fat32'] +supported_fs_rename = ['fat12', 'fat16', 'fat32', 'exfat', 'fs_generic'] # # Filesystem test specific setup diff --git a/test/py/tests/test_fs/test_basic.py b/test/py/tests/test_fs/test_basic.py index 64a3b50f52a..88b163ce305 100644 --- a/test/py/tests/test_fs/test_basic.py +++ b/test/py/tests/test_fs/test_basic.py @@ -35,6 +35,19 @@ class TestFsBasic(object): '%sls host 0:0 invalid_d' % fs_cmd_prefix) assert('' == output) + with ubman.log.section('Test Case 1c - test -e'): + # Test Case 1 - test -e + output = ubman.run_command_list([ + 'host bind 0 %s' % fs_img, + 'test -e host 0:0 1MB.file && echo PASS']) + assert('PASS' in ''.join(output)) + + with ubman.log.section('Test Case 1d - test -e (invalid file)'): + # In addition, test with a nonexistent file to see if we crash. + output = ubman.run_command( + 'test -e host 0:0 2MB.file || echo PASS') + assert('PASS' in ''.join(output)) + def test_fs2(self, ubman, fs_obj_basic): """ Test Case 2 - size command for a small file diff --git a/test/py/tests/test_memtest.py b/test/py/tests/test_memtest.py index 0340edbea5a..f24f9f0d67d 100644 --- a/test/py/tests/test_memtest.py +++ b/test/py/tests/test_memtest.py @@ -29,12 +29,12 @@ def get_memtest_env(ubman): if not f: pytest.skip("memtest is not enabled!") else: - start = f.get("start_addr", 0x0) - size = f.get("size", 0x1000) - pattern = f.get("pattern", 0x0) + start = hex(f.get("start_addr", 0x0)) + size = hex(f.get("size", 0x1000)) + pattern = hex(f.get("pattern", 0x0)) iteration = f.get("iteration", 2) timeout = f.get("timeout", 50000) - end = hex(int(start) + int(size)) + end = hex(int(start, 16) + int(size, 16)) return start, end, pattern, iteration, timeout @pytest.mark.buildconfigspec("cmd_memtest") diff --git a/test/py/tests/test_spi.py b/test/py/tests/test_spi.py index dd767528dbf..09174f91e98 100644 --- a/test/py/tests/test_spi.py +++ b/test/py/tests/test_spi.py @@ -703,4 +703,33 @@ def test_spi_negative(ubman): ubman, 'read', start, size, res_area, 1, error_msg, EXPECTED_READ ) + # Start reading from the reserved area + m = re.search(r'reserved\[0\]\s*\[(0x.+)-(0x.+)\]', output) + if not m or int(m.group(1), 16) == 0: + ubman.log.info('No reserved area is defined or start addr is 0x0!') + else: + rstart_area = int(m.group(1), 16) + rend_area = int(m.group(2), 16) + + # Case 1: Start reading from the middle of the reserved area + r_size = rend_area - rstart_area + r_area = rstart_area + r_size + flash_ops( + ubman, 'read', start, size, r_area, 1, error_msg, EXPECTED_READ + ) + + # Case 2: Start reading from before the reserved area to cross-over + # the reserved area + rstart_area = rstart_area - int(size/2) + flash_ops( + ubman, 'read', start, size, rstart_area, 1, error_msg, EXPECTED_READ + ) + + # Case 3: Start reading till after the reserved area to cross-over + # the reserved area + rend_area = rend_area - int(size/2) + flash_ops( + ubman, 'read', start, size, rend_area, 1, error_msg, EXPECTED_READ + ) + i = i + 1 diff --git a/test/py/tests/test_trace.py b/test/py/tests/test_trace.py index 6ac1b225465..fcdcbe2c6db 100644 --- a/test/py/tests/test_trace.py +++ b/test/py/tests/test_trace.py @@ -201,7 +201,7 @@ def check_funcgraph(ubman, fname, proftool, map_fname, trace_dat): # Then look for this: # u-boot-1 0..... 282.101375: funcgraph_exit: 0.006 us | } # Then check for this: - # u-boot-1 0..... 282.101375: funcgraph_entry: 0.000 us | calc_reloc_ofs(); + # u-boot-1 0..... 282.101375: funcgraph_entry: 0.000 us | event_init(); expected_indent = None found_start = False @@ -224,8 +224,8 @@ def check_funcgraph(ubman, fname, proftool, map_fname, trace_dat): found_end = True # The next function after initf_bootstage() exits should be - # initcall_is_event() - assert upto == 'calc_reloc_ofs()' + # event_init() + assert upto == 'event_init()' # Now look for initf_dm() and dm_timer_init() so we can check the bootstage # time @@ -274,7 +274,7 @@ def check_flamegraph(ubman, fname, proftool, map_fname, trace_fg): # We expect dm_timer_init() to be called twice: once before relocation and # once after look1 = 'initf_dm;dm_timer_init 1' - look2 = 'board_init_r;initcall_run_list;initr_dm_devices;dm_timer_init 1' + look2 = 'board_init_r;initcall_run_r;initr_dm_devices;dm_timer_init 1' found = 0 with open(trace_fg, 'r') as fd: for line in fd: |