--- old/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.c 2018-07-05 17:56:20.877592380 -0400 +++ new/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.c 2018-07-05 17:56:19.325503086 -0400 @@ -317,6 +317,9 @@ if (tries > TRIES) { NSK_COMPLAIN1("TEST FAILURE: failed to wait for the redirection in agent B after %d attempts\n", TRIES); + if ((res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm))) != 0) { + NSK_COMPLAIN1("TEST WARNING: agent A: DetachCurrentThread() returns: %d\n", res); + } exit(STATUS_FAILED); } } while(redir[1] != 1); @@ -333,8 +336,11 @@ checkIntercept(1, 0, 1); /* expected interceptions: 1 */ NSK_DISPLAY0("\n<<< TEST CASE #4) done\n"); - NSK_DISPLAY1("\nagent A: returning exit code %d\n", + NSK_DISPLAY1("\nagent A: detaching and returning exit code %d\n", exitCode); + if ((res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm))) != 0) { + NSK_COMPLAIN1("TEST WARNING: agent A: DetachCurrentThread() returns: %d\n", res); + } return exitCode; } @@ -351,6 +357,9 @@ JNI_ENV_ARG(vm, (void **) &env), (void *) 0)) != 0) { NSK_COMPLAIN1("TEST FAILURE: AttachCurrentThread() returns: %d\n", res); + if ((res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm))) != 0) { + NSK_COMPLAIN1("TEST WARNING: agent B: DetachCurrentThread() returns: %d\n", res); + } exit(STATUS_FAILED); } @@ -363,6 +372,9 @@ if (tries > TRIES) { NSK_COMPLAIN1("TEST FAILURE: failed to wait for the redirection in agent A after %d attempts\n", TRIES); + if ((res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm))) != 0) { + NSK_COMPLAIN1("TEST WARNING: agent B: DetachCurrentThread() returns: %d\n", res); + } exit(STATUS_FAILED); } } while(redir[0] != 1); @@ -393,8 +405,11 @@ redir[1] = 1; - NSK_DISPLAY1("\nagent B: returning exit code %d\n", + NSK_DISPLAY1("\nagent B: detaching and returning exit code %d\n", exitCode); + if ((res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm))) != 0) { + NSK_COMPLAIN1("TEST WARNING: agent B: DetachCurrentThread() returns: %d\n", res); + } return exitCode; } /*********************/