Unverified Commit 1246e580 authored by Gennadiy Civil's avatar Gennadiy Civil Committed by GitHub
Browse files

Merge branch 'master' into cleanup-cmake

parents 4b6a7a49 2172c08c
// Copyright 2013, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Each TEST() expands to some static registration logic. GCC puts all
// such static initialization logic for a translation unit in a common,
// internal function. Since Google's build system restricts how much
// stack space a function can use, there's a limit on how many TEST()s
// one can put in a single C++ test file. This test ensures that a large
// number of TEST()s can be defined in the same translation unit.
#include "gtest/gtest.h"
// This macro defines 10 dummy tests.
#define TEN_TESTS_(test_case_name) \
TEST(test_case_name, T0) {} \
TEST(test_case_name, T1) {} \
TEST(test_case_name, T2) {} \
TEST(test_case_name, T3) {} \
TEST(test_case_name, T4) {} \
TEST(test_case_name, T5) {} \
TEST(test_case_name, T6) {} \
TEST(test_case_name, T7) {} \
TEST(test_case_name, T8) {} \
TEST(test_case_name, T9) {}
// This macro defines 100 dummy tests.
#define HUNDRED_TESTS_(test_case_name_prefix) \
TEN_TESTS_(test_case_name_prefix ## 0) \
TEN_TESTS_(test_case_name_prefix ## 1) \
TEN_TESTS_(test_case_name_prefix ## 2) \
TEN_TESTS_(test_case_name_prefix ## 3) \
TEN_TESTS_(test_case_name_prefix ## 4) \
TEN_TESTS_(test_case_name_prefix ## 5) \
TEN_TESTS_(test_case_name_prefix ## 6) \
TEN_TESTS_(test_case_name_prefix ## 7) \
TEN_TESTS_(test_case_name_prefix ## 8) \
TEN_TESTS_(test_case_name_prefix ## 9)
// This macro defines 1000 dummy tests.
#define THOUSAND_TESTS_(test_case_name_prefix) \
HUNDRED_TESTS_(test_case_name_prefix ## 0) \
HUNDRED_TESTS_(test_case_name_prefix ## 1) \
HUNDRED_TESTS_(test_case_name_prefix ## 2) \
HUNDRED_TESTS_(test_case_name_prefix ## 3) \
HUNDRED_TESTS_(test_case_name_prefix ## 4) \
HUNDRED_TESTS_(test_case_name_prefix ## 5) \
HUNDRED_TESTS_(test_case_name_prefix ## 6) \
HUNDRED_TESTS_(test_case_name_prefix ## 7) \
HUNDRED_TESTS_(test_case_name_prefix ## 8) \
HUNDRED_TESTS_(test_case_name_prefix ## 9)
// Ensures that we can define 1000 TEST()s in the same translation
// unit.
THOUSAND_TESTS_(T)
int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
// We don't actually need to run the dummy tests - the purpose is to
// ensure that they compile.
return 0;
}
...@@ -27,24 +27,20 @@ ...@@ -27,24 +27,20 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Unit test utilities for Google C++ Testing Framework.""" """Unit test utilities for Google C++ Testing and Mocking Framework."""
# Suppresses the 'Import not at the top of the file' lint complaint. # Suppresses the 'Import not at the top of the file' lint complaint.
# pylint: disable-msg=C6204 # pylint: disable-msg=C6204
__author__ = 'wan@google.com (Zhanyong Wan)'
import os import os
import sys import sys
IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux'
IS_WINDOWS = os.name == 'nt' IS_WINDOWS = os.name == 'nt'
IS_CYGWIN = os.name == 'posix' and 'CYGWIN' in os.uname()[0] IS_CYGWIN = os.name == 'posix' and 'CYGWIN' in os.uname()[0]
import atexit import atexit
import shutil import shutil
import tempfile import tempfile
import unittest import unittest as _test_module
_test_module = unittest
try: try:
import subprocess import subprocess
...@@ -74,7 +70,7 @@ def SetEnvVar(env_var, value): ...@@ -74,7 +70,7 @@ def SetEnvVar(env_var, value):
# Here we expose a class from a particular module, depending on the # Here we expose a class from a particular module, depending on the
# environment. The comment suppresses the 'Invalid variable name' lint # environment. The comment suppresses the 'Invalid variable name' lint
# complaint. # complaint.
TestCase = _test_module.TestCase # pylint: disable-msg=C6409 TestCase = _test_module.TestCase # pylint: disable=C6409
# Initially maps a flag to its default value. After # Initially maps a flag to its default value. After
# _ParseAndStripGTestFlags() is called, maps a flag to its actual value. # _ParseAndStripGTestFlags() is called, maps a flag to its actual value.
...@@ -88,7 +84,7 @@ def _ParseAndStripGTestFlags(argv): ...@@ -88,7 +84,7 @@ def _ParseAndStripGTestFlags(argv):
# Suppresses the lint complaint about a global variable since we need it # Suppresses the lint complaint about a global variable since we need it
# here to maintain module-wide state. # here to maintain module-wide state.
global _gtest_flags_are_parsed # pylint: disable-msg=W0603 global _gtest_flags_are_parsed # pylint: disable=W0603
if _gtest_flags_are_parsed: if _gtest_flags_are_parsed:
return return
...@@ -310,7 +306,7 @@ def Main(): ...@@ -310,7 +306,7 @@ def Main():
_ParseAndStripGTestFlags(sys.argv) _ParseAndStripGTestFlags(sys.argv)
# The tested binaries should not be writing XML output files unless the # The tested binaries should not be writing XML output files unless the
# script explicitly instructs them to. # script explicitly instructs them to.
# TODO(vladl@google.com): Move this into Subprocess when we implement # FIXME: Move this into Subprocess when we implement
# passing environment into it as a parameter. # passing environment into it as a parameter.
if GTEST_OUTPUT_VAR_NAME in os.environ: if GTEST_OUTPUT_VAR_NAME in os.environ:
del os.environ[GTEST_OUTPUT_VAR_NAME] del os.environ[GTEST_OUTPUT_VAR_NAME]
......
#!/usr/bin/env python
#
# Copyright 2018 Google LLC. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Verifies that Google Test uses filter provided via testbridge."""
import os
import gtest_test_utils
binary_name = 'gtest_testbridge_test_'
COMMAND = gtest_test_utils.GetTestExecutablePath(binary_name)
TESTBRIDGE_NAME = 'TESTBRIDGE_TEST_ONLY'
def Assert(condition):
if not condition:
raise AssertionError
class GTestTestFilterTest(gtest_test_utils.TestCase):
def testTestExecutionIsFiltered(self):
"""Tests that the test filter is picked up from the testbridge env var."""
subprocess_env = os.environ.copy()
subprocess_env[TESTBRIDGE_NAME] = '*.TestThatSucceeds'
p = gtest_test_utils.Subprocess(COMMAND, env=subprocess_env)
self.assertEquals(0, p.exit_code)
Assert('filter = *.TestThatSucceeds' in p.output)
Assert('[ OK ] TestFilterTest.TestThatSucceeds' in p.output)
Assert('[ PASSED ] 1 test.' in p.output)
if __name__ == '__main__':
gtest_test_utils.Main()
// Copyright 2018, Google LLC.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This program is meant to be run by gtest_test_filter_test.py. Do not run
// it directly.
#include "gtest/gtest.h"
// These tests are used to detect if filtering is working. Only
// 'TestThatSucceeds' should ever run.
TEST(TestFilterTest, TestThatSucceeds) {}
TEST(TestFilterTest, TestThatFails) {
ASSERT_TRUE(false) << "This test should never be run.";
}
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Tests Google Test's throw-on-failure mode with exceptions enabled. // Tests Google Test's throw-on-failure mode with exceptions enabled.
......
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// //
// Tests for Google Test itself. This verifies that the basic constructs of // Tests for Google Test itself. This verifies that the basic constructs of
// Google Test work. // Google Test work.
...@@ -35,8 +34,8 @@ ...@@ -35,8 +34,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
// Verifies that the command line flag variables can be accessed in // Verifies that the command line flag variables can be accessed in
// code once "gtest/gtest.h" has been // code once "gtest.h" has been #included.
// #included. Do not move it after other gtest #includes. // Do not move it after other gtest #includes.
TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) { TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) {
bool dummy = testing::GTEST_FLAG(also_run_disabled_tests) bool dummy = testing::GTEST_FLAG(also_run_disabled_tests)
|| testing::GTEST_FLAG(break_on_failure) || testing::GTEST_FLAG(break_on_failure)
...@@ -380,6 +379,31 @@ TEST(GetTestTypeIdTest, ReturnsTheSameValueInsideOrOutsideOfGoogleTest) { ...@@ -380,6 +379,31 @@ TEST(GetTestTypeIdTest, ReturnsTheSameValueInsideOrOutsideOfGoogleTest) {
EXPECT_EQ(kTestTypeIdInGoogleTest, GetTestTypeId()); EXPECT_EQ(kTestTypeIdInGoogleTest, GetTestTypeId());
} }
// Tests CanonicalizeForStdLibVersioning.
using ::testing::internal::CanonicalizeForStdLibVersioning;
TEST(CanonicalizeForStdLibVersioning, LeavesUnversionedNamesUnchanged) {
EXPECT_EQ("std::bind", CanonicalizeForStdLibVersioning("std::bind"));
EXPECT_EQ("std::_", CanonicalizeForStdLibVersioning("std::_"));
EXPECT_EQ("std::__foo", CanonicalizeForStdLibVersioning("std::__foo"));
EXPECT_EQ("gtl::__1::x", CanonicalizeForStdLibVersioning("gtl::__1::x"));
EXPECT_EQ("__1::x", CanonicalizeForStdLibVersioning("__1::x"));
EXPECT_EQ("::__1::x", CanonicalizeForStdLibVersioning("::__1::x"));
}
TEST(CanonicalizeForStdLibVersioning, ElidesDoubleUnderNames) {
EXPECT_EQ("std::bind", CanonicalizeForStdLibVersioning("std::__1::bind"));
EXPECT_EQ("std::_", CanonicalizeForStdLibVersioning("std::__1::_"));
EXPECT_EQ("std::bind", CanonicalizeForStdLibVersioning("std::__g::bind"));
EXPECT_EQ("std::_", CanonicalizeForStdLibVersioning("std::__g::_"));
EXPECT_EQ("std::bind",
CanonicalizeForStdLibVersioning("std::__google::bind"));
EXPECT_EQ("std::_", CanonicalizeForStdLibVersioning("std::__google::_"));
}
// Tests FormatTimeInMillisAsSeconds(). // Tests FormatTimeInMillisAsSeconds().
TEST(FormatTimeInMillisAsSecondsTest, FormatsZero) { TEST(FormatTimeInMillisAsSecondsTest, FormatsZero) {
...@@ -419,10 +443,10 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test { ...@@ -419,10 +443,10 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test {
virtual void SetUp() { virtual void SetUp() {
saved_tz_ = NULL; saved_tz_ = NULL;
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* getenv, strdup: deprecated */) GTEST_DISABLE_MSC_DEPRECATED_PUSH_(/* getenv, strdup: deprecated */)
if (getenv("TZ")) if (getenv("TZ"))
saved_tz_ = strdup(getenv("TZ")); saved_tz_ = strdup(getenv("TZ"));
GTEST_DISABLE_MSC_WARNINGS_POP_() GTEST_DISABLE_MSC_DEPRECATED_POP_()
// Set up the time zone for FormatEpochTimeInMillisAsIso8601 to use. We // Set up the time zone for FormatEpochTimeInMillisAsIso8601 to use. We
// cannot use the local time zone because the function's output depends // cannot use the local time zone because the function's output depends
...@@ -1360,8 +1384,7 @@ class TestResultTest : public Test { ...@@ -1360,8 +1384,7 @@ class TestResultTest : public Test {
// In order to test TestResult, we need to modify its internal // In order to test TestResult, we need to modify its internal
// state, in particular the TestPartResult vector it holds. // state, in particular the TestPartResult vector it holds.
// test_part_results() returns a const reference to this vector. // test_part_results() returns a const reference to this vector.
// We cast it to a non-const object s.t. it can be modified (yes, // We cast it to a non-const object s.t. it can be modified
// this is a hack).
TPRVector* results1 = const_cast<TPRVector*>( TPRVector* results1 = const_cast<TPRVector*>(
&TestResultAccessor::test_part_results(*r1)); &TestResultAccessor::test_part_results(*r1));
TPRVector* results2 = const_cast<TPRVector*>( TPRVector* results2 = const_cast<TPRVector*>(
...@@ -4664,7 +4687,7 @@ TEST(MacroTest, ADD_FAILURE_AT) { ...@@ -4664,7 +4687,7 @@ TEST(MacroTest, ADD_FAILURE_AT) {
// Unfortunately, we cannot verify that the failure message contains // Unfortunately, we cannot verify that the failure message contains
// the right file path and line number the same way, as // the right file path and line number the same way, as
// EXPECT_NONFATAL_FAILURE() doesn't get to see the file path and // EXPECT_NONFATAL_FAILURE() doesn't get to see the file path and
// line number. Instead, we do that in gtest_output_test_.cc. // line number. Instead, we do that in googletest-output-test_.cc.
} }
// Tests FAIL. // Tests FAIL.
...@@ -7348,7 +7371,7 @@ GTEST_TEST(AlternativeNameTest, Works) { // GTEST_TEST is the same as TEST. ...@@ -7348,7 +7371,7 @@ GTEST_TEST(AlternativeNameTest, Works) { // GTEST_TEST is the same as TEST.
// Tests for internal utilities necessary for implementation of the universal // Tests for internal utilities necessary for implementation of the universal
// printing. // printing.
// TODO(vladl@google.com): Find a better home for them. // FIXME: Find a better home for them.
class ConversionHelperBase {}; class ConversionHelperBase {};
class ConversionHelperDerived : public ConversionHelperBase {}; class ConversionHelperDerived : public ConversionHelperBase {};
...@@ -7748,3 +7771,25 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) { ...@@ -7748,3 +7771,25 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) {
EXPECT_FALSE(SkipPrefix("world!", &p)); EXPECT_FALSE(SkipPrefix("world!", &p));
EXPECT_EQ(str, p); EXPECT_EQ(str, p);
} }
// Tests ad_hoc_test_result().
class AdHocTestResultTest : public testing::Test {
protected:
static void SetUpTestCase() {
FAIL() << "A failure happened inside SetUpTestCase().";
}
};
TEST_F(AdHocTestResultTest, AdHocTestResultForTestCaseShowsFailure) {
const testing::TestResult& test_result = testing::UnitTest::GetInstance()
->current_test_case()
->ad_hoc_test_result();
EXPECT_TRUE(test_result.Failed());
}
TEST_F(AdHocTestResultTest, AdHocTestResultTestForUnitTestDoesNotShowFailure) {
const testing::TestResult& test_result =
testing::UnitTest::GetInstance()->ad_hoc_test_result();
EXPECT_FALSE(test_result.Failed());
}
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
//
// gtest_xml_outfile1_test_ writes some xml via TestProperty used by // gtest_xml_outfile1_test_ writes some xml via TestProperty used by
// gtest_xml_outfiles_test.py // gtest_xml_outfiles_test.py
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
//
// gtest_xml_outfile2_test_ writes some xml via TestProperty used by // gtest_xml_outfile2_test_ writes some xml via TestProperty used by
// gtest_xml_outfiles_test.py // gtest_xml_outfiles_test.py
......
...@@ -111,11 +111,11 @@ class GTestXMLOutFilesTest(gtest_xml_test_utils.GTestXMLTestCase): ...@@ -111,11 +111,11 @@ class GTestXMLOutFilesTest(gtest_xml_test_utils.GTestXMLTestCase):
self.assert_(p.exited) self.assert_(p.exited)
self.assertEquals(0, p.exit_code) self.assertEquals(0, p.exit_code)
# TODO(wan@google.com): libtool causes the built test binary to be # FIXME: libtool causes the built test binary to be
# named lt-gtest_xml_outfiles_test_ instead of # named lt-gtest_xml_outfiles_test_ instead of
# gtest_xml_outfiles_test_. To account for this possibility, we # gtest_xml_outfiles_test_. To account for this possibility, we
# allow both names in the following code. We should remove this # allow both names in the following code. We should remove this
# hack when Chandler Carruth's libtool replacement tool is ready. # when libtool replacement tool is ready.
output_file_name1 = test_name + ".xml" output_file_name1 = test_name + ".xml"
output_file1 = os.path.join(self.output_dir_, output_file_name1) output_file1 = os.path.join(self.output_dir_, output_file_name1)
output_file_name2 = 'lt-' + output_file_name1 output_file_name2 = 'lt-' + output_file_name1
......
...@@ -47,17 +47,22 @@ GTEST_OUTPUT_FLAG = '--gtest_output' ...@@ -47,17 +47,22 @@ GTEST_OUTPUT_FLAG = '--gtest_output'
GTEST_DEFAULT_OUTPUT_FILE = 'test_detail.xml' GTEST_DEFAULT_OUTPUT_FILE = 'test_detail.xml'
GTEST_PROGRAM_NAME = 'gtest_xml_output_unittest_' GTEST_PROGRAM_NAME = 'gtest_xml_output_unittest_'
# The flag indicating stacktraces are not supported
NO_STACKTRACE_SUPPORT_FLAG = '--no_stacktrace_support'
# The environment variables for test sharding. # The environment variables for test sharding.
TOTAL_SHARDS_ENV_VAR = 'GTEST_TOTAL_SHARDS' TOTAL_SHARDS_ENV_VAR = 'GTEST_TOTAL_SHARDS'
SHARD_INDEX_ENV_VAR = 'GTEST_SHARD_INDEX' SHARD_INDEX_ENV_VAR = 'GTEST_SHARD_INDEX'
SHARD_STATUS_FILE_ENV_VAR = 'GTEST_SHARD_STATUS_FILE' SHARD_STATUS_FILE_ENV_VAR = 'GTEST_SHARD_STATUS_FILE'
SUPPORTS_STACK_TRACES = False SUPPORTS_STACK_TRACES = NO_STACKTRACE_SUPPORT_FLAG not in sys.argv
if SUPPORTS_STACK_TRACES: if SUPPORTS_STACK_TRACES:
STACK_TRACE_TEMPLATE = '\nStack trace:\n*' STACK_TRACE_TEMPLATE = '\nStack trace:\n*'
else: else:
STACK_TRACE_TEMPLATE = '' STACK_TRACE_TEMPLATE = ''
# unittest.main() can't handle unknown flags
sys.argv.remove(NO_STACKTRACE_SUPPORT_FLAG)
EXPECTED_NON_EMPTY_XML = """<?xml version="1.0" encoding="UTF-8"?> EXPECTED_NON_EMPTY_XML = """<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="23" failures="4" disabled="2" errors="0" time="*" timestamp="*" name="AllTests" ad_hoc_property="42"> <testsuites tests="23" failures="4" disabled="2" errors="0" time="*" timestamp="*" name="AllTests" ad_hoc_property="42">
......
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// //
// This is part of the unit test for gtest_prod.h. // This is part of the unit test for gtest_prod.h.
......
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// //
// This is part of the unit test for gtest_prod.h. // This is part of the unit test for gtest_prod.h.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// examples. It is set in the "Based On:" dropdown in the "Project" info // examples. It is set in the "Based On:" dropdown in the "Project" info
// dialog. // dialog.
// This file is based on the Xcode Configuration files in: // This file is based on the Xcode Configuration files in:
// http://code.google.com/p/google-toolbox-for-mac/ // https://github.com/google/google-toolbox-for-mac
// //
#include "General.xcconfig" #include "General.xcconfig"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// These are Framework target settings for the gtest framework and examples. It // These are Framework target settings for the gtest framework and examples. It
// is set in the "Based On:" dropdown in the "Target" info dialog. // is set in the "Based On:" dropdown in the "Target" info dialog.
// This file is based on the Xcode Configuration files in: // This file is based on the Xcode Configuration files in:
// http://code.google.com/p/google-toolbox-for-mac/ // https://github.com/google/google-toolbox-for-mac
// //
// Dynamic libs need to be position independent // Dynamic libs need to be position independent
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// These are General configuration settings for the gtest framework and // These are General configuration settings for the gtest framework and
// examples. // examples.
// This file is based on the Xcode Configuration files in: // This file is based on the Xcode Configuration files in:
// http://code.google.com/p/google-toolbox-for-mac/ // https://github.com/google/google-toolbox-for-mac
// //
// Build for PPC and Intel, 32- and 64-bit // Build for PPC and Intel, 32- and 64-bit
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// and examples. It is set in the "Based On:" dropdown in the "Project" info // and examples. It is set in the "Based On:" dropdown in the "Project" info
// dialog. // dialog.
// This file is based on the Xcode Configuration files in: // This file is based on the Xcode Configuration files in:
// http://code.google.com/p/google-toolbox-for-mac/ // https://github.com/google/google-toolbox-for-mac
// //
#include "General.xcconfig" #include "General.xcconfig"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// These are static library target settings for libgtest.a. It // These are static library target settings for libgtest.a. It
// is set in the "Based On:" dropdown in the "Target" info dialog. // is set in the "Based On:" dropdown in the "Target" info dialog.
// This file is based on the Xcode Configuration files in: // This file is based on the Xcode Configuration files in:
// http://code.google.com/p/google-toolbox-for-mac/ // https://github.com/google/google-toolbox-for-mac
// //
// Static libs can be included in bundles so make them position independent // Static libs can be included in bundles so make them position independent
......
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