test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java
changeset 51583 ad2224d4f346
parent 50018 3ba0d8631f24
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java	Tue Aug 28 08:06:59 2018 -0400
@@ -33,7 +33,7 @@
 
 public class resume001a {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
 
     static final int PASSED = 0;
     static final int FAILED = 2;
@@ -57,6 +57,7 @@
 
     static int exitCode = PASSED;
 
+    static int testCase    = -1;
     static int instruction = 1;
     static int end         = 0;
                                    //    static int quit        = 0;
@@ -100,6 +101,10 @@
 
                 case 0:
                 TestClass2 obj2 = new TestClass2();
+                // Wait for debugger to complete the first test case
+                // before advancing to the first breakpoint
+                waitForTestCase(0);
+
                 break;
 
                 case 1:
@@ -119,6 +124,16 @@
         log1("debuggee exits");
         System.exit(exitCode + PASS_BASE);
     }
+    // Synchronize with debugger progression.
+    static void waitForTestCase(int t) {
+        while (testCase < t) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // ignored
+            }
+        }
+    }
 }
 
 class TestClass2 {