changeset 51319:fb8b3f467277

6545967: sp05t003 failed ResumeThread() due to THREAD_NOT_SUSPENDED Reviewed-by: cjplummer, sspitsyn
author gadams
date Wed, 20 Jun 2018 13:57:38 -0400
parents e0eca40cd514
children 2f558e1677fb
files test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.java test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.c
diffstat 2 files changed, 18 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.java	Wed Jun 20 10:01:49 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.java	Wed Jun 20 13:57:38 2018 -0400
@@ -77,29 +77,32 @@
     }
 
 
-    public boolean  agentMethod() {
+    public boolean agentMethod() {
         boolean passed = false;
         MyThread mt = new MyThread();
-                try {
+        try {
             mt.start();
             // check if we can can pop the thread.
-            // we can not do redefine / pop frame on run method.
-            while(!MyThread.resume.get());
-                        Thread.sleep(10000);
+            // we can not do redefine/pop frame on run method.
+            while (!MyThread.resume.get());
             // sleep for some few secs to get redefined.
-            popThreadFrame(mt);
-            // pop the frame.
-            resumeThread(mt);
-            // resume the thread.
+            while (!isRedefined()) {
+                if (!agentStatus()) {
+                    System.out.println("Failed to redefine class");
+                    return passed;
+                }
+                Thread.sleep(100);
+            }
+            popThreadFrame(mt); // pop the frame.
+            resumeThread(mt);   // resume the thread.
             mt.join();
             // wait till the other thread completes its execution.
-            System.out.println(" Thread state after poping / redefining = "+mt.threadState);
+            System.out.println("Thread state after popping/redefining = "
+                               + mt.threadState);
         } catch(Exception ie) {
             ie.printStackTrace();
         }
-        if ( ( mt.threadState < 1000 ) &&
-                ( redefineAttempted() && isRedefined())  &&
-                agentStatus() ) {
+        if ((mt.threadState < 1000) && agentStatus()) {
             passed = true;
         }
         return passed;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.c	Wed Jun 20 10:01:49 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.c	Wed Jun 20 13:57:38 2018 -0400
@@ -383,7 +383,6 @@
     for (i = 0; i < THREADS_COUNT; i++) {
         if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) {
                 NSK_DISPLAY0("SUCCESS: expected THREAD_START event\n");
-            eventsStart++;
 
             /* suspend thread */
             NSK_DISPLAY3("  suspend starting thread #%d (%s): %p\n",
@@ -394,6 +393,7 @@
                 nsk_jvmti_setFailStatus();
                 return;
             }
+            eventsStart++;
 
             break;
         }
@@ -418,7 +418,6 @@
     for (i = 0; i < THREADS_COUNT; i++) {
         if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) {
                 NSK_DISPLAY0("SUCCESS: expected THREAD_END event\n");
-            eventsEnd++;
 
             /* suspend thread */
             NSK_DISPLAY3("  suspend finishing thread #%d (%s): %p\n",
@@ -429,6 +428,7 @@
                 nsk_jvmti_setFailStatus();
                 return;
             }
+            eventsEnd++;
 
             break;
         }