[pypy-svn] r54894 - in pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk: . test

tverwaes at codespeak.net tverwaes at codespeak.net
Sun May 18 17:29:38 CEST 2008


Author: tverwaes
Date: Sun May 18 17:29:35 2008
New Revision: 54894

Modified:
   pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/test/test_wrapper.py
   pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/wrapper.py
Log:
(cfbolz, tverwaes) test for signal, wait, wait


Modified: pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/test/test_wrapper.py
==============================================================================
--- pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/test/test_wrapper.py	(original)
+++ pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/test/test_wrapper.py	Sun May 18 17:29:35 2008
@@ -197,3 +197,16 @@
         semaphore.wait(interp)
         assert semaphore.first_link() is old_process.w_self
         assert wrapper.scheduler().active_process() is process.w_self
+
+    def test_semaphore_signal_wait(self):
+        semaphore = new_semaphore()
+        semaphore.signal(None)
+        interp, process, old_process = self.make_processes(4, 2, objtable.w_false, objtable.w_true)
+        semaphore.wait(interp)
+        assert semaphore.is_empty_list()
+        assert wrapper.scheduler().active_process() is old_process.w_self
+        semaphore.wait(interp)
+        assert semaphore.first_link() is old_process.w_self
+        assert wrapper.scheduler().active_process() is process.w_self
+
+        py.test.raises(FatalError, semaphore.wait, interp)

Modified: pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/wrapper.py
==============================================================================
--- pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/wrapper.py	(original)
+++ pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/wrapper.py	Sun May 18 17:29:35 2008
@@ -56,6 +56,7 @@
         sched.store_active_process(self.w_self)
         interp.store_w_active_context(self.suspended_context())
         self.store_suspended_context(objtable.w_nil)
+        self.store_my_list(objtable.w_nil)
 
     def deactivate(self, interp):
         self.put_to_sleep()



More information about the Pypy-commit mailing list