From: Megan Wachs Date: Tue, 15 May 2018 17:19:08 +0000 (-0700) Subject: Merge pull request #139 from riscv/debug-tests-more-single X-Git-Url: https://git.libre-soc.org/?p=riscv-tests.git;a=commitdiff_plain;h=f9db9282d7db202dc6bd5e29f4745d9932292ac4;hp=67500e2f200619bcd8ca3a8e5d396ea3021a7e27 Merge pull request #139 from riscv/debug-tests-more-single Mark more Debug tests as "Single Hart" --- diff --git a/debug/gdbserver.py b/debug/gdbserver.py index 98eb818..be89d19 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -615,7 +615,7 @@ class MulticoreRunAllHaltOne(GdbTest): time.sleep(1) self.gdb.p("buf", fmt="") -class StepTest(GdbTest): +class StepTest(GdbSingleHartTest): compile_args = ("programs/step.S", ) def setup(self): @@ -634,7 +634,7 @@ class StepTest(GdbTest): pc = self.gdb.p("$pc") assertEqual("%x" % (pc - main_address), "%x" % expected) -class TriggerTest(GdbTest): +class TriggerTest(GdbSingleHartTest): compile_args = ("programs/trigger.S", ) def setup(self): self.gdb.load() @@ -753,7 +753,7 @@ class TriggerDmode(TriggerTest): assertIn("clear_triggers", output) self.check_triggers((1<<6) | (1<<0), 0xfeedac00) -class RegsTest(GdbTest): +class RegsTest(GdbSingleHartTest): compile_args = ("programs/regs.S", ) def setup(self): self.gdb.load() @@ -830,16 +830,17 @@ class DownloadTest(GdbTest): self.binary = self.target.compile(self.hart, self.download_c.name, "programs/checksum.c") - self.gdb.command("file %s" % self.binary) + self.gdb.global_command("file %s" % self.binary) def test(self): self.gdb.load() + self.parkOtherHarts() self.gdb.command("b _exit") self.gdb.c() assertEqual(self.gdb.p("status"), self.crc) os.unlink(self.download_c.name) -#class MprvTest(GdbTest): +#class MprvTest(GdbSingleHartTest): # compile_args = ("programs/mprv.S", ) # def setup(self): # self.gdb.load() @@ -852,7 +853,7 @@ class DownloadTest(GdbTest): # output = self.gdb.command("p/x *(int*)(((char*)&data)-0x80000000)") # assertIn("0xbead", output) -class PrivTest(GdbTest): +class PrivTest(GdbSingleHartTest): compile_args = ("programs/priv.S", ) def setup(self): # pylint: disable=attribute-defined-outside-init diff --git a/debug/testlib.py b/debug/testlib.py index 0fe0322..fb5bee3 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -549,6 +549,8 @@ class Gdb(object): output = self.command("load", ops=1000) assert "failed" not in output assert "Transfer rate" in output + output = self.command("compare-sections", ops=1000) + assert "MIS" not in output def b(self, location): output = self.command("b %s" % location, ops=5) @@ -852,22 +854,28 @@ class GdbTest(BaseTest): self.gdb.interrupt() self.gdb.command("disassemble", ops=20) self.gdb.command("info registers all", ops=100) + self.gdb.command("flush regs") + self.gdb.command("info threads", ops=100) def classTeardown(self): del self.gdb BaseTest.classTeardown(self) -class GdbSingleHartTest(GdbTest): - def classSetup(self): - GdbTest.classSetup(self) - + def parkOtherHarts(self): + """Park harts besides the currently selected one in loop_forever().""" for hart in self.target.harts: # Park all harts that we're not using in a safe place. if hart != self.hart: self.gdb.select_hart(hart) self.gdb.p("$pc=loop_forever") + self.gdb.select_hart(self.hart) +class GdbSingleHartTest(GdbTest): + def classSetup(self): + GdbTest.classSetup(self) + self.parkOtherHarts() + class ExamineTarget(GdbTest): def test(self): for hart in self.target.harts: