Files
meson/run_cross_test.py
T
Dylan Baker e991c4d454 Use SPDX-License-Identifier consistently
This replaces all of the Apache blurbs at the start of each file with an
`# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing
uses to be consistent in capitalization, and to be placed above any
copyright notices.

This removes nearly 3000 lines of boilerplate from the project (only
python files), which no developer cares to look at.

SPDX is in common use, particularly in the Linux kernel, and is the
recommended format for Meson's own `project(license: )` field
2023-12-13 15:19:21 -05:00

52 lines
1.7 KiB
Python
Executable File

#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# Copyright 2013-2016 The Meson development team
'''Runs the basic test suite through a cross compiler.
This is now just a wrapper around run_project_tests.py with specific arguments
'''
import argparse
import subprocess
from mesonbuild import mesonlib
from mesonbuild.coredata import version as meson_version
from pathlib import Path
import json
import os
def runtests(cross_file, failfast, cross_only, test_list, env=None):
tests = ['--only'] + test_list
if not cross_only:
tests.append('native')
cmd = mesonlib.python_command + ['run_project_tests.py', '--backend', 'ninja']
if failfast:
cmd += ['--failfast']
cmd += tests
cmd += ['--cross-file', cross_file]
if cross_only:
cmd += ['--native-file', 'cross/none.txt']
return subprocess.call(cmd, env=env)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--failfast', action='store_true')
parser.add_argument('--cross-only', action='store_true')
parser.add_argument('cross_file')
options = parser.parse_args()
cf_path = Path(options.cross_file)
try:
data = json.loads(cf_path.read_text(encoding='utf-8'))
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__':
print('Meson build system', meson_version, 'Cross Tests')
raise SystemExit(main())