diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-10-11 23:27:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-11 23:27:44 +0300 |
commit | 253fcb37af3f6d853d431d06aaf75c09292342b6 (patch) | |
tree | 8336395507fdc9302b22519bb0170174dcbd4b2f /run_cross_test.py | |
parent | be07a710ee45232a60b6add2da7b9e33f90a1d2f (diff) | |
parent | d964da79e76b2e75d6fdaa06f48098e54cba8024 (diff) | |
download | meson-253fcb37af3f6d853d431d06aaf75c09292342b6.zip meson-253fcb37af3f6d853d431d06aaf75c09292342b6.tar.gz meson-253fcb37af3f6d853d431d06aaf75c09292342b6.tar.bz2 |
Merge pull request #3424 from NickeZ/nickez/fail-fast
Add option to fail fast in tests
Diffstat (limited to 'run_cross_test.py')
-rwxr-xr-x | run_cross_test.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/run_cross_test.py b/run_cross_test.py index 7191402..6e04fa2 100755 --- a/run_cross_test.py +++ b/run_cross_test.py @@ -25,14 +25,16 @@ Eventually migrate to something fancier.''' import sys import os from pathlib import Path +import argparse from run_project_tests import gather_tests, run_tests, StopException, setup_commands from run_project_tests import failing_logs -def runtests(cross_file): +def runtests(cross_file, failfast): commontests = [('common', gather_tests(Path('test cases', 'common')), False)] try: - (passing_tests, failing_tests, skipped_tests) = run_tests(commontests, 'meson-cross-test-run', ['--cross', cross_file]) + (passing_tests, failing_tests, skipped_tests) = \ + run_tests(commontests, 'meson-cross-test-run', failfast, ['--cross', cross_file]) except StopException: pass print('\nTotal passed cross tests:', passing_tests) @@ -40,11 +42,17 @@ def runtests(cross_file): print('Total skipped cross tests:', skipped_tests) if failing_tests > 0 and ('TRAVIS' in os.environ or 'APPVEYOR' in os.environ): print('\nMesonlogs of failing tests\n') - for l in failing_logs: - print(l, '\n') - sys.exit(failing_tests) + for log in failing_logs: + print(log, '\n') + return failing_tests + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--failfast', action='store_true') + parser.add_argument('cross_file') + options = parser.parse_args() + setup_commands('ninja') + return runtests(options.cross_file, options.failfast) if __name__ == '__main__': - setup_commands('ninja') - cross_file = sys.argv[1] - runtests(cross_file) + sys.exit(main()) |