Skip to content

Commit

Permalink
Merge pull request #486 from en-sc/en-sc/warning-repeat-read
Browse files Browse the repository at this point in the history
change warning check in RepeatReadTest
  • Loading branch information
timsifive authored Jul 10, 2023
2 parents fb7a4a7 + 4b18e07 commit ed0a63e
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions debug/gdbserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import time
import os
import re
import itertools

import targets
import testlib
Expand Down Expand Up @@ -904,6 +905,9 @@ class RepeatReadTest(DebugTest):
def early_applicable(self):
return self.target.supports_clint_mtime

warning_re = re.compile(r"\[(?P<target_name>[^\]]+)\] Re-reading memory "
r"from addresses 0x(?P<addr>[\da-f]+) and 0x(?P=addr)\.")

def test(self):
self.gdb.b("main:start")
self.gdb.c()
Expand All @@ -912,8 +916,17 @@ def test(self):
output = self.gdb.command(
f"monitor riscv repeat_read {count} 0x{mtime_addr:x} 4")
values = []
for line in output.splitlines():
# Ignore warnings
def is_valid_warning(line):
match = self.warning_re.match(line)
if match is None:
return False
assertEqual(int(match["addr"], 16), mtime_addr,
"The repeat read is reading from the wrong address")
return True

for line in itertools.dropwhile(is_valid_warning, output.splitlines()):
# This `if` is to be removed after
# https://github.com/riscv/riscv-openocd/pull/871 is merged.
if line.startswith("Batch memory"):
continue
for v in line.split():
Expand Down

0 comments on commit ed0a63e

Please sign in to comment.