Skip to content

Commit 406db1c

Browse files
committed
8253913: unify gtest test names
Reviewed-by: stefank
1 parent ea5a2b1 commit 406db1c

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/hotspot/share/logging/logStream.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232

3333

3434
class LogStream : public outputStream {
35-
friend class LogStreamTest_TestLineBufferAllocation_test_vm_Test; // see test/native/logging/test_logStream.cpp
36-
friend class LogStreamTest_TestLineBufferAllocationCap_test_vm_Test; // see test/native/logging/test_logStream.cpp
35+
// see test/hotspot/gtest/logging/test_logStream.cpp
36+
friend class LogStreamTest_TestLineBufferAllocation_vm_Test;
37+
friend class LogStreamTest_TestLineBufferAllocationCap_vm_Test;
3738

3839
// Helper class, maintains the line buffer. For small line lengths,
3940
// we avoid malloc and use a fixed sized member char array. If LogStream

test/hotspot/gtest/gtestMain.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ static int init_jvm(int argc, char **argv, bool disable_error_handling) {
9494
return JNI_CreateJavaVM(&jvm, (void**)&env, &args);
9595
}
9696

97+
static bool is_same_vm_test(const char* name) {
98+
return is_suffix("_vm", name) && !is_suffix("_other_vm", name);
99+
}
100+
97101
class JVMInitializerListener : public ::testing::EmptyTestEventListener {
98102
private:
99103
int _argc;
@@ -110,7 +114,7 @@ class JVMInitializerListener : public ::testing::EmptyTestEventListener {
110114

111115
virtual void OnTestStart(const ::testing::TestInfo& test_info) {
112116
const char* name = test_info.name();
113-
if (!_is_initialized && is_suffix("_test_vm", name)) {
117+
if (!_is_initialized && is_same_vm_test(name)) {
114118
// we want to have hs_err and core files when we execute regular tests
115119
int ret_val = init_jvm(_argc, _argv, false);
116120
if (ret_val != 0) {
@@ -205,8 +209,8 @@ static void runUnitTestsInner(int argc, char** argv) {
205209
if (::testing::internal::GTEST_FLAG(internal_run_death_test).length() > 0) {
206210
// when we execute death test, filter value equals to test name
207211
const char* test_name = ::testing::GTEST_FLAG(filter).c_str();
208-
const char* const othervm_suffix = "_other_vm_test"; // TEST_OTHER_VM
209-
const char* const vmassert_suffix = "_vm_assert_test"; // TEST_VM_ASSERT(_MSG)
212+
const char* const othervm_suffix = "_other_vm"; // TEST_OTHER_VM
213+
const char* const vmassert_suffix = "_vm_assert"; // TEST_VM_ASSERT(_MSG)
210214
if (is_suffix(othervm_suffix, test_name)) {
211215
is_othervm_test = true;
212216
} else if (is_suffix(vmassert_suffix, test_name)) {

test/hotspot/gtest/unittest.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@
7070

7171
#define CONCAT(a, b) a ## b
7272

73-
#define TEST(category, name) GTEST_TEST(category, CONCAT(name, _test))
73+
#define TEST(category, name) GTEST_TEST(category, name)
7474

75-
#define TEST_VM(category, name) GTEST_TEST(category, CONCAT(name, _test_vm))
75+
#define TEST_VM(category, name) GTEST_TEST(category, CONCAT(name, _vm))
7676

7777
#define TEST_VM_F(test_fixture, name) \
78-
GTEST_TEST_(test_fixture, name ## _test_vm, test_fixture, \
78+
GTEST_TEST_(test_fixture, name ## _vm, test_fixture, \
7979
::testing::internal::GetTypeId<test_fixture>())
8080

8181
#define TEST_OTHER_VM(category, name) \
@@ -131,7 +131,7 @@
131131
TEST(category, CONCAT(name, _vm_assert)) { \
132132
ASSERT_EXIT(child_ ## category ## _ ## name ## _(), \
133133
::testing::ExitedWithCode(1), \
134-
"^assert failed: " msg); \
134+
"^assert failed: " msg); \
135135
} \
136136
\
137137
void test_ ## category ## _ ## name ## _()

0 commit comments

Comments
 (0)