Debian Codegraph @

rpython/jit/tl/test/test_pypyjit.py

raw symbols SCIP
1 import os
2 import py
3
4 from rpython.jit.tl.test import jitcrashers
5
6 path = os.path.join(os.path.dirname(__file__), "..", "targetpypyjit-c")
7 JIT_EXECUTABLE = py.path.local(path)
8 del path
9 CRASH_FILE = os.path.abspath(jitcrashers.__file__.rstrip("c"))
10
11 if not JIT_EXECUTABLE.check():
12 py.test.skip("no JIT executable")
13
14 def setup_module(mod):
15 mod._old_cwd = os.getcwd()
16 os.chdir(str(JIT_EXECUTABLE.dirpath()))
17
18 def teardown_module(mod):
19 os.chdir(mod._old_cwd)
20
21 def check_crasher(func_name):
22 try:
23 JIT_EXECUTABLE.sysexec(CRASH_FILE, func_name)
24 except py.process.cmdexec.Error as e:
25 print "stderr"
26 print "------"
27 print e.err
28 print "stdout"
29 print "------"
30 print e.out
31 raise
32
33 def test_jit_crashers():
34 # Iterate in over sorted test functions, so it's always consistent and
35 # reproducible.
36 for func_name in sorted(jitcrashers.__dict__):
37 if func_name.startswith("jit_"):
38 yield check_crasher, func_name