|
|
@ -23,10 +23,13 @@ import argparse |
|
|
|
import subprocess |
|
|
|
import subprocess |
|
|
|
from mesonbuild import mesonlib |
|
|
|
from mesonbuild import mesonlib |
|
|
|
from mesonbuild.coredata import version as meson_version |
|
|
|
from mesonbuild.coredata import version as meson_version |
|
|
|
|
|
|
|
from pathlib import Path |
|
|
|
|
|
|
|
import json |
|
|
|
|
|
|
|
import os |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def runtests(cross_file, failfast, cross_only): |
|
|
|
def runtests(cross_file, failfast, cross_only, test_list, env=None): |
|
|
|
tests = ['--only', 'common'] |
|
|
|
tests = ['--only'] + test_list |
|
|
|
if not cross_only: |
|
|
|
if not cross_only: |
|
|
|
tests.append('native') |
|
|
|
tests.append('native') |
|
|
|
cmd = mesonlib.python_command + ['run_project_tests.py', '--backend', 'ninja'] |
|
|
|
cmd = mesonlib.python_command + ['run_project_tests.py', '--backend', 'ninja'] |
|
|
@ -36,7 +39,7 @@ def runtests(cross_file, failfast, cross_only): |
|
|
|
cmd += ['--cross-file', cross_file] |
|
|
|
cmd += ['--cross-file', cross_file] |
|
|
|
if cross_only: |
|
|
|
if cross_only: |
|
|
|
cmd += ['--native-file', 'cross/none.txt'] |
|
|
|
cmd += ['--native-file', 'cross/none.txt'] |
|
|
|
return subprocess.call(cmd) |
|
|
|
return subprocess.call(cmd, env=env) |
|
|
|
|
|
|
|
|
|
|
|
def main(): |
|
|
|
def main(): |
|
|
|
parser = argparse.ArgumentParser() |
|
|
|
parser = argparse.ArgumentParser() |
|
|
@ -44,7 +47,16 @@ def main(): |
|
|
|
parser.add_argument('--cross-only', action='store_true') |
|
|
|
parser.add_argument('--cross-only', action='store_true') |
|
|
|
parser.add_argument('cross_file') |
|
|
|
parser.add_argument('cross_file') |
|
|
|
options = parser.parse_args() |
|
|
|
options = parser.parse_args() |
|
|
|
return runtests(options.cross_file, options.failfast, options.cross_only) |
|
|
|
cf_path = Path(options.cross_file) |
|
|
|
|
|
|
|
try: |
|
|
|
|
|
|
|
data = json.loads(cf_path.read_text()) |
|
|
|
|
|
|
|
real_cf = cf_path.resolve().parent / data['file'] |
|
|
|
|
|
|
|
assert real_cf.exists() |
|
|
|
|
|
|
|
env = os.environ.copy() |
|
|
|
|
|
|
|
env.update(data['env']) |
|
|
|
|
|
|
|
return runtests(real_cf.as_posix(), options.failfast, options.cross_only, data['tests'], env=env) |
|
|
|
|
|
|
|
except Exception: |
|
|
|
|
|
|
|
return runtests(options.cross_file, options.failfast, options.cross_only, ['common']) |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
if __name__ == '__main__': |
|
|
|
print('Meson build system', meson_version, 'Cross Tests') |
|
|
|
print('Meson build system', meson_version, 'Cross Tests') |
|
|
|