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
a7a7f51d
Unverified
Commit
a7a7f51d
authored
Mar 05, 2018
by
Tanzinul Islam
Committed by
GitHub
Mar 05, 2018
Browse files
Merge branch 'master' into fix_death_test_child_mingw_wer_issue1116
parents
4ba3803f
6c73adfc
Changes
138
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1050 additions
and
86 deletions
+1050
-86
googletest/test/gtest_all_test.cc
googletest/test/gtest_all_test.cc
+12
-12
googletest/test/gtest_assert_by_exception_test.cc
googletest/test/gtest_assert_by_exception_test.cc
+119
-0
googletest/test/gtest_break_on_failure_unittest.py
googletest/test/gtest_break_on_failure_unittest.py
+1
-3
googletest/test/gtest_break_on_failure_unittest_.cc
googletest/test/gtest_break_on_failure_unittest_.cc
+1
-2
googletest/test/gtest_catch_exceptions_test.py
googletest/test/gtest_catch_exceptions_test.py
+0
-2
googletest/test/gtest_color_test.py
googletest/test/gtest_color_test.py
+1
-2
googletest/test/gtest_color_test_.cc
googletest/test/gtest_color_test_.cc
+0
-8
googletest/test/gtest_env_var_test.py
googletest/test/gtest_env_var_test.py
+2
-2
googletest/test/gtest_env_var_test_.cc
googletest/test/gtest_env_var_test_.cc
+0
-2
googletest/test/gtest_environment_test.cc
googletest/test/gtest_environment_test.cc
+0
-3
googletest/test/gtest_filter_unittest.py
googletest/test/gtest_filter_unittest.py
+20
-18
googletest/test/gtest_filter_unittest_.cc
googletest/test/gtest_filter_unittest_.cc
+0
-2
googletest/test/gtest_json_outfiles_test.py
googletest/test/gtest_json_outfiles_test.py
+163
-0
googletest/test/gtest_json_output_unittest.py
googletest/test/gtest_json_output_unittest.py
+612
-0
googletest/test/gtest_json_test_utils.py
googletest/test/gtest_json_test_utils.py
+60
-0
googletest/test/gtest_list_tests_unittest.py
googletest/test/gtest_list_tests_unittest.py
+2
-2
googletest/test/gtest_main_unittest.cc
googletest/test/gtest_main_unittest.cc
+2
-2
googletest/test/gtest_output_test.py
googletest/test/gtest_output_test.py
+10
-6
googletest/test/gtest_output_test_.cc
googletest/test/gtest_output_test_.cc
+17
-12
googletest/test/gtest_output_test_golden_lin.txt
googletest/test/gtest_output_test_golden_lin.txt
+28
-8
No files found.
googletest/test/gtest_all_test.cc
View file @
a7a7f51d
...
@@ -33,15 +33,15 @@
...
@@ -33,15 +33,15 @@
//
//
// Sometimes it's desirable to build most of Google Test's own tests
// Sometimes it's desirable to build most of Google Test's own tests
// by compiling a single file. This file serves this purpose.
// by compiling a single file. This file serves this purpose.
#include "
test/
gtest-filepath_test.cc"
#include "gtest-filepath_test.cc"
#include "
test/
gtest-linked_ptr_test.cc"
#include "gtest-linked_ptr_test.cc"
#include "
test/
gtest-message_test.cc"
#include "gtest-message_test.cc"
#include "
test/
gtest-options_test.cc"
#include "gtest-options_test.cc"
#include "
test/
gtest-port_test.cc"
#include "gtest-port_test.cc"
#include "
test/
gtest_pred_impl_unittest.cc"
#include "gtest_pred_impl_unittest.cc"
#include "
test/
gtest_prod_test.cc"
#include "gtest_prod_test.cc"
#include "
test/
gtest-test-part_test.cc"
#include "gtest-test-part_test.cc"
#include "
test/
gtest-typed-test_test.cc"
#include "gtest-typed-test_test.cc"
#include "
test/
gtest-typed-test2_test.cc"
#include "gtest-typed-test2_test.cc"
#include "
test/
gtest_unittest.cc"
#include "gtest_unittest.cc"
#include "
test/
production.cc"
#include "production.cc"
googletest/test/gtest_assert_by_exception_test.cc
0 → 100644
View file @
a7a7f51d
// Copyright 2009, 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.
//
// Author: wan@google.com (Zhanyong Wan)
// Tests Google Test's assert-by-exception mode with exceptions enabled.
#include "gtest/gtest.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdexcept>
class
ThrowListener
:
public
testing
::
EmptyTestEventListener
{
void
OnTestPartResult
(
const
testing
::
TestPartResult
&
result
)
override
{
if
(
result
.
type
()
==
testing
::
TestPartResult
::
kFatalFailure
)
{
throw
testing
::
AssertionException
(
result
);
}
}
};
// Prints the given failure message and exits the program with
// non-zero. We use this instead of a Google Test assertion to
// indicate a failure, as the latter is been tested and cannot be
// relied on.
void
Fail
(
const
char
*
msg
)
{
printf
(
"FAILURE: %s
\n
"
,
msg
);
fflush
(
stdout
);
exit
(
1
);
}
static
void
AssertFalse
()
{
ASSERT_EQ
(
2
,
3
)
<<
"Expected failure"
;
}
// Tests that an assertion failure throws a subclass of
// std::runtime_error.
TEST
(
Test
,
Test
)
{
// A successful assertion shouldn't throw.
try
{
EXPECT_EQ
(
3
,
3
);
}
catch
(...)
{
Fail
(
"A successful assertion wrongfully threw."
);
}
// A successful assertion shouldn't throw.
try
{
EXPECT_EQ
(
3
,
4
);
}
catch
(...)
{
Fail
(
"A failed non-fatal assertion wrongfully threw."
);
}
// A failed assertion should throw.
try
{
AssertFalse
();
}
catch
(
const
testing
::
AssertionException
&
e
)
{
if
(
strstr
(
e
.
what
(),
"Expected failure"
)
!=
NULL
)
throw
;
printf
(
"%s"
,
"A failed assertion did throw an exception of the right type, "
"but the message is incorrect. Instead of containing
\"
Expected "
"failure
\"
, it is:
\n
"
);
Fail
(
e
.
what
());
}
catch
(...)
{
Fail
(
"A failed assertion threw the wrong type of exception."
);
}
Fail
(
"A failed assertion should've thrown but didn't."
);
}
int
kTestForContinuingTest
=
0
;
TEST
(
Test
,
Test2
)
{
// FIXME(sokolov): how to force Test2 to be after Test?
kTestForContinuingTest
=
1
;
}
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
testing
::
UnitTest
::
GetInstance
()
->
listeners
().
Append
(
new
ThrowListener
);
int
result
=
RUN_ALL_TESTS
();
if
(
result
==
0
)
{
printf
(
"RUN_ALL_TESTS returned %d
\n
"
,
result
);
Fail
(
"Expected failure instead."
);
}
if
(
kTestForContinuingTest
==
0
)
{
Fail
(
"Should have continued with other tests, but did not."
);
}
return
0
;
}
googletest/test/gtest_break_on_failure_unittest.py
View file @
a7a7f51d
...
@@ -40,10 +40,8 @@ Google Test) with different environments and command line flags.
...
@@ -40,10 +40,8 @@ Google Test) with different environments and command line flags.
__author__
=
'wan@google.com (Zhanyong Wan)'
__author__
=
'wan@google.com (Zhanyong Wan)'
import
gtest_test_utils
import
os
import
os
import
sys
import
gtest_test_utils
# Constants.
# Constants.
...
...
googletest/test/gtest_break_on_failure_unittest_.cc
View file @
a7a7f51d
...
@@ -80,8 +80,7 @@ int main(int argc, char **argv) {
...
@@ -80,8 +80,7 @@ int main(int argc, char **argv) {
SetUnhandledExceptionFilter
(
ExitWithExceptionCode
);
SetUnhandledExceptionFilter
(
ExitWithExceptionCode
);
# endif
# endif
#endif
#endif // GTEST_OS_WINDOWS
testing
::
InitGoogleTest
(
&
argc
,
argv
);
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
return
RUN_ALL_TESTS
();
...
...
googletest/test/gtest_catch_exceptions_test.py
View file @
a7a7f51d
...
@@ -37,8 +37,6 @@ Google Test) and verifies their output.
...
@@ -37,8 +37,6 @@ Google Test) and verifies their output.
__author__
=
'vladl@google.com (Vlad Losev)'
__author__
=
'vladl@google.com (Vlad Losev)'
import
os
import
gtest_test_utils
import
gtest_test_utils
# Constants.
# Constants.
...
...
googletest/test/gtest_color_test.py
View file @
a7a7f51d
...
@@ -36,8 +36,7 @@ __author__ = 'wan@google.com (Zhanyong Wan)'
...
@@ -36,8 +36,7 @@ __author__ = 'wan@google.com (Zhanyong Wan)'
import
os
import
os
import
gtest_test_utils
import
gtest_test_utils
IS_WINDOWS
=
os
.
name
==
'nt'
IS_WINDOWS
=
os
.
name
=
'nt'
COLOR_ENV_VAR
=
'GTEST_COLOR'
COLOR_ENV_VAR
=
'GTEST_COLOR'
COLOR_FLAG
=
'gtest_color'
COLOR_FLAG
=
'gtest_color'
...
...
googletest/test/gtest_color_test_.cc
View file @
a7a7f51d
...
@@ -36,15 +36,7 @@
...
@@ -36,15 +36,7 @@
#include <stdio.h>
#include <stdio.h>
#include "gtest/gtest.h"
#include "gtest/gtest.h"
// Indicates that this translation unit is part of Google Test's
// implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
using
testing
::
internal
::
ShouldUseColor
;
using
testing
::
internal
::
ShouldUseColor
;
...
...
googletest/test/gtest_env_var_test.py
View file @
a7a7f51d
...
@@ -47,8 +47,8 @@ environ = os.environ.copy()
...
@@ -47,8 +47,8 @@ environ = os.environ.copy()
def
AssertEq
(
expected
,
actual
):
def
AssertEq
(
expected
,
actual
):
if
expected
!=
actual
:
if
expected
!=
actual
:
print
(
'Expected: %s'
%
(
expected
,)
)
print
'Expected: %s'
%
(
expected
,)
print
(
' Actual: %s'
%
(
actual
,)
)
print
' Actual: %s'
%
(
actual
,)
raise
AssertionError
raise
AssertionError
...
...
googletest/test/gtest_env_var_test_.cc
View file @
a7a7f51d
...
@@ -36,9 +36,7 @@
...
@@ -36,9 +36,7 @@
#include <iostream>
#include <iostream>
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
using
::
std
::
cout
;
using
::
std
::
cout
;
...
...
googletest/test/gtest_environment_test.cc
View file @
a7a7f51d
...
@@ -34,10 +34,7 @@
...
@@ -34,10 +34,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#define GTEST_IMPLEMENTATION_ 1 // Required for the next #include.
#include "src/gtest-internal-inl.h"
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
namespace
testing
{
namespace
testing
{
GTEST_DECLARE_string_
(
filter
);
GTEST_DECLARE_string_
(
filter
);
...
...
googletest/test/gtest_filter_unittest.py
View file @
a7a7f51d
...
@@ -44,12 +44,8 @@ __author__ = 'wan@google.com (Zhanyong Wan)'
...
@@ -44,12 +44,8 @@ __author__ = 'wan@google.com (Zhanyong Wan)'
import
os
import
os
import
re
import
re
try
:
import
sets
from
sets
import
Set
as
set
# For Python 2.3 compatibility
except
ImportError
:
pass
import
sys
import
sys
import
gtest_test_utils
import
gtest_test_utils
# Constants.
# Constants.
...
@@ -59,10 +55,12 @@ import gtest_test_utils
...
@@ -59,10 +55,12 @@ import gtest_test_utils
# script in a subprocess to print whether the variable is STILL in
# script in a subprocess to print whether the variable is STILL in
# os.environ. We then use 'eval' to parse the child's output so that an
# os.environ. We then use 'eval' to parse the child's output so that an
# exception is thrown if the input is anything other than 'True' nor 'False'.
# exception is thrown if the input is anything other than 'True' nor 'False'.
os
.
environ
[
'EMPTY_VAR'
]
=
''
CAN_PASS_EMPTY_ENV
=
False
child
=
gtest_test_utils
.
Subprocess
(
if
sys
.
executable
:
[
sys
.
executable
,
'-c'
,
'import os; print(
\'
EMPTY_VAR
\'
in os.environ)'
])
os
.
environ
[
'EMPTY_VAR'
]
=
''
CAN_PASS_EMPTY_ENV
=
eval
(
child
.
output
)
child
=
gtest_test_utils
.
Subprocess
(
[
sys
.
executable
,
'-c'
,
'import os; print
\'
EMPTY_VAR
\'
in os.environ'
])
CAN_PASS_EMPTY_ENV
=
eval
(
child
.
output
)
# Check if this platform can unset environment variables in child processes.
# Check if this platform can unset environment variables in child processes.
...
@@ -71,11 +69,14 @@ CAN_PASS_EMPTY_ENV = eval(child.output)
...
@@ -71,11 +69,14 @@ CAN_PASS_EMPTY_ENV = eval(child.output)
# is NO LONGER in os.environ.
# is NO LONGER in os.environ.
# We use 'eval' to parse the child's output so that an exception
# We use 'eval' to parse the child's output so that an exception
# is thrown if the input is neither 'True' nor 'False'.
# is thrown if the input is neither 'True' nor 'False'.
os
.
environ
[
'UNSET_VAR'
]
=
'X'
CAN_UNSET_ENV
=
False
del
os
.
environ
[
'UNSET_VAR'
]
if
sys
.
executable
:
child
=
gtest_test_utils
.
Subprocess
(
os
.
environ
[
'UNSET_VAR'
]
=
'X'
[
sys
.
executable
,
'-c'
,
'import os; print(
\'
UNSET_VAR
\'
not in os.environ)'
])
del
os
.
environ
[
'UNSET_VAR'
]
CAN_UNSET_ENV
=
eval
(
child
.
output
)
child
=
gtest_test_utils
.
Subprocess
(
[
sys
.
executable
,
'-c'
,
'import os; print
\'
UNSET_VAR
\'
not in os.environ'
])
CAN_UNSET_ENV
=
eval
(
child
.
output
)
# Checks if we should test with an empty filter. This doesn't
# Checks if we should test with an empty filter. This doesn't
...
@@ -97,7 +98,7 @@ SHARD_STATUS_FILE_ENV_VAR = 'GTEST_SHARD_STATUS_FILE'
...
@@ -97,7 +98,7 @@ SHARD_STATUS_FILE_ENV_VAR = 'GTEST_SHARD_STATUS_FILE'
FILTER_FLAG
=
'gtest_filter'
FILTER_FLAG
=
'gtest_filter'
# The command line flag for including disabled tests.
# The command line flag for including disabled tests.
ALSO_RUN_DISABED_TESTS_FLAG
=
'gtest_also_run_disabled_tests'
ALSO_RUN_DISAB
L
ED_TESTS_FLAG
=
'gtest_also_run_disabled_tests'
# Command to run the gtest_filter_unittest_ program.
# Command to run the gtest_filter_unittest_ program.
COMMAND
=
gtest_test_utils
.
GetTestExecutablePath
(
'gtest_filter_unittest_'
)
COMMAND
=
gtest_test_utils
.
GetTestExecutablePath
(
'gtest_filter_unittest_'
)
...
@@ -246,14 +247,14 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
...
@@ -246,14 +247,14 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
for
slice_var
in
list_of_sets
:
for
slice_var
in
list_of_sets
:
full_partition
.
extend
(
slice_var
)
full_partition
.
extend
(
slice_var
)
self
.
assertEqual
(
len
(
set_var
),
len
(
full_partition
))
self
.
assertEqual
(
len
(
set_var
),
len
(
full_partition
))
self
.
assertEqual
(
set
(
set_var
),
set
(
full_partition
))
self
.
assertEqual
(
set
s
.
Set
(
set_var
),
set
s
.
Set
(
full_partition
))
def
AdjustForParameterizedTests
(
self
,
tests_to_run
):
def
AdjustForParameterizedTests
(
self
,
tests_to_run
):
"""Adjust tests_to_run in case value parameterized tests are disabled."""
"""Adjust tests_to_run in case value parameterized tests are disabled."""
global
param_tests_present
global
param_tests_present
if
not
param_tests_present
:
if
not
param_tests_present
:
return
list
(
set
(
tests_to_run
)
-
set
(
PARAM_TESTS
))
return
list
(
set
s
.
Set
(
tests_to_run
)
-
set
s
.
Set
(
PARAM_TESTS
))
else
:
else
:
return
tests_to_run
return
tests_to_run
...
@@ -294,6 +295,7 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
...
@@ -294,6 +295,7 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
Runs all shards of gtest_filter_unittest_ with the given filter, and
Runs all shards of gtest_filter_unittest_ with the given filter, and
verifies that the right set of tests were run. The union of tests run
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.
on each shard should be identical to tests_to_run, without duplicates.
If check_exit_0, .
Args:
Args:
gtest_filter: A filter to apply to the tests.
gtest_filter: A filter to apply to the tests.
...
@@ -339,7 +341,7 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
...
@@ -339,7 +341,7 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
tests_to_run
=
self
.
AdjustForParameterizedTests
(
tests_to_run
)
tests_to_run
=
self
.
AdjustForParameterizedTests
(
tests_to_run
)
# Construct the command line.
# Construct the command line.
args
=
[
'--%s'
%
ALSO_RUN_DISABED_TESTS_FLAG
]
args
=
[
'--%s'
%
ALSO_RUN_DISAB
L
ED_TESTS_FLAG
]
if
gtest_filter
is
not
None
:
if
gtest_filter
is
not
None
:
args
.
append
(
'--%s=%s'
%
(
FILTER_FLAG
,
gtest_filter
))
args
.
append
(
'--%s=%s'
%
(
FILTER_FLAG
,
gtest_filter
))
...
...
googletest/test/gtest_filter_unittest_.cc
View file @
a7a7f51d
...
@@ -117,7 +117,6 @@ TEST(DISABLED_FoobarbazTest, TestA) {
...
@@ -117,7 +117,6 @@ TEST(DISABLED_FoobarbazTest, TestA) {
FAIL
()
<<
"Expected failure."
;
FAIL
()
<<
"Expected failure."
;
}
}
#if GTEST_HAS_PARAM_TEST
class
ParamTest
:
public
testing
::
TestWithParam
<
int
>
{
class
ParamTest
:
public
testing
::
TestWithParam
<
int
>
{
};
};
...
@@ -129,7 +128,6 @@ TEST_P(ParamTest, TestY) {
...
@@ -129,7 +128,6 @@ TEST_P(ParamTest, TestY) {
INSTANTIATE_TEST_CASE_P
(
SeqP
,
ParamTest
,
testing
::
Values
(
1
,
2
));
INSTANTIATE_TEST_CASE_P
(
SeqP
,
ParamTest
,
testing
::
Values
(
1
,
2
));
INSTANTIATE_TEST_CASE_P
(
SeqQ
,
ParamTest
,
testing
::
Values
(
5
,
6
));
INSTANTIATE_TEST_CASE_P
(
SeqQ
,
ParamTest
,
testing
::
Values
(
5
,
6
));
#endif // GTEST_HAS_PARAM_TEST
}
// namespace
}
// namespace
...
...
googletest/test/gtest_json_outfiles_test.py
0 → 100644
View file @
a7a7f51d
#!/usr/bin/env python
# Copyright 2018, 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.
"""Unit test for the gtest_json_output module."""
import
json
import
os
import
gtest_test_utils
import
gtest_json_test_utils
GTEST_OUTPUT_SUBDIR
=
'json_outfiles'
GTEST_OUTPUT_1_TEST
=
'gtest_xml_outfile1_test_'
GTEST_OUTPUT_2_TEST
=
'gtest_xml_outfile2_test_'
EXPECTED_1
=
{
u
'tests'
:
1
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'timestamp'
:
u
'*'
,
u
'name'
:
u
'AllTests'
,
u
'testsuites'
:
[{
u
'name'
:
u
'PropertyOne'
,
u
'tests'
:
1
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[{
u
'name'
:
u
'TestSomeProperties'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'PropertyOne'
,
u
'SetUpProp'
:
u
'1'
,
u
'TestSomeProperty'
:
u
'1'
,
u
'TearDownProp'
:
u
'1'
,
}],
}],
}
EXPECTED_2
=
{
u
'tests'
:
1
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'timestamp'
:
u
'*'
,
u
'name'
:
u
'AllTests'
,
u
'testsuites'
:
[{
u
'name'
:
u
'PropertyTwo'
,
u
'tests'
:
1
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[{
u
'name'
:
u
'TestSomeProperties'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'PropertyTwo'
,
u
'SetUpProp'
:
u
'2'
,
u
'TestSomeProperty'
:
u
'2'
,
u
'TearDownProp'
:
u
'2'
,
}],
}],
}
class
GTestJsonOutFilesTest
(
gtest_test_utils
.
TestCase
):
"""Unit test for Google Test's JSON output functionality."""
def
setUp
(
self
):
# We want the trailing '/' that the last "" provides in os.path.join, for
# telling Google Test to create an output directory instead of a single file
# for xml output.
self
.
output_dir_
=
os
.
path
.
join
(
gtest_test_utils
.
GetTempDir
(),
GTEST_OUTPUT_SUBDIR
,
''
)
self
.
DeleteFilesAndDir
()
def
tearDown
(
self
):
self
.
DeleteFilesAndDir
()
def
DeleteFilesAndDir
(
self
):
try
:
os
.
remove
(
os
.
path
.
join
(
self
.
output_dir_
,
GTEST_OUTPUT_1_TEST
+
'.json'
))
except
os
.
error
:
pass
try
:
os
.
remove
(
os
.
path
.
join
(
self
.
output_dir_
,
GTEST_OUTPUT_2_TEST
+
'.json'
))
except
os
.
error
:
pass
try
:
os
.
rmdir
(
self
.
output_dir_
)
except
os
.
error
:
pass
def
testOutfile1
(
self
):
self
.
_TestOutFile
(
GTEST_OUTPUT_1_TEST
,
EXPECTED_1
)
def
testOutfile2
(
self
):
self
.
_TestOutFile
(
GTEST_OUTPUT_2_TEST
,
EXPECTED_2
)
def
_TestOutFile
(
self
,
test_name
,
expected
):
gtest_prog_path
=
gtest_test_utils
.
GetTestExecutablePath
(
test_name
)
command
=
[
gtest_prog_path
,
'--gtest_output=json:%s'
%
self
.
output_dir_
]
p
=
gtest_test_utils
.
Subprocess
(
command
,
working_dir
=
gtest_test_utils
.
GetTempDir
())
self
.
assert_
(
p
.
exited
)
self
.
assertEquals
(
0
,
p
.
exit_code
)
# TODO(wan@google.com): 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.
output_file_name1
=
test_name
+
'.json'
output_file1
=
os
.
path
.
join
(
self
.
output_dir_
,
output_file_name1
)
output_file_name2
=
'lt-'
+
output_file_name1
output_file2
=
os
.
path
.
join
(
self
.
output_dir_
,
output_file_name2
)
self
.
assert_
(
os
.
path
.
isfile
(
output_file1
)
or
os
.
path
.
isfile
(
output_file2
),
output_file1
)
if
os
.
path
.
isfile
(
output_file1
):
with
open
(
output_file1
)
as
f
:
actual
=
json
.
load
(
f
)
else
:
with
open
(
output_file2
)
as
f
:
actual
=
json
.
load
(
f
)
self
.
assertEqual
(
expected
,
gtest_json_test_utils
.
normalize
(
actual
))
if
__name__
==
'__main__'
:
os
.
environ
[
'GTEST_STACK_TRACE_DEPTH'
]
=
'0'
gtest_test_utils
.
Main
()
googletest/test/gtest_json_output_unittest.py
0 → 100644
View file @
a7a7f51d
#!/usr/bin/env python
# Copyright 2018, 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.
"""Unit test for the gtest_json_output module."""
import
datetime
import
errno
import
json
import
os
import
re
import
sys
import
gtest_test_utils
import
gtest_json_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.json'
GTEST_PROGRAM_NAME
=
'gtest_xml_output_unittest_'
SUPPORTS_STACK_TRACES
=
False
if
SUPPORTS_STACK_TRACES
:
STACK_TRACE_TEMPLATE
=
'
\n
Stack trace:
\n
*'
else
:
STACK_TRACE_TEMPLATE
=
''
EXPECTED_NON_EMPTY
=
{
u
'tests'
:
23
,
u
'failures'
:
4
,
u
'disabled'
:
2
,
u
'errors'
:
0
,
u
'timestamp'
:
u
'*'
,
u
'time'
:
u
'*'
,
u
'ad_hoc_property'
:
u
'42'
,
u
'name'
:
u
'AllTests'
,
u
'testsuites'
:
[
{
u
'name'
:
u
'SuccessfulTest'
,
u
'tests'
:
1
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[
{
u
'name'
:
u
'Succeeds'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'SuccessfulTest'
}
]
},
{
u
'name'
:
u
'FailedTest'
,
u
'tests'
:
1
,
u
'failures'
:
1
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[
{
u
'name'
:
u
'Fails'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'FailedTest'
,
u
'failures'
:
[
{
u
'failure'
:
u
'gtest_xml_output_unittest_.cc:*
\n
'
u
'Expected equality of these values:
\n
'
u
' 1
\n
2'
+
STACK_TRACE_TEMPLATE
,
u
'type'
:
u
''
}
]
}
]
},
{
u
'name'
:
u
'DisabledTest'
,
u
'tests'
:
1
,
u
'failures'
:
0
,
u
'disabled'
:
1
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[
{
u
'name'
:
u
'DISABLED_test_not_run'
,
u
'status'
:
u
'NOTRUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'DisabledTest'
}
]
},
{
u
'name'
:
u
'MixedResultTest'
,
u
'tests'
:
3
,
u
'failures'
:
1
,
u
'disabled'
:
1
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[
{
u
'name'
:
u
'Succeeds'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'MixedResultTest'
},
{
u
'name'
:
u
'Fails'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'MixedResultTest'
,
u
'failures'
:
[
{
u
'failure'
:
u
'gtest_xml_output_unittest_.cc:*
\n
'
u
'Expected equality of these values:
\n
'
u
' 1
\n
2'
+
STACK_TRACE_TEMPLATE
,
u
'type'
:
u
''
},
{
u
'failure'
:
u
'gtest_xml_output_unittest_.cc:*
\n
'
u
'Expected equality of these values:
\n
'
u
' 2
\n
3'
+
STACK_TRACE_TEMPLATE
,
u
'type'
:
u
''
}
]
},
{
u
'name'
:
u
'DISABLED_test'
,
u
'status'
:
u
'NOTRUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'MixedResultTest'
}
]
},
{
u
'name'
:
u
'XmlQuotingTest'
,
u
'tests'
:
1
,
u
'failures'
:
1
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[
{
u
'name'
:
u
'OutputsCData'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'XmlQuotingTest'
,
u
'failures'
:
[
{
u
'failure'
:
u
'gtest_xml_output_unittest_.cc:*
\n
'
u
'Failed
\n
XML output: <?xml encoding="utf-8">'
u
'<top><![CDATA[cdata text]]></top>'
+
STACK_TRACE_TEMPLATE
,
u
'type'
:
u
''
}
]
}
]
},
{
u
'name'
:
u
'InvalidCharactersTest'
,
u
'tests'
:
1
,
u
'failures'
:
1
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[
{
u
'name'
:
u
'InvalidCharactersInMessage'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'InvalidCharactersTest'
,
u
'failures'
:
[
{
u
'failure'
:
u
'gtest_xml_output_unittest_.cc:*
\n
'
u
'Failed
\n
Invalid characters in brackets'
u
' [
\x01\x02
]'
+
STACK_TRACE_TEMPLATE
,
u
'type'
:
u
''
}
]
}
]
},
{
u
'name'
:
u
'PropertyRecordingTest'
,
u
'tests'
:
4
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'SetUpTestCase'
:
u
'yes'
,
u
'TearDownTestCase'
:
u
'aye'
,
u
'testsuite'
:
[
{
u
'name'
:
u
'OneProperty'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'PropertyRecordingTest'
,
u
'key_1'
:
u
'1'
},
{
u
'name'
:
u
'IntValuedProperty'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'PropertyRecordingTest'
,
u
'key_int'
:
u
'1'
},
{
u
'name'
:
u
'ThreeProperties'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'PropertyRecordingTest'
,
u
'key_1'
:
u
'1'
,
u
'key_2'
:
u
'2'
,
u
'key_3'
:
u
'3'
},
{
u
'name'
:
u
'TwoValuesForOneKeyUsesLastValue'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'PropertyRecordingTest'
,
u
'key_1'
:
u
'2'
}
]
},
{
u
'name'
:
u
'NoFixtureTest'
,
u
'tests'
:
3
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[
{
u
'name'
:
u
'RecordProperty'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'NoFixtureTest'
,
u
'key'
:
u
'1'
},
{
u
'name'
:
u
'ExternalUtilityThatCallsRecordIntValuedProperty'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'NoFixtureTest'
,
u
'key_for_utility_int'
:
u
'1'
},
{
u
'name'
:
u
'ExternalUtilityThatCallsRecordStringValuedProperty'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'NoFixtureTest'
,
u
'key_for_utility_string'
:
u
'1'
}
]
},
{
u
'name'
:
u
'TypedTest/0'
,
u
'tests'
:
1
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[
{
u
'name'
:
u
'HasTypeParamAttribute'
,
u
'type_param'
:
u
'int'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'TypedTest/0'
}
]
},
{
u
'name'
:
u
'TypedTest/1'
,
u
'tests'
:
1
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[
{
u
'name'
:
u
'HasTypeParamAttribute'
,
u
'type_param'
:
u
'long'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'TypedTest/1'
}
]
},
{
u
'name'
:
u
'Single/TypeParameterizedTestCase/0'
,
u
'tests'
:
1
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[
{
u
'name'
:
u
'HasTypeParamAttribute'
,
u
'type_param'
:
u
'int'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'Single/TypeParameterizedTestCase/0'
}
]
},
{
u
'name'
:
u
'Single/TypeParameterizedTestCase/1'
,
u
'tests'
:
1
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[
{
u
'name'
:
u
'HasTypeParamAttribute'
,
u
'type_param'
:
u
'long'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'Single/TypeParameterizedTestCase/1'
}
]
},
{
u
'name'
:
u
'Single/ValueParamTest'
,
u
'tests'
:
4
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[
{
u
'name'
:
u
'HasValueParamAttribute/0'
,
u
'value_param'
:
u
'33'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'Single/ValueParamTest'
},
{
u
'name'
:
u
'HasValueParamAttribute/1'
,
u
'value_param'
:
u
'42'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'Single/ValueParamTest'
},
{
u
'name'
:
u
'AnotherTestThatHasValueParamAttribute/0'
,
u
'value_param'
:
u
'33'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'Single/ValueParamTest'
},
{
u
'name'
:
u
'AnotherTestThatHasValueParamAttribute/1'
,
u
'value_param'
:
u
'42'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'Single/ValueParamTest'
}
]
}
]
}
EXPECTED_FILTERED
=
{
u
'tests'
:
1
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'timestamp'
:
u
'*'
,
u
'name'
:
u
'AllTests'
,
u
'ad_hoc_property'
:
u
'42'
,
u
'testsuites'
:
[{
u
'name'
:
u
'SuccessfulTest'
,
u
'tests'
:
1
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'testsuite'
:
[{
u
'name'
:
u
'Succeeds'
,
u
'status'
:
u
'RUN'
,
u
'time'
:
u
'*'
,
u
'classname'
:
u
'SuccessfulTest'
,
}]
}],
}
EXPECTED_EMPTY
=
{
u
'tests'
:
0
,
u
'failures'
:
0
,
u
'disabled'
:
0
,
u
'errors'
:
0
,
u
'time'
:
u
'*'
,
u
'timestamp'
:
u
'*'
,
u
'name'
:
u
'AllTests'
,
u
'testsuites'
:
[],
}
GTEST_PROGRAM_PATH
=
gtest_test_utils
.
GetTestExecutablePath
(
GTEST_PROGRAM_NAME
)
SUPPORTS_TYPED_TESTS
=
'TypedTest'
in
gtest_test_utils
.
Subprocess
(
[
GTEST_PROGRAM_PATH
,
GTEST_LIST_TESTS_FLAG
],
capture_stderr
=
False
).
output
class
GTestJsonOutputUnitTest
(
gtest_test_utils
.
TestCase
):
"""Unit test for Google Test's JSON output functionality.
"""
# This test currently breaks on platforms that do not support typed and
# type-parameterized tests, so we don't run it under them.
if
SUPPORTS_TYPED_TESTS
:
def
testNonEmptyJsonOutput
(
self
):
"""Verifies JSON output for a Google Test binary with non-empty output.
Runs a test program that generates a non-empty JSON output, and
tests that the JSON output is expected.
"""
self
.
_TestJsonOutput
(
GTEST_PROGRAM_NAME
,
EXPECTED_NON_EMPTY
,
1
)
def
testEmptyJsonOutput
(
self
):
"""Verifies JSON output for a Google Test binary without actual tests.
Runs a test program that generates an empty JSON output, and
tests that the JSON output is expected.
"""
self
.
_TestJsonOutput
(
'gtest_no_test_unittest'
,
EXPECTED_EMPTY
,
0
)
def
testTimestampValue
(
self
):
"""Checks whether the timestamp attribute in the JSON output is valid.
Runs a test program that generates an empty JSON output, and checks if
the timestamp attribute in the testsuites tag is valid.
"""
actual
=
self
.
_GetJsonOutput
(
'gtest_no_test_unittest'
,
[],
0
)
date_time_str
=
actual
[
'timestamp'
]
# datetime.strptime() is only available in Python 2.5+ so we have to
# parse the expected datetime manually.
match
=
re
.
match
(
r
'(\d+)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)'
,
date_time_str
)
self
.
assertTrue
(
re
.
match
,
'JSON datettime string %s has incorrect format'
%
date_time_str
)
date_time_from_json
=
datetime
.
datetime
(
year
=
int
(
match
.
group
(
1
)),
month
=
int
(
match
.
group
(
2
)),
day
=
int
(
match
.
group
(
3
)),
hour
=
int
(
match
.
group
(
4
)),
minute
=
int
(
match
.
group
(
5
)),
second
=
int
(
match
.
group
(
6
)))
time_delta
=
abs
(
datetime
.
datetime
.
now
()
-
date_time_from_json
)
# timestamp value should be near the current local time
self
.
assertTrue
(
time_delta
<
datetime
.
timedelta
(
seconds
=
600
),
'time_delta is %s'
%
time_delta
)
def
testDefaultOutputFile
(
self
):
"""Verifies the default output file name.
Confirms that Google Test produces an JSON output file with the expected
default name if no name is explicitly specified.
"""
output_file
=
os
.
path
.
join
(
gtest_test_utils
.
GetTempDir
(),
GTEST_DEFAULT_OUTPUT_FILE
)
gtest_prog_path
=
gtest_test_utils
.
GetTestExecutablePath
(
'gtest_no_test_unittest'
)
try
:
os
.
remove
(
output_file
)
except
OSError
:
e
=
sys
.
exc_info
()[
1
]
if
e
.
errno
!=
errno
.
ENOENT
:
raise
p
=
gtest_test_utils
.
Subprocess
(
[
gtest_prog_path
,
'%s=json'
%
GTEST_OUTPUT_FLAG
],
working_dir
=
gtest_test_utils
.
GetTempDir
())
self
.
assert_
(
p
.
exited
)
self
.
assertEquals
(
0
,
p
.
exit_code
)
self
.
assert_
(
os
.
path
.
isfile
(
output_file
))
def
testSuppressedJsonOutput
(
self
):
"""Verifies that no JSON output is generated.
Tests that no JSON file is generated if the default JSON listener is
shut down before RUN_ALL_TESTS is invoked.
"""
json_path
=
os
.
path
.
join
(
gtest_test_utils
.
GetTempDir
(),
GTEST_PROGRAM_NAME
+
'out.json'
)
if
os
.
path
.
isfile
(
json_path
):
os
.
remove
(
json_path
)
command
=
[
GTEST_PROGRAM_PATH
,
'%s=json:%s'
%
(
GTEST_OUTPUT_FLAG
,
json_path
),
'--shut_down_xml'
]
p
=
gtest_test_utils
.
Subprocess
(
command
)
if
p
.
terminated_by_signal
:
# p.signal is available only if p.terminated_by_signal is True.
self
.
assertFalse
(
p
.
terminated_by_signal
,
'%s was killed by signal %d'
%
(
GTEST_PROGRAM_NAME
,
p
.
signal
))
else
:
self
.
assert_
(
p
.
exited
)
self
.
assertEquals
(
1
,
p
.
exit_code
,
"'%s' exited with code %s, which doesn't match "
'the expected exit code %s.'
%
(
command
,
p
.
exit_code
,
1
))
self
.
assert_
(
not
os
.
path
.
isfile
(
json_path
))
def
testFilteredTestJsonOutput
(
self
):
"""Verifies JSON output when a filter is applied.
Runs a test program that executes only some tests and verifies that
non-selected tests do not show up in the JSON output.
"""
self
.
_TestJsonOutput
(
GTEST_PROGRAM_NAME
,
EXPECTED_FILTERED
,
0
,
extra_args
=
[
'%s=SuccessfulTest.*'
%
GTEST_FILTER_FLAG
])
def
_GetJsonOutput
(
self
,
gtest_prog_name
,
extra_args
,
expected_exit_code
):
"""Returns the JSON output generated by running the program gtest_prog_name.
Furthermore, the program's exit code must be expected_exit_code.
Args:
gtest_prog_name: Google Test binary name.
extra_args: extra arguments to binary invocation.
expected_exit_code: program's exit code.
"""
json_path
=
os
.
path
.
join
(
gtest_test_utils
.
GetTempDir
(),
gtest_prog_name
+
'out.json'
)
gtest_prog_path
=
gtest_test_utils
.
GetTestExecutablePath
(
gtest_prog_name
)
command
=
(
[
gtest_prog_path
,
'%s=json:%s'
%
(
GTEST_OUTPUT_FLAG
,
json_path
)]
+
extra_args
)
p
=
gtest_test_utils
.
Subprocess
(
command
)
if
p
.
terminated_by_signal
:
self
.
assert_
(
False
,
'%s was killed by signal %d'
%
(
gtest_prog_name
,
p
.
signal
))
else
:
self
.
assert_
(
p
.
exited
)
self
.
assertEquals
(
expected_exit_code
,
p
.
exit_code
,
"'%s' exited with code %s, which doesn't match "
'the expected exit code %s.'
%
(
command
,
p
.
exit_code
,
expected_exit_code
))
with
open
(
json_path
)
as
f
:
actual
=
json
.
load
(
f
)
return
actual
def
_TestJsonOutput
(
self
,
gtest_prog_name
,
expected
,
expected_exit_code
,
extra_args
=
None
):
"""Checks the JSON output generated by the Google Test binary.
Asserts that the JSON document generated by running the program
gtest_prog_name matches expected_json, a string containing another
JSON document. Furthermore, the program's exit code must be
expected_exit_code.
Args:
gtest_prog_name: Google Test binary name.
expected: expected output.
expected_exit_code: program's exit code.
extra_args: extra arguments to binary invocation.
"""
actual
=
self
.
_GetJsonOutput
(
gtest_prog_name
,
extra_args
or
[],
expected_exit_code
)
self
.
assertEqual
(
expected
,
gtest_json_test_utils
.
normalize
(
actual
))
if
__name__
==
'__main__'
:
os
.
environ
[
'GTEST_STACK_TRACE_DEPTH'
]
=
'1'
gtest_test_utils
.
Main
()
googletest/test/gtest_json_test_utils.py
0 → 100644
View file @
a7a7f51d
# Copyright 2018, 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.
"""Unit test utilities for gtest_json_output."""
import
re
def
normalize
(
obj
):
"""Normalize output object.
Args:
obj: Google Test's JSON output object to normalize.
Returns:
Normalized output without any references to transient information that may
change from run to run.
"""
def
_normalize
(
key
,
value
):
if
key
==
'time'
:
return
re
.
sub
(
r
'^\d+(\.\d+)?s$'
,
u
'*'
,
value
)
elif
key
==
'timestamp'
:
return
re
.
sub
(
r
'^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ$'
,
'*'
,
value
)
elif
key
==
'failure'
:
value
=
re
.
sub
(
r
'^.*[/\\](.*:)\d+\n'
,
'
\\
1*
\n
'
,
value
)
return
re
.
sub
(
r
'Stack trace:\n(.|\n)*'
,
'Stack trace:
\n
*'
,
value
)
else
:
return
normalize
(
value
)
if
isinstance
(
obj
,
dict
):
return
{
k
:
_normalize
(
k
,
v
)
for
k
,
v
in
obj
.
items
()}
if
isinstance
(
obj
,
list
):
return
[
normalize
(
x
)
for
x
in
obj
]
else
:
return
obj
googletest/test/gtest_list_tests_unittest.py
View file @
a7a7f51d
...
@@ -39,9 +39,8 @@ Google Test) the command line flags.
...
@@ -39,9 +39,8 @@ Google Test) the command line flags.
__author__
=
'phanna@google.com (Patrick Hanna)'
__author__
=
'phanna@google.com (Patrick Hanna)'
import
gtest_test_utils
import
re
import
re
import
gtest_test_utils
# Constants.
# Constants.
...
@@ -123,6 +122,7 @@ def Run(args):
...
@@ -123,6 +122,7 @@ def Run(args):
# The unit test.
# The unit test.
class
GTestListTestsUnitTest
(
gtest_test_utils
.
TestCase
):
class
GTestListTestsUnitTest
(
gtest_test_utils
.
TestCase
):
"""Tests using the --gtest_list_tests flag to list all tests."""
"""Tests using the --gtest_list_tests flag to list all tests."""
...
...
googletest/test/gtest_main_unittest.cc
View file @
a7a7f51d
...
@@ -41,5 +41,5 @@ TEST(GTestMainTest, ShouldSucceed) {
...
@@ -41,5 +41,5 @@ TEST(GTestMainTest, ShouldSucceed) {
}
// namespace
}
// namespace
// We are using the main() function defined in
src/
gtest_main.cc, so
// We are using the main() function defined in gtest_main.cc, so
we
//
we
don't define it here.
// don't define it here.
googletest/test/gtest_output_test.py
View file @
a7a7f51d
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
"""Tests the text output of Google C++ Testing Framework.
"""Tests the text output of Google C++ Testing Framework.
SYNOPSIS
SYNOPSIS
gtest_output_test.py --build_dir=BUILD/DIR --gengolden
gtest_output_test.py --build_dir=BUILD/DIR --gengolden
# where BUILD/DIR contains the built gtest_output_test_ file.
# where BUILD/DIR contains the built gtest_output_test_ file.
...
@@ -51,6 +52,7 @@ import gtest_test_utils
...
@@ -51,6 +52,7 @@ import gtest_test_utils
GENGOLDEN_FLAG
=
'--gengolden'
GENGOLDEN_FLAG
=
'--gengolden'
CATCH_EXCEPTIONS_ENV_VAR_NAME
=
'GTEST_CATCH_EXCEPTIONS'
CATCH_EXCEPTIONS_ENV_VAR_NAME
=
'GTEST_CATCH_EXCEPTIONS'
IS_LINUX
=
os
.
name
==
'posix'
and
os
.
uname
()[
0
]
==
'Linux'
IS_WINDOWS
=
os
.
name
==
'nt'
IS_WINDOWS
=
os
.
name
==
'nt'
# TODO(vladl@google.com): remove the _lin suffix.
# TODO(vladl@google.com): remove the _lin suffix.
...
@@ -99,7 +101,8 @@ def RemoveLocations(test_output):
...
@@ -99,7 +101,8 @@ def RemoveLocations(test_output):
'FILE_NAME:#: '.
'FILE_NAME:#: '.
"""
"""
return
re
.
sub
(
r
'.*[/\\](.+)(\:\d+|\(\d+\))\: '
,
r
'\1:#: '
,
test_output
)
return
re
.
sub
(
r
'.*[/\\]((gtest_output_test_|gtest).cc)(\:\d+|\(\d+\))\: '
,
r
'\1:#: '
,
test_output
)
def
RemoveStackTraceDetails
(
output
):
def
RemoveStackTraceDetails
(
output
):
...
@@ -249,11 +252,12 @@ test_list = GetShellCommandOutput(COMMAND_LIST_TESTS)
...
@@ -249,11 +252,12 @@ test_list = GetShellCommandOutput(COMMAND_LIST_TESTS)
SUPPORTS_DEATH_TESTS
=
'DeathTest'
in
test_list
SUPPORTS_DEATH_TESTS
=
'DeathTest'
in
test_list
SUPPORTS_TYPED_TESTS
=
'TypedTest'
in
test_list
SUPPORTS_TYPED_TESTS
=
'TypedTest'
in
test_list
SUPPORTS_THREADS
=
'ExpectFailureWithThreadsTest'
in
test_list
SUPPORTS_THREADS
=
'ExpectFailureWithThreadsTest'
in
test_list
SUPPORTS_STACK_TRACES
=
False
SUPPORTS_STACK_TRACES
=
IS_LINUX
CAN_GENERATE_GOLDEN_FILE
=
(
SUPPORTS_DEATH_TESTS
and
CAN_GENERATE_GOLDEN_FILE
=
(
SUPPORTS_DEATH_TESTS
and
SUPPORTS_TYPED_TESTS
and
SUPPORTS_TYPED_TESTS
and
SUPPORTS_THREADS
and
SUPPORTS_THREADS
and
SUPPORTS_STACK_TRACES
and
not
IS_WINDOWS
)
not
IS_WINDOWS
)
class
GTestOutputTest
(
gtest_test_utils
.
TestCase
):
class
GTestOutputTest
(
gtest_test_utils
.
TestCase
):
...
@@ -279,7 +283,7 @@ class GTestOutputTest(gtest_test_utils.TestCase):
...
@@ -279,7 +283,7 @@ class GTestOutputTest(gtest_test_utils.TestCase):
def
testOutput
(
self
):
def
testOutput
(
self
):
output
=
GetOutputOfAllCommands
()
output
=
GetOutputOfAllCommands
()
golden_file
=
open
(
GOLDEN_PATH
,
'r'
)
golden_file
=
open
(
GOLDEN_PATH
,
'r
b
'
)
# A mis-configured source control system can cause \r appear in EOL
# A mis-configured source control system can cause \r appear in EOL
# sequences when we read the golden file irrespective of an operating
# sequences when we read the golden file irrespective of an operating
# system used. Therefore, we need to strip those \r's from newlines
# system used. Therefore, we need to strip those \r's from newlines
...
@@ -330,9 +334,9 @@ if __name__ == '__main__':
...
@@ -330,9 +334,9 @@ if __name__ == '__main__':
else
:
else
:
message
=
(
message
=
(
"""Unable to write a golden file when compiled in an environment
"""Unable to write a golden file when compiled in an environment
that does not support all the required features (death tests,
typed tests,
that does not support all the required features (death tests,
and multiple threads). Please generate the golden file using a binary built
typed tests, stack traces, and multiple threads).
with those features enabled
."""
)
Please build this test and generate the golden file using Blaze on Linux
."""
)
sys
.
stderr
.
write
(
message
)
sys
.
stderr
.
write
(
message
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
...
...
googletest/test/gtest_output_test_.cc
View file @
a7a7f51d
...
@@ -37,15 +37,7 @@
...
@@ -37,15 +37,7 @@
#include "gtest/gtest-spi.h"
#include "gtest/gtest-spi.h"
#include "gtest/gtest.h"
#include "gtest/gtest.h"
// Indicates that this translation unit is part of Google Test's
// implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
#include <stdlib.h>
#include <stdlib.h>
...
@@ -176,6 +168,16 @@ void SubWithTrace(int n) {
...
@@ -176,6 +168,16 @@ void SubWithTrace(int n) {
SubWithoutTrace
(
n
);
SubWithoutTrace
(
n
);
}
}
TEST
(
SCOPED_TRACETest
,
AcceptedValues
)
{
SCOPED_TRACE
(
"literal string"
);
SCOPED_TRACE
(
std
::
string
(
"std::string"
));
SCOPED_TRACE
(
1337
);
// streamable type
const
char
*
null_value
=
NULL
;
SCOPED_TRACE
(
null_value
);
ADD_FAILURE
()
<<
"Just checking that all these values work fine."
;
}
// Tests that SCOPED_TRACE() obeys lexical scopes.
// Tests that SCOPED_TRACE() obeys lexical scopes.
TEST
(
SCOPED_TRACETest
,
ObeysScopes
)
{
TEST
(
SCOPED_TRACETest
,
ObeysScopes
)
{
printf
(
"(expected to fail)
\n
"
);
printf
(
"(expected to fail)
\n
"
);
...
@@ -323,6 +325,13 @@ TEST(SCOPED_TRACETest, WorksConcurrently) {
...
@@ -323,6 +325,13 @@ TEST(SCOPED_TRACETest, WorksConcurrently) {
}
}
#endif // GTEST_IS_THREADSAFE
#endif // GTEST_IS_THREADSAFE
// Tests basic functionality of the ScopedTrace utility (most of its features
// are already tested in SCOPED_TRACETest).
TEST
(
ScopedTraceTest
,
WithExplicitFileAndLine
)
{
testing
::
ScopedTrace
trace
(
"explicit_file.cc"
,
123
,
"expected trace message"
);
ADD_FAILURE
()
<<
"Check that the trace is attached to a particular location."
;
}
TEST
(
DisabledTestsWarningTest
,
TEST
(
DisabledTestsWarningTest
,
DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning
)
{
DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning
)
{
// This test body is intentionally empty. Its sole purpose is for
// This test body is intentionally empty. Its sole purpose is for
...
@@ -757,8 +766,6 @@ TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
...
@@ -757,8 +766,6 @@ TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
// This #ifdef block tests the output of value-parameterized tests.
// This #ifdef block tests the output of value-parameterized tests.
#if GTEST_HAS_PARAM_TEST
std
::
string
ParamNameFunc
(
const
testing
::
TestParamInfo
<
std
::
string
>&
info
)
{
std
::
string
ParamNameFunc
(
const
testing
::
TestParamInfo
<
std
::
string
>&
info
)
{
return
info
.
param
;
return
info
.
param
;
}
}
...
@@ -779,8 +786,6 @@ INSTANTIATE_TEST_CASE_P(PrintingStrings,
...
@@ -779,8 +786,6 @@ INSTANTIATE_TEST_CASE_P(PrintingStrings,
testing
::
Values
(
std
::
string
(
"a"
)),
testing
::
Values
(
std
::
string
(
"a"
)),
ParamNameFunc
);
ParamNameFunc
);
#endif // GTEST_HAS_PARAM_TEST
// This #ifdef block tests the output of typed tests.
// This #ifdef block tests the output of typed tests.
#if GTEST_HAS_TYPED_TEST
#if GTEST_HAS_TYPED_TEST
...
...
googletest/test/gtest_output_test_golden_lin.txt
View file @
a7a7f51d
...
@@ -8,7 +8,7 @@ gtest_output_test_.cc:#: Failure
...
@@ -8,7 +8,7 @@ gtest_output_test_.cc:#: Failure
Expected equality of these values:
Expected equality of these values:
2
2
3
3
[0;32m[==========] [mRunning 6
6
tests from
29
test cases.
[0;32m[==========] [mRunning 6
8
tests from
30
test cases.
[0;32m[----------] [mGlobal test environment set-up.
[0;32m[----------] [mGlobal test environment set-up.
FooEnvironment::SetUp() called.
FooEnvironment::SetUp() called.
BarEnvironment::SetUp() called.
BarEnvironment::SetUp() called.
...
@@ -95,7 +95,17 @@ i == 3
...
@@ -95,7 +95,17 @@ i == 3
gtest_output_test_.cc:#: Failure
gtest_output_test_.cc:#: Failure
Expected: (3) >= (a[i]), actual: 3 vs 6
Expected: (3) >= (a[i]), actual: 3 vs 6
[0;31m[ FAILED ] [mLoggingTest.InterleavingLoggingAndAssertions
[0;31m[ FAILED ] [mLoggingTest.InterleavingLoggingAndAssertions
[0;32m[----------] [m6 tests from SCOPED_TRACETest
[0;32m[----------] [m7 tests from SCOPED_TRACETest
[0;32m[ RUN ] [mSCOPED_TRACETest.AcceptedValues
gtest_output_test_.cc:#: Failure
Failed
Just checking that all these values work fine.
Google Test trace:
gtest_output_test_.cc:#: (null)
gtest_output_test_.cc:#: 1337
gtest_output_test_.cc:#: std::string
gtest_output_test_.cc:#: literal string
[0;31m[ FAILED ] [mSCOPED_TRACETest.AcceptedValues
[0;32m[ RUN ] [mSCOPED_TRACETest.ObeysScopes
[0;32m[ RUN ] [mSCOPED_TRACETest.ObeysScopes
(expected to fail)
(expected to fail)
gtest_output_test_.cc:#: Failure
gtest_output_test_.cc:#: Failure
...
@@ -212,6 +222,14 @@ gtest_output_test_.cc:#: Failure
...
@@ -212,6 +222,14 @@ gtest_output_test_.cc:#: Failure
Failed
Failed
Expected failure #6 (in thread A, no trace alive).
Expected failure #6 (in thread A, no trace alive).
[0;31m[ FAILED ] [mSCOPED_TRACETest.WorksConcurrently
[0;31m[ FAILED ] [mSCOPED_TRACETest.WorksConcurrently
[0;32m[----------] [m1 test from ScopedTraceTest
[0;32m[ RUN ] [mScopedTraceTest.WithExplicitFileAndLine
gtest_output_test_.cc:#: Failure
Failed
Check that the trace is attached to a particular location.
Google Test trace:
explicit_file.cc:123: expected trace message
[0;31m[ FAILED ] [mScopedTraceTest.WithExplicitFileAndLine
[0;32m[----------] [m1 test from NonFatalFailureInFixtureConstructorTest
[0;32m[----------] [m1 test from NonFatalFailureInFixtureConstructorTest
[0;32m[ RUN ] [mNonFatalFailureInFixtureConstructorTest.FailureInConstructor
[0;32m[ RUN ] [mNonFatalFailureInFixtureConstructorTest.FailureInConstructor
(expecting 5 failures)
(expecting 5 failures)
...
@@ -466,7 +484,7 @@ Expected equality of these values:
...
@@ -466,7 +484,7 @@ Expected equality of these values:
Which is: '\0'
Which is: '\0'
Expected failure
Expected failure
[0;31m[ FAILED ] [mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[0;31m[ FAILED ] [mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[0;32m[----------] [m2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned
int
[0;32m[----------] [m2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned
[0;32m[ RUN ] [mUnsigned/TypedTestP/1.Success
[0;32m[ RUN ] [mUnsigned/TypedTestP/1.Success
[0;32m[ OK ] [mUnsigned/TypedTestP/1.Success
[0;32m[ OK ] [mUnsigned/TypedTestP/1.Success
[0;32m[ RUN ] [mUnsigned/TypedTestP/1.Failure
[0;32m[ RUN ] [mUnsigned/TypedTestP/1.Failure
...
@@ -477,7 +495,7 @@ Expected equality of these values:
...
@@ -477,7 +495,7 @@ Expected equality of these values:
TypeParam()
TypeParam()
Which is: 0
Which is: 0
Expected failure
Expected failure
[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned
int
[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned
[0;32m[----------] [m4 tests from ExpectFailureTest
[0;32m[----------] [m4 tests from ExpectFailureTest
[0;32m[ RUN ] [mExpectFailureTest.ExpectFatalFailure
[0;32m[ RUN ] [mExpectFailureTest.ExpectFatalFailure
(expecting 1 failure)
(expecting 1 failure)
...
@@ -636,21 +654,23 @@ FooEnvironment::TearDown() called.
...
@@ -636,21 +654,23 @@ FooEnvironment::TearDown() called.
gtest_output_test_.cc:#: Failure
gtest_output_test_.cc:#: Failure
Failed
Failed
Expected fatal failure.
Expected fatal failure.
[0;32m[==========] [m6
6
tests from
29
test cases ran.
[0;32m[==========] [m6
8
tests from
30
test cases ran.
[0;32m[ PASSED ] [m22 tests.
[0;32m[ PASSED ] [m22 tests.
[0;31m[ FAILED ] [m4
4
tests, listed below:
[0;31m[ FAILED ] [m4
6
tests, listed below:
[0;31m[ FAILED ] [mNonfatalFailureTest.EscapesStringOperands
[0;31m[ FAILED ] [mNonfatalFailureTest.EscapesStringOperands
[0;31m[ FAILED ] [mNonfatalFailureTest.DiffForLongStrings
[0;31m[ FAILED ] [mNonfatalFailureTest.DiffForLongStrings
[0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInSubroutine
[0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInSubroutine
[0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInNestedSubroutine
[0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInNestedSubroutine
[0;31m[ FAILED ] [mFatalFailureTest.NonfatalFailureInSubroutine
[0;31m[ FAILED ] [mFatalFailureTest.NonfatalFailureInSubroutine
[0;31m[ FAILED ] [mLoggingTest.InterleavingLoggingAndAssertions
[0;31m[ FAILED ] [mLoggingTest.InterleavingLoggingAndAssertions
[0;31m[ FAILED ] [mSCOPED_TRACETest.AcceptedValues
[0;31m[ FAILED ] [mSCOPED_TRACETest.ObeysScopes
[0;31m[ FAILED ] [mSCOPED_TRACETest.ObeysScopes
[0;31m[ FAILED ] [mSCOPED_TRACETest.WorksInLoop
[0;31m[ FAILED ] [mSCOPED_TRACETest.WorksInLoop
[0;31m[ FAILED ] [mSCOPED_TRACETest.WorksInSubroutine
[0;31m[ FAILED ] [mSCOPED_TRACETest.WorksInSubroutine
[0;31m[ FAILED ] [mSCOPED_TRACETest.CanBeNested
[0;31m[ FAILED ] [mSCOPED_TRACETest.CanBeNested
[0;31m[ FAILED ] [mSCOPED_TRACETest.CanBeRepeated
[0;31m[ FAILED ] [mSCOPED_TRACETest.CanBeRepeated
[0;31m[ FAILED ] [mSCOPED_TRACETest.WorksConcurrently
[0;31m[ FAILED ] [mSCOPED_TRACETest.WorksConcurrently
[0;31m[ FAILED ] [mScopedTraceTest.WithExplicitFileAndLine
[0;31m[ FAILED ] [mNonFatalFailureInFixtureConstructorTest.FailureInConstructor
[0;31m[ FAILED ] [mNonFatalFailureInFixtureConstructorTest.FailureInConstructor
[0;31m[ FAILED ] [mFatalFailureInFixtureConstructorTest.FailureInConstructor
[0;31m[ FAILED ] [mFatalFailureInFixtureConstructorTest.FailureInConstructor
[0;31m[ FAILED ] [mNonFatalFailureInSetUpTest.FailureInSetUp
[0;31m[ FAILED ] [mNonFatalFailureInSetUpTest.FailureInSetUp
...
@@ -673,7 +693,7 @@ Expected fatal failure.
...
@@ -673,7 +693,7 @@ Expected fatal failure.
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenStatementThrows
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenStatementThrows
[0;31m[ FAILED ] [mTypedTest/0.Failure, where TypeParam = int
[0;31m[ FAILED ] [mTypedTest/0.Failure, where TypeParam = int
[0;31m[ FAILED ] [mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[0;31m[ FAILED ] [mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned
int
[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned
[0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailure
[0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailure
[0;31m[ FAILED ] [mExpectFailureTest.ExpectNonFatalFailure
[0;31m[ FAILED ] [mExpectFailureTest.ExpectNonFatalFailure
[0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailureOnAllThreads
[0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailureOnAllThreads
...
@@ -684,7 +704,7 @@ Expected fatal failure.
...
@@ -684,7 +704,7 @@ Expected fatal failure.
[0;31m[ FAILED ] [mPrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2
[0;31m[ FAILED ] [mPrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2
[0;31m[ FAILED ] [mPrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
[0;31m[ FAILED ] [mPrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
4
4
FAILED TESTS
4
6
FAILED TESTS
[0;33m YOU HAVE 1 DISABLED TEST
[0;33m YOU HAVE 1 DISABLED TEST
[mNote: Google Test filter = FatalFailureTest.*:LoggingTest.*
[mNote: Google Test filter = FatalFailureTest.*:LoggingTest.*
...
...
Prev
1
2
3
4
5
6
7
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