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
......@@ -26,13 +26,12 @@
// 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.
//
#include <stdio.h>
#include "gtest/gtest.h"
GTEST_API_ int main(int argc, char **argv) {
printf("Running main() from gtest_main.cc\n");
printf("Running main() from %s\n", __FILE__);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
......@@ -34,35 +34,65 @@
licenses(["notice"])
""" gtest own tests """
config_setting(
name = "windows",
values = {"cpu": "x64_windows"},
)
config_setting(
name = "windows_msvc",
values = {"cpu": "x64_windows_msvc"},
)
#on windows exclude gtest-tuple.h and gtest-tuple_test.cc
config_setting(
name = "has_absl",
values = {"define": "absl=1"},
)
#on windows exclude gtest-tuple.h and googletest-tuple-test.cc
cc_test(
name = "gtest_all_test",
size = "small",
srcs = glob(
include = [
"gtest-*.cc",
"*.h",
"googletest/include/gtest/**/*.h",
],
exclude = [
"gtest-unittest-api_test.cc",
"gtest-tuple_test.cc",
"googletest/src/gtest-all.cc",
"gtest_all_test.cc",
"gtest-death-test_ex_test.cc",
"gtest-listener_test.cc",
"gtest-unittest-api_test.cc",
"gtest-param-test_test.cc",
],
) + select({
srcs = glob(
include = [
"gtest-*.cc",
"googletest-*.cc",
"*.h",
"googletest/include/gtest/**/*.h",
],
exclude = [
"gtest-unittest-api_test.cc",
"googletest-tuple-test.cc",
"googletest/src/gtest-all.cc",
"gtest_all_test.cc",
"gtest-death-test_ex_test.cc",
"gtest-listener_test.cc",
"gtest-unittest-api_test.cc",
"googletest-param-test-test.cc",
"googletest-catch-exceptions-test_.cc",
"googletest-color-test_.cc",
"googletest-env-var-test_.cc",
"googletest-filter-unittest_.cc",
"googletest-break-on-failure-unittest_.cc",
"googletest-listener-test.cc",
"googletest-output-test_.cc",
"googletest-list-tests-unittest_.cc",
"googletest-shuffle-test_.cc",
"googletest-uninitialized-test_.cc",
"googletest-death-test_ex_test.cc",
"googletest-param-test-test",
"googletest-throw-on-failure-test_.cc",
"googletest-param-test-invalid-name1-test_.cc",
"googletest-param-test-invalid-name2-test_.cc",
],
) + select({
"//:windows": [],
"//:windows_msvc": [],
"//conditions:default": [
"gtest-tuple_test.cc",
"googletest-tuple-test.cc",
],
}),
}),
copts = select({
"//:windows": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
"//:windows_msvc": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
......@@ -84,16 +114,28 @@ cc_test(
deps = ["//:gtest_main"],
)
# Tests death tests.
cc_test(
name = "googletest-death-test-test",
size = "medium",
srcs = ["googletest-death-test-test.cc"],
deps = ["//:gtest_main"],
)
cc_test(
name = "gtest_test_macro_stack_footprint_test",
size = "small",
srcs = ["gtest_test_macro_stack_footprint_test.cc"],
deps = ["//:gtest"],
)
#These googletest tests have their own main()
cc_test(
name = "gtest-listener_test",
name = "googletest-listener-test",
size = "small",
srcs = [
"gtest-listener_test.cc",
],
deps = [
"//:gtest",
],
srcs = ["googletest-listener-test.cc"],
deps = ["//:gtest_main"],
)
cc_test(
......@@ -108,16 +150,14 @@ cc_test(
)
cc_test(
name = "gtest-param-test_test",
name = "googletest-param-test-test",
size = "small",
srcs = [
"gtest-param-test2_test.cc",
"gtest-param-test_test.cc",
"gtest-param-test_test.h",
],
deps = [
"//:gtest",
"googletest-param-test-test.cc",
"googletest-param-test-test.h",
"googletest-param-test2-test.cc",
],
deps = ["//:gtest"],
)
cc_test(
......@@ -135,7 +175,6 @@ py_library(
name = "gtest_test_utils",
testonly = 1,
srcs = ["gtest_test_utils.py"],
)
cc_binary(
......@@ -144,6 +183,7 @@ cc_binary(
srcs = ["gtest_help_test_.cc"],
deps = ["//:gtest_main"],
)
py_test(
name = "gtest_help_test",
size = "small",
......@@ -153,82 +193,92 @@ py_test(
)
cc_binary(
name = "gtest_output_test_",
name = "googletest-output-test_",
testonly = 1,
srcs = ["gtest_output_test_.cc"],
srcs = ["googletest-output-test_.cc"],
deps = ["//:gtest"],
)
py_test(
name = "gtest_output_test",
name = "googletest-output-test",
size = "small",
srcs = ["gtest_output_test.py"],
srcs = ["googletest-output-test.py"],
args = select({
":has_absl": [],
"//conditions:default": ["--no_stacktrace_support"],
}),
data = [
"gtest_output_test_golden_lin.txt",
":gtest_output_test_",
"googletest-output-test-golden-lin.txt",
":googletest-output-test_",
],
deps = [":gtest_test_utils"],
)
cc_binary(
name = "gtest_color_test_",
name = "googletest-color-test_",
testonly = 1,
srcs = ["gtest_color_test_.cc"],
srcs = ["googletest-color-test_.cc"],
deps = ["//:gtest"],
)
py_test(
name = "gtest_color_test",
name = "googletest-color-test",
size = "small",
srcs = ["gtest_color_test.py"],
data = [":gtest_color_test_"],
srcs = ["googletest-color-test.py"],
data = [":googletest-color-test_"],
deps = [":gtest_test_utils"],
)
cc_binary(
name = "gtest_env_var_test_",
name = "googletest-env-var-test_",
testonly = 1,
srcs = ["gtest_env_var_test_.cc"],
srcs = ["googletest-env-var-test_.cc"],
deps = ["//:gtest"],
)
py_test(
name = "gtest_env_var_test",
size = "small",
srcs = ["gtest_env_var_test.py"],
data = [":gtest_env_var_test_"],
name = "googletest-env-var-test",
size = "medium",
srcs = ["googletest-env-var-test.py"],
data = [":googletest-env-var-test_"],
deps = [":gtest_test_utils"],
)
cc_binary(
name = "gtest_filter_unittest_",
name = "googletest-filter-unittest_",
testonly = 1,
srcs = ["gtest_filter_unittest_.cc"],
srcs = ["googletest-filter-unittest_.cc"],
deps = ["//:gtest"],
)
py_test(
name = "gtest_filter_unittest",
size = "small",
srcs = ["gtest_filter_unittest.py"],
data = [":gtest_filter_unittest_"],
name = "googletest-filter-unittest",
size = "medium",
srcs = ["googletest-filter-unittest.py"],
data = [":googletest-filter-unittest_"],
deps = [":gtest_test_utils"],
)
cc_binary(
name = "gtest_break_on_failure_unittest_",
name = "googletest-break-on-failure-unittest_",
testonly = 1,
srcs = ["gtest_break_on_failure_unittest_.cc"],
srcs = ["googletest-break-on-failure-unittest_.cc"],
deps = ["//:gtest"],
)
py_test(
name = "gtest_break_on_failure_unittest",
name = "googletest-break-on-failure-unittest",
size = "small",
srcs = ["gtest_break_on_failure_unittest.py"],
data = [":gtest_break_on_failure_unittest_"],
srcs = ["googletest-break-on-failure-unittest.py"],
data = [":googletest-break-on-failure-unittest_"],
deps = [":gtest_test_utils"],
)
cc_test(
name = "gtest_assert_by_exception_test",
size = "small",
......@@ -236,72 +286,75 @@ cc_test(
deps = ["//:gtest"],
)
cc_binary(
name = "gtest_throw_on_failure_test_",
name = "googletest-throw-on-failure-test_",
testonly = 1,
srcs = ["gtest_throw_on_failure_test_.cc"],
srcs = ["googletest-throw-on-failure-test_.cc"],
deps = ["//:gtest"],
)
py_test(
name = "gtest_throw_on_failure_test",
name = "googletest-throw-on-failure-test",
size = "small",
srcs = ["gtest_throw_on_failure_test.py"],
data = [":gtest_throw_on_failure_test_"],
srcs = ["googletest-throw-on-failure-test.py"],
data = [":googletest-throw-on-failure-test_"],
deps = [":gtest_test_utils"],
)
cc_binary(
name = "gtest_list_tests_unittest_",
name = "googletest-list-tests-unittest_",
testonly = 1,
srcs = ["gtest_list_tests_unittest_.cc"],
srcs = ["googletest-list-tests-unittest_.cc"],
deps = ["//:gtest"],
)
py_test(
name = "gtest_list_tests_unittest",
name = "googletest-list-tests-unittest",
size = "small",
srcs = ["gtest_list_tests_unittest.py"],
data = [":gtest_list_tests_unittest_"],
srcs = ["googletest-list-tests-unittest.py"],
data = [":googletest-list-tests-unittest_"],
deps = [":gtest_test_utils"],
)
cc_binary(
name = "gtest_shuffle_test_",
srcs = ["gtest_shuffle_test_.cc"],
name = "googletest-shuffle-test_",
srcs = ["googletest-shuffle-test_.cc"],
deps = ["//:gtest"],
)
py_test(
name = "gtest_shuffle_test",
name = "googletest-shuffle-test",
size = "small",
srcs = ["gtest_shuffle_test.py"],
data = [":gtest_shuffle_test_"],
srcs = ["googletest-shuffle-test.py"],
data = [":googletest-shuffle-test_"],
deps = [":gtest_test_utils"],
)
cc_binary(
name = "gtest_catch_exceptions_no_ex_test_",
name = "googletest-catch-exceptions-no-ex-test_",
testonly = 1,
srcs = ["gtest_catch_exceptions_test_.cc"],
srcs = ["googletest-catch-exceptions-test_.cc"],
deps = ["//:gtest_main"],
)
cc_binary(
name = "gtest_catch_exceptions_ex_test_",
name = "googletest-catch-exceptions-ex-test_",
testonly = 1,
srcs = ["gtest_catch_exceptions_test_.cc"],
srcs = ["googletest-catch-exceptions-test_.cc"],
copts = ["-fexceptions"],
deps = ["//:gtest_main"],
)
py_test(
name = "gtest_catch_exceptions_test",
name = "googletest-catch-exceptions-test",
size = "small",
srcs = ["gtest_catch_exceptions_test.py"],
srcs = ["googletest-catch-exceptions-test.py"],
data = [
":gtest_catch_exceptions_ex_test_",
":gtest_catch_exceptions_no_ex_test_",
":googletest-catch-exceptions-ex-test_",
":googletest-catch-exceptions-no-ex-test_",
],
deps = [":gtest_test_utils"],
)
......@@ -327,6 +380,10 @@ py_test(
"gtest_xml_output_unittest.py",
"gtest_xml_test_utils.py",
],
args = select({
":has_absl": [],
"//conditions:default": ["--no_stacktrace_support"],
}),
data = [
# We invoke gtest_no_test_unittest to verify the XML output
# when the test program contains no test definition.
......@@ -365,16 +422,106 @@ py_test(
)
cc_binary(
name = "gtest_uninitialized_test_",
name = "googletest-uninitialized-test_",
testonly = 1,
srcs = ["gtest_uninitialized_test_.cc"],
srcs = ["googletest-uninitialized-test_.cc"],
deps = ["//:gtest"],
)
py_test(
name = "gtest_uninitialized_test",
name = "googletest-uninitialized-test",
size = "medium",
srcs = ["gtest_uninitialized_test.py"],
data = [":gtest_uninitialized_test_"],
srcs = ["googletest-uninitialized-test.py"],
data = ["googletest-uninitialized-test_"],
deps = [":gtest_test_utils"],
)
cc_binary(
name = "gtest_testbridge_test_",
testonly = 1,
srcs = ["gtest_testbridge_test_.cc"],
deps = ["//:gtest_main"],
)
# Tests that filtering via testbridge works
py_test(
name = "gtest_testbridge_test",
size = "small",
srcs = ["gtest_testbridge_test.py"],
data = [":gtest_testbridge_test_"],
deps = [":gtest_test_utils"],
)
py_test(
name = "googletest-json-outfiles-test",
size = "small",
srcs = [
"googletest-json-outfiles-test.py",
"gtest_json_test_utils.py",
],
data = [
":gtest_xml_outfile1_test_",
":gtest_xml_outfile2_test_",
],
deps = [":gtest_test_utils"],
)
py_test(
name = "googletest-json-output-unittest",
size = "medium",
srcs = [
"googletest-json-output-unittest.py",
"gtest_json_test_utils.py",
],
data = [
# We invoke gtest_no_test_unittest to verify the JSON output
# when the test program contains no test definition.
":gtest_no_test_unittest",
":gtest_xml_output_unittest_",
],
args = select({
":has_absl": [],
"//conditions:default": ["--no_stacktrace_support"],
}),
deps = [":gtest_test_utils"],
)
# Verifies interaction of death tests and exceptions.
cc_test(
name = "googletest-death-test_ex_catch_test",
size = "medium",
srcs = ["googletest-death-test_ex_test.cc"],
copts = ["-fexceptions"],
defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=1"],
deps = ["//:gtest"],
)
cc_binary(
name = "googletest-param-test-invalid-name1-test_",
testonly = 1,
srcs = ["googletest-param-test-invalid-name1-test_.cc"],
deps = ["//:gtest"],
)
cc_binary(
name = "googletest-param-test-invalid-name2-test_",
testonly = 1,
srcs = ["googletest-param-test-invalid-name2-test_.cc"],
deps = ["//:gtest"],
)
py_test(
name = "googletest-param-test-invalid-name1-test",
size = "small",
srcs = ["googletest-param-test-invalid-name1-test.py"],
data = [":googletest-param-test-invalid-name1-test_"],
deps = [":gtest_test_utils"],
)
py_test(
name = "googletest-param-test-invalid-name2-test",
size = "small",
srcs = ["googletest-param-test-invalid-name2-test.py"],
data = [":googletest-param-test-invalid-name2-test_"],
deps = [":gtest_test_utils"],
)
......@@ -34,12 +34,10 @@
A user can ask Google Test to seg-fault when an assertion fails, using
either the GTEST_BREAK_ON_FAILURE environment variable or the
--gtest_break_on_failure flag. This script tests such functionality
by invoking gtest_break_on_failure_unittest_ (a program written with
by invoking googletest-break-on-failure-unittest_ (a program written with
Google Test) with different environments and command line flags.
"""
__author__ = 'wan@google.com (Zhanyong Wan)'
import os
import gtest_test_utils
......@@ -59,9 +57,9 @@ THROW_ON_FAILURE_ENV_VAR = 'GTEST_THROW_ON_FAILURE'
# The environment variable for enabling/disabling the catch-exceptions mode.
CATCH_EXCEPTIONS_ENV_VAR = 'GTEST_CATCH_EXCEPTIONS'
# Path to the gtest_break_on_failure_unittest_ program.
# Path to the googletest-break-on-failure-unittest_ program.
EXE_PATH = gtest_test_utils.GetTestExecutablePath(
'gtest_break_on_failure_unittest_')
'googletest-break-on-failure-unittest_')
environ = gtest_test_utils.environ
......@@ -95,7 +93,7 @@ class GTestBreakOnFailureUnitTest(gtest_test_utils.TestCase):
"""
def RunAndVerify(self, env_var_value, flag_value, expect_seg_fault):
"""Runs gtest_break_on_failure_unittest_ and verifies that it does
"""Runs googletest-break-on-failure-unittest_ and verifies that it does
(or does not) have a seg-fault.
Args:
......
......@@ -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)
// Unit test for Google Test's break-on-failure mode.
//
......
......@@ -30,13 +30,11 @@
"""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 googletest-catch-exceptions-test_ and
googletest-catch-exceptions-ex-test_ (programs written with
Google Test) and verifies their output.
"""
__author__ = 'vladl@google.com (Vlad Losev)'
import gtest_test_utils
# Constants.
......@@ -45,15 +43,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 googletest-catch-exceptions-ex-test_ binary, compiled with
# exceptions enabled.
EX_EXE_PATH = gtest_test_utils.GetTestExecutablePath(
'gtest_catch_exceptions_ex_test_')
'googletest-catch-exceptions-ex-test_')
# Path to the gtest_catch_exceptions_test_ binary, compiled with
# Path to the googletest-catch-exceptions-test_ binary, compiled with
# exceptions disabled.
EXE_PATH = gtest_test_utils.GetTestExecutablePath(
'gtest_catch_exceptions_no_ex_test_')
'googletest-catch-exceptions-no-ex-test_')
environ = gtest_test_utils.environ
SetEnvVar = gtest_test_utils.SetEnvVar
......
......@@ -26,17 +26,17 @@
// 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: 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.
#include "gtest/gtest.h"
// exceptions, and the output is verified by
// googletest-catch-exceptions-test.py.
#include <stdio.h> // NOLINT
#include <stdlib.h> // For exit().
#include "gtest/gtest.h"
#if GTEST_HAS_SEH
# include <windows.h>
#endif
......
......@@ -31,8 +31,6 @@
"""Verifies that Google Test correctly determines whether to use colors."""
__author__ = 'wan@google.com (Zhanyong Wan)'
import os
import gtest_test_utils
......@@ -40,7 +38,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('googletest-color-test_')
def SetEnvVar(env_var, value):
......@@ -53,7 +51,7 @@ def SetEnvVar(env_var, value):
def UsesColor(term, color_env_var, color_flag):
"""Runs gtest_color_test_ and returns its exit code."""
"""Runs googletest-color-test_ and returns its exit code."""
SetEnvVar('TERM', term)
SetEnvVar(COLOR_ENV_VAR, color_env_var)
......
......@@ -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)
// A helper program for testing how Google Test determines whether to use
// colors in the output. It prints "YES" and returns 1 if Google Test
......
......@@ -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 death tests.
......@@ -200,7 +199,7 @@ int DieInDebugElse12(int* sideeffect) {
return 12;
}
# if GTEST_OS_WINDOWS
# if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA
// Tests the ExitedWithCode predicate.
TEST(ExitStatusPredicateTest, ExitedWithCode) {
......@@ -272,7 +271,7 @@ TEST(ExitStatusPredicateTest, KilledBySignal) {
EXPECT_FALSE(pred_kill(status_segv));
}
# endif // GTEST_OS_WINDOWS
# endif // GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA
// Tests that the death test macros expand to code which may or may not
// be followed by operator<<, and that in either case the complete text
......@@ -784,11 +783,12 @@ 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 https://msdn.microsoft.com/en-us/query-bi/m/dwwzkt4c.
EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "") << "b_ar";
# else
# elif !GTEST_OS_FUCHSIA
// Fuchsia has no unix signals.
EXPECT_EXIT(raise(SIGKILL), testing::KilledBySignal(SIGKILL), "") << "foo";
ASSERT_EXIT(raise(SIGUSR2), testing::KilledBySignal(SIGUSR2), "") << "bar";
......@@ -1279,7 +1279,7 @@ TEST(ParseNaturalNumberTest, WorksForShorterIntegers) {
# if GTEST_OS_WINDOWS
TEST(EnvironmentTest, HandleFitsIntoSizeT) {
// TODO(vladl@google.com): Remove this test after this condition is verified
// FIXME: Remove this test after this condition is verified
// in a static assertion in gtest-death-test.cc in the function
// GetStatusFileDescriptor.
ASSERT_TRUE(sizeof(HANDLE) <= sizeof(size_t));
......
......@@ -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: vladl@google.com (Vlad Losev)
//
// Tests that verify interaction of exceptions and death tests.
......@@ -69,7 +68,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");
"googletest-death-test_ex_test.cc");
}
# endif // GTEST_HAS_EXCEPTIONS
......
......@@ -31,8 +31,6 @@
"""Verifies that Google Test correctly parses environment variables."""
__author__ = 'wan@google.com (Zhanyong Wan)'
import os
import gtest_test_utils
......@@ -40,7 +38,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('googletest-env-var-test_')
environ = os.environ.copy()
......@@ -62,7 +60,7 @@ def SetEnvVar(env_var, value):
def GetFlag(flag):
"""Runs gtest_env_var_test_ and returns its output."""
"""Runs googletest-env-var-test_ and returns its output."""
args = [COMMAND]
if flag is not None:
......
......@@ -26,16 +26,14 @@
// 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)
// A helper program for testing that Google Test parses the environment
// variables correctly.
#include "gtest/gtest.h"
#include <iostream>
#include "gtest/gtest.h"
#include "src/gtest-internal-inl.h"
using ::std::cout;
......@@ -115,7 +113,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: googletest-env-var-test_ NAME_OF_FLAG\n";
return 1;
}
......
......@@ -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.
//
//
// Google Test filepath utilities
//
// This file tests classes and functions used internally by
......@@ -51,7 +50,7 @@ namespace internal {
namespace {
#if GTEST_OS_WINDOWS_MOBILE
// TODO(wan@google.com): Move these to the POSIX adapter section in
// FIXME: Move these to the POSIX adapter section in
// gtest-port.h.
// Windows CE doesn't have the remove C function.
......
......@@ -33,15 +33,13 @@
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
googletest-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,
we test that here also.
"""
__author__ = 'wan@google.com (Zhanyong Wan)'
import os
import re
import sets
......@@ -100,8 +98,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 googletest-filter-unittest_ program.
COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-filter-unittest_')
# Regex for determining whether parameterized tests are enabled in the binary.
PARAM_TEST_REGEX = re.compile(r'/ParamTest')
......@@ -120,7 +118,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 googletest-filter-unittests_.
PARAM_TESTS = [
'SeqP/ParamTest.TestX/0',
'SeqP/ParamTest.TestX/1',
......@@ -292,7 +290,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 googletest-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 +328,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 googletest-filter-unittest_ with the given filter, and enables
disabled tests. Verifies that the right set of tests were run.
Args:
......
......@@ -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)
// Unit test for Google Test test filters.
//
......
......@@ -136,11 +136,11 @@ class GTestJsonOutFilesTest(gtest_test_utils.TestCase):
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 + '.json'
output_file1 = os.path.join(self.output_dir_, output_file_name1)
output_file_name2 = 'lt-' + output_file_name1
......
......@@ -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 = '\nStack 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()
......@@ -26,13 +26,10 @@
// 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.
//
// Authors: Dan Egnor (egnor@google.com)
// Ported to Windows: Vadim Berman (vadimb@google.com)
#include "gtest/internal/gtest-linked_ptr.h"
#include <stdlib.h>
#include "gtest/internal/gtest-linked_ptr.h"
#include "gtest/gtest.h"
namespace {
......
......@@ -33,12 +33,10 @@
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 googletest-list-tests-unittest_ (a program written with
Google Test) the command line flags.
"""
__author__ = 'phanna@google.com (Patrick Hanna)'
import re
import gtest_test_utils
......@@ -47,10 +45,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 googletest-list-tests-unittest_ program.
EXE_PATH = gtest_test_utils.GetTestExecutablePath('googletest-list-tests-unittest_')
# The expected output when running gtest_list_tests_unittest_ with
# The expected output when running googletest-list-tests-unittest_ with
# --gtest_list_tests
EXPECTED_OUTPUT_NO_FILTER_RE = re.compile(r"""FooDeathTest\.
Test1
......@@ -94,7 +92,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 googletest-list-tests-unittest_ with
# --gtest_list_tests and --gtest_filter=Foo*.
EXPECTED_OUTPUT_FILTER_FOO_RE = re.compile(r"""FooDeathTest\.
Test1
......@@ -114,7 +112,7 @@ FooTest\.
def Run(args):
"""Runs gtest_list_tests_unittest_ and returns the list of tests printed."""
"""Runs googletest-list-tests-unittest_ and returns the list of tests printed."""
return gtest_test_utils.Subprocess([EXE_PATH] + args,
capture_stderr=False).output
......@@ -127,7 +125,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 googletest-list-tests-unittest_ and verifies that it prints
the correct tests.
Args:
......
......@@ -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: phanna@google.com (Patrick Hanna)
// Unit test for Google Test's --gtest_list_tests flag.
//
......
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