1#!/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(): 18 parser = argparse.ArgumentParser() 19 parser.add_argument('--isolated-script-test-perf-output') 20 args, unrecognized_args = parser.parse_known_args() 21 22 test_command = _ForcePythonInterpreter(unrecognized_args) 23 if args.isolated_script_test_perf_output: 24 test_command += ['--isolated_script_test_perf_output=' + 25 args.isolated_script_test_perf_output] 26 logging.info('Running %r', test_command) 27 28 return subprocess.call(test_command) 29 30 31def _ForcePythonInterpreter(cmd): 32 """Returns the fixed command line to call the right python executable.""" 33 out = cmd[:] 34 if out[0] == 'python': 35 out[0] = sys.executable 36 elif out[0].endswith('.py'): 37 out.insert(0, sys.executable) 38 return out 39 40 41if __name__ == '__main__': 42 # pylint: disable=W0101 43 logging.basicConfig(level=logging.INFO) 44 sys.exit(main()) 45