Specify crossfile use in CI job configuration

Pull the crossfile specification out of run_test.py so it can be
specified in the CI job configuration.

Also make some fixes to output ordering in run_test.py.
pull/6536/head
Jon Turney 6 years ago
parent 0fe485a100
commit 26d1c2a52d
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
  1. 4
      .travis.yml
  2. 32
      run_tests.py

@ -33,10 +33,10 @@ matrix:
# Test cross builds separately, they do not use the global compiler # Test cross builds separately, they do not use the global compiler
- os: linux - os: linux
compiler: gcc compiler: gcc
env: RUN_TESTS_ARGS="--cross" env: RUN_TESTS_ARGS="--cross ubuntu-armhf.txt --cross linux-mingw-w64-64bit.txt"
- os: linux - os: linux
compiler: gcc compiler: gcc
env: RUN_TESTS_ARGS="--cross" MESON_ARGS="--unity=on" env: RUN_TESTS_ARGS="--cross ubuntu-armhf.txt --cross linux-mingw-w64-64bit.txt" MESON_ARGS="--unity=on"
before_install: before_install:
- python ./skip_ci.py --base-branch-env=TRAVIS_BRANCH --is-pull-env=TRAVIS_PULL_REQUEST - python ./skip_ci.py --base-branch-env=TRAVIS_BRANCH --is-pull-env=TRAVIS_PULL_REQUEST

@ -312,6 +312,7 @@ def print_system_info():
print('Processor:', platform.processor()) print('Processor:', platform.processor())
print('System:', platform.system()) print('System:', platform.system())
print('') print('')
print(flush=True)
def main(): def main():
print_system_info() print_system_info()
@ -319,7 +320,7 @@ def main():
parser.add_argument('--cov', action='store_true') parser.add_argument('--cov', action='store_true')
parser.add_argument('--backend', default=None, dest='backend', parser.add_argument('--backend', default=None, dest='backend',
choices=backendlist) choices=backendlist)
parser.add_argument('--cross', default=False, dest='cross', action='store_true') parser.add_argument('--cross', default=[], dest='cross', action='append')
parser.add_argument('--failfast', action='store_true') parser.add_argument('--failfast', action='store_true')
parser.add_argument('--no-unittests', action='store_true', default=False) parser.add_argument('--no-unittests', action='store_true', default=False)
(options, _) = parser.parse_known_args() (options, _) = parser.parse_known_args()
@ -352,8 +353,6 @@ def main():
if 'APPVEYOR' in os.environ and os.environ['arch'] == 'x86': if 'APPVEYOR' in os.environ and os.environ['arch'] == 'x86':
os.environ.pop('platform') os.environ.pop('platform')
# Run tests # Run tests
print(mlog.bold('Running unittests.').get_text(mlog.colorize_console))
print(flush=True)
# Can't pass arguments to unit tests, so set the backend to use in the environment # Can't pass arguments to unit tests, so set the backend to use in the environment
env = os.environ.copy() env = os.environ.copy()
env['MESON_UNIT_TEST_BACKEND'] = backend.name env['MESON_UNIT_TEST_BACKEND'] = backend.name
@ -377,8 +376,11 @@ def main():
return returncode return returncode
if no_unittests: if no_unittests:
print('Skipping all unit tests.') print('Skipping all unit tests.')
print(flush=True)
returncode = 0 returncode = 0
else: else:
print(mlog.bold('Running unittests.').get_text(mlog.colorize_console))
print(flush=True)
cmd = mesonlib.python_command + ['run_unittests.py', '-v'] cmd = mesonlib.python_command + ['run_unittests.py', '-v']
if options.failfast: if options.failfast:
cmd += ['--failfast'] cmd += ['--failfast']
@ -389,21 +391,15 @@ def main():
returncode += subprocess.call(cmd, env=env) returncode += subprocess.call(cmd, env=env)
else: else:
cross_test_args = mesonlib.python_command + ['run_cross_test.py'] cross_test_args = mesonlib.python_command + ['run_cross_test.py']
print(mlog.bold('Running armhf cross tests.').get_text(mlog.colorize_console)) for cf in options.cross:
print(flush=True) print(mlog.bold('Running {} cross tests.'.format(cf)).get_text(mlog.colorize_console))
cmd = cross_test_args + ['cross/ubuntu-armhf.txt'] print(flush=True)
if options.failfast: cmd = cross_test_args + ['cross/' + cf]
cmd += ['--failfast'] if options.failfast:
returncode += subprocess.call(cmd, env=env) cmd += ['--failfast']
if options.failfast and returncode != 0: returncode += subprocess.call(cmd, env=env)
return returncode if options.failfast and returncode != 0:
print(mlog.bold('Running mingw-w64 64-bit cross tests.') return returncode
.get_text(mlog.colorize_console))
print(flush=True)
cmd = cross_test_args + ['cross/linux-mingw-w64-64bit.txt']
if options.failfast:
cmd += ['--failfast']
returncode += subprocess.call(cmd, env=env)
return returncode return returncode
if __name__ == '__main__': if __name__ == '__main__':

Loading…
Cancel
Save