Add MemTestWriteInvalid.
authorTim Newsome <tim@sifive.com>
Thu, 13 Oct 2016 18:32:02 +0000 (11:32 -0700)
committerTim Newsome <tim@sifive.com>
Thu, 13 Oct 2016 18:32:17 +0000 (11:32 -0700)
debug/gdbserver.py

index 91c385f548909d86e0da527c42d203119bd03134..318428daba3407d70038c95fa6e2255a6479a0b4 100755 (executable)
@@ -299,9 +299,21 @@ class MemTestReadInvalid(SimpleMemoryTest):
         # the openocd.cfg file.
         try:
             self.gdb.p("*((int*)0xdeadbeef)")
-            assert False, "Access should have failed."
+            assert False, "Read should have failed."
         except testlib.CannotAccess as e:
             assertEqual(e.address, 0xdeadbeef)
+        self.gdb.p("*((int*)0x%x)" % self.target.ram)
+
+class MemTestWriteInvalid(SimpleMemoryTest):
+    def test(self):
+        # This test relies on 'gdb_report_data_abort enable' being executed in
+        # the openocd.cfg file.
+        try:
+            self.gdb.p("*((int*)0xdeadbeef)=8675309")
+            assert False, "Write should have failed."
+        except testlib.CannotAccess as e:
+            assertEqual(e.address, 0xdeadbeef)
+        self.gdb.p("*((int*)0x%x)=6874742" % self.target.ram)
 
 class MemTestBlock(GdbTest):
     def test(self):