aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGennadiy Civil <misterg@google.com>2018-01-15 16:56:17 -0500
committerGennadiy Civil <misterg@google.com>2018-01-15 16:56:17 -0500
commitf45c22c4824934299f2899d2717efbf3061cfe73 (patch)
treeef5e28334935c90a6079f501cfd81db35a24adc4
parent5f4ce9d88475b5f5b089c10983ea65cdc9cb92d8 (diff)
downloadgoogletest-f45c22c4824934299f2899d2717efbf3061cfe73.tar.gz
googletest-f45c22c4824934299f2899d2717efbf3061cfe73.tar.bz2
googletest-f45c22c4824934299f2899d2717efbf3061cfe73.zip
Test files for corresponding changes
-rwxr-xr-xgoogletest/test/gtest_xml_output_unittest.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/googletest/test/gtest_xml_output_unittest.py b/googletest/test/gtest_xml_output_unittest.py
index 9ba08dfb..3b0abaea 100755
--- a/googletest/test/gtest_xml_output_unittest.py
+++ b/googletest/test/gtest_xml_output_unittest.py
@@ -46,11 +46,16 @@ import gtest_xml_test_utils
GTEST_FILTER_FLAG = '--gtest_filter'
GTEST_LIST_TESTS_FLAG = '--gtest_list_tests'
-GTEST_OUTPUT_FLAG = "--gtest_output"
-GTEST_DEFAULT_OUTPUT_FILE = "test_detail.xml"
-GTEST_PROGRAM_NAME = "gtest_xml_output_unittest_"
+GTEST_OUTPUT_FLAG = '--gtest_output'
+GTEST_DEFAULT_OUTPUT_FILE = 'test_detail.xml'
+GTEST_PROGRAM_NAME = 'gtest_xml_output_unittest_'
-SUPPORTS_STACK_TRACES = False
+# The environment variables for test sharding.
+TOTAL_SHARDS_ENV_VAR = 'TEST_TOTAL_SHARDS'
+SHARD_INDEX_ENV_VAR = 'TEST_SHARD_INDEX'
+SHARD_STATUS_FILE_ENV_VAR = 'GTEST_SHARD_STATUS_FILE'
+
+SUPPORTS_STACK_TRACES = IS_LINUX
if SUPPORTS_STACK_TRACES:
STACK_TRACE_TEMPLATE = '\nStack trace:\n*'
@@ -276,7 +281,22 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
self._TestXmlOutput(GTEST_PROGRAM_NAME, EXPECTED_FILTERED_TEST_XML, 0,
extra_args=['%s=SuccessfulTest.*' % GTEST_FILTER_FLAG])
- def _GetXmlOutput(self, gtest_prog_name, extra_args, expected_exit_code):
+ def testShardedTestXmlOutput(self):
+ """Verifies XML output when run using multiple shards.
+
+ Runs a test program that executes only one shard and verifies that tests
+ from other shards do not show up in the XML output.
+ """
+
+ self._TestXmlOutput(
+ GTEST_PROGRAM_NAME,
+ EXPECTED_SHARDED_TEST_XML,
+ 0,
+ extra_env={SHARD_INDEX_ENV_VAR: '0',
+ TOTAL_SHARDS_ENV_VAR: '10'})
+
+ def _GetXmlOutput(self, gtest_prog_name, extra_args, extra_env,
+ expected_exit_code):
"""
Returns the xml output generated by running the program gtest_prog_name.
Furthermore, the program's exit code must be expected_exit_code.