From 66e5a68a33dcd6b23c73c892d51b3efed162b8f8 Mon Sep 17 00:00:00 2001 From: Axel Boldt-Christmas Date: Mon, 10 Nov 2025 05:53:36 +0000 Subject: [PATCH] 8371343: ZGC: Remove dependency on test execution order for gtests Reviewed-by: stefank, eosterlund --- src/hotspot/share/gc/z/zAddress.hpp | 2 -- test/hotspot/gtest/gc/z/test_zAddress.cpp | 9 ++++----- test/hotspot/gtest/gc/z/test_zLiveMap.cpp | 7 +++---- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/hotspot/share/gc/z/zAddress.hpp b/src/hotspot/share/gc/z/zAddress.hpp index de97c17d089..ca904f69277 100644 --- a/src/hotspot/share/gc/z/zAddress.hpp +++ b/src/hotspot/share/gc/z/zAddress.hpp @@ -309,8 +309,6 @@ public: }; class ZGlobalsPointers : public AllStatic { - friend class ZAddressTest; - private: static void set_good_masks(); static void pd_set_good_masks(); diff --git a/test/hotspot/gtest/gc/z/test_zAddress.cpp b/test/hotspot/gtest/gc/z/test_zAddress.cpp index 9f5c8e1f0bc..0df77b01ad2 100644 --- a/test/hotspot/gtest/gc/z/test_zAddress.cpp +++ b/test/hotspot/gtest/gc/z/test_zAddress.cpp @@ -23,9 +23,9 @@ #include "gc/z/zAddress.inline.hpp" #include "gc/z/zGlobals.hpp" -#include "unittest.hpp" +#include "zunittest.hpp" -class ZAddressTest : public ::testing::Test { +class ZAddressTest : public ZTest { protected: static zpointer color(uintptr_t value, uintptr_t color) { return ZAddress::color(zaddress(value | ZAddressHeapBase), color); @@ -374,8 +374,7 @@ protected: static void is_checks() { int young_phase = 0; int old_phase = 0; - // Setup - ZGlobalsPointers::initialize(); + test_is_checks_on_all(); advance_and_test_old_phase(old_phase, 4); @@ -431,6 +430,6 @@ protected: } }; -TEST_F(ZAddressTest, is_checks) { +TEST_VM_F(ZAddressTest, is_checks) { is_checks(); } diff --git a/test/hotspot/gtest/gc/z/test_zLiveMap.cpp b/test/hotspot/gtest/gc/z/test_zLiveMap.cpp index 18b90f5f149..da956b70b2a 100644 --- a/test/hotspot/gtest/gc/z/test_zLiveMap.cpp +++ b/test/hotspot/gtest/gc/z/test_zLiveMap.cpp @@ -24,9 +24,9 @@ #include "gc/z/zGenerationId.hpp" #include "gc/z/zGlobals.hpp" #include "gc/z/zLiveMap.inline.hpp" -#include "unittest.hpp" +#include "zunittest.hpp" -class ZLiveMapTest : public ::testing::Test { +class ZLiveMapTest : public ZTest { private: // Setup and tear down ZHeap* _old_heap; @@ -36,7 +36,6 @@ private: public: virtual void SetUp() { - ZGlobalsPointers::initialize(); _old_heap = ZHeap::_heap; ZHeap::_heap = (ZHeap*)os::malloc(sizeof(ZHeap), mtTest); @@ -84,6 +83,6 @@ protected: } }; -TEST_F(ZLiveMapTest, strongly_live_for_large_zpage) { +TEST_VM_F(ZLiveMapTest, strongly_live_for_large_zpage) { strongly_live_for_large_zpage(); }