diff options
author | Tim Newsome <tim@sifive.com> | 2022-12-14 16:52:28 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-14 16:52:28 -0800 |
commit | 898c20bf0b74b2899d7491823cbbac84b5508751 (patch) | |
tree | cea2fb6d7176f4cfe14fc1d8f3bf2823a481fe55 | |
parent | 45f4da6224ee254f235ff223f77e69dccf100c46 (diff) | |
download | riscv-tests-898c20bf0b74b2899d7491823cbbac84b5508751.zip riscv-tests-898c20bf0b74b2899d7491823cbbac84b5508751.tar.gz riscv-tests-898c20bf0b74b2899d7491823cbbac84b5508751.tar.bz2 |
debug: Remove unnecessary exit() functions. (#437)
Also make the semi-hosting test program return 10. That's more fragile
than returning 0, so makes for a better test.
-rwxr-xr-x | debug/gdbserver.py | 12 | ||||
-rw-r--r-- | debug/programs/semihosting.c | 2 | ||||
-rw-r--r-- | debug/testlib.py | 1 |
3 files changed, 4 insertions, 11 deletions
diff --git a/debug/gdbserver.py b/debug/gdbserver.py index a61722d..ac7b162 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -521,10 +521,7 @@ class DebugTest(GdbSingleHartTest): self.gdb.b("_exit") def exit(self, expected_result=0xc86455d4): - output = self.gdb.c() - assertIn("Breakpoint", output) - assertIn("_exit", output) - assertEqual(self.gdb.p("status"), expected_result) + super().exit(expected_result) class DebugCompareSections(DebugTest): def test(self): @@ -944,13 +941,6 @@ class Semihosting(GdbSingleHartTest): self.parkOtherHarts() self.gdb.b("_exit") - def exit(self, expected_result=0): - output = self.gdb.c() - assertIn("Breakpoint", output) - assertIn("_exit", output) - assertEqual(self.gdb.p("status"), expected_result) - return output - def test(self): with tempfile.NamedTemporaryFile(suffix=".data") as temp: self.gdb.b("main:begin") diff --git a/debug/programs/semihosting.c b/debug/programs/semihosting.c index ea3fdde..10f3c01 100644 --- a/debug/programs/semihosting.c +++ b/debug/programs/semihosting.c @@ -72,4 +72,6 @@ begin: fd = open(filename, O_WRONLY, 0644); write(fd, message, strlen(message)); write(1, message2, strlen(message2)); + + return 10; } diff --git a/debug/testlib.py b/debug/testlib.py index d2e587b..27deb3a 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -1267,6 +1267,7 @@ class GdbTest(BaseTest): assertIn("Breakpoint", output) assertIn("_exit", output) assertEqual(self.gdb.p("status"), expected_result) + return output class GdbSingleHartTest(GdbTest): def classSetup(self): |