Debian Codegraph @

rpython/jit/backend/x86/test/conftest.py

raw symbols SCIP
1 import os
2 import pytest
3 from rpython.jit.backend import detect_cpu
4
5 cpu = detect_cpu.autodetect()
6 IS_X86 = cpu.startswith('x86')
7 THIS_DIR = os.path.dirname(__file__)
8
9 @pytest.hookimpl(tryfirst=True)
10 def pytest_ignore_collect(path, config):
11 path = str(path)
12 if not IS_X86:
13 if os.path.commonprefix([path, THIS_DIR]) == THIS_DIR: # workaround for bug in pytest<3.0.5
14 return True
15
16 def pytest_collect_file():
17 if not IS_X86:
18 # We end up here when calling py.test .../test_foo.py with a wrong cpu
19 # It's OK to kill the whole session with the following line
20 pytest.skip("X86 tests skipped: cpu is %r" % (cpu,))
21
22 def pytest_runtest_setup(item):
23 if cpu == 'x86_64':
24 if os.name == "nt":
25 pytest.skip("Windows cannot allocate non-reserved memory")
26 from rpython.rtyper.lltypesystem import ll2ctypes
27 ll2ctypes.do_allocation_in_far_regions()