blob: caad537b7e828c291b3d82ad4b578c7a69e9cabc [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():
Jeremy Leconte994bf452022-01-12 10:51:16 +010018 parser = argparse.ArgumentParser()
19 parser.add_argument('--isolated-script-test-output')
20 parser.add_argument('--isolated-script-test-perf-output')
21 args, unrecognized_args = parser.parse_known_args()
Patrik Höglund28b8a0b2020-03-26 20:30:50 +010022
Jeremy Leconte994bf452022-01-12 10:51:16 +010023 test_command = _ForcePythonInterpreter(unrecognized_args)
24 if args.isolated_script_test_output:
25 test_command += [
26 '--isolated_script_test_output', args.isolated_script_test_output
27 ]
28 if args.isolated_script_test_perf_output:
29 test_command += [
30 '--isolated_script_test_perf_output=' +
31 args.isolated_script_test_perf_output
32 ]
33 logging.info('Running %r', test_command)
Patrik Höglund28b8a0b2020-03-26 20:30:50 +010034
Jeremy Leconte994bf452022-01-12 10:51:16 +010035 return subprocess.call(test_command)
Patrik Höglund28b8a0b2020-03-26 20:30:50 +010036
37
38def _ForcePythonInterpreter(cmd):
Jeremy Leconte994bf452022-01-12 10:51:16 +010039 """Returns the fixed command line to call the right python executable."""
40 out = cmd[:]
41 if out[0] == 'python':
42 out[0] = sys.executable
43 elif out[0].endswith('.py'):
44 out.insert(0, sys.executable)
45 return out
Patrik Höglund28b8a0b2020-03-26 20:30:50 +010046
47
48if __name__ == '__main__':
Jeremy Leconte994bf452022-01-12 10:51:16 +010049 logging.basicConfig(level=logging.INFO)
50 sys.exit(main())