[pypy-svn] r31804 - in pypy/dist/pypy/jit: codegen/i386/test timeshifter/test
arigo at codespeak.net
arigo at codespeak.net
Tue Aug 29 18:59:57 CEST 2006
Author: arigo
Date: Tue Aug 29 18:59:52 2006
New Revision: 31804
Modified:
pypy/dist/pypy/jit/codegen/i386/test/test_genc_ts.py
pypy/dist/pypy/jit/codegen/i386/test/test_interp_ts.py
pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
Log:
(pedronis, arigo)
Converted the last failing test_timeshit test - return of a struct - to
codegen/i386.
We can now enable these tests and make running all PyPy tests 30 minutes
longer :-)
Modified: pypy/dist/pypy/jit/codegen/i386/test/test_genc_ts.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/i386/test/test_genc_ts.py (original)
+++ pypy/dist/pypy/jit/codegen/i386/test/test_genc_ts.py Tue Aug 29 18:59:52 2006
@@ -7,7 +7,7 @@
from pypy.rpython.unroll import unrolling_iterable
from pypy.jit.codegen.i386.ri386genop import RI386GenOp
-import py; py.test.skip("in-progress")
+#import py; py.test.skip("in-progress")
class TestTimeshiftI386(test_timeshift.TestTimeshift):
@@ -28,6 +28,7 @@
decoders = [int] * len(argcolors)
argcolors_decoders = zip(argcolors, decoders)
argcolors_decoders = unrolling_iterable(argcolors_decoders)
+ convert_result = getattr(self.ll_function, 'convert_result', str)
def ll_main(argv):
i = 1
@@ -79,7 +80,7 @@
generated = ml_generate_code(rgenop, *mainargs)
os.write(1, SEPLINE)
res = generated(*residualargs)
- os.write(1, str(res) + '\n')
+ os.write(1, convert_result(res) + '\n')
keepalive_until_here(rgenop) # to keep the code blocks alive
return 0
@@ -112,7 +113,10 @@
output = self.main_cbuilder.cmdexec(mainargs)
assert output.startswith(self.SEPLINE)
lastline = output[len(self.SEPLINE):].strip()
- return int(lastline)
+ if hasattr(ll_function, 'convert_result'):
+ return lastline
+ else:
+ return int(lastline) # assume an int
def check_insns(self, expected=None, **counts):
"Cannot check instructions in the generated assembler."
Modified: pypy/dist/pypy/jit/codegen/i386/test/test_interp_ts.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/i386/test/test_interp_ts.py (original)
+++ pypy/dist/pypy/jit/codegen/i386/test/test_interp_ts.py Tue Aug 29 18:59:52 2006
@@ -3,7 +3,7 @@
from pypy.jit.timeshifter.test import test_timeshift
from pypy.jit.codegen.i386.ri386genop import RI386GenOp, IntConst
-import py; py.test.skip("in-progress")
+#import py; py.test.skip("in-progress")
class Whatever(object):
Modified: pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py (original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py Tue Aug 29 18:59:52 2006
@@ -252,6 +252,8 @@
residual_graph.show()
self.insns = summary(residual_graph)
res = llinterp.eval_graph(residual_graph, residualargs)
+ if hasattr(ll_function, 'convert_result'):
+ res = ll_function.convert_result(res)
return res
def check_insns(self, expected=None, **counts):
@@ -563,6 +565,11 @@
def test_degenerated_at_return(self):
S = lltype.GcStruct('S', ('n', lltype.Signed))
T = lltype.GcStruct('T', ('s', S), ('n', lltype.Float))
+ class Result:
+ def convert(self, s):
+ self.s = s
+ return str(s.n)
+ glob_result = Result()
def ll_function(flag):
t = lltype.malloc(T)
@@ -573,14 +580,18 @@
if flag:
s = t.s
return s
+ ll_function.convert_result = glob_result.convert
+
res = self.timeshift(ll_function, [0], [])
- assert res.n == 4
- assert lltype.parentlink(res._obj) == (None, None)
+ assert res == "4"
+ if self.__class__ is TestTimeshift:
+ assert lltype.parentlink(glob_result.s._obj) == (None, None)
res = self.timeshift(ll_function, [1], [])
- assert res.n == 3
- parent, parentindex = lltype.parentlink(res._obj)
- assert parentindex == 's'
- assert parent.n == 3.25
+ assert res == "3"
+ if self.__class__ is TestTimeshift:
+ parent, parentindex = lltype.parentlink(glob_result.s._obj)
+ assert parentindex == 's'
+ assert parent.n == 3.25
def test_degenerated_via_substructure(self):
S = lltype.GcStruct('S', ('n', lltype.Signed))
More information about the Pypy-commit
mailing list