From 36600d7465e854c6f3d7fc824a7fa5d4415a6292 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Tue, 8 Sep 2020 19:27:20 +0100 Subject: Add a test run in an environment which only has a cross compiler Add '--cross-only' option to run_tests.py, so we can arrange not to run tests in the 'native' suite when only a cross-compiler is available, as they can't succeed. --- .github/workflows/nonative.yml | 19 +++++++++++++++++++ run_cross_test.py | 9 ++++++--- run_tests.py | 6 ++++-- 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/nonative.yml diff --git a/.github/workflows/nonative.yml b/.github/workflows/nonative.yml new file mode 100644 index 000000000..59386c530 --- /dev/null +++ b/.github/workflows/nonative.yml @@ -0,0 +1,19 @@ +name: Cross-only compilation environment + +on: + push: + branches: + - master + pull_request: + +jobs: + cross-only-armhf: + runs-on: ubuntu-latest + container: mesonbuild/eoan:latest + steps: + - run: | + apt-get -y purge clang gcc gdc + apt-get -y autoremove + - uses: actions/checkout@v2 + - name: Run tests + run: bash -c 'source /ci/env_vars.sh; cd $GITHUB_WORKSPACE; ./run_tests.py $CI_ARGS --cross ubuntu-armhf.txt --cross-only' diff --git a/run_cross_test.py b/run_cross_test.py index 269eb01c3..70db66721 100755 --- a/run_cross_test.py +++ b/run_cross_test.py @@ -25,17 +25,20 @@ from mesonbuild import mesonlib from mesonbuild.coredata import version as meson_version -def runtests(cross_file, failfast): - tests = ['--only', 'common', 'native'] +def runtests(cross_file, failfast, cross_only): + tests = ['--only', 'common'] + if not cross_only: + tests.append('native') cmd = mesonlib.python_command + ['run_project_tests.py', '--backend', 'ninja'] + (['--failfast'] if failfast else []) + tests + ['--cross-file', cross_file] return subprocess.call(cmd) 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() - return runtests(options.cross_file, options.failfast) + return runtests(options.cross_file, options.failfast, options.cross_only) if __name__ == '__main__': print('Meson build system', meson_version, 'Cross Tests') diff --git a/run_tests.py b/run_tests.py index 08ad78a61..b3bcee20f 100755 --- a/run_tests.py +++ b/run_tests.py @@ -319,6 +319,7 @@ def main(): parser.add_argument('--backend', default=None, dest='backend', choices=backendlist) parser.add_argument('--cross', default=[], dest='cross', action='append') + parser.add_argument('--cross-only', action='store_true') parser.add_argument('--failfast', action='store_true') parser.add_argument('--no-unittests', action='store_true', default=False) (options, _) = parser.parse_known_args() @@ -330,7 +331,6 @@ def main(): import coverage coverage.process_startup() returncode = 0 - cross = options.cross backend, _ = guess_backend(options.backend, shutil.which('msbuild')) no_unittests = options.no_unittests # Running on a developer machine? Be nice! @@ -365,7 +365,7 @@ def main(): env['PYTHONPATH'] = os.pathsep.join([temp_dir, env.get('PYTHONPATH')]) else: env['PYTHONPATH'] = temp_dir - if not cross: + if not options.cross: cmd = mesonlib.python_command + ['run_meson_command_tests.py', '-v'] if options.failfast: cmd += ['--failfast'] @@ -395,6 +395,8 @@ def main(): cmd = cross_test_args + ['cross/' + cf] if options.failfast: cmd += ['--failfast'] + if options.cross_only: + cmd += ['--cross-only'] returncode += subprocess.call(cmd, env=env) if options.failfast and returncode != 0: return returncode -- cgit v1.2.1