[pypy-commit] pypy reverse-debugger: Next bug

arigo pypy.commits at gmail.com
Sat Jul 2 16:48:17 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: reverse-debugger
Changeset: r85522:7a8820692e0a
Date: 2016-07-02 22:49 +0200
http://bitbucket.org/pypy/pypy/changeset/7a8820692e0a/

Log:	Next bug

diff --git a/rpython/translator/revdb/test/test_bug.py b/rpython/translator/revdb/test/test_bug.py
new file mode 100644
--- /dev/null
+++ b/rpython/translator/revdb/test/test_bug.py
@@ -0,0 +1,41 @@
+import os, subprocess
+from rpython.rlib import revdb
+from rpython.rtyper.lltypesystem import lltype
+from rpython.translator.revdb.test.test_basic import InteractiveTests
+
+from rpython.translator.revdb.message import *
+
+
+class TestReplayingBug(InteractiveTests):
+    expected_stop_points = 1
+
+    def setup_class(cls):
+        from rpython.translator.revdb.test.test_basic import compile, run
+
+        FOO = lltype.Struct('FOO')
+        foo = lltype.malloc(FOO, flavor='raw', immortal=True)
+
+        BAR = lltype.Struct('BAR', ('p', lltype.Ptr(FOO)))
+        bar = lltype.malloc(BAR, flavor='raw', immortal=True)
+        bar.p = foo
+
+        def main(argv):
+            assert bar.p == foo
+            revdb.stop_point()
+            return 9
+
+        compile(cls, main, backendopt=False)
+        run(cls, '')
+
+    def test_replaying_bug(self):
+        # This tiny test seems to always have foo at the same address
+        # in multiple runs.  Here we recompile with different options
+        # just to change that address.
+        subprocess.check_call(["make", "clean"],
+                              cwd=os.path.dirname(str(self.exename)))
+        subprocess.check_call(["make", "lldebug"],
+                              cwd=os.path.dirname(str(self.exename)))
+        #
+        child = self.replay()
+        child.send(Message(CMD_FORWARD, 2))
+        child.expect(ANSWER_AT_END)


More information about the pypy-commit mailing list