OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 |
| 3 # Copyright (c) 2016 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 |
| 11 import os |
| 12 import subprocess |
| 13 import sys |
| 14 |
| 15 # GTEST_SHARD_INDEX and GTEST_TOTAL_SHARDS must be removed from the environment |
| 16 # otherwise it will be picked up by the binary, causing a bug where only tests |
| 17 # in the firsh shard are executed. |
| 18 test_env = os.environ.copy() |
| 19 gtest_shard_index = test_env.pop('GTEST_SHARD_INDEX', '0') |
| 20 gtest_total_shards = test_env.pop('GTEST_TOTAL_SHARDS', '1') |
| 21 |
| 22 gtest_parallel_path = os.path.dirname(os.path.abspath(__file__)) |
| 23 gtest_parallel_path = os.path.join(gtest_parallel_path, 'gtest-parallel') |
| 24 |
| 25 command = [ |
| 26 sys.executable, |
| 27 gtest_parallel_path, |
| 28 '--shard_count', |
| 29 gtest_total_shards, |
| 30 '--shard_index', |
| 31 gtest_shard_index, |
| 32 ] + sys.argv[1:] |
| 33 |
| 34 print 'gtest-parallel-wrapper: Executing command %s' % ' '.join(command) |
| 35 sys.stdout.flush() |
| 36 |
| 37 sys.exit(subprocess.call(command, env=test_env, cwd=os.getcwd())) |
OLD | NEW |