Add support for building with the system google test
authorVladimir Petko <vladimir.petko@canonical.com>
Thu, 2 Nov 2023 10:23:27 +0000 (11:23 +0100)
committerMatthias Klose <doko@ubuntu.com>
Thu, 2 Nov 2023 10:23:27 +0000 (11:23 +0100)
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
test/hotspot/gtest/gtestMain.cpp

index c431341f4d8990f94ab473ca037611616f815a4c..3bd4aa00c64a86ba4db9a8f29d41d6589ca645c8 100644 (file)
@@ -36,6 +36,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])
index ae50e96da0e32fd00bb1a8ee02f9ec4e2c7309ba..0f4ddd4caa2c5fa6248a0ca810a281ecd5c686f8 100644 (file)
@@ -230,7 +230,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