[pypy-commit] pypy better-jit-hooks: fix test runner

fijal noreply at buildbot.pypy.org
Wed Jan 11 18:15:04 CET 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: better-jit-hooks
Changeset: r51236:d1f73a4788a2
Date: 2012-01-11 19:14 +0200
http://bitbucket.org/pypy/pypy/changeset/d1f73a4788a2/

Log:	fix test runner

diff --git a/pypy/jit/backend/test/runner_test.py b/pypy/jit/backend/test/runner_test.py
--- a/pypy/jit/backend/test/runner_test.py
+++ b/pypy/jit/backend/test/runner_test.py
@@ -3002,28 +3002,30 @@
         bridge = parse(bridge_ops, self.cpu, namespace=locals())
         looptoken = JitCellToken()
         self.cpu.assembler.set_debug(False)
-        _, asm, asmlen = self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken)
-        _, basm, basmlen = self.cpu.compile_bridge(faildescr, bridge.inputargs,
-                                                   bridge.operations,
-                                                   looptoken)
+        info = self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken)
+        bridge_info = self.cpu.compile_bridge(faildescr, bridge.inputargs,
+                                              bridge.operations,
+                                              looptoken)
         self.cpu.assembler.set_debug(True) # always on untranslated
-        assert asmlen != 0
+        assert info.asmlen != 0
         cpuname = autodetect_main_model_and_size()
         # XXX we have to check the precise assembler, otherwise
         # we don't quite know if borders are correct
 
-        def checkops(mc, startline, ops):
-            for i in range(startline, len(mc)):
-                assert mc[i].split("\t")[-1].startswith(ops[i - startline])
+        def checkops(mc, ops):
+            for i in range(len(mc)):
+                assert mc[i].split("\t")[-1].startswith(ops[i])
             
-        data = ctypes.string_at(asm, asmlen)
-        mc = list(machine_code_dump(data, asm, cpuname))
-        assert len(mc) == 5
-        checkops(mc, 1, self.add_loop_instructions)
-        data = ctypes.string_at(basm, basmlen)
-        mc = list(machine_code_dump(data, basm, cpuname))
-        assert len(mc) == 4
-        checkops(mc, 1, self.bridge_loop_instructions)
+        data = ctypes.string_at(info.asmaddr, info.asmlen)
+        mc = list(machine_code_dump(data, info.asmaddr, cpuname))
+        lines = [line for line in mc if line.count('\t') == 2]
+        assert len(lines) == 4
+        checkops(lines, self.add_loop_instructions)
+        data = ctypes.string_at(bridge_info.asmaddr, bridge_info.asmlen)
+        mc = list(machine_code_dump(data, bridge_info.asmaddr, cpuname))
+        lines = [line for line in mc if line.count('\t') == 2]
+        assert len(lines) == 3
+        checkops(lines, self.bridge_loop_instructions)
 
 
     def test_compile_bridge_with_target(self):
diff --git a/pypy/jit/backend/x86/test/test_runner.py b/pypy/jit/backend/x86/test/test_runner.py
--- a/pypy/jit/backend/x86/test/test_runner.py
+++ b/pypy/jit/backend/x86/test/test_runner.py
@@ -419,7 +419,8 @@
             ]
         inputargs = [i0]
         debug._log = dlog = debug.DebugLog()
-        ops_offset = self.cpu.compile_loop(inputargs, operations, looptoken)[0]
+        info = self.cpu.compile_loop(inputargs, operations, looptoken)
+        ops_offset = info.ops_offset
         debug._log = None
         #
         assert ops_offset is looptoken._x86_ops_offset


More information about the pypy-commit mailing list