@@ -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+
97101class 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)) {
0 commit comments