From 7a4e8378d1cbace28f44c3a5c5c125cfbe213311 Mon Sep 17 00:00:00 2001 From: Vladimir Petko Date: Tue, 30 Jul 2024 08:42:49 +0200 Subject: [PATCH] Add support for building with the system google test Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/openjdk-20/+bug/2012316 Last-Update: 2023-07-20 A major portion of hotspot tests require google test. In order to get tier1 tests passing the package should build with the system google test. Gbp-Pq: Name build_gtest.patch --- make/autoconf/lib-tests.m4 | 2 ++ test/hotspot/gtest/gtestMain.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/make/autoconf/lib-tests.m4 b/make/autoconf/lib-tests.m4 index cd0d5cf05..647e45dd4 100644 --- a/make/autoconf/lib-tests.m4 +++ b/make/autoconf/lib-tests.m4 @@ -43,6 +43,8 @@ AC_DEFUN_ONCE([LIB_TESTS_SETUP_GTEST], AC_MSG_CHECKING([for gtest]) if test "x${with_gtest}" = xno; then AC_MSG_RESULT([no, disabled]) + elif test "x${with_gtest}" = xsystem; then + GTEST_FRAMEWORK_SRC=/usr/src/googletest elif test "x${with_gtest}" = xyes; then AC_MSG_RESULT([no, error]) AC_MSG_ERROR([--with-gtest must have a value]) diff --git a/test/hotspot/gtest/gtestMain.cpp b/test/hotspot/gtest/gtestMain.cpp index 44ab6a3d5..2e7d52513 100644 --- a/test/hotspot/gtest/gtestMain.cpp +++ b/test/hotspot/gtest/gtestMain.cpp @@ -231,7 +231,9 @@ static void runUnitTestsInner(int argc, char** argv) { bool is_vmassert_test = false; bool is_othervm_test = false; // death tests facility is used for both regular death tests, other vm and vmassert tests - if (::testing::internal::GTEST_FLAG(internal_run_death_test).length() > 0) { +using namespace ::testing; +using namespace ::testing::internal; + if (GTEST_FLAG(internal_run_death_test).length() > 0) { // when we execute death test, filter value equals to test name const char* test_name = ::testing::GTEST_FLAG(filter).c_str(); const char* const othervm_suffix = "_other_vm"; // TEST_OTHER_VM -- 2.30.2