Author: Remi Meier <[email protected]>
Branch: c7
Changeset: r620:064e07d95b60
Date: 2014-01-17 11:40 +0100
http://bitbucket.org/pypy/stmgc/changeset/064e07d95b60/

Log:    fix test

diff --git a/c7/test/support.py b/c7/test/support.py
--- a/c7/test/support.py
+++ b/c7/test/support.py
@@ -275,10 +275,14 @@
         lib._stm_restore_local_state(1)
         if lib._stm_is_in_transaction():
             stm_stop_transaction()
-        lib._stm_teardown_thread()
+
         lib._stm_restore_local_state(0)
         if lib._stm_is_in_transaction():
             stm_stop_transaction()
+
+        lib._stm_restore_local_state(1)
+        lib._stm_teardown_thread()
+        lib._stm_restore_local_state(0)
         lib._stm_teardown_thread()
         lib._stm_teardown()
 
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
@@ -185,50 +185,27 @@
 
 
         
-    # def test_read_write_2(self):
-    #     stm_start_transaction()
-    #     lp1, p1 = stm_allocate(16)
-    #     p1[8] = 'a'
-    #     stm_stop_transaction(False)
-    #     #
-    #     self.switch(1)
-    #     stm_start_transaction()
-    #     stm_write(lp1)
-    #     p1 = stm_get_real_address(lp1)
-    #     assert p1[8] == 'a'
-    #     p1[8] = 'b'
-    #     #
-    #     self.switch(0)
-    #     stm_start_transaction()
-    #     stm_read(lp1)
-    #     p1 = stm_get_real_address(lp1)
-    #     assert p1[8] == 'a'
-    #     #
-    #     self.switch(1)
-    #     stm_stop_transaction(False)
-    #     #
-    #     self.switch(0)
-    #     p1 = stm_get_real_address(lp1)
-    #     assert p1[8] == 'a'
-
+    def test_start_transaction_updates(self):
+        stm_start_transaction()
+        lp1, p1 = stm_allocate(16)
+        p1[8] = 'a'
+        stm_push_root(lp1)
+        stm_stop_transaction()
+        lp1 = stm_pop_root()
+        #
+        self.switch(1)
+        stm_start_transaction()
+        stm_write(lp1)
+        p1 = stm_get_real_address(lp1)
+        assert p1[8] == 'a'
+        p1[8] = 'b'
+        stm_stop_transaction()
+        #
+        self.switch(0)
+        stm_start_transaction()
+        p1 = stm_get_real_address(lp1)
+        assert p1[8] == 'b'
         
-    # def test_start_transaction_updates(self):
-    #     stm_start_transaction()
-    #     p1 = stm_allocate(16)
-    #     p1[8] = 'a'
-    #     stm_stop_transaction(False)
-    #     #
-    #     self.switch(1)
-    #     stm_start_transaction()
-    #     stm_write(p1)
-    #     assert p1[8] == 'a'
-    #     p1[8] = 'b'
-    #     stm_stop_transaction(False)
-    #     #
-    #     self.switch(0)
-    #     assert p1[8] == 'a'
-    #     stm_start_transaction()
-    #     assert p1[8] == 'b'
 
     # def test_resolve_no_conflict_empty(self):
     #     stm_start_transaction()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to