[pypy-svn] r64606 - pypy/branch/pyjitpl5/pypy/jit/backend/test
arigo at codespeak.net
arigo at codespeak.net
Thu Apr 23 17:54:57 CEST 2009
Author: arigo
Date: Thu Apr 23 17:54:56 2009
New Revision: 64606
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/test/conftest.py
pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py
Log:
Small extension. For now there are enough bugs in the x86 backend
that almost not a single test passes.
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/test/conftest.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/test/conftest.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/test/conftest.py Thu Apr 23 17:54:56 2009
@@ -5,7 +5,7 @@
class RandomRunnerPlugin:
def pytest_addoption(self, parser):
group = parser.addgroup('random test options')
- group.addoption('--seed', action="store", type="int",
+ group.addoption('--random-seed', action="store", type="int",
default=random.randrange(0, 10000),
dest="randomseed",
help="choose a fixed random seed")
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py Thu Apr 23 17:54:56 2009
@@ -31,6 +31,8 @@
print ' %s = BoxInt()' % (names[v],)
print ' inputargs = [%s]' % (
', '.join([names[v] for v in self.loop.inputargs]))
+ print ' inputvalues = [%s]' % (
+ ', '.join(str(v.value) for v in self.loop.inputargs))
from pypy.jit.metainterp.resoperation import opname
print ' operations = ['
for op in self.loop.operations:
@@ -40,6 +42,7 @@
for v in op.args]),
names[op.result])
print ' ]'
+ self.names = names
class AbstractOperation:
def __init__(self, opnum, boolres=False):
@@ -137,10 +140,10 @@
r = random.Random(seed)
def get_random_integer():
while True:
- result = int(random.expovariate(0.05))
+ result = int(r.expovariate(0.05))
if result <= sys.maxint:
break
- if random.randrange(0, 5) <= 1:
+ if r.randrange(0, 5) <= 1:
result = -result
return result
r.random_integer = get_random_integer
@@ -198,7 +201,11 @@
cpu.execute_operations(loop, valueboxes)
for v in endvars:
- assert v.value == expected[v]
+ assert v.value == expected[v], (
+ "Got %d, expected %d, in the variable %s" % (v.value,
+ expected[v],
+ builder.names[v])
+ )
print ' # passed.'
print
More information about the Pypy-commit
mailing list