From 1c42f2e0d3c5532bb022eace66e97e91b55e082b Mon Sep 17 00:00:00 2001 From: Jim Holmlund Date: Fri, 15 Aug 2008 18:06:42 -0700 Subject: [PATCH] 6737900: TEST: Some JDI regression tests timeout on slow machines Don't execute useless code, and split test into multiple @runs. Reviewed-by: tbell --- jdk/test/com/sun/jdi/ClassesByName2Test.java | 9 ++-- jdk/test/com/sun/jdi/ConnectedVMs.java | 47 +++++++++----------- jdk/test/com/sun/jdi/sde/MangleStepTest.java | 10 +++-- 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/jdk/test/com/sun/jdi/ClassesByName2Test.java b/jdk/test/com/sun/jdi/ClassesByName2Test.java index 96df25d792d..3bdab5d476a 100644 --- a/jdk/test/com/sun/jdi/ClassesByName2Test.java +++ b/jdk/test/com/sun/jdi/ClassesByName2Test.java @@ -134,10 +134,11 @@ public class ClassesByName2Test extends TestScaffold { } } } - /* - * 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 diff --git a/jdk/test/com/sun/jdi/ConnectedVMs.java b/jdk/test/com/sun/jdi/ConnectedVMs.java index 549efcc9c90..bbbc769a660 100644 --- a/jdk/test/com/sun/jdi/ConnectedVMs.java +++ b/jdk/test/com/sun/jdi/ConnectedVMs.java @@ -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 @@ import java.util.List; 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 @@ public class ConnectedVMs extends TestScaffold { } } - 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 @@ public class ConnectedVMs extends TestScaffold { } 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(); diff --git a/jdk/test/com/sun/jdi/sde/MangleStepTest.java b/jdk/test/com/sun/jdi/sde/MangleStepTest.java index 7a1a12c2f02..ca10e27b7dc 100644 --- a/jdk/test/com/sun/jdi/sde/MangleStepTest.java +++ b/jdk/test/com/sun/jdi/sde/MangleStepTest.java @@ -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 class MangleStepTest extends TestScaffold { 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"); }