Bug 78318 - Backport performance tests
diff --git a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/performance/OpenLaunchConfigurationDialogTests.java b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/performance/OpenLaunchConfigurationDialogTests.java
index 0b24146..4619c1b 100644
--- a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/performance/OpenLaunchConfigurationDialogTests.java
+++ b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/performance/OpenLaunchConfigurationDialogTests.java
@@ -11,7 +11,7 @@
package org.eclipse.ant.tests.ui.performance;
-import org.eclipse.ant.internal.ui.IAntUIConstants;
+import org.eclipse.ant.internal.ui.model.IAntUIConstants;
import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IStatus;
diff --git a/ant/org.eclipse.ant.tests.ui/plugin.xml b/ant/org.eclipse.ant.tests.ui/plugin.xml
index cb5d656..c3911d1 100644
--- a/ant/org.eclipse.ant.tests.ui/plugin.xml
+++ b/ant/org.eclipse.ant.tests.ui/plugin.xml
@@ -27,6 +27,7 @@
<import plugin="org.eclipse.ui.externaltools"/>
<import plugin="org.eclipse.ant.ui"/>
<import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.test.performance"/>
</requires>
<runtime>
diff --git a/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AbstractAntUITest.java b/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AbstractAntUITest.java
index 9258ed1..effdc46 100644
--- a/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AbstractAntUITest.java
+++ b/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AbstractAntUITest.java
@@ -80,7 +80,7 @@
*
* @return the test project
*/
- protected IProject getProject() {
+ protected static IProject getProject() {
return ResourcesPlugin.getWorkspace().getRoot().getProject(ProjectHelper.PROJECT_NAME);
}
@@ -258,7 +258,7 @@
*
* @return launch manager
*/
- protected ILaunchManager getLaunchManager() {
+ public static ILaunchManager getLaunchManager() {
return DebugPlugin.getDefault().getLaunchManager();
}
@@ -267,7 +267,7 @@
*
* @return the test project
*/
- protected IJavaProject getJavaProject() {
+ public static IJavaProject getJavaProject() {
return JavaCore.create( getProject());
}
diff --git a/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AntUIPerformanceTests.java b/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AntUIPerformanceTests.java
index 4740e93..cfd7a52 100644
--- a/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AntUIPerformanceTests.java
+++ b/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AntUIPerformanceTests.java
@@ -29,7 +29,6 @@
suite.setName("Ant UI Performance Unit Tests");
suite.addTest(new TestSuite(ProjectCreationDecorator.class));
suite.addTest(new TestSuite(OpenAntEditorTest.class));
- //suite.addTest(new TestSuite(NonInitialTypingTest.class));
suite.addTest(new TestSuite(OpenLaunchConfigurationDialogTests.class));
suite.addTest(new TestSuite(SeparateVMTests.class));
return suite;
diff --git a/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/ProjectCreationDecorator.java b/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/ProjectCreationDecorator.java
index 8ef115b..c70a408 100644
--- a/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/ProjectCreationDecorator.java
+++ b/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/ProjectCreationDecorator.java
@@ -20,7 +20,9 @@
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.IDebugUIConstants;
@@ -53,31 +55,42 @@
File root = AntUITestPlugin.getDefault().getFileInPlugin(ProjectHelper.TEST_BUILDFILES_DIR);
ProjectHelper.importFilesFromDirectory(root, folder.getFullPath(), null);
- createLaunchConfiguration("echoing");
+ createLaunchConfigurationForBoth("echoing");
createLaunchConfiguration("build");
createLaunchConfiguration("bad");
- createLaunchConfigurationForSeparateVM("echoingSepVM");
- createLaunchConfigurationForSeparateVM("extensionPointSepVM");
- createLaunchConfigurationForSeparateVM("extensionPointTaskSepVM");
- createLaunchConfigurationForSeparateVM("extensionPointTypeSepVM");
+ createLaunchConfigurationForSeparateVM("extensionPointSepVM", null);
+ createLaunchConfigurationForSeparateVM("extensionPointTaskSepVM", null);
+ createLaunchConfigurationForSeparateVM("extensionPointTypeSepVM", null);
+
+ createLaunchConfiguration("big", "buildfiles/performance/build.xml");
} finally {
//do not show the Ant build failed error dialog
AntUIPlugin.getDefault().getPreferenceStore().setValue(IAntUIPreferenceConstants.ANT_ERROR_DIALOG, false);
}
}
+ private void createLaunchConfigurationForBoth(String launchConfigName) throws Exception {
+ createLaunchConfiguration(launchConfigName);
+ createLaunchConfigurationForSeparateVM(launchConfigName + "SepVM", launchConfigName);
+
+ }
+
/**
* Creates a shared launch configuration for launching Ant in a separate VM with the given
* name.
*/
- protected void createLaunchConfigurationForSeparateVM(String launchConfigName) throws Exception {
+ protected void createLaunchConfigurationForSeparateVM(String launchConfigName, String buildFileName) throws Exception {
ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(IAntLaunchConfigurationConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE);
ILaunchConfigurationWorkingCopy config = type.newInstance(getJavaProject().getProject().getFolder("launchConfigurations"), launchConfigName);
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "org.eclipse.ant.internal.ui.antsupport.InternalAntRunner"); //$NON-NLS-1$
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, "org.eclipse.ant.ui.AntClasspathProvider"); //$NON-NLS-1$
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, getJavaProject().getElementName());
- config.setAttribute(IExternalToolConstants.ATTR_LOCATION, "${workspace_loc:/" + ProjectHelper.PROJECT_NAME + "/buildfiles/" + launchConfigName + ".xml}");
+ if (buildFileName == null) {
+ buildFileName= launchConfigName;
+ }
+ config.setAttribute(IExternalToolConstants.ATTR_LOCATION, "${workspace_loc:/" + ProjectHelper.PROJECT_NAME + "/buildfiles/" + buildFileName + ".xml}");
+
config.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, true);
config.setAttribute(DebugPlugin.ATTR_PROCESS_FACTORY_ID, IAntUIConstants.REMOTE_ANT_PROCESS_FACTORY_ID);
@@ -91,14 +104,19 @@
* name.
*/
protected void createLaunchConfiguration(String launchConfigName) throws Exception {
- ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(IAntLaunchConfigurationConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE);
+ createLaunchConfiguration(launchConfigName, ProjectHelper.PROJECT_NAME + "/buildfiles/" + launchConfigName + ".xml");
+ }
+
+ public static ILaunchConfiguration createLaunchConfiguration(String launchConfigName, String path) throws CoreException {
+ ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(IAntLaunchConfigurationConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE);
ILaunchConfigurationWorkingCopy config = type.newInstance(getJavaProject().getProject().getFolder("launchConfigurations"), launchConfigName);
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, getJavaProject().getElementName());
- config.setAttribute(IExternalToolConstants.ATTR_LOCATION, "${workspace_loc:/" + ProjectHelper.PROJECT_NAME + "/buildfiles/" + launchConfigName + ".xml}");
+ config.setAttribute(IExternalToolConstants.ATTR_LOCATION, "${workspace_loc:/" + path + "}");
config.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, true);
config.doSave();
+ return config;
}
private void setVM(ILaunchConfigurationWorkingCopy config) {
diff --git a/ant/org.eclipse.ant.tests.ui/test.xml b/ant/org.eclipse.ant.tests.ui/test.xml
index e5dff43..c6f1563 100644
--- a/ant/org.eclipse.ant.tests.ui/test.xml
+++ b/ant/org.eclipse.ant.tests.ui/test.xml
@@ -31,6 +31,19 @@
value="org.eclipse.ant.tests.ui.testplugin.AntUITests"/>
</ant>
</target>
+
+ <!-- This target defines the performance tests that need to be run. -->
+ <target name="perfsuite">
+ <property name="jdt-folder"
+ value="${eclipse-home}/jdt_folder"/>
+ <delete dir="${jdt-folder}" quiet="true"/>
+ <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${jdt-folder}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname"
+ value="org.eclipse.ant.tests.ui.testplugin.AntUIPerformanceTests"/>
+ </ant>
+ </target>
<!-- This target holds code to cleanup the testing environment after -->
<!-- after all of the tests have been run. You can use this target to -->
@@ -47,4 +60,12 @@
</ant>
</target>
+ <!--This target runs the performance test suites and collects results.-->
+ <target name="performance" depends="init, perfsuite, cleanup">
+ <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="includes" value="org*.xml"/>
+ <property name="output-file" value="${plugin-name}.xml"/>
+ </ant>
+ </target>
+
</project>