Commit d2cf48ea authored by Wenbin Zhang's avatar Wenbin Zhang Committed by Commit Bot

[benchmarking] remove shading environment variables before running gtests

Removing the variables which will confuse gtests.

Bug: chromium:1138988,1142435
Change-Id: Ied118e9350db38ba960ac6ac2cac75f5db601bf1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2504637
Commit-Queue: Wenbin Zhang <wenbinzhang@google.com>
Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821888}
parent 3a607750
......@@ -281,6 +281,16 @@ def execute_gtest_perf_test(command_generator, output_paths, use_xvfb=False):
# all the time on Linux.
env[CHROME_SANDBOX_ENV] = CHROME_SANDBOX_PATH
env['CHROME_HEADLESS'] = '1'
#TODO(crbug/1138988): Some gtests do not implements the unit_test_launcher.cc.
# As a result, they will not respect the arguments added by
# _generate_shard_args() and will still use the values of GTEST_SHARD_INDEX
# and GTEST_TOTAL_SHARDS to run part of the tests.
# Removing those environment variables as a workaround.
if command_generator._ignore_shard_env_vars:
if 'GTEST_TOTAL_SHARDS' in env:
env.pop('GTEST_TOTAL_SHARDS')
if 'GTEST_SHARD_INDEX' in env:
env.pop('GTEST_SHARD_INDEX')
return_code = 0
try:
......
......@@ -371,6 +371,7 @@ class ScriptsSmokeTest(unittest.TestCase):
class FakeCommandGenerator(object):
def __init__(self):
self.executable_name = 'binary_that_doesnt_exist'
self._ignore_shard_env_vars = False
def generate(self, unused_path):
return [self.executable_name]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment