Skip to content

Commit 36600d7

Browse files
jon-turneynirbheek
authored andcommitted
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.
1 parent 1480fdf commit 36600d7

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

.github/workflows/nonative.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Cross-only compilation environment
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
cross-only-armhf:
11+
runs-on: ubuntu-latest
12+
container: mesonbuild/eoan:latest
13+
steps:
14+
- run: |
15+
apt-get -y purge clang gcc gdc
16+
apt-get -y autoremove
17+
- uses: actions/checkout@v2
18+
- name: Run tests
19+
run: bash -c 'source /ci/env_vars.sh; cd $GITHUB_WORKSPACE; ./run_tests.py $CI_ARGS --cross ubuntu-armhf.txt --cross-only'

run_cross_test.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,20 @@
2525
from mesonbuild.coredata import version as meson_version
2626

2727

28-
def runtests(cross_file, failfast):
29-
tests = ['--only', 'common', 'native']
28+
def runtests(cross_file, failfast, cross_only):
29+
tests = ['--only', 'common']
30+
if not cross_only:
31+
tests.append('native')
3032
cmd = mesonlib.python_command + ['run_project_tests.py', '--backend', 'ninja'] + (['--failfast'] if failfast else []) + tests + ['--cross-file', cross_file]
3133
return subprocess.call(cmd)
3234

3335
def main():
3436
parser = argparse.ArgumentParser()
3537
parser.add_argument('--failfast', action='store_true')
38+
parser.add_argument('--cross-only', action='store_true')
3639
parser.add_argument('cross_file')
3740
options = parser.parse_args()
38-
return runtests(options.cross_file, options.failfast)
41+
return runtests(options.cross_file, options.failfast, options.cross_only)
3942

4043
if __name__ == '__main__':
4144
print('Meson build system', meson_version, 'Cross Tests')

run_tests.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ def main():
319319
parser.add_argument('--backend', default=None, dest='backend',
320320
choices=backendlist)
321321
parser.add_argument('--cross', default=[], dest='cross', action='append')
322+
parser.add_argument('--cross-only', action='store_true')
322323
parser.add_argument('--failfast', action='store_true')
323324
parser.add_argument('--no-unittests', action='store_true', default=False)
324325
(options, _) = parser.parse_known_args()
@@ -330,7 +331,6 @@ def main():
330331
import coverage
331332
coverage.process_startup()
332333
returncode = 0
333-
cross = options.cross
334334
backend, _ = guess_backend(options.backend, shutil.which('msbuild'))
335335
no_unittests = options.no_unittests
336336
# Running on a developer machine? Be nice!
@@ -365,7 +365,7 @@ def main():
365365
env['PYTHONPATH'] = os.pathsep.join([temp_dir, env.get('PYTHONPATH')])
366366
else:
367367
env['PYTHONPATH'] = temp_dir
368-
if not cross:
368+
if not options.cross:
369369
cmd = mesonlib.python_command + ['run_meson_command_tests.py', '-v']
370370
if options.failfast:
371371
cmd += ['--failfast']
@@ -395,6 +395,8 @@ def main():
395395
cmd = cross_test_args + ['cross/' + cf]
396396
if options.failfast:
397397
cmd += ['--failfast']
398+
if options.cross_only:
399+
cmd += ['--cross-only']
398400
returncode += subprocess.call(cmd, env=env)
399401
if options.failfast and returncode != 0:
400402
return returncode

0 commit comments

Comments
 (0)