File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 99import time
1010import os
1111import re
12+ import itertools
1213
1314import targets
1415import testlib
@@ -904,6 +905,9 @@ class RepeatReadTest(DebugTest):
904905 def early_applicable (self ):
905906 return self .target .supports_clint_mtime
906907
908+ warning_re = re .compile (r"\[(?P<target_name>[^\]]+)\] Re-reading memory "
909+ r"from addresses 0x(?P<addr>[\da-f]+) and 0x(?P=addr)\." )
910+
907911 def test (self ):
908912 self .gdb .b ("main:start" )
909913 self .gdb .c ()
@@ -912,8 +916,17 @@ def test(self):
912916 output = self .gdb .command (
913917 f"monitor riscv repeat_read { count } 0x{ mtime_addr :x} 4" )
914918 values = []
915- for line in output .splitlines ():
916- # Ignore warnings
919+ def is_valid_warning (line ):
920+ match = self .warning_re .match (line )
921+ if match is None :
922+ return False
923+ assertEqual (int (match ["addr" ], 16 ), mtime_addr ,
924+ "The repeat read is reading from the wrong address" )
925+ return True
926+
927+ for line in itertools .dropwhile (is_valid_warning , output .splitlines ()):
928+ # This `if` is to be removed after
929+ # https://github.com/riscv/riscv-openocd/pull/871 is merged.
917930 if line .startswith ("Batch memory" ):
918931 continue
919932 for v in line .split ():
You can’t perform that action at this time.
0 commit comments