run_tests: Improve the backend detection

pull/1575/head
Nirbheek Chauhan 8 years ago
parent 0e8eba7f64
commit 4646958917
  1. 18
      run_tests.py

@ -20,15 +20,21 @@ import shutil
import subprocess import subprocess
import platform import platform
from mesonbuild import mesonlib from mesonbuild import mesonlib
from enum import Enum
def using_vs_backend(): Backend = Enum('Backend', 'ninja vs xcode')
for arg in sys.argv[1:]:
if arg.startswith('--backend=vs'):
return True
return False
if __name__ == '__main__': if __name__ == '__main__':
returncode = 0 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! # Running on a developer machine? Be nice!
if not mesonlib.is_windows() and 'TRAVIS' not in os.environ: if not mesonlib.is_windows() and 'TRAVIS' not in os.environ:
os.nice(20) os.nice(20)
@ -40,7 +46,7 @@ if __name__ == '__main__':
units += ['WindowsTests'] units += ['WindowsTests']
# Unit tests always use the Ninja backend, so just skip them if we're # Unit tests always use the Ninja backend, so just skip them if we're
# testing the VS backend # testing the VS backend
if not using_vs_backend(): if backend is Backend.ninja:
returncode += subprocess.call([sys.executable, 'run_unittests.py', '-v'] + units) returncode += subprocess.call([sys.executable, 'run_unittests.py', '-v'] + units)
# Ubuntu packages do not have a binary without -6 suffix. # Ubuntu packages do not have a binary without -6 suffix.
if shutil.which('arm-linux-gnueabihf-gcc-6') and not platform.machine().startswith('arm'): if shutil.which('arm-linux-gnueabihf-gcc-6') and not platform.machine().startswith('arm'):

Loading…
Cancel
Save