From 515d185db118a54e920514c6fc7783d95b530d4c Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Fri, 12 Nov 2021 11:29:20 -0800 Subject: Create DisconnectTest. (#364) Disconnects from gdb, and then reconnects, making sure that didn't change any of the registers. This test will start passing when https://github.com/riscv/riscv-openocd/pull/661 merges. --- debug/gdbserver.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'debug/gdbserver.py') diff --git a/debug/gdbserver.py b/debug/gdbserver.py index 69bb3b1..4476ea8 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -409,6 +409,21 @@ class MemTestBlock2(MemTestBlock): def test(self): return self.test_block(2) +class DisconnectTest(GdbTest): + def test(self): + old_values = self.gdb.info_registers("all", ops=20) + self.gdb.disconnect() + self.gdb.connect() + self.gdb.select_hart(self.hart) + new_values = self.gdb.info_registers("all", ops=20) + + regnames = set(old_values.keys()).union(set(new_values.keys())) + for regname in regnames: + if regname in ("mcycle", "minstret", "instret", "cycle"): + continue + assertEqual(old_values[regname], new_values[regname], + "Register %s didn't match" % regname) + class InstantHaltTest(GdbTest): def test(self): """Assert that reset is really resetting what it should.""" -- cgit v1.1