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)
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)
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)
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")
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")