[pypy-commit] pypy nogil-unsafe-2: (fijal, arigo) add a failing test

fijal pypy.commits at gmail.com
Tue Jul 11 08:41:22 EDT 2017


Author: fijal
Branch: nogil-unsafe-2
Changeset: r91853:98cf831a0ac4
Date: 2017-07-11 14:03 +0200
http://bitbucket.org/pypy/pypy/changeset/98cf831a0ac4/

Log:	(fijal, arigo) add a failing test

diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py
--- a/rpython/translator/c/test/test_standalone.py
+++ b/rpython/translator/c/test/test_standalone.py
@@ -1221,6 +1221,43 @@
             py.test.fail("none of the stack sizes worked")
 
 
+    def test_thread_and_gc_simple(self):
+        import time, gc
+        from rpython.rlib import rthread, rposix
+
+        def bootstrap():
+            rthread.gc_thread_start()
+            gc.collect()
+            rthread.gc_thread_die()
+
+        def new_thread():
+            ident = rthread.start_new_thread(bootstrap, ())
+            return ident
+
+        def entry_point(argv):
+            # start 5 new threads
+            new_thread()
+            new_thread()
+            #
+            gc.collect()
+            #
+            new_thread()
+            new_thread()
+            new_thread()
+            time.sleep(0.5)
+            os.write(1, "ok\n")
+            return 0
+
+        def runme(no__thread):
+            t, cbuilder = self.compile(entry_point, no__thread=no__thread)
+            data = cbuilder.cmdexec('')
+            assert data == 'ok\n'
+
+        if SUPPORT__THREAD:
+            runme(no__thread=False)
+        runme(no__thread=True)
+
+
     def test_thread_and_gc(self):
         import time, gc
         from rpython.rlib import rthread, rposix


More information about the pypy-commit mailing list