changeset 1081:1382b6e4980b

6737900: TEST: Some JDI regression tests timeout on slow machines Summary: Don't execute useless code, and split test into multiple @runs. Reviewed-by: tbell
author jjh
date Fri, 15 Aug 2008 18:06:42 -0700
parents e50239bc5f51
children 53833ff90c45
files jdk/test/com/sun/jdi/ClassesByName2Test.java jdk/test/com/sun/jdi/ConnectedVMs.java jdk/test/com/sun/jdi/sde/MangleStepTest.java
diffstat 3 files changed, 32 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/com/sun/jdi/ClassesByName2Test.java	Sun Aug 10 18:35:53 2008 -0700
+++ b/jdk/test/com/sun/jdi/ClassesByName2Test.java	Fri Aug 15 18:06:42 2008 -0700
@@ -134,10 +134,11 @@
                 }
             }
         }
-        /*
-         * resume the target listening for events
-         */
-        listenUntilVMDisconnect();
+
+
+        // Doing vm().exit(0) instead of listenUntilVMDisconnect()
+        // speeds up the test up by more than 50% in -server -Xcomp (solsparc32-fastdebug)
+        vm().exit(0);
 
         /*
          * deal with results of test
--- a/jdk/test/com/sun/jdi/ConnectedVMs.java	Sun Aug 10 18:35:53 2008 -0700
+++ b/jdk/test/com/sun/jdi/ConnectedVMs.java	Fri Aug 15 18:06:42 2008 -0700
@@ -28,7 +28,10 @@
  *
  *  @run build TestScaffold VMConnection TargetListener TargetAdapter
  *  @run compile -g InstTarg.java
- *  @run main ConnectedVMs InstTarg
+ *  @run main ConnectedVMs "Kill"
+ *  @run main ConnectedVMs "Resume to exit"
+ *  @run main ConnectedVMs "dispose()"
+ *  @run main ConnectedVMs "exit()"
  *
  * @summary ConnectedVMs checks the method
  * VirtualMachineManager.connectedVirtualMachines()
@@ -40,14 +43,10 @@
 
 public class ConnectedVMs extends TestScaffold {
     static int failCount = 0;;
-    static int pass;
-    static String[] passNames = {"Kill", "Resume to exit",
-                                 "dispose()", "exit()"};
+    static String passName;
 
     public static void main(String args[]) throws Exception {
-        for (pass=0; pass < passNames.length; pass++) {
-            new ConnectedVMs(args).startTests();
-        }
+        new ConnectedVMs(args[0]).startTests();
         if (failCount > 0) {
             throw new RuntimeException(
              "VirtualMachineManager.connectedVirtualMachines() " +
@@ -58,16 +57,17 @@
         }
     }
 
-    ConnectedVMs(String args[]) throws Exception {
-        super(args);
-        System.out.println("create");
+    ConnectedVMs(String name) throws Exception {
+        super(new String[0]);
+        passName = name;
+        System.out.println("create " + passName);
     }
 
     void vms(int expected) {
         List vms = Bootstrap.virtualMachineManager().
             connectedVirtualMachines();
         if (vms.size() != expected) {
-            System.out.println("FAILURE! " + passNames[pass] +
+            System.out.println("FAILURE! " + passName +
                                " - expected: " + expected +
                                ", got: " + vms.size());
             ++failCount;
@@ -75,27 +75,22 @@
     }
 
     protected void runTests() throws Exception {
-        System.out.println("Testing " + passNames[pass]);
+        System.out.println("Testing " + passName);
         vms(0);
         startToMain("InstTarg");
         ThreadReference thread = waitForVMStart();
         StepEvent stepEvent = stepIntoLine(thread);
         vms(1);
 
-        // pick a way to die
-        switch (pass) {
-            case 0:
-                vm().process().destroy();
-                break;
-            case 1:
-                vm().resume();
-                break;
-            case 2:
-                vm().dispose();
-                break;
-            case 3:
-                vm().exit(1);
-                break;
+        // pick a way to die based on the input arg.
+        if (passName.equals("Kill")) {
+            vm().process().destroy();
+        } else if (passName.equals("Resume to exit")) {
+            vm().resume();
+        } else if (passName.equals("dispose()")) {
+            vm().dispose();
+        } else if (passName.equals("exit()")) {
+            vm().exit(1);
         }
 
         resumeToVMDisconnect();
--- a/jdk/test/com/sun/jdi/sde/MangleStepTest.java	Sun Aug 10 18:35:53 2008 -0700
+++ b/jdk/test/com/sun/jdi/sde/MangleStepTest.java	Fri Aug 15 18:06:42 2008 -0700
@@ -10,7 +10,11 @@
  *  @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE
  *  @run compile MangleStepTest.java
  *  @run compile -g  onion/pickle/Mangle.java
- *  @run main MangleStepTest unset Java XYZ Rats bogus
+ *  @run main MangleStepTest unset
+ *  @run main MangleStepTest Java
+ *  @run main MangleStepTest XYZ
+ *  @run main MangleStepTest Rats
+ *  @run main MangleStepTest bogus
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
@@ -32,9 +36,7 @@
 
     public static void main(String[] args)      throws Exception {
         testSetUp();
-        for (int i = 0; i < args.length; ++i) {
-            new MangleStepTest(args[i]).startTests();
-        }
+        new MangleStepTest(args[0]).startTests();
         if (aTestFailed) {
             throw new Exception("MangleStepTest: failed");
         }