| 1 |
|
| 2 |
import os |
| 3 |
import platform |
| 4 |
import sys |
| 5 |
|
| 6 |
IS_ARM64 = platform.machine() == 'arm64' |
| 7 |
IS_MACOS = sys.platform == 'darwin' |
| 8 |
IS_PYPY = 'pypyjit' in sys.builtin_module_names |
| 9 |
IS_PYPY_MACOS_ARM64 = IS_ARM64 and IS_MACOS and IS_PYPY |
| 10 |
|
| 11 |
DIRS_SPLIT = [ |
| 12 |
'translator/c', 'rlib', |
| 13 |
'memory/test', 'jit/metainterp', |
| 14 |
'jit/backend/aarch64', |
| 15 |
'jit/backend/x86', |
| 16 |
'module/cpyext/test', |
| 17 |
] |
| 18 |
|
| 19 |
pytestpath = os.path.abspath('pytest.py') |
| 20 |
|
| 21 |
def collect_one_testdir(testdirs, reldir, tests): |
| 22 |
for dir in DIRS_SPLIT: |
| 23 |
if reldir.startswith(dir): |
| 24 |
testdirs.extend(tests) |
| 25 |
break |
| 26 |
else: |
| 27 |
testdirs.append(reldir) |
| 28 |
|
| 29 |
def get_test_driver(testdir): |
| 30 |
if "jit/backend/aarch64" in testdir and IS_PYPY_MACOS_ARM64: |
| 31 |
return ["--jit", "off", pytestpath] |
| 32 |
return [pytestpath] |
| 33 |
|
| 34 |
_cherrypick = os.getenv('PYPYCHERRYPICK', '') |
| 35 |
if _cherrypick: |
| 36 |
cherrypick = _cherrypick.split(':') |