Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r88340:dd2ec76131ce
Date: 2016-11-13 13:38 +0000
http://bitbucket.org/pypy/pypy/changeset/dd2ec76131ce/
Log: Starting to pass these tests (many many failures)
diff --git a/pypy/module/pypyjit/test/conftest.py
b/pypy/module/pypyjit/test_pypy_c/conftest.py
copy from pypy/module/pypyjit/test/conftest.py
copy to pypy/module/pypyjit/test_pypy_c/conftest.py
--- a/pypy/module/pypyjit/test/conftest.py
+++ b/pypy/module/pypyjit/test_pypy_c/conftest.py
@@ -1,7 +1,4 @@
def pytest_addoption(parser):
group = parser.getgroup("pypyjit options")
group.addoption("--pypy", action="store", default=None, dest="pypy_c",
- help="DEPRECATED: use this in test_pypy_c instead")
-# XXX kill the corresponding section in the buildbot run,
-# which (as far as I can tell) ignores that option entirely and does
-# the same as the regular py.test.
+ help="the location of the JIT enabled pypy-c")
diff --git a/pypy/module/pypyjit/test_pypy_c/test_00_model.py
b/pypy/module/pypyjit/test_pypy_c/test_00_model.py
--- a/pypy/module/pypyjit/test_pypy_c/test_00_model.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_00_model.py
@@ -2,7 +2,7 @@
import sys, os
import types
import subprocess
-import py
+import py, pytest
from rpython.tool import disassembler
from rpython.tool.udir import udir
from rpython.tool import logparser
@@ -15,10 +15,20 @@
log_string = 'jit-log-opt,jit-log-noopt,jit-log-virtualstate,jit-summary'
def setup_class(cls):
- if '__pypy__' not in sys.builtin_module_names:
- py.test.skip("must run this test with pypy")
- if not sys.pypy_translation_info['translation.jit']:
- py.test.skip("must give a pypy-c with the jit enabled")
+ pypy_c = pytest.config.option.pypy_c or None
+ if pypy_c is not None:
+ assert os.path.exists(pypy_c), (
+ "--pypy specifies %r, which does not exist" % (pypy_c,))
+ out = subprocess.check_output([pypy_c, '-c',
+ "import sys; print('__pypy__' in sys.builtin_module_names)"])
+ assert 'True' in out, "%r is not a pypy executable" % (pypy_c,)
+ out = subprocess.check_output([pypy_c, '-c',
+ "import sys; print(sys.pypy_translation_info['translation.jit'])"])
+ assert 'True' in out, "%r is a not a JIT-enabled pypy" % (pypy_c,)
+ out = subprocess.check_output([pypy_c, '-c',
+ "import sys; print(sys.version)"])
+ assert out.startswith('3'), "%r is a not a pypy 3" % (pypy_c,)
+ cls.pypy_c = pypy_c
cls.tmpdir = udir.join('test-pypy-jit')
cls.tmpdir.ensure(dir=True)
@@ -29,6 +39,8 @@
discard_stdout_before_last_line=False, **jitopts):
jitopts.setdefault('threshold', 200)
jitopts.setdefault('disable_unrolling', 9999)
+ if self.pypy_c is None:
+ py.test.skip("run with --pypy=PATH")
src = py.code.Source(func_or_src)
if isinstance(func_or_src, types.FunctionType):
funcname = func_or_src.func_name
@@ -42,12 +54,12 @@
f.write("import sys\n")
f.write("sys.setcheckinterval(10000000)\n")
f.write(str(src) + "\n")
- f.write("print %s(%s)\n" % (funcname, arglist))
+ f.write("print(%s(%s))\n" % (funcname, arglist))
#
# run a child pypy-c with logging enabled
logfile = self.filepath.new(ext='.log')
#
- cmdline = [sys.executable]
+ cmdline = [self.pypy_c]
if not import_site:
cmdline.append('-S')
if jitopts:
@@ -74,6 +86,9 @@
#if stderr.startswith('debug_alloc.h:'): # lldebug builds
# stderr = ''
#assert not stderr
+ if not stdout:
+ raise Exception("no stdout produced; stderr='''\n%s'''"
+ % (stderr,))
if stderr:
print '*** stderr of the subprocess: ***'
print stderr
@@ -433,7 +448,7 @@
import pytest
def f():
import sys
- print >> sys.stderr, 'SKIP: foobar'
+ sys.stderr.write('SKIP: foobar\n')
#
raises(pytest.skip.Exception, "self.run(f, [])")
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit