[pypy-commit] stmgc c7-refactor: Update tests

arigo noreply at buildbot.pypy.org
Sun Feb 16 10:09:34 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: c7-refactor
Changeset: r748:c5e34d7c00ca
Date: 2014-02-16 10:05 +0100
http://bitbucket.org/pypy/stmgc/changeset/c5e34d7c00ca/

Log:	Update tests

diff --git a/c7/test/support.py b/c7/test/support.py
--- a/c7/test/support.py
+++ b/c7/test/support.py
@@ -459,3 +459,7 @@
         assert 0 < curlength <= SHADOWSTACK_LENGTH
         tl.shadowstack -= 1
         return ffi.cast("object_t *", tl.shadowstack[0])
+
+    def push_root_no_gc(self):
+        "Pushes an invalid object, to crash in case the GC is called"
+        self.push_root(ffi.cast("object_t *", -1))
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
@@ -98,27 +98,22 @@
         py.test.raises(Conflict, self.switch, 0) # detects rw conflict
 
     def test_commit_fresh_objects(self):
+        self.push_root_no_gc()
         self.start_transaction()
         lp = stm_allocate(16)
         stm_set_char(lp, 'u')
-        p = stm_get_real_address(lp)
-        self.push_root(lp)
         self.commit_transaction()
-        lp = self.pop_root()
         p1 = stm_get_real_address(lp)
-        assert p != p1
-        
+
         self.switch(1)
-        
+
         self.start_transaction()
         stm_write(lp) # privatize page
-        p_ = stm_get_real_address(lp)
-        assert p != p_
-        assert p1 != p_
+        p2 = stm_get_real_address(lp)
+        assert p1 != p2
         assert stm_get_char(lp) == 'u'
         self.commit_transaction()
 
-        
     def test_commit_fresh_objects2(self):
         self.switch(1)
         self.start_transaction()


More information about the pypy-commit mailing list