Maciej Fijalkowski avatar Maciej Fijalkowski committed a84a39a

write a failing test and remove tests that don't test anything (especially
not what they advertise to test)

Comments (0)

Files changed (2)

rpython/jit/backend/x86/test/test_gc_integration.py

         self.nursery_ptrs[1] = self.nursery_ptrs[0] + nursery_size
         self.nursery_addr = rffi.cast(lltype.Signed, self.nursery_ptrs)
         self.all_nurseries.append(self.nursery)
-        self.collections.reverse()
+        if hasattr(self, 'collections'):
+            self.collections.reverse()
 
     def _collect(self):
         gcmap = unpack_gcmap(self.frames[-1])
         def f(x):
             import pdb
             pdb.set_trace()
-        
+
+        FUNC = lltype.FuncType([lltype.Float], lltype.Float)
+        fptr = llhelper(lltype.Ptr(FUNC), f)
+        calldescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
+                                    EffectInfo.MOST_GENERAL)        
         loop = self.parse("""
         [f0]
         f1 = call_release_gil(ConstClass(fptr), f0, descr=calldescr)
+        guard_not_forced(descr=faildescr) []
         finish(f1)
-        """, namespace={
-        })
+        """, namespace={'fptr': fptr, 'calldescr':calldescr,
+                        'faildescr': BasicFailDescr()})
+        token = JitCellToken()
+        cpu.gc_ll_descr.init_nursery(100)
+        cpu.setup_once()
+        cpu.compile_loop(loop.inputargs, loop.operations, token)
+        cpu.execute_token(token, 1.3)

rpython/jit/backend/x86/test/test_zrpy_gc.py

     def test_compile_framework_minimal_size_in_nursery(self):
         self.run('compile_framework_minimal_size_in_nursery')
 
-    def define_simple_call_release_gil(self):
-        class Glob:
-            pass
-        glob = Glob()
-        #
-        def f42(n):
-            c_strchr = glob.c_strchr
-            raw = rffi.str2charp("foobar" + chr((n & 63) + 32))
-            argchain = ArgChain()
-            argchain = argchain.arg(rffi.cast(lltype.Signed, raw))
-            argchain = argchain.arg(rffi.cast(rffi.INT, ord('b')))
-            res = c_strchr.call(argchain, rffi.CCHARP)
-            check(rffi.charp2str(res) == "bar" + chr((n & 63) + 32))
-            rffi.free_charp(raw)
-        #
-        def before(n, x):
-            libc = CDLL(libc_name)
-            c_strchr = libc.getpointer('strchr', [types.pointer, types.sint],
-                                       types.pointer)
-            glob.c_strchr = c_strchr
-            return (n, None, None, None, None, None,
-                    None, None, None, None, None, None)
-        #
-        def f(n, x, *args):
-            f42(n)
-            n -= 1
-            return (n, x) + args
-        return before, f, None
-
-    def test_simple_call_release_gil(self):
-        self.run('simple_call_release_gil')
-
-    def define_close_stack(self):
-        #
-        class Glob(object):
-            pass
-        glob = Glob()
-        class X(object):
-            pass
-        #
-        def callback(p1, p2):
-            for i in range(100):
-                glob.lst.append(X())
-            return rffi.cast(rffi.INT, 1)
-        CALLBACK = lltype.Ptr(lltype.FuncType([lltype.Signed,
-                                               lltype.Signed], rffi.INT))
-        #
-        @dont_look_inside
-        def alloc1():
-            return llmemory.raw_malloc(16)
-        @dont_look_inside
-        def free1(p):
-            llmemory.raw_free(p)
-        #
-        def f42():
-            length = len(glob.lst)
-            c_qsort = glob.c_qsort
-            raw = alloc1()
-            fn = llhelper(CALLBACK, rffi._make_wrapper_for(CALLBACK, callback))
-            argchain = ArgChain()
-            argchain = argchain.arg(rffi.cast(lltype.Signed, raw))
-            argchain = argchain.arg(rffi.cast(rffi.SIZE_T, 2))
-            argchain = argchain.arg(rffi.cast(rffi.SIZE_T, 8))
-            argchain = argchain.arg(rffi.cast(lltype.Signed, fn))
-            c_qsort.call(argchain, lltype.Void)
-            free1(raw)
-            check(len(glob.lst) > length)
-            del glob.lst[:]
-        #
-        def before(n, x):
-            libc = CDLL(libc_name)
-            types_size_t = clibffi.cast_type_to_ffitype(rffi.SIZE_T)
-            c_qsort = libc.getpointer('qsort', [types.pointer, types_size_t,
-                                                types_size_t, types.pointer],
-                                      types.void)
-            glob.c_qsort = c_qsort
-            glob.lst = []
-            return (n, None, None, None, None, None,
-                    None, None, None, None, None, None)
-        #
-        def f(n, x, *args):
-            f42()
-            n -= 1
-            return (n, x) + args
-        return before, f, None
-
-    def test_close_stack(self):
-        self.run('close_stack')
-
 class TestShadowStack(CompileFrameworkTests):
     gcrootfinder = "shadowstack"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.