Bug 79134 - Investigate Ant Separate VM tests slow down
diff --git a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AbstractAntUIBuildPerformanceTest.java b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AbstractAntUIBuildPerformanceTest.java
index cec2e19..f7f4503 100644
--- a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AbstractAntUIBuildPerformanceTest.java
+++ b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AbstractAntUIBuildPerformanceTest.java
@@ -11,6 +11,7 @@
package org.eclipse.ant.tests.ui;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.test.performance.Dimension;
import org.eclipse.test.performance.Performance;
import org.eclipse.test.performance.PerformanceMeter;
@@ -125,29 +126,17 @@
}
/**
- * Launches the Ant build with the buildfile name (no extension).
+ * Launches the Ant build for this config.
* Waits for all of the lines to be appended to the console.
*
- * @param mainTypeName the program to launch
+ * @param config the launch configuration to execute
* @param i the number of times to perform the launch
- * @return thread in which the first suspend event occurred
*/
- protected void launch(String buildFileName, int i) throws CoreException {
+ protected void launch(ILaunchConfiguration config, int i) throws CoreException {
startMeasuring();
for (int j = 0; j < i; j++) {
- super.launch(buildFileName);
+ super.launch(config);
}
stopMeasuring();
}
-
- /* (non-Javadoc)
- * @see org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest#launch(java.lang.String, java.lang.String)
- */
- protected void launch(String buildFileName, String arguments, int i) throws CoreException {
- startMeasuring();
- for (int j = 0; j < i; j++) {
- super.launch(buildFileName, arguments);
- }
- stopMeasuring();
- }
}
\ No newline at end of file
diff --git a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AbstractAntUIBuildTest.java b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AbstractAntUIBuildTest.java
index 8f1edb6..cdd0702 100644
--- a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AbstractAntUIBuildTest.java
+++ b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AbstractAntUIBuildTest.java
@@ -16,10 +16,10 @@
import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest;
import org.eclipse.ant.tests.ui.testplugin.ConsoleLineTracker;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.ui.console.IConsoleHyperlink;
import org.eclipse.swt.widgets.Display;
-
public abstract class AbstractAntUIBuildTest extends AbstractAntUITest {
/**
@@ -66,7 +66,7 @@
* Launches the Ant build with the buildfile name (no extension).
* Waits for all of the lines to be appended to the console.
*
- * @param mainTypeName the program to launch
+ * @param buildFileName the buildfile to execute
* @return thread in which the first suspend event occurred
*/
protected void launch(String buildFileName) throws CoreException {
@@ -74,6 +74,18 @@
ConsoleLineTracker.waitForConsole();
}
+ /**
+ * Launches the launch configuration
+ * Waits for all of the lines to be appended to the console.
+ *
+ * @param config the config to execute
+ * @return thread in which the first suspend event occurred
+ */
+ protected void launch(ILaunchConfiguration config) throws CoreException {
+ launchAndTerminate(config, 20000);
+ ConsoleLineTracker.waitForConsole();
+ }
+
protected void activateLink(final IConsoleHyperlink link) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
@@ -88,4 +100,4 @@
super.launch(buildFileName, arguments);
ConsoleLineTracker.waitForConsole();
}
-}
+}
\ No newline at end of file
diff --git a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/performance/SeparateVMTests.java b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/performance/SeparateVMTests.java
index 8ba7430..21dd6c1 100644
--- a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/performance/SeparateVMTests.java
+++ b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/performance/SeparateVMTests.java
@@ -13,9 +13,13 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+
import org.eclipse.ant.tests.ui.AbstractAntUIBuildPerformanceTest;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.test.performance.Dimension;
+import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
public class SeparateVMTests extends AbstractAntUIBuildPerformanceTest {
@@ -32,8 +36,29 @@
*/
public void testBuild() throws CoreException {
tagAsSummary("Simple separate JRE Build", Dimension.CPU_TIME);
+ ILaunchConfiguration config= getLaunchConfiguration("echoingSepVM");
for (int i = 0; i < 10; i++) {
- launch("echoingSepVM", 10);
+ launch(config, 10);
+ }
+ commitMeasurements();
+ assertPerformance();
+ }
+
+ /**
+ * Performance test for launching Ant in a separate vm with no console output.
+ */
+ public void testBuildNoConsole() throws CoreException {
+ tagAsSummary("Simple separate JRE Build set to not capture output", Dimension.CPU_TIME);
+ ILaunchConfiguration config = getLaunchConfiguration("echoingSepVM");
+ assertNotNull("Could not locate launch configuration for " + "echoingSepVM", config);
+ ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy();
+ copy.setAttribute(IExternalToolConstants.ATTR_CAPTURE_OUTPUT, false);
+ for (int i = 0; i < 10; i++) {
+ startMeasuring();
+ for (int j = 0; j < i; j++) {
+ launchAndTerminate(copy, 20000);
+ }
+ stopMeasuring();
}
commitMeasurements();
assertPerformance();
@@ -44,8 +69,12 @@
*/
public void testBuildMinusDebug() throws CoreException {
tagAsSummary("Simple separate JRE Build with debug information", Dimension.CPU_TIME);
+ ILaunchConfiguration config = getLaunchConfiguration("echoingSepVM");
+ assertNotNull("Could not locate launch configuration for " + "echoingSepVM", config);
+ ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy();
+ copy.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, "-debug");
for (int i = 0; i < 10; i++) {
- launch("echoingSepVM", "-debug", 10);
+ launch(copy, 10);
}
commitMeasurements();
assertPerformance();