diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-04-06 04:17:47 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-04-09 23:07:49 +0530 |
commit | 4646958917c0a0924c989698c178f849c5c94635 (patch) | |
tree | 62af515deffe4d9504ad9caa37b0440ad68e5684 /run_tests.py | |
parent | 0e8eba7f644571ea0beb40334d2a3d0b150ac4ef (diff) | |
download | meson-4646958917c0a0924c989698c178f849c5c94635.zip meson-4646958917c0a0924c989698c178f849c5c94635.tar.gz meson-4646958917c0a0924c989698c178f849c5c94635.tar.bz2 |
run_tests: Improve the backend detection
Diffstat (limited to 'run_tests.py')
-rwxr-xr-x | run_tests.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/run_tests.py b/run_tests.py index 02aa701..b444b9a 100755 --- a/run_tests.py +++ b/run_tests.py @@ -20,15 +20,21 @@ import shutil import subprocess import platform from mesonbuild import mesonlib +from enum import Enum -def using_vs_backend(): - for arg in sys.argv[1:]: - if arg.startswith('--backend=vs'): - return True - return False +Backend = Enum('Backend', 'ninja vs xcode') if __name__ == '__main__': returncode = 0 + # Iterate over list in reverse order to find the last --backend arg + backend = Backend.ninja + for arg in reversed(sys.argv[1:]): + if arg.startswith('--backend'): + if arg.startswith('--backend=vs'): + backend = Backend.vs + elif arg == '--backend=xcode': + backend = Backend.xcode + break # Running on a developer machine? Be nice! if not mesonlib.is_windows() and 'TRAVIS' not in os.environ: os.nice(20) @@ -40,7 +46,7 @@ if __name__ == '__main__': units += ['WindowsTests'] # Unit tests always use the Ninja backend, so just skip them if we're # testing the VS backend - if not using_vs_backend(): + if backend is Backend.ninja: returncode += subprocess.call([sys.executable, 'run_unittests.py', '-v'] + units) # Ubuntu packages do not have a binary without -6 suffix. if shutil.which('arm-linux-gnueabihf-gcc-6') and not platform.machine().startswith('arm'): |