blob: c7165744777cce6839d8b3ead8297760d990f0a5 [file] [log] [blame]
Patrik Höglund28b8a0b2020-03-26 20:30:50 +01001#!/usr/bin/env python
2
3# Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
4#
5# Use of this source code is governed by a BSD-style license
6# that can be found in the LICENSE file in the root of the source
7# tree. An additional intellectual property rights grant can be found
8# in the file PATENTS. All contributing project authors may
9# be found in the AUTHORS file in the root of the source tree.
10
11import argparse
12import logging
13import subprocess
14import sys
15
16
17def main():
Mirko Bonadei8cc66952020-10-30 10:13:45 +010018 parser = argparse.ArgumentParser()
19 parser.add_argument('--isolated-script-test-perf-output')
20 args, unrecognized_args = parser.parse_known_args()
Patrik Höglund28b8a0b2020-03-26 20:30:50 +010021
Mirko Bonadei8cc66952020-10-30 10:13:45 +010022 test_command = _ForcePythonInterpreter(unrecognized_args)
23 if args.isolated_script_test_perf_output:
24 test_command += [
25 '--isolated_script_test_perf_output=' +
26 args.isolated_script_test_perf_output
27 ]
28 logging.info('Running %r', test_command)
Patrik Höglund28b8a0b2020-03-26 20:30:50 +010029
Mirko Bonadei8cc66952020-10-30 10:13:45 +010030 return subprocess.call(test_command)
Patrik Höglund28b8a0b2020-03-26 20:30:50 +010031
32
33def _ForcePythonInterpreter(cmd):
Mirko Bonadei8cc66952020-10-30 10:13:45 +010034 """Returns the fixed command line to call the right python executable."""
35 out = cmd[:]
36 if out[0] == 'python':
37 out[0] = sys.executable
38 elif out[0].endswith('.py'):
39 out.insert(0, sys.executable)
40 return out
Patrik Höglund28b8a0b2020-03-26 20:30:50 +010041
42
43if __name__ == '__main__':
Mirko Bonadei8cc66952020-10-30 10:13:45 +010044 # pylint: disable=W0101
45 logging.basicConfig(level=logging.INFO)
46 sys.exit(main())