From cfdd0f22f6b7c27280ff73722eb35a8f9af7c54b Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Mon, 23 May 2016 12:16:20 -0700 Subject: [PATCH] Kill spike as soon as the test is done with it. --- tests/gdbserver.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/gdbserver.py b/tests/gdbserver.py index 7edae58..f16a3cc 100755 --- a/tests/gdbserver.py +++ b/tests/gdbserver.py @@ -8,7 +8,11 @@ import time import random import binascii -class InstantHaltTest(unittest.TestCase): +class DeleteSpike(unittest.TestCase): + def tearDown(self): + del self.spike + +class InstantHaltTest(DeleteSpike): def setUp(self): self.binary = testlib.compile("debug.c") self.spike = testlib.Spike(self.binary, halted=True) @@ -35,7 +39,7 @@ class InstantHaltTest(unittest.TestCase): self.gdb.command("stepi") self.assertEqual(0x80000008, self.gdb.p("$pc")) -class DebugTest(unittest.TestCase): +class DebugTest(DeleteSpike): def setUp(self): self.binary = testlib.compile("debug.c") self.spike = testlib.Spike(self.binary, halted=False) @@ -108,7 +112,7 @@ class DebugTest(unittest.TestCase): self.assertIn("Continuing", output) self.assertIn("Remote connection closed", output) -class RegsTest(unittest.TestCase): +class RegsTest(DeleteSpike): def setUp(self): self.binary = testlib.compile("regs.s") self.spike = testlib.Spike(self.binary, halted=False) @@ -158,7 +162,7 @@ class RegsTest(unittest.TestCase): self.assertEqual(9, self.gdb.p("$x1")) self.assertEqual(9, self.gdb.p("$csr1")) -class DownloadTest(unittest.TestCase): +class DownloadTest(DeleteSpike): def setUp(self): length = 2**20 fd = file("data.c", "w") @@ -196,7 +200,7 @@ class DownloadTest(unittest.TestCase): result = self.gdb.p("$a0") self.assertEqual(self.crc, result) -class MprvTest(unittest.TestCase): +class MprvTest(DeleteSpike): def setUp(self): self.binary = testlib.compile("mprv.S", "-T", "standalone.lds", "-nostartfiles") -- 2.30.2