diff options
-rw-r--r-- | BUILD.bazel | 13 | ||||
-rw-r--r-- | appveyor.yml | 71 | ||||
-rw-r--r-- | googlemock/Makefile.am | 2 | ||||
-rw-r--r-- | googlemock/configure.ac | 15 | ||||
-rw-r--r-- | googlemock/test/gmock-generated-matchers_test.cc | 2 | ||||
-rw-r--r-- | googlemock/test/gmock-matchers_test.cc | 6 | ||||
-rw-r--r-- | googletest/src/gtest-death-test.cc | 10 |
7 files changed, 83 insertions, 36 deletions
diff --git a/BUILD.bazel b/BUILD.bazel index 4dbaa271..8d2f6bdb 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -104,12 +104,20 @@ cc_library( ], "//conditions:default": [], }), + features = select({ + ":windows": ["windows_export_all_symbols"], + "//conditions:default": [], + }) ) cc_library( name = "gtest_main", srcs = ["googlemock/src/gmock_main.cc"], deps = [":gtest"], + features = select({ + ":windows": ["windows_export_all_symbols"], + "//conditions:default": [], + }) ) # The following rules build samples of how to use gTest. @@ -127,6 +135,10 @@ cc_library( "googletest/samples/sample3-inl.h", "googletest/samples/sample4.h", ], + features = select({ + ":windows": ["windows_export_all_symbols"], + "//conditions:default": [], + }) ) cc_test( @@ -149,6 +161,7 @@ cc_test( "gtest_sample_lib", ":gtest_main", ], + linkstatic = 0, ) cc_test( diff --git a/appveyor.yml b/appveyor.yml index f734a0c4..6ef08fd8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,21 +6,31 @@ environment: matrix: - compiler: msvc-15-seh generator: "Visual Studio 15 2017" + build_system: cmake APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - compiler: msvc-15-seh generator: "Visual Studio 15 2017 Win64" + build_system: cmake + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + enabled_on_pr: yes + + - compiler: msvc-15-seh + build_system: bazel APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 enabled_on_pr: yes - compiler: msvc-14-seh + build_system: cmake generator: "Visual Studio 14 2015" enabled_on_pr: yes - compiler: msvc-14-seh + build_system: cmake generator: "Visual Studio 14 2015 Win64" - compiler: gcc-6.3.0-posix + build_system: cmake generator: "MinGW Makefiles" cxx_path: 'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin' enabled_on_pr: yes @@ -46,20 +56,44 @@ install: } } - # git bash conflicts with MinGW makefiles - if ($env:generator -eq "MinGW Makefiles") { - $env:path = $env:path.replace("C:\Program Files\Git\usr\bin;", "") - if ($env:cxx_path -ne "") { - $env:path += ";$env:cxx_path" + # install Bazel + if ($env:build_system -eq "bazel") { + appveyor DownloadFile https://github.com/bazelbuild/bazel/releases/download/0.21.0/bazel-0.21.0-windows-x86_64.exe -FileName bazel.exe + } + + if ($env:build_system -eq "cmake") { + # git bash conflicts with MinGW makefiles + if ($env:generator -eq "MinGW Makefiles") { + $env:path = $env:path.replace("C:\Program Files\Git\usr\bin;", "") + if ($env:cxx_path -ne "") { + $env:path += ";$env:cxx_path" + } } } +before_build: +- ps: | + $env:root=$env:APPVEYOR_BUILD_FOLDER + Write-Output "env:root: $env:root" + build_script: - ps: | # Only enable some builds for pull requests, the AppVeyor queue is too long. if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) { return + } else { + # special case - build with Bazel + if ($env:build_system -eq "bazel") { + & $env:root\bazel.exe build -c opt //:gtest_samples + if ($LastExitCode -eq 0) { # bazel writes to StdErr and PowerShell interprets it as an error + $host.SetShouldExit(0) + } else { # a real error + throw "Exec: $ErrorMessage" + } + return + } } + # by default build with CMake md _build -Force | Out-Null cd _build @@ -88,12 +122,25 @@ test_script: if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) { return } - if ($env:generator -eq "MinGW Makefiles") { - return # No test available for MinGW + if ($env:build_system -eq "bazel") { + # special case - testing with Bazel + & $env:root\bazel.exe test //:gtest_samples + if ($LastExitCode -eq 0) { # bazel writes to StdErr and PowerShell interprets it as an error + $host.SetShouldExit(0) + } else { # a real error + throw "Exec: $ErrorMessage" + } } - & ctest -C $env:configuration --timeout 600 --output-on-failure - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" + if ($env:build_system -eq "cmake") { + # built with CMake - test with CTest + if ($env:generator -eq "MinGW Makefiles") { + return # No test available for MinGW + } + + & ctest -C $env:configuration --timeout 600 --output-on-failure + if ($LastExitCode -ne 0) { + throw "Exec: $ErrorMessage" + } } artifacts: @@ -101,3 +148,7 @@ artifacts: name: logs - path: '_build/Testing/**/*.xml' name: test_results + - path: 'bazel-testlogs/**/test.log' + name: test_logs + - path: 'bazel-testlogs/**/test.xml' + name: test_results diff --git a/googlemock/Makefile.am b/googlemock/Makefile.am index 6a5651c2..8e0128fa 100644 --- a/googlemock/Makefile.am +++ b/googlemock/Makefile.am @@ -133,7 +133,6 @@ EXTRA_DIST += \ make/Makefile # Pump scripts for generating Google Mock headers. -# TODO(chandlerc@google.com): automate the generation of *.h from *.h.pump. EXTRA_DIST += \ include/gmock/gmock-generated-actions.h.pump \ include/gmock/gmock-generated-function-mockers.h.pump \ @@ -188,7 +187,6 @@ if HAVE_PYTHON # generated. $(test_gmock_fused_test_SOURCES): fused-gmock-internal -# TODO(vladl@google.com): Find a way to add Google Tests's sources here. fused-gmock-internal: $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS) \ $(lib_libgmock_la_SOURCES) $(GMOCK_SOURCE_INGLUDES) \ $(lib_libgmock_main_la_SOURCES) \ diff --git a/googlemock/configure.ac b/googlemock/configure.ac index cb5e1a6a..9456c3d5 100644 --- a/googlemock/configure.ac +++ b/googlemock/configure.ac @@ -24,19 +24,12 @@ AC_PROG_CXX AC_LANG([C++]) AC_PROG_LIBTOOL -# TODO(chandlerc@google.com): Currently we aren't running the Python tests -# against the interpreter detected by AM_PATH_PYTHON, and so we condition -# HAVE_PYTHON by requiring "python" to be in the PATH, and that interpreter's -# version to be >= 2.3. This will allow the scripts to use a "/usr/bin/env" -# hashbang. PYTHON= # We *do not* allow the user to specify a python interpreter AC_PATH_PROG([PYTHON],[python],[:]) AS_IF([test "$PYTHON" != ":"], [AM_PYTHON_CHECK_VERSION([$PYTHON],[2.3],[:],[PYTHON=":"])]) AM_CONDITIONAL([HAVE_PYTHON],[test "$PYTHON" != ":"]) -# TODO(chandlerc@google.com) Check for the necessary system headers. - # Configure pthreads. AC_ARG_WITH([pthreads], [AS_HELP_STRING([--with-pthreads], @@ -83,10 +76,7 @@ dependency upon GoogleTest to build, please provide a version, or allow GoogleMock to use any installed version and fall back upon its internal version.])]) -# Setup various GTEST variables. TODO(chandlerc@google.com): When these are -# used below, they should be used such that any pre-existing values always -# trump values we set them to, so that they can be used to selectively override -# details of the detection process. +# Setup various GTEST variables. AC_ARG_VAR([GTEST_CONFIG], [The exact path of Google Test's 'gtest-config' script.]) AC_ARG_VAR([GTEST_CPPFLAGS], @@ -139,8 +129,5 @@ AS_IF([test "x${HAVE_BUILT_GTEST}" = "xyes"], GTEST_LIBS='$(top_builddir)/../googletest/lib/libgtest.la' GTEST_VERSION="${GTEST_MIN_VERSION}"]) -# TODO(chandlerc@google.com) Check the types, structures, and other compiler -# and architecture characteristics. - # Output the generated files. No further autoconf macros may be used. AC_OUTPUT diff --git a/googlemock/test/gmock-generated-matchers_test.cc b/googlemock/test/gmock-generated-matchers_test.cc index eb47f2b0..6c4b3000 100644 --- a/googlemock/test/gmock-generated-matchers_test.cc +++ b/googlemock/test/gmock-generated-matchers_test.cc @@ -1262,7 +1262,7 @@ namespace adl_test { MATCHER(M, "") { return true; } template <typename T1, typename T2> -bool AllOf(const T1& t1, const T2& t2) { return true; } +bool AllOf(const T1& /*t1*/, const T2& /*t2*/) { return true; } TEST(AllOfTest, DoesNotCallAllOfUnqualified) { EXPECT_THAT(42, testing::AllOf( diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index cdca2300..40ccaf05 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -6943,10 +6943,10 @@ TEST(ArgsTest, ExplainsMatchResultWithoutInnerExplanation) { // For testing Args<>'s explanation. class LessThanMatcher : public MatcherInterface<std::tuple<char, int> > { public: - virtual void DescribeTo(::std::ostream* os) const {} + void DescribeTo(::std::ostream* /*os*/) const override {} - virtual bool MatchAndExplain(std::tuple<char, int> value, - MatchResultListener* listener) const { + bool MatchAndExplain(std::tuple<char, int> value, + MatchResultListener* listener) const override { const int diff = std::get<0>(value) - std::get<1>(value); if (diff > 0) { *listener << "where the first value is " << diff diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc index 9bdfdea4..d15e250b 100644 --- a/googletest/src/gtest-death-test.cc +++ b/googletest/src/gtest-death-test.cc @@ -65,12 +65,12 @@ # endif // GTEST_OS_QNX # if GTEST_OS_FUCHSIA +# include <lib/fdio/fd.h> # include <lib/fdio/io.h> # include <lib/fdio/spawn.h> -# include <lib/fdio/util.h> -# include <lib/zx/socket.h> # include <lib/zx/port.h> # include <lib/zx/process.h> +# include <lib/zx/socket.h> # include <zircon/processargs.h> # include <zircon/syscalls.h> # include <zircon/syscalls/policy.h> @@ -1006,10 +1006,8 @@ DeathTest::TestRole FuchsiaDeathTest::AssumeRole() { zx::socket::create(0, &stderr_producer_socket, &stderr_socket_); GTEST_DEATH_TEST_CHECK_(status >= 0); int stderr_producer_fd = -1; - zx_handle_t producer_handle[1] = { stderr_producer_socket.release() }; - uint32_t producer_handle_type[1] = { PA_FDIO_SOCKET }; - status = fdio_create_fd( - producer_handle, producer_handle_type, 1, &stderr_producer_fd); + status = + fdio_fd_create(stderr_producer_socket.release(), &stderr_producer_fd); GTEST_DEATH_TEST_CHECK_(status >= 0); // Make the stderr socket nonblocking. |