blob: f1ea478c62d62e6249fcb9c995d85fa72c344f9f [file] [log] [blame]
Mike Fleming3933d922018-04-02 10:53:08 -07001#!/usr/bin/env python
2# Copyright 2017 the V8 project authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""
7Legacy test-runner wrapper supporting a product of multiple architectures and
8modes.
9"""
10
11import argparse
12import itertools
13from os.path import abspath, dirname, join
14import subprocess
15import sys
16
17BASE_DIR = dirname(dirname(abspath(__file__)))
18RUN_TESTS = join(BASE_DIR, 'tools', 'run-tests.py')
19
20def main():
21 parser = argparse.ArgumentParser(description='Legacy test-runner wrapper')
22 parser.add_argument(
23 '--arch', help='Comma-separated architectures to run tests on')
24 parser.add_argument(
25 '--mode', help='Comma-separated modes to run tests on')
26 parser.add_argument(
27 '--arch-and-mode',
28 help='Architecture and mode in the format \'arch.mode\'',
29 )
30
31 args, remaining_args = parser.parse_known_args(sys.argv)
32 if (args.arch or args.mode) and args.arch_and_mode:
33 parser.error('The flags --arch-and-mode and --arch/--mode are exclusive.')
34 arch = (args.arch or 'ia32,x64,arm').split(',')
35 mode = (args.mode or 'release,debug').split(',')
36 if args.arch_and_mode:
37 arch_and_mode = map(
38 lambda am: am.split('.'),
39 args.arch_and_mode.split(','))
40 arch = map(lambda am: am[0], arch_and_mode)
41 mode = map(lambda am: am[1], arch_and_mode)
42
43 ret_code = 0
44 for a, m in itertools.product(arch, mode):
45 ret_code |= subprocess.check_call(
46 [RUN_TESTS] + remaining_args[1:] + ['--arch', a, '--mode', m])
47 return ret_code
48
49if __name__ == '__main__':
50 sys.exit(main())