8051349: nsk/jvmti/scenarios/sampling/SP06/sp06t003 fails in nightly
authorgadams
Tue, 18 Dec 2018 07:33:07 -0500
changeset 53039 3bc260237317
parent 53038 9dd0a2fdec24
child 53040 6aeb6a23fb83
child 57076 687505381ca4
8051349: nsk/jvmti/scenarios/sampling/SP06/sp06t003 fails in nightly Reviewed-by: dholmes, sspitsyn, cjplummer, jcbeyler
test/hotspot/jtreg/ProblemList.txt
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001.java
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp
--- a/test/hotspot/jtreg/ProblemList.txt	Tue Dec 18 10:26:15 2018 +0000
+++ b/test/hotspot/jtreg/ProblemList.txt	Tue Dec 18 07:33:07 2018 -0500
@@ -187,7 +187,6 @@
 vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted004/TestDescription.java 7013634,6606767 generic-all
 vmTestbase/nsk/jvmti/ThreadStart/threadstart001/TestDescription.java 8016181 generic-all
 vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/TestDescription.java 8173658 generic-all
-vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/TestDescription.java 8051349 generic-all
 vmTestbase/nsk/jvmti/AttachOnDemand/attach034/TestDescription.java 8042145 generic-all
 vmTestbase/nsk/jvmti/AttachOnDemand/attach045/TestDescription.java 8202971 generic-all
 vmTestbase/nsk/jvmti/unit/heap/HeapWalkTests/TestDescription.java 8016181 generic-all
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp	Tue Dec 18 10:26:15 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp	Tue Dec 18 07:33:07 2018 -0500
@@ -310,7 +310,8 @@
                                         (long)frameStack[j].location);
             /* query frame location */
             if (!NSK_JVMTI_VERIFY(
-                    jvmti->GetFrameLocation(threadsDesc[i].thread, j, &qMethod, &qLocation))) {
+                    jvmti->GetFrameLocation(threadsDesc[i].thread, j, &qMethod, &qLocation))
+                && (suspended == NSK_TRUE)) {
                 nsk_jvmti_setFailStatus();
                 continue;
             }
@@ -318,8 +319,8 @@
             NSK_DISPLAY2("      queried: method: %p, location: %ld\n",
                                         (void*)qMethod, (long)qLocation);
 
-            /* check frame equalaty */
-            if (frameStack[j].method != qMethod) {
+            /* check frame equality */
+            if ((suspended == NSK_TRUE) && (frameStack[j].method != qMethod)) {
                 NSK_COMPLAIN6("Different method in stack frame #%d for %s thread #%d (%s):\n"
                             "#   GetStackTrace():    %p\n"
                             "#   GetFrameLocation(): %p\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001.java	Tue Dec 18 10:26:15 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001.java	Tue Dec 18 07:33:07 2018 -0500
@@ -268,6 +268,7 @@
 
 class sp06t001ThreadRunningInterrupted extends sp06t001Thread {
     private Object waitingMonitor = new Object();
+    volatile boolean interruptReady = false;
 
     public sp06t001ThreadRunningInterrupted(String name, Log log) {
         super(name, log);
@@ -275,8 +276,9 @@
 
     public void testedMethod(boolean simulate, int i) {
         if (!simulate) {
+            interruptReady = true;
             synchronized (waitingMonitor) {
-                // wait on watingMonitor until interrupted
+                // wait on waitingMonitor until interrupted
                 try {
                     waitingMonitor.wait();
                 } catch (InterruptedException ignore) {
@@ -303,6 +305,14 @@
 
     public boolean checkReady() {
         // interrupt thread on wait()
+        // delay until testMethod is ready
+        while (!interruptReady) {
+            try {
+                sleep(1000);
+            } catch (InterruptedException ie) {
+                // ignored
+            }
+        }
         synchronized (waitingMonitor) {
             interrupt();
         }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp	Tue Dec 18 10:26:15 2018 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp	Tue Dec 18 07:33:07 2018 -0500
@@ -333,7 +333,8 @@
                                         (long)frameStack[j].location);
             /* query frame location */
             if (!NSK_JVMTI_VERIFY(
-                    jvmti->GetFrameLocation(threadsDesc[i].thread, j, &qMethod, &qLocation))) {
+                    jvmti->GetFrameLocation(threadsDesc[i].thread, j, &qMethod, &qLocation))
+                && (suspended == NSK_TRUE)) {
                 nsk_jvmti_setFailStatus();
                 continue;
             }
@@ -341,8 +342,8 @@
             NSK_DISPLAY2("      queried: method: 0x%p, location: %ld\n",
                                         (void*)qMethod, (long)qLocation);
 
-            /* check frame equalaty */
-            if (frameStack[j].method != qMethod) {
+            /* check frame equality */
+            if ((suspended == NSK_TRUE) && (frameStack[j].method != qMethod)) {
                 NSK_COMPLAIN6("Different method in stack frame #%d for %s thread #%d (%s):\n"
                             "#   GetStackTrace():    0x%p\n"
                             "#   GetFrameLocation(): 0x%p\n",
@@ -350,7 +351,7 @@
                             (void*)frameStack[j].method, (void*)qMethod);
                 nsk_jvmti_setFailStatus();
             }
-            if (frameStack[j].location != qLocation) {
+            if ((suspended == NSK_TRUE) && (frameStack[j].location != qLocation)) {
                 NSK_COMPLAIN6("Different location in stack frame #%d for %s thread #%d (%s):\n"
                             "#   GetStackTrace():    %ld\n"
                             "#   GetFrameLocation(): %ld\n",