[pypy-commit] stmgc c7-refactor: A test for 44b81083d7cf.

arigo noreply at buildbot.pypy.org
Wed Feb 19 10:44:42 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: c7-refactor
Changeset: r779:77f7aa36c2c7
Date: 2014-02-19 10:44 +0100
http://bitbucket.org/pypy/stmgc/changeset/77f7aa36c2c7/

Log:	A test for 44b81083d7cf.

diff --git a/c7/test/support.py b/c7/test/support.py
--- a/c7/test/support.py
+++ b/c7/test/support.py
@@ -291,6 +291,9 @@
 class Conflict(Exception):
     pass
 
+class EmptyStack(Exception):
+    pass
+
 def is_in_nursery(o):
     return lib._stm_in_nursery(o)
 
@@ -464,6 +467,8 @@
     def pop_root(self):
         tl = self.tls[self.current_thread]
         curlength = tl.shadowstack - tl.shadowstack_base
+        if curlength == 0:
+            raise EmptyStack
         assert 0 < curlength <= SHADOWSTACK_LENGTH
         tl.shadowstack -= 1
         return ffi.cast("object_t *", tl.shadowstack[0])
diff --git a/c7/test/test_basic.py b/c7/test/test_basic.py
--- a/c7/test/test_basic.py
+++ b/c7/test/test_basic.py
@@ -402,6 +402,12 @@
         assert stm_get_char(lp1, offset=4103) == 'b'
         self.commit_transaction()
 
+    def test_abort_restores_shadowstack(self):
+        self.start_transaction()
+        self.push_root(ffi.cast("object_t *", 0))
+        self.abort_transaction()
+        py.test.raises(EmptyStack, self.pop_root)
+
     # def test_resolve_write_write_no_conflict(self):
     #     self.start_transaction()
     #     p1 = stm_allocate(16)


More information about the pypy-commit mailing list