Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
1dad4cf5
Unverified
Commit
1dad4cf5
authored
Aug 16, 2018
by
Gennadiy Civil
Committed by
GitHub
Aug 16, 2018
Browse files
Merge branch 'master' into fix_death_test_child_mingw_wer_issue1116
parents
10f05a62
490554aa
Changes
215
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
177 additions
and
26 deletions
+177
-26
googletest/test/gtest_testbridge_test.py
googletest/test/gtest_testbridge_test.py
+63
-0
googletest/test/gtest_testbridge_test_.cc
googletest/test/gtest_testbridge_test_.cc
+43
-0
googletest/test/gtest_throw_on_failure_ex_test.cc
googletest/test/gtest_throw_on_failure_ex_test.cc
+1
-2
googletest/test/gtest_unittest.cc
googletest/test/gtest_unittest.cc
+55
-10
googletest/test/gtest_xml_outfile1_test_.cc
googletest/test/gtest_xml_outfile1_test_.cc
+0
-1
googletest/test/gtest_xml_outfile2_test_.cc
googletest/test/gtest_xml_outfile2_test_.cc
+0
-1
googletest/test/gtest_xml_outfiles_test.py
googletest/test/gtest_xml_outfiles_test.py
+2
-2
googletest/test/gtest_xml_output_unittest.py
googletest/test/gtest_xml_output_unittest.py
+6
-1
googletest/test/production.cc
googletest/test/production.cc
+1
-2
googletest/test/production.h
googletest/test/production.h
+1
-2
googletest/xcode/Config/DebugProject.xcconfig
googletest/xcode/Config/DebugProject.xcconfig
+1
-1
googletest/xcode/Config/FrameworkTarget.xcconfig
googletest/xcode/Config/FrameworkTarget.xcconfig
+1
-1
googletest/xcode/Config/General.xcconfig
googletest/xcode/Config/General.xcconfig
+1
-1
googletest/xcode/Config/ReleaseProject.xcconfig
googletest/xcode/Config/ReleaseProject.xcconfig
+1
-1
googletest/xcode/Config/StaticLibraryTarget.xcconfig
googletest/xcode/Config/StaticLibraryTarget.xcconfig
+1
-1
No files found.
googletest/test/gtest_testbridge_test.py
0 → 100755
View file @
1dad4cf5
#!/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
()
googletest/test/gtest_testbridge_test_.cc
0 → 100644
View file @
1dad4cf5
// 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."
;
}
googletest/test/gtest_throw_on_failure_ex_test.cc
View file @
1dad4cf5
...
...
@@ -26,8 +26,7 @@
// 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.
//
// Author: wan@google.com (Zhanyong Wan)
// Tests Google Test's throw-on-failure mode with exceptions enabled.
...
...
googletest/test/gtest_unittest.cc
View file @
1dad4cf5
...
...
@@ -26,8 +26,7 @@
// 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.
//
// Author: wan@google.com (Zhanyong Wan)
//
// Tests for Google Test itself. This verifies that the basic constructs of
// Google Test work.
...
...
@@ -35,8 +34,8 @@
#include "gtest/gtest.h"
// Verifies that the command line flag variables can be accessed in
// code once "gtest
/gtest
.h" has been
//
#included.
Do not move it after other gtest #includes.
// code once "gtest.h" has been
#included.
// Do not move it after other gtest #includes.
TEST
(
CommandLineFlagsTest
,
CanBeAccessedInCodeOnceGTestHIsIncluded
)
{
bool
dummy
=
testing
::
GTEST_FLAG
(
also_run_disabled_tests
)
||
testing
::
GTEST_FLAG
(
break_on_failure
)
...
...
@@ -380,6 +379,31 @@ TEST(GetTestTypeIdTest, ReturnsTheSameValueInsideOrOutsideOfGoogleTest) {
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().
TEST
(
FormatTimeInMillisAsSecondsTest
,
FormatsZero
)
{
...
...
@@ -419,10 +443,10 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test {
virtual
void
SetUp
()
{
saved_tz_
=
NULL
;
GTEST_DISABLE_MSC_
WARNINGS
_PUSH_
(
4996
/* getenv, strdup: deprecated */
)
GTEST_DISABLE_MSC_
DEPRECATED
_PUSH_
(
/* getenv, strdup: deprecated */
)
if
(
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
// cannot use the local time zone because the function's output depends
...
...
@@ -1360,8 +1384,7 @@ class TestResultTest : public Test {
// In order to test TestResult, we need to modify its internal
// state, in particular the TestPartResult vector it holds.
// 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,
// this is a hack).
// We cast it to a non-const object s.t. it can be modified
TPRVector
*
results1
=
const_cast
<
TPRVector
*>
(
&
TestResultAccessor
::
test_part_results
(
*
r1
));
TPRVector
*
results2
=
const_cast
<
TPRVector
*>
(
...
...
@@ -4664,7 +4687,7 @@ TEST(MacroTest, ADD_FAILURE_AT) {
// Unfortunately, we cannot verify that the failure message contains
// the right file path and line number the same way, as
// 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 g
oogle
test
-
output
-
test_.cc.
}
// Tests FAIL.
...
...
@@ -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
// printing.
//
TODO(vladl@google.com)
: Find a better home for them.
//
FIXME
: Find a better home for them.
class
ConversionHelperBase
{};
class
ConversionHelperDerived
:
public
ConversionHelperBase
{};
...
...
@@ -7748,3 +7771,25 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) {
EXPECT_FALSE
(
SkipPrefix
(
"world!"
,
&
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
());
}
googletest/test/gtest_xml_outfile1_test_.cc
View file @
1dad4cf5
...
...
@@ -27,7 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// 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_outfiles_test.py
...
...
googletest/test/gtest_xml_outfile2_test_.cc
View file @
1dad4cf5
...
...
@@ -27,7 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// 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_outfiles_test.py
...
...
googletest/test/gtest_xml_outfiles_test.py
View file @
1dad4cf5
...
...
@@ -111,11 +111,11 @@ class GTestXMLOutFilesTest(gtest_xml_test_utils.GTestXMLTestCase):
self
.
assert_
(
p
.
exited
)
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
# gtest_xml_outfiles_test_. To account for this possibility, we
# 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_file1
=
os
.
path
.
join
(
self
.
output_dir_
,
output_file_name1
)
output_file_name2
=
'lt-'
+
output_file_name1
...
...
googletest/test/gtest_xml_output_unittest.py
View file @
1dad4cf5
...
...
@@ -47,17 +47,22 @@ GTEST_OUTPUT_FLAG = '--gtest_output'
GTEST_DEFAULT_OUTPUT_FILE
=
'test_detail.xml'
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.
TOTAL_SHARDS_ENV_VAR
=
'GTEST_TOTAL_SHARDS'
SHARD_INDEX_ENV_VAR
=
'GTEST_SHARD_INDEX'
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
:
STACK_TRACE_TEMPLATE
=
'
\n
Stack trace:
\n
*'
else
:
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"?>
<testsuites tests="23" failures="4" disabled="2" errors="0" time="*" timestamp="*" name="AllTests" ad_hoc_property="42">
...
...
googletest/test/production.cc
View file @
1dad4cf5
...
...
@@ -26,8 +26,7 @@
// 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.
//
// Author: wan@google.com (Zhanyong Wan)
//
// This is part of the unit test for gtest_prod.h.
...
...
googletest/test/production.h
View file @
1dad4cf5
...
...
@@ -26,8 +26,7 @@
// 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.
//
// Author: wan@google.com (Zhanyong Wan)
//
// This is part of the unit test for gtest_prod.h.
...
...
googletest/xcode/Config/DebugProject.xcconfig
View file @
1dad4cf5
...
...
@@ -5,7 +5,7 @@
// examples. It is set in the "Based On:" dropdown in the "Project" info
// dialog.
// This file is based on the Xcode Configuration files in:
// http://
code.google.com/p
/google-toolbox-for-mac
/
// http
s
://
github.com/google
/google-toolbox-for-mac
//
#include "General.xcconfig"
...
...
googletest/xcode/Config/FrameworkTarget.xcconfig
View file @
1dad4cf5
...
...
@@ -4,7 +4,7 @@
// These are Framework target settings for the gtest framework and examples. It
// is set in the "Based On:" dropdown in the "Target" info dialog.
// This file is based on the Xcode Configuration files in:
// http://
code.google.com/p
/google-toolbox-for-mac
/
// http
s
://
github.com/google
/google-toolbox-for-mac
//
// Dynamic libs need to be position independent
...
...
googletest/xcode/Config/General.xcconfig
View file @
1dad4cf5
...
...
@@ -4,7 +4,7 @@
// These are General configuration settings for the gtest framework and
// examples.
// This file is based on the Xcode Configuration files in:
// http://
code.google.com/p
/google-toolbox-for-mac
/
// http
s
://
github.com/google
/google-toolbox-for-mac
//
// Build for PPC and Intel, 32- and 64-bit
...
...
googletest/xcode/Config/ReleaseProject.xcconfig
View file @
1dad4cf5
...
...
@@ -5,7 +5,7 @@
// and examples. It is set in the "Based On:" dropdown in the "Project" info
// dialog.
// This file is based on the Xcode Configuration files in:
// http://
code.google.com/p
/google-toolbox-for-mac
/
// http
s
://
github.com/google
/google-toolbox-for-mac
//
#include "General.xcconfig"
...
...
googletest/xcode/Config/StaticLibraryTarget.xcconfig
View file @
1dad4cf5
...
...
@@ -4,7 +4,7 @@
// These are static library target settings for libgtest.a. It
// is set in the "Based On:" dropdown in the "Target" info dialog.
// This file is based on the Xcode Configuration files in:
// http://
code.google.com/p
/google-toolbox-for-mac
/
// http
s
://
github.com/google
/google-toolbox-for-mac
//
// Static libs can be included in bundles so make them position independent
...
...
Prev
1
…
7
8
9
10
11
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment