aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2016-01-26 08:22:09 -0800
committerGravatar Jan Tattermusch <jtattermusch@google.com>2016-01-27 07:29:30 -0800
commitf08018ad244c1187670b581317518709dbf02159 (patch)
tree3374a009ee32c76b5ce6486f3beb41cc9aeec26d /tools/run_tests
parent79288c15468a42401de902d067e5eac05e02386d (diff)
better architecture check on linux
Diffstat (limited to 'tools/run_tests')
-rwxr-xr-xtools/run_tests/run_tests.py36
1 files changed, 27 insertions, 9 deletions
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 7482824099..a390864237 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -545,6 +545,27 @@ def _windows_arch_option(arch):
else:
print 'Architecture %s not supported.' % arch
sys.exit(1)
+
+
+def _check_arch_option(arch):
+ """Checks that architecture option is valid."""
+ if platform_string() == 'windows':
+ _windows_arch_option(arch)
+ elif platform_string() == 'linux':
+ # On linux, we need to be running under docker with the right architecture.
+ if arch == 'default':
+ return
+ elif runtime_arch == '64bit' and arch == 'x64':
+ return
+ elif runtime_arch == '32bit' and arch == 'x86':
+ return
+ else:
+ print 'Architecture %s does not match current runtime architecture.' % arch
+ sys.exit(1)
+ else:
+ if args.arch != 'default':
+ print 'Architecture %s not supported on current platform.' % args.arch
+ sys.exit(1)
def _windows_build_bat(compiler):
@@ -735,15 +756,6 @@ if any(language.make_options() for language in languages):
else:
language_make_options = next(iter(languages)).make_options()
-if platform_string() != 'windows':
- if args.arch != 'default' and platform_string() != 'linux':
- # TODO: check if the current arch is correct
- print 'Architecture %s not supported on current platform.' % args.arch
- sys.exit(1)
- if args.compiler != 'default':
- print 'Compiler %s not supported on current platform.' % args.compiler
- sys.exit(1)
-
if len(languages) != 1 or len(build_configs) != 1:
print 'Multi-language and multi-config testing is not supported.'
sys.exit(1)
@@ -773,6 +785,12 @@ if args.use_docker:
shell=True,
env=env)
sys.exit(0)
+
+if platform_string() != 'windows' and args.compiler != 'default':
+ print 'Compiler %s not supported on current platform.' % args.compiler
+ sys.exit(1)
+
+_check_arch_option(args.arch)
def make_jobspec(cfg, targets, makefile='Makefile'):
if platform_string() == 'windows':