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
e9b05a4d
Unverified
Commit
e9b05a4d
authored
Aug 07, 2018
by
tisi1988
Committed by
GitHub
Aug 07, 2018
Browse files
Merge branch 'master' into master
parents
25e1436b
28b71e44
Changes
69
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
37 additions
and
30 deletions
+37
-30
googletest/test/googletest-break-on-failure-unittest_.cc
googletest/test/googletest-break-on-failure-unittest_.cc
+0
-0
googletest/test/googletest-catch-exceptions-test.py
googletest/test/googletest-catch-exceptions-test.py
+6
-6
googletest/test/googletest-catch-exceptions-test_.cc
googletest/test/googletest-catch-exceptions-test_.cc
+1
-1
googletest/test/googletest-color-test.py
googletest/test/googletest-color-test.py
+2
-2
googletest/test/googletest-color-test_.cc
googletest/test/googletest-color-test_.cc
+0
-0
googletest/test/googletest-death-test-test.cc
googletest/test/googletest-death-test-test.cc
+1
-1
googletest/test/googletest-death-test_ex_test.cc
googletest/test/googletest-death-test_ex_test.cc
+1
-1
googletest/test/googletest-env-var-test.py
googletest/test/googletest-env-var-test.py
+2
-2
googletest/test/googletest-env-var-test_.cc
googletest/test/googletest-env-var-test_.cc
+1
-1
googletest/test/googletest-filepath-test.cc
googletest/test/googletest-filepath-test.cc
+0
-0
googletest/test/googletest-filter-unittest.py
googletest/test/googletest-filter-unittest.py
+6
-6
googletest/test/googletest-filter-unittest_.cc
googletest/test/googletest-filter-unittest_.cc
+0
-0
googletest/test/googletest-json-outfiles-test.py
googletest/test/googletest-json-outfiles-test.py
+0
-0
googletest/test/googletest-json-output-unittest.py
googletest/test/googletest-json-output-unittest.py
+8
-1
googletest/test/googletest-linked-ptr-test.cc
googletest/test/googletest-linked-ptr-test.cc
+0
-0
googletest/test/googletest-list-tests-unittest.py
googletest/test/googletest-list-tests-unittest.py
+7
-7
googletest/test/googletest-list-tests-unittest_.cc
googletest/test/googletest-list-tests-unittest_.cc
+0
-0
googletest/test/googletest-listener-test.cc
googletest/test/googletest-listener-test.cc
+0
-0
googletest/test/googletest-message-test.cc
googletest/test/googletest-message-test.cc
+0
-0
googletest/test/googletest-options-test.cc
googletest/test/googletest-options-test.cc
+2
-2
No files found.
googletest/test/gtest
_
break
_
on
_
failure
_
unittest_.cc
→
googletest/test/g
oogle
test
-
break
-
on
-
failure
-
unittest_.cc
View file @
e9b05a4d
File moved
googletest/test/gtest
_
catch
_
exceptions
_
test.py
→
googletest/test/g
oogle
test
-
catch
-
exceptions
-
test.py
View file @
e9b05a4d
...
...
@@ -30,8 +30,8 @@
"""Tests Google Test's exception catching behavior.
This script invokes gtest
_
catch
_
exceptions
_
test_ and
gtest
_
catch
_
exceptions
_
ex
_
test_ (programs written with
This script invokes g
oogle
test
-
catch
-
exceptions
-
test_ and
g
oogle
test
-
catch
-
exceptions
-
ex
-
test_ (programs written with
Google Test) and verifies their output.
"""
...
...
@@ -45,15 +45,15 @@ LIST_TESTS_FLAG = FLAG_PREFIX + 'list_tests'
NO_CATCH_EXCEPTIONS_FLAG
=
FLAG_PREFIX
+
'catch_exceptions=0'
FILTER_FLAG
=
FLAG_PREFIX
+
'filter'
# Path to the gtest
_
catch
_
exceptions
_
ex
_
test_ binary, compiled with
# Path to the g
oogle
test
-
catch
-
exceptions
-
ex
-
test_ binary, compiled with
# exceptions enabled.
EX_EXE_PATH
=
gtest_test_utils
.
GetTestExecutablePath
(
'gtest
_
catch
_
exceptions
_
ex
_
test_'
)
'g
oogle
test
-
catch
-
exceptions
-
ex
-
test_'
)
# Path to the gtest
_
catch
_
exceptions
_
test_ binary, compiled with
# Path to the g
oogle
test
-
catch
-
exceptions
-
test_ binary, compiled with
# exceptions disabled.
EXE_PATH
=
gtest_test_utils
.
GetTestExecutablePath
(
'gtest
_
catch
_
exceptions
_
no
_
ex
_
test_'
)
'g
oogle
test
-
catch
-
exceptions
-
no
-
ex
-
test_'
)
environ
=
gtest_test_utils
.
environ
SetEnvVar
=
gtest_test_utils
.
SetEnvVar
...
...
googletest/test/gtest
_
catch
_
exceptions
_
test_.cc
→
googletest/test/g
oogle
test
-
catch
-
exceptions
-
test_.cc
View file @
e9b05a4d
...
...
@@ -30,7 +30,7 @@
// Author: vladl@google.com (Vlad Losev)
//
// Tests for Google Test itself. Tests in this file throw C++ or SEH
// exceptions, and the output is verified by gtest
_
catch
_
exceptions
_
test.py.
// exceptions, and the output is verified by g
oogle
test
-
catch
-
exceptions
-
test.py.
#include "gtest/gtest.h"
...
...
googletest/test/gtest
_
color
_
test.py
→
googletest/test/g
oogle
test
-
color
-
test.py
View file @
e9b05a4d
...
...
@@ -40,7 +40,7 @@ IS_WINDOWS = os.name == 'nt'
COLOR_ENV_VAR
=
'GTEST_COLOR'
COLOR_FLAG
=
'gtest_color'
COMMAND
=
gtest_test_utils
.
GetTestExecutablePath
(
'gtest
_
color
_
test_'
)
COMMAND
=
gtest_test_utils
.
GetTestExecutablePath
(
'g
oogle
test
-
color
-
test_'
)
def
SetEnvVar
(
env_var
,
value
):
...
...
@@ -53,7 +53,7 @@ def SetEnvVar(env_var, value):
def
UsesColor
(
term
,
color_env_var
,
color_flag
):
"""Runs gtest
_
color
_
test_ and returns its exit code."""
"""Runs g
oogle
test
-
color
-
test_ and returns its exit code."""
SetEnvVar
(
'TERM'
,
term
)
SetEnvVar
(
COLOR_ENV_VAR
,
color_env_var
)
...
...
googletest/test/gtest
_
color
_
test_.cc
→
googletest/test/g
oogle
test
-
color
-
test_.cc
View file @
e9b05a4d
File moved
googletest/test/gtest-death-test
_
test.cc
→
googletest/test/g
oogle
test-death-test
-
test.cc
View file @
e9b05a4d
...
...
@@ -784,7 +784,7 @@ static void TestExitMacros() {
// Of all signals effects on the process exit code, only those of SIGABRT
// are documented on Windows.
// See http://msdn.microsoft.com/en-us/
library/dwwzkt4c(VS.71).aspx
.
// See http
s
://msdn.microsoft.com/en-us/
query-bi/m/dwwzkt4c
.
EXPECT_EXIT
(
raise
(
SIGABRT
),
testing
::
ExitedWithCode
(
3
),
""
)
<<
"b_ar"
;
# elif !GTEST_OS_FUCHSIA
...
...
googletest/test/gtest-death-test_ex_test.cc
→
googletest/test/g
oogle
test-death-test_ex_test.cc
View file @
e9b05a4d
...
...
@@ -69,7 +69,7 @@ TEST(CxxExceptionDeathTest, PrintsMessageForStdExceptions) {
"exceptional message"
);
// Verifies that the location is mentioned in the failure text.
EXPECT_NONFATAL_FAILURE
(
EXPECT_DEATH
(
throw
TestException
(),
""
),
"gtest-death-test_ex_test.cc"
);
"g
oogle
test-death-test_ex_test.cc"
);
}
# endif // GTEST_HAS_EXCEPTIONS
...
...
googletest/test/gtest
_
env
_
var
_
test.py
→
googletest/test/g
oogle
test
-
env
-
var
-
test.py
View file @
e9b05a4d
...
...
@@ -40,7 +40,7 @@ import gtest_test_utils
IS_WINDOWS
=
os
.
name
==
'nt'
IS_LINUX
=
os
.
name
==
'posix'
and
os
.
uname
()[
0
]
==
'Linux'
COMMAND
=
gtest_test_utils
.
GetTestExecutablePath
(
'gtest
_
env
_
var
_
test_'
)
COMMAND
=
gtest_test_utils
.
GetTestExecutablePath
(
'g
oogle
test
-
env
-
var
-
test_'
)
environ
=
os
.
environ
.
copy
()
...
...
@@ -62,7 +62,7 @@ def SetEnvVar(env_var, value):
def
GetFlag
(
flag
):
"""Runs gtest
_
env
_
var
_
test_ and returns its output."""
"""Runs g
oogle
test
-
env
-
var
-
test_ and returns its output."""
args
=
[
COMMAND
]
if
flag
is
not
None
:
...
...
googletest/test/gtest
_
env
_
var
_
test_.cc
→
googletest/test/g
oogle
test
-
env
-
var
-
test_.cc
View file @
e9b05a4d
...
...
@@ -115,7 +115,7 @@ int main(int argc, char** argv) {
testing
::
InitGoogleTest
(
&
argc
,
argv
);
if
(
argc
!=
2
)
{
cout
<<
"Usage: gtest
_
env
_
var
_
test_ NAME_OF_FLAG
\n
"
;
cout
<<
"Usage: g
oogle
test
-
env
-
var
-
test_ NAME_OF_FLAG
\n
"
;
return
1
;
}
...
...
googletest/test/gtest-filepath
_
test.cc
→
googletest/test/g
oogle
test-filepath
-
test.cc
View file @
e9b05a4d
File moved
googletest/test/gtest
_
filter
_
unittest.py
→
googletest/test/g
oogle
test
-
filter
-
unittest.py
View file @
e9b05a4d
...
...
@@ -33,7 +33,7 @@
A user can specify which test(s) in a Google Test program to run via either
the GTEST_FILTER environment variable or the --gtest_filter flag.
This script tests such functionality by invoking
gtest
_
filter
_
unittest_ (a program written with Google Test) with different
g
oogle
test
-
filter
-
unittest_ (a program written with Google Test) with different
environments and command line flags.
Note that test sharding may also influence which tests are filtered. Therefore,
...
...
@@ -100,8 +100,8 @@ FILTER_FLAG = 'gtest_filter'
# The command line flag for including disabled tests.
ALSO_RUN_DISABLED_TESTS_FLAG
=
'gtest_also_run_disabled_tests'
# Command to run the gtest
_
filter
_
unittest_ program.
COMMAND
=
gtest_test_utils
.
GetTestExecutablePath
(
'gtest
_
filter
_
unittest_'
)
# Command to run the g
oogle
test
-
filter
-
unittest_ program.
COMMAND
=
gtest_test_utils
.
GetTestExecutablePath
(
'g
oogle
test
-
filter
-
unittest_'
)
# Regex for determining whether parameterized tests are enabled in the binary.
PARAM_TEST_REGEX
=
re
.
compile
(
r
'/ParamTest'
)
...
...
@@ -120,7 +120,7 @@ LIST_TESTS_FLAG = '--gtest_list_tests'
SUPPORTS_DEATH_TESTS
=
'HasDeathTest'
in
gtest_test_utils
.
Subprocess
(
[
COMMAND
,
LIST_TESTS_FLAG
]).
output
# Full names of all tests in gtest
_
filter
_
unittests_.
# Full names of all tests in g
oogle
test
-
filter
-
unittests_.
PARAM_TESTS
=
[
'SeqP/ParamTest.TestX/0'
,
'SeqP/ParamTest.TestX/1'
,
...
...
@@ -292,7 +292,7 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
args
=
None
,
check_exit_0
=
False
):
"""Checks that binary runs correct tests for the given filter and shard.
Runs all shards of gtest
_
filter
_
unittest_ with the given filter, and
Runs all shards of g
oogle
test
-
filter
-
unittest_ with the given filter, and
verifies that the right set of tests were run. The union of tests run
on each shard should be identical to tests_to_run, without duplicates.
If check_exit_0, .
...
...
@@ -330,7 +330,7 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
def
RunAndVerifyAllowingDisabled
(
self
,
gtest_filter
,
tests_to_run
):
"""Checks that the binary runs correct set of tests for the given filter.
Runs gtest
_
filter
_
unittest_ with the given filter, and enables
Runs g
oogle
test
-
filter
-
unittest_ with the given filter, and enables
disabled tests. Verifies that the right set of tests were run.
Args:
...
...
googletest/test/gtest
_
filter
_
unittest_.cc
→
googletest/test/g
oogle
test
-
filter
-
unittest_.cc
View file @
e9b05a4d
File moved
googletest/test/gtest
_
json
_
outfiles
_
test.py
→
googletest/test/g
oogle
test
-
json
-
outfiles
-
test.py
View file @
e9b05a4d
File moved
googletest/test/gtest
_
json
_
output
_
unittest.py
→
googletest/test/g
oogle
test
-
json
-
output
-
unittest.py
View file @
e9b05a4d
...
...
@@ -46,7 +46,10 @@ GTEST_OUTPUT_FLAG = '--gtest_output'
GTEST_DEFAULT_OUTPUT_FILE
=
'test_detail.json'
GTEST_PROGRAM_NAME
=
'gtest_xml_output_unittest_'
SUPPORTS_STACK_TRACES
=
False
# The flag indicating stacktraces are not supported
NO_STACKTRACE_SUPPORT_FLAG
=
'--no_stacktrace_support'
SUPPORTS_STACK_TRACES
=
NO_STACKTRACE_SUPPORT_FLAG
not
in
sys
.
argv
if
SUPPORTS_STACK_TRACES
:
STACK_TRACE_TEMPLATE
=
'
\n
Stack trace:
\n
*'
...
...
@@ -607,5 +610,9 @@ class GTestJsonOutputUnitTest(gtest_test_utils.TestCase):
if
__name__
==
'__main__'
:
if
NO_STACKTRACE_SUPPORT_FLAG
in
sys
.
argv
:
# unittest.main() can't handle unknown flags
sys
.
argv
.
remove
(
NO_STACKTRACE_SUPPORT_FLAG
)
os
.
environ
[
'GTEST_STACK_TRACE_DEPTH'
]
=
'1'
gtest_test_utils
.
Main
()
googletest/test/gtest-linked
_
ptr
_
test.cc
→
googletest/test/g
oogle
test-linked
-
ptr
-
test.cc
View file @
e9b05a4d
File moved
googletest/test/gtest
_
list
_
tests
_
unittest.py
→
googletest/test/g
oogle
test
-
list
-
tests
-
unittest.py
View file @
e9b05a4d
...
...
@@ -33,7 +33,7 @@
A user can ask Google Test to list all tests by specifying the
--gtest_list_tests flag. This script tests such functionality
by invoking gtest
_
list
_
tests
_
unittest_ (a program written with
by invoking g
oogle
test
-
list
-
tests
-
unittest_ (a program written with
Google Test) the command line flags.
"""
...
...
@@ -47,10 +47,10 @@ import gtest_test_utils
# The command line flag for enabling/disabling listing all tests.
LIST_TESTS_FLAG
=
'gtest_list_tests'
# Path to the gtest
_
list
_
tests
_
unittest_ program.
EXE_PATH
=
gtest_test_utils
.
GetTestExecutablePath
(
'gtest
_
list
_
tests
_
unittest_'
)
# Path to the g
oogle
test
-
list
-
tests
-
unittest_ program.
EXE_PATH
=
gtest_test_utils
.
GetTestExecutablePath
(
'g
oogle
test
-
list
-
tests
-
unittest_'
)
# The expected output when running gtest
_
list
_
tests
_
unittest_ with
# The expected output when running g
oogle
test
-
list
-
tests
-
unittest_ with
# --gtest_list_tests
EXPECTED_OUTPUT_NO_FILTER_RE
=
re
.
compile
(
r
"""FooDeathTest\.
Test1
...
...
@@ -94,7 +94,7 @@ MyInstantiation/ValueParamTest\.
TestB/2 # GetParam\(\) = a very\\nlo{241}\.\.\.
"""
)
# The expected output when running gtest
_
list
_
tests
_
unittest_ with
# The expected output when running g
oogle
test
-
list
-
tests
-
unittest_ with
# --gtest_list_tests and --gtest_filter=Foo*.
EXPECTED_OUTPUT_FILTER_FOO_RE
=
re
.
compile
(
r
"""FooDeathTest\.
Test1
...
...
@@ -114,7 +114,7 @@ FooTest\.
def
Run
(
args
):
"""Runs gtest
_
list
_
tests
_
unittest_ and returns the list of tests printed."""
"""Runs g
oogle
test
-
list
-
tests
-
unittest_ and returns the list of tests printed."""
return
gtest_test_utils
.
Subprocess
([
EXE_PATH
]
+
args
,
capture_stderr
=
False
).
output
...
...
@@ -127,7 +127,7 @@ class GTestListTestsUnitTest(gtest_test_utils.TestCase):
"""Tests using the --gtest_list_tests flag to list all tests."""
def
RunAndVerify
(
self
,
flag_value
,
expected_output_re
,
other_flag
):
"""Runs gtest
_
list
_
tests
_
unittest_ and verifies that it prints
"""Runs g
oogle
test
-
list
-
tests
-
unittest_ and verifies that it prints
the correct tests.
Args:
...
...
googletest/test/gtest
_
list
_
tests
_
unittest_.cc
→
googletest/test/g
oogle
test
-
list
-
tests
-
unittest_.cc
View file @
e9b05a4d
File moved
googletest/test/gtest-listener
_
test.cc
→
googletest/test/g
oogle
test-listener
-
test.cc
View file @
e9b05a4d
File moved
googletest/test/gtest-message
_
test.cc
→
googletest/test/g
oogle
test-message
-
test.cc
View file @
e9b05a4d
File moved
googletest/test/gtest-options
_
test.cc
→
googletest/test/g
oogle
test-options
-
test.cc
View file @
e9b05a4d
...
...
@@ -99,7 +99,7 @@ TEST(OutputFileHelpersTest, GetCurrentExecutableName) {
const
std
::
string
exe_str
=
GetCurrentExecutableName
().
string
();
#if GTEST_OS_WINDOWS
const
bool
success
=
_strcmpi
(
"gtest-options
_
test"
,
exe_str
.
c_str
())
==
0
||
_strcmpi
(
"g
oogle
test-options
-
test"
,
exe_str
.
c_str
())
==
0
||
_strcmpi
(
"gtest-options-ex_test"
,
exe_str
.
c_str
())
==
0
||
_strcmpi
(
"gtest_all_test"
,
exe_str
.
c_str
())
==
0
||
_strcmpi
(
"gtest_dll_test"
,
exe_str
.
c_str
())
==
0
;
...
...
@@ -109,7 +109,7 @@ TEST(OutputFileHelpersTest, GetCurrentExecutableName) {
// TODO(wan@google.com): remove the hard-coded "lt-" prefix when
// Chandler Carruth's libtool replacement is ready.
const
bool
success
=
exe_str
==
"gtest-options
_
test"
||
exe_str
==
"g
oogle
test-options
-
test"
||
exe_str
==
"gtest_all_test"
||
exe_str
==
"lt-gtest_all_test"
||
exe_str
==
"gtest_dll_test"
;
...
...
Prev
1
2
3
4
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