11be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#!/usr/bin/env python 21be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# 341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# Copyright 2005 Google Inc. All Rights Reserved. 41be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# 51be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# Redistribution and use in source and binary forms, with or without 61be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# modification, are permitted provided that the following conditions are 71be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# met: 81be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# 91be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# * Redistributions of source code must retain the above copyright 101be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# notice, this list of conditions and the following disclaimer. 111be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# * Redistributions in binary form must reproduce the above 121be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# copyright notice, this list of conditions and the following disclaimer 131be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# in the documentation and/or other materials provided with the 141be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# distribution. 151be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# * Neither the name of Google Inc. nor the names of its 161be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# contributors may be used to endorse or promote products derived from 171be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# this software without specific prior written permission. 181be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# 191be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 201be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 211be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 221be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 231be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 241be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 251be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 261be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 271be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 281be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 291be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 301be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 311be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania"""Unit test for Google Test test filters. 321be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 331be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaA user can specify which test(s) in a Google Test program to run via either 341be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniathe GTEST_FILTER environment variable or the --gtest_filter flag. 351be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaThis script tests such functionality by invoking 361be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniagtest_filter_unittest_ (a program written with Google Test) with different 371be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaenvironments and command line flags. 381be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 391be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaNote that test sharding may also influence which tests are filtered. Therefore, 401be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniawe test that here also. 411be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania""" 421be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 431be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania__author__ = 'wan@google.com (Zhanyong Wan)' 441be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 451be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaimport os 461be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaimport re 471be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaimport sets 4841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabotimport sys 4941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 501be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaimport gtest_test_utils 511be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 521be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# Constants. 531be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# Checks if this platform can pass empty environment variables to child 5541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# processes. We set an env variable to an empty string and invoke a python 5641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# script in a subprocess to print whether the variable is STILL in 5741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# os.environ. We then use 'eval' to parse the child's output so that an 5841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# exception is thrown if the input is anything other than 'True' nor 'False'. 5941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabotos.environ['EMPTY_VAR'] = '' 6041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabotchild = gtest_test_utils.Subprocess( 6141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot [sys.executable, '-c', 'import os; print \'EMPTY_VAR\' in os.environ']) 6241d0579e8de9ef4ff178fc4991043c61a19943f7Brett ChabotCAN_PASS_EMPTY_ENV = eval(child.output) 6341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 6441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 6541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# Check if this platform can unset environment variables in child processes. 6641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# We set an env variable to a non-empty string, unset it, and invoke 6741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# a python script in a subprocess to print whether the variable 6841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# is NO LONGER in os.environ. 6941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# We use 'eval' to parse the child's output so that an exception 7041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# is thrown if the input is neither 'True' nor 'False'. 7141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabotos.environ['UNSET_VAR'] = 'X' 7241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabotdel os.environ['UNSET_VAR'] 7341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabotchild = gtest_test_utils.Subprocess( 7441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot [sys.executable, '-c', 'import os; print \'UNSET_VAR\' not in os.environ']) 7541d0579e8de9ef4ff178fc4991043c61a19943f7Brett ChabotCAN_UNSET_ENV = eval(child.output) 7641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 7741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 7841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# Checks if we should test with an empty filter. This doesn't 7941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# make sense on platforms that cannot pass empty env variables (Win32) 8041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# and on platforms that cannot unset variables (since we cannot tell 8141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# the difference between "" and NULL -- Borland and Solaris < 5.10) 8241d0579e8de9ef4ff178fc4991043c61a19943f7Brett ChabotCAN_TEST_EMPTY_FILTER = (CAN_PASS_EMPTY_ENV and CAN_UNSET_ENV) 8341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 8441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 851be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# The environment variable for specifying the test filters. 861be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaFILTER_ENV_VAR = 'GTEST_FILTER' 871be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 881be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# The environment variables for test sharding. 891be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTOTAL_SHARDS_ENV_VAR = 'GTEST_TOTAL_SHARDS' 901be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaSHARD_INDEX_ENV_VAR = 'GTEST_SHARD_INDEX' 911be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaSHARD_STATUS_FILE_ENV_VAR = 'GTEST_SHARD_STATUS_FILE' 921be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 931be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# The command line flag for specifying the test filters. 941be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaFILTER_FLAG = 'gtest_filter' 951be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 961be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# The command line flag for including disabled tests. 971be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaALSO_RUN_DISABED_TESTS_FLAG = 'gtest_also_run_disabled_tests' 981be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 991be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# Command to run the gtest_filter_unittest_ program. 10041d0579e8de9ef4ff178fc4991043c61a19943f7Brett ChabotCOMMAND = gtest_test_utils.GetTestExecutablePath('gtest_filter_unittest_') 1011be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1021be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# Regex for determining whether parameterized tests are enabled in the binary. 1031be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaPARAM_TEST_REGEX = re.compile(r'/ParamTest') 1041be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1051be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# Regex for parsing test case names from Google Test's output. 1061be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTEST_CASE_REGEX = re.compile(r'^\[\-+\] \d+ tests? from (\w+(/\w+)?)') 1071be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1081be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# Regex for parsing test names from Google Test's output. 1091be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTEST_REGEX = re.compile(r'^\[\s*RUN\s*\].*\.(\w+(/\w+)?)') 1101be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 11141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# The command line flag to tell Google Test to output the list of tests it 11241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# will run. 11341d0579e8de9ef4ff178fc4991043c61a19943f7Brett ChabotLIST_TESTS_FLAG = '--gtest_list_tests' 11441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 11541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot# Indicates whether Google Test supports death tests. 11641d0579e8de9ef4ff178fc4991043c61a19943f7Brett ChabotSUPPORTS_DEATH_TESTS = 'HasDeathTest' in gtest_test_utils.Subprocess( 11741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot [COMMAND, LIST_TESTS_FLAG]).output 11841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 1191be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# Full names of all tests in gtest_filter_unittests_. 1201be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaPARAM_TESTS = [ 1211be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqP/ParamTest.TestX/0', 1221be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqP/ParamTest.TestX/1', 1231be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqP/ParamTest.TestY/0', 1241be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqP/ParamTest.TestY/1', 1251be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqQ/ParamTest.TestX/0', 1261be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqQ/ParamTest.TestX/1', 1271be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqQ/ParamTest.TestY/0', 1281be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqQ/ParamTest.TestY/1', 1291be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania ] 1301be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1311be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaDISABLED_TESTS = [ 1321be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.DISABLED_TestFour', 1331be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.DISABLED_TestFive', 1341be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.DISABLED_TestC', 1351be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'DISABLED_FoobarTest.Test1', 1361be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'DISABLED_FoobarTest.DISABLED_Test2', 1371be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'DISABLED_FoobarbazTest.TestA', 1381be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania ] 1391be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 14041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabotif SUPPORTS_DEATH_TESTS: 14141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot DEATH_TESTS = [ 14241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'HasDeathTest.Test1', 14341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'HasDeathTest.Test2', 14441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot ] 14541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabotelse: 14641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot DEATH_TESTS = [] 14741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 1481be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# All the non-disabled tests. 1491be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaACTIVE_TESTS = [ 1501be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Abc', 1511be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Xyz', 1521be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1531be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestOne', 1541be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestTwo', 1551be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestThree', 1561be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1571be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestOne', 1581be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestA', 1591be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestB', 16041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot ] + DEATH_TESTS + PARAM_TESTS 1611be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1621be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaparam_tests_present = None 1631be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1641be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# Utilities. 1651be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 16641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabotenviron = os.environ.copy() 16741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 1681be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1691be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniadef SetEnvVar(env_var, value): 1701be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Sets the env variable to 'value'; unsets it when 'value' is None.""" 1711be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1721be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania if value is not None: 17341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot environ[env_var] = value 17441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot elif env_var in environ: 17541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot del environ[env_var] 17641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 1771be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 17841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabotdef RunAndReturnOutput(args = None): 17941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot """Runs the test program and returns its output.""" 1801be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 18141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot return gtest_test_utils.Subprocess([COMMAND] + (args or []), 18241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot env=environ).output 1831be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 18441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 18541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabotdef RunAndExtractTestList(args = None): 18641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot """Runs the test program and returns its exit code and a list of tests run.""" 18741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 18841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot p = gtest_test_utils.Subprocess([COMMAND] + (args or []), env=environ) 1891be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania tests_run = [] 1901be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania test_case = '' 1911be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania test = '' 19241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot for line in p.output.split('\n'): 1931be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania match = TEST_CASE_REGEX.match(line) 1941be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania if match is not None: 1951be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania test_case = match.group(1) 1961be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania else: 1971be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania match = TEST_REGEX.match(line) 1981be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania if match is not None: 1991be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania test = match.group(1) 20041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot tests_run.append(test_case + '.' + test) 20141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot return (tests_run, p.exit_code) 2021be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2031be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2041be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniadef InvokeWithModifiedEnv(extra_env, function, *args, **kwargs): 2051be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Runs the given function and arguments in a modified environment.""" 2061be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania try: 20741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot original_env = environ.copy() 20841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot environ.update(extra_env) 2091be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania return function(*args, **kwargs) 2101be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania finally: 21141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot environ.clear() 21241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot environ.update(original_env) 2131be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2141be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2151be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniadef RunWithSharding(total_shards, shard_index, command): 21641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot """Runs a test program shard and returns exit code and a list of tests run.""" 2171be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2181be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania extra_env = {SHARD_INDEX_ENV_VAR: str(shard_index), 2191be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania TOTAL_SHARDS_ENV_VAR: str(total_shards)} 22041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot return InvokeWithModifiedEnv(extra_env, RunAndExtractTestList, command) 2211be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2221be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania# The unit test. 2231be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2241be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 22541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabotclass GTestFilterUnitTest(gtest_test_utils.TestCase): 22641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot """Tests the env variable or the command line flag to filter tests.""" 2271be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2281be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania # Utilities. 2291be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2301be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def AssertSetEqual(self, lhs, rhs): 2311be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Asserts that two sets are equal.""" 2321be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2331be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania for elem in lhs: 2341be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.assert_(elem in rhs, '%s in %s' % (elem, rhs)) 2351be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2361be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania for elem in rhs: 2371be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.assert_(elem in lhs, '%s in %s' % (elem, lhs)) 2381be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2391be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def AssertPartitionIsValid(self, set_var, list_of_sets): 2401be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Asserts that list_of_sets is a valid partition of set_var.""" 2411be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2421be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania full_partition = [] 2431be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania for slice_var in list_of_sets: 2441be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania full_partition.extend(slice_var) 2451be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.assertEqual(len(set_var), len(full_partition)) 2461be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.assertEqual(sets.Set(set_var), sets.Set(full_partition)) 2471be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 24841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot def AdjustForParameterizedTests(self, tests_to_run): 24941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot """Adjust tests_to_run in case value parameterized tests are disabled.""" 25041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 2511be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania global param_tests_present 2521be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania if not param_tests_present: 25341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot return list(sets.Set(tests_to_run) - sets.Set(PARAM_TESTS)) 25441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot else: 25541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot return tests_to_run 25641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 25741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot def RunAndVerify(self, gtest_filter, tests_to_run): 25841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot """Checks that the binary runs correct set of tests for a given filter.""" 2591be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 26041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot tests_to_run = self.AdjustForParameterizedTests(tests_to_run) 2611be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 26241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # First, tests using the environment variable. 2631be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 26441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # Windows removes empty variables from the environment when passing it 26541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # to a new process. This means it is impossible to pass an empty filter 26641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # into a process using the environment variable. However, we can still 26741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # test the case when the variable is not supplied (i.e., gtest_filter is 26841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # None). 26941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # pylint: disable-msg=C6403 27041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot if CAN_TEST_EMPTY_FILTER or gtest_filter != '': 27141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot SetEnvVar(FILTER_ENV_VAR, gtest_filter) 27241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot tests_run = RunAndExtractTestList()[0] 27341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot SetEnvVar(FILTER_ENV_VAR, None) 27441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot self.AssertSetEqual(tests_run, tests_to_run) 27541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # pylint: enable-msg=C6403 2761be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 27741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # Next, tests using the command line flag. 2781be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2791be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania if gtest_filter is None: 28041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot args = [] 2811be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania else: 28241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot args = ['--%s=%s' % (FILTER_FLAG, gtest_filter)] 2831be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 28441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot tests_run = RunAndExtractTestList(args)[0] 2851be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.AssertSetEqual(tests_run, tests_to_run) 2861be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2871be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def RunAndVerifyWithSharding(self, gtest_filter, total_shards, tests_to_run, 28841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot args=None, check_exit_0=False): 28941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot """Checks that binary runs correct tests for the given filter and shard. 29041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 29141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot Runs all shards of gtest_filter_unittest_ with the given filter, and 2921be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania verifies that the right set of tests were run. The union of tests run 2931be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania on each shard should be identical to tests_to_run, without duplicates. 29441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 29541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot Args: 29641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot gtest_filter: A filter to apply to the tests. 29741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot total_shards: A total number of shards to split test run into. 29841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot tests_to_run: A set of tests expected to run. 29941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot args : Arguments to pass to the to the test binary. 30041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot check_exit_0: When set to a true value, make sure that all shards 30141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot return 0. 3021be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """ 30341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 30441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot tests_to_run = self.AdjustForParameterizedTests(tests_to_run) 30541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 30641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # Windows removes empty variables from the environment when passing it 30741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # to a new process. This means it is impossible to pass an empty filter 30841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # into a process using the environment variable. However, we can still 30941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # test the case when the variable is not supplied (i.e., gtest_filter is 31041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # None). 31141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # pylint: disable-msg=C6403 31241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot if CAN_TEST_EMPTY_FILTER or gtest_filter != '': 31341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot SetEnvVar(FILTER_ENV_VAR, gtest_filter) 31441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot partition = [] 31541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot for i in range(0, total_shards): 31641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot (tests_run, exit_code) = RunWithSharding(total_shards, i, args) 31741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot if check_exit_0: 31841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot self.assertEqual(0, exit_code) 31941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot partition.append(tests_run) 32041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 32141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot self.AssertPartitionIsValid(tests_to_run, partition) 32241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot SetEnvVar(FILTER_ENV_VAR, None) 32341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # pylint: enable-msg=C6403 3241be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 3251be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def RunAndVerifyAllowingDisabled(self, gtest_filter, tests_to_run): 32641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot """Checks that the binary runs correct set of tests for the given filter. 32741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 32841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot Runs gtest_filter_unittest_ with the given filter, and enables 3291be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania disabled tests. Verifies that the right set of tests were run. 33041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 33141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot Args: 33241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot gtest_filter: A filter to apply to the tests. 33341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot tests_to_run: A set of tests expected to run. 3341be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """ 33541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 33641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot tests_to_run = self.AdjustForParameterizedTests(tests_to_run) 33741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 3381be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania # Construct the command line. 33941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot args = ['--%s' % ALSO_RUN_DISABED_TESTS_FLAG] 3401be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania if gtest_filter is not None: 34141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot args.append('--%s=%s' % (FILTER_FLAG, gtest_filter)) 3421be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 34341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot tests_run = RunAndExtractTestList(args)[0] 3441be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.AssertSetEqual(tests_run, tests_to_run) 3451be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 3461be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def setUp(self): 34741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot """Sets up test case. 34841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 34941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot Determines whether value-parameterized tests are enabled in the binary and 35041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot sets the flags accordingly. 3511be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """ 35241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 3531be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania global param_tests_present 3541be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania if param_tests_present is None: 3551be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania param_tests_present = PARAM_TEST_REGEX.search( 35641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot RunAndReturnOutput()) is not None 3571be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 3581be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testDefaultBehavior(self): 3591be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Tests the behavior of not specifying the filter.""" 3601be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 3611be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify(None, ACTIVE_TESTS) 3621be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 3631be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testDefaultBehaviorWithShards(self): 36441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot """Tests the behavior without the filter, with sharding enabled.""" 36541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 3661be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyWithSharding(None, 1, ACTIVE_TESTS) 3671be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyWithSharding(None, 2, ACTIVE_TESTS) 3681be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyWithSharding(None, len(ACTIVE_TESTS) - 1, ACTIVE_TESTS) 3691be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyWithSharding(None, len(ACTIVE_TESTS), ACTIVE_TESTS) 3701be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyWithSharding(None, len(ACTIVE_TESTS) + 1, ACTIVE_TESTS) 3711be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 3721be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testEmptyFilter(self): 3731be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Tests an empty filter.""" 3741be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 3751be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('', []) 3761be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyWithSharding('', 1, []) 3771be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyWithSharding('', 2, []) 3781be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 3791be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testBadFilter(self): 3801be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Tests a filter that matches nothing.""" 3811be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 3821be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('BadFilter', []) 3831be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyAllowingDisabled('BadFilter', []) 3841be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 3851be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testFullName(self): 3861be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Tests filtering by full name.""" 3871be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 3881be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('FooTest.Xyz', ['FooTest.Xyz']) 3891be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyAllowingDisabled('FooTest.Xyz', ['FooTest.Xyz']) 3901be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyWithSharding('FooTest.Xyz', 5, ['FooTest.Xyz']) 3911be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 3921be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testUniversalFilters(self): 3931be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Tests filters that match everything.""" 3941be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 3951be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('*', ACTIVE_TESTS) 3961be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('*.*', ACTIVE_TESTS) 3971be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyWithSharding('*.*', len(ACTIVE_TESTS) - 3, ACTIVE_TESTS) 3981be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyAllowingDisabled('*', ACTIVE_TESTS + DISABLED_TESTS) 3991be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyAllowingDisabled('*.*', ACTIVE_TESTS + DISABLED_TESTS) 4001be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4011be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testFilterByTestCase(self): 4021be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Tests filtering by test case name.""" 4031be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4041be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('FooTest.*', ['FooTest.Abc', 'FooTest.Xyz']) 4051be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4061be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania BAZ_TESTS = ['BazTest.TestOne', 'BazTest.TestA', 'BazTest.TestB'] 4071be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('BazTest.*', BAZ_TESTS) 4081be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyAllowingDisabled('BazTest.*', 4091be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania BAZ_TESTS + ['BazTest.DISABLED_TestC']) 4101be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4111be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testFilterByTest(self): 4121be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Tests filtering by test name.""" 4131be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4141be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('*.TestOne', ['BarTest.TestOne', 'BazTest.TestOne']) 4151be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4161be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testFilterDisabledTests(self): 4171be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Select only the disabled tests to run.""" 4181be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4191be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('DISABLED_FoobarTest.Test1', []) 4201be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyAllowingDisabled('DISABLED_FoobarTest.Test1', 4211be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania ['DISABLED_FoobarTest.Test1']) 4221be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4231be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('*DISABLED_*', []) 4241be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyAllowingDisabled('*DISABLED_*', DISABLED_TESTS) 4251be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4261be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('*.DISABLED_*', []) 4271be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyAllowingDisabled('*.DISABLED_*', [ 4281be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.DISABLED_TestFour', 4291be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.DISABLED_TestFive', 4301be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.DISABLED_TestC', 4311be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'DISABLED_FoobarTest.DISABLED_Test2', 4321be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania ]) 4331be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4341be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('DISABLED_*', []) 4351be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerifyAllowingDisabled('DISABLED_*', [ 4361be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'DISABLED_FoobarTest.Test1', 4371be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'DISABLED_FoobarTest.DISABLED_Test2', 4381be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'DISABLED_FoobarbazTest.TestA', 4391be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania ]) 4401be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4411be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testWildcardInTestCaseName(self): 4421be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Tests using wildcard in the test case name.""" 4431be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4441be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('*a*.*', [ 4451be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestOne', 4461be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestTwo', 4471be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestThree', 4481be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4491be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestOne', 4501be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestA', 45141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'BazTest.TestB', ] + DEATH_TESTS + PARAM_TESTS) 4521be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4531be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testWildcardInTestName(self): 4541be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Tests using wildcard in the test name.""" 4551be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4561be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('*.*A*', ['FooTest.Abc', 'BazTest.TestA']) 4571be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4581be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testFilterWithoutDot(self): 4591be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Tests a filter that has no '.' in it.""" 4601be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4611be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('*z*', [ 4621be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Xyz', 4631be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4641be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestOne', 4651be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestA', 4661be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestB', 4671be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania ]) 4681be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4691be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testTwoPatterns(self): 4701be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Tests filters that consist of two patterns.""" 4711be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4721be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('Foo*.*:*A*', [ 4731be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Abc', 4741be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Xyz', 4751be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4761be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestA', 4771be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania ]) 4781be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4791be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania # An empty pattern + a non-empty one 4801be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify(':*A*', ['FooTest.Abc', 'BazTest.TestA']) 4811be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4821be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testThreePatterns(self): 4831be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Tests filters that consist of three patterns.""" 4841be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4851be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('*oo*:*A*:*One', [ 4861be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Abc', 4871be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Xyz', 4881be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4891be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestOne', 4901be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4911be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestOne', 4921be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestA', 4931be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania ]) 4941be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 4951be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania # The 2nd pattern is empty. 4961be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('*oo*::*One', [ 4971be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Abc', 4981be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Xyz', 4991be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5001be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestOne', 5011be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5021be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestOne', 5031be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania ]) 5041be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5051be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania # The last 2 patterns are empty. 5061be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('*oo*::', [ 5071be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Abc', 5081be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Xyz', 5091be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania ]) 5101be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5111be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testNegativeFilters(self): 51241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot self.RunAndVerify('*-BazTest.TestOne', [ 5131be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Abc', 5141be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Xyz', 5151be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5161be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestOne', 5171be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestTwo', 5181be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestThree', 5191be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5201be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestA', 5211be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BazTest.TestB', 52241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot ] + DEATH_TESTS + PARAM_TESTS) 5231be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 52441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot self.RunAndVerify('*-FooTest.Abc:BazTest.*', [ 5251be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'FooTest.Xyz', 5261be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5271be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestOne', 5281be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestTwo', 5291be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestThree', 53041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot ] + DEATH_TESTS + PARAM_TESTS) 5311be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5321be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('BarTest.*-BarTest.TestOne', [ 5331be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestTwo', 5341be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestThree', 5351be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania ]) 5361be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5371be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania # Tests without leading '*'. 53841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot self.RunAndVerify('-FooTest.Abc:FooTest.Xyz:BazTest.*', [ 5391be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestOne', 5401be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestTwo', 5411be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'BarTest.TestThree', 54241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot ] + DEATH_TESTS + PARAM_TESTS) 5431be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5441be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania # Value parameterized tests. 5451be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('*/*', PARAM_TESTS) 5461be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5471be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania # Value parameterized tests filtering by the sequence name. 5481be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('SeqP/*', [ 5491be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqP/ParamTest.TestX/0', 5501be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqP/ParamTest.TestX/1', 5511be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqP/ParamTest.TestY/0', 5521be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqP/ParamTest.TestY/1', 5531be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania ]) 5541be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5551be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania # Value parameterized tests filtering by the test name. 5561be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.RunAndVerify('*/0', [ 5571be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqP/ParamTest.TestX/0', 5581be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqP/ParamTest.TestY/0', 5591be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqQ/ParamTest.TestX/0', 5601be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 'SeqQ/ParamTest.TestY/0', 5611be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania ]) 5621be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5631be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testFlagOverridesEnvVar(self): 56441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot """Tests that the filter flag overrides the filtering env. variable.""" 5651be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5661be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania SetEnvVar(FILTER_ENV_VAR, 'Foo*') 56741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot args = ['--%s=%s' % (FILTER_FLAG, '*One')] 56841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot tests_run = RunAndExtractTestList(args)[0] 5691be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania SetEnvVar(FILTER_ENV_VAR, None) 5701be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5711be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.AssertSetEqual(tests_run, ['BarTest.TestOne', 'BazTest.TestOne']) 5721be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5731be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testShardStatusFileIsCreated(self): 5741be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania """Tests that the shard file is created if specified in the environment.""" 5751be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 57641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot shard_status_file = os.path.join(gtest_test_utils.GetTempDir(), 57741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'shard_status_file') 5781be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.assert_(not os.path.exists(shard_status_file)) 5791be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5801be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania extra_env = {SHARD_STATUS_FILE_ENV_VAR: shard_status_file} 5811be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania try: 58241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot InvokeWithModifiedEnv(extra_env, RunAndReturnOutput) 5831be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania finally: 5841be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.assert_(os.path.exists(shard_status_file)) 5851be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania os.remove(shard_status_file) 5861be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5871be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania def testShardStatusFileIsCreatedWithListTests(self): 58841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot """Tests that the shard file is created with the "list_tests" flag.""" 5891be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 59041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot shard_status_file = os.path.join(gtest_test_utils.GetTempDir(), 59141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'shard_status_file2') 5921be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.assert_(not os.path.exists(shard_status_file)) 5931be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 5941be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania extra_env = {SHARD_STATUS_FILE_ENV_VAR: shard_status_file} 5951be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania try: 59641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot output = InvokeWithModifiedEnv(extra_env, 59741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot RunAndReturnOutput, 59841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot [LIST_TESTS_FLAG]) 5991be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania finally: 60041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # This assertion ensures that Google Test enumerated the tests as 60141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot # opposed to running them. 60241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot self.assert_('[==========]' not in output, 60341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'Unexpected output during test enumeration.\n' 60441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'Please ensure that LIST_TESTS_FLAG is assigned the\n' 60541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'correct flag value for listing Google Test tests.') 60641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 6071be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania self.assert_(os.path.exists(shard_status_file)) 6081be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania os.remove(shard_status_file) 6091be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 61041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot if SUPPORTS_DEATH_TESTS: 61141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot def testShardingWorksWithDeathTests(self): 61241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot """Tests integration with death tests and sharding.""" 61341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 61441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot gtest_filter = 'HasDeathTest.*:SeqP/*' 61541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot expected_tests = [ 61641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'HasDeathTest.Test1', 61741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'HasDeathTest.Test2', 61841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 61941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'SeqP/ParamTest.TestX/0', 62041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'SeqP/ParamTest.TestX/1', 62141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'SeqP/ParamTest.TestY/0', 62241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 'SeqP/ParamTest.TestY/1', 62341d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot ] 62441d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot 62541d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot for flag in ['--gtest_death_test_style=threadsafe', 62641d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot '--gtest_death_test_style=fast']: 62741d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot self.RunAndVerifyWithSharding(gtest_filter, 3, expected_tests, 62841d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot check_exit_0=True, args=[flag]) 62941d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot self.RunAndVerifyWithSharding(gtest_filter, 5, expected_tests, 63041d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot check_exit_0=True, args=[flag]) 6311be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 6321be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaif __name__ == '__main__': 6331be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania gtest_test_utils.Main() 634