Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-08-30 13:39:39 -0400
committerMichael Valenta2004-08-30 13:39:39 -0400
commit25184cea3b6ef0b85032307e0773e6c447c9b44c (patch)
tree12ef37082681134d47b2ebad8d0eca69cbca84ee
parentee800fd40488cbc5aab7cf3d3f8622a8a8614bfb (diff)
downloadeclipse.platform.team-25184cea3b6ef0b85032307e0773e6c447c9b44c.tar.gz
eclipse.platform.team-25184cea3b6ef0b85032307e0773e6c447c9b44c.tar.xz
eclipse.platform.team-25184cea3b6ef0b85032307e0773e6c447c9b44c.zip
Starting to use new performance testing frameworkI20040830
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/plugin.xml1
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java17
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java100
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTestSetup.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/SyncTests.java97
5 files changed, 141 insertions, 76 deletions
diff --git a/tests/org.eclipse.team.tests.cvs.core/plugin.xml b/tests/org.eclipse.team.tests.cvs.core/plugin.xml
index 26f39c1cd..e07842d07 100644
--- a/tests/org.eclipse.team.tests.cvs.core/plugin.xml
+++ b/tests/org.eclipse.team.tests.cvs.core/plugin.xml
@@ -30,6 +30,7 @@
<import plugin="org.eclipse.update.core"/>
<import plugin="org.junit"/>
<import plugin="org.eclipse.team.tests.core"/>
+ <import plugin="org.eclipse.test.performance"/>
</requires>
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
index f9cb620f8..10297fa4d 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
@@ -202,21 +202,28 @@ public class EclipseTest extends EclipseWorkspaceTest {
CVSWorkspaceRoot.getCVSResourceFor(resources[i]).unmanage(null);
}
}
+
/**
* Update the resources from an existing container with the changes from the CVS repository
*/
public IResource[] updateResources(IContainer container, String[] hierarchy, boolean ignoreLocalChanges) throws CoreException, TeamException {
IResource[] resources = getResources(container, hierarchy);
- LocalOption[] options = Command.NO_LOCAL_OPTIONS;
+ return updateResources(resources, ignoreLocalChanges);
+ }
+
+ /**
+ * Update the resources from an existing container with the changes from the CVS repository
+ */
+ protected IResource[] updateResources(IResource[] resources, boolean ignoreLocalChanges) throws CVSException {
+ LocalOption[] options = Command.NO_LOCAL_OPTIONS;
if(ignoreLocalChanges) {
options = new LocalOption[] {Update.IGNORE_LOCAL_CHANGES};
}
executeHeadless(new UpdateOperation(null, resources, options, null));
return resources;
- }
-
-
- protected void replace(IContainer container, String[] hierarchy, CVSTag tag, boolean recurse) throws CoreException {
+ }
+
+ protected void replace(IContainer container, String[] hierarchy, CVSTag tag, boolean recurse) throws CoreException {
IResource[] resources = getResources(container, hierarchy);
replace(resources, tag, recurse);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java
index 88a71d5b1..7359acabf 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java
@@ -13,6 +13,8 @@ package org.eclipse.team.tests.ccvs.ui.benchmark;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.zip.ZipException;
import org.eclipse.core.resources.IProject;
@@ -23,13 +25,20 @@ import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
import org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource;
+import org.eclipse.team.tests.ccvs.ui.SynchronizeViewTestAdapter;
+import org.eclipse.test.performance.Performance;
+import org.eclipse.test.performance.PerformanceMeter;
/**
* Benchmark test superclass
*/
public abstract class BenchmarkTest extends EclipseTest {
- protected BenchmarkTest() {
+ private HashMap groups;
+ private PerformanceMeter currentMeter;
+ private static SyncInfoSource source = new SynchronizeViewTestAdapter();
+
+ protected BenchmarkTest() {
}
protected BenchmarkTest(String name) {
@@ -64,19 +73,72 @@ public abstract class BenchmarkTest extends EclipseTest {
}
/**
+ * Create a set of perforance meters that can be started with the
+ * startGroup method.
+ * @param performance_groups
+ */
+ protected void setupGroups(String[] performance_groups) {
+ groups = new HashMap();
+ Performance perf = Performance.getDefault();
+ for (int i = 0; i < performance_groups.length; i++) {
+ String suffix = performance_groups[i];
+ PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this) + suffix);
+ groups.put(suffix, meter);
+ }
+ }
+
+ /**
+ * Commit the performance meters that were created by setupGroups and started and
+ * stoped using startGroup/endGroup
+ */
+ protected void commitGroups() {
+ for (Iterator iter = groups.values().iterator(); iter.hasNext();) {
+ PerformanceMeter meter = (PerformanceMeter) iter.next();
+ meter.commit();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.tests.ccvs.core.EclipseTest#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ try {
+ if (groups != null) {
+ Performance perf = Performance.getDefault();
+ try {
+ for (Iterator iter = groups.values().iterator(); iter.hasNext();) {
+ PerformanceMeter meter = (PerformanceMeter) iter.next();
+ perf.assertPerformance(meter);
+ }
+ } finally {
+ for (Iterator iter = groups.values().iterator(); iter.hasNext();) {
+ PerformanceMeter meter = (PerformanceMeter) iter.next();
+ meter.dispose();
+ }
+ }
+ groups = null;
+ }
+ } finally {
+ super.tearDown();
+ }
+ }
+
+ /**
+ * Start the meter that was created for the given key
* @param string
*/
- protected void startGroup(String string) {
- // TODO Auto-generated method stub
-
+ protected void startGroup(String key) {
+ assertNull(currentMeter);
+ currentMeter = (PerformanceMeter)groups.get(key);
+ currentMeter.start();
}
/**
- *
+ * End the current meter
*/
protected void endGroup() {
- // TODO Auto-generated method stub
-
+ currentMeter.stop();
+ currentMeter = null;
}
protected void disableLog() {
@@ -100,10 +162,12 @@ public abstract class BenchmarkTest extends EclipseTest {
* @throws TeamException
*/
protected void syncCommitResources(IResource[] resources, String comment) throws TeamException, CoreException {
+ startTask("Synchronize outgoing changes");
syncResources(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), resources);
- startTask("Sync View Commit action");
+ endTask();
// TODO: Commit all outgoing changes that are children of the given resource
// by extracting them from the subscriber sync set
+ startTask("Commit outgoing changes");
commitResources(resources, IResource.DEPTH_INFINITE);
endTask();
}
@@ -113,28 +177,20 @@ public abstract class BenchmarkTest extends EclipseTest {
* @throws TeamException
*/
protected void syncUpdateResources(IResource[] resources) throws TeamException {
+ startTask("Synchronize incoming changes");
syncResources(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), resources);
+ endTask();
// TODO: Update all incoming changes that are children of the given resource
// by extracting them from the subscriber sync set
- updateResources(resources, IResource.DEPTH_INFINITE, false);
+ startTask("Update incoming changes");
+ updateResources(resources, false);
+ endTask();
}
/**
* @return
*/
private SyncInfoSource getSyncInfoSource() {
- // TODO Auto-generated method stub
- return null;
+ return source;
}
-
- /**
- * @param resources
- * @param depth_infinite
- * @param b
- */
- private void updateResources(IResource[] resources, int depth_infinite, boolean ignoreLocalChanges) {
- // TODO Auto-generated method stub
-
- }
-
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTestSetup.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTestSetup.java
index 459586ded..b944178f1 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTestSetup.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTestSetup.java
@@ -25,9 +25,11 @@ public class BenchmarkTestSetup extends CVSTestSetup {
public static final File BIG_ZIP_FILE;
public static final File SMALL_ZIP_FILE;
public static final File TINY_ZIP_FILE;
+ public static final int LOOP_COUNT;
// Static initializer for constants
static {
+ LOOP_COUNT = Integer.valueOf(System.getProperty("eclipse.cvs.loopCount", "1")).intValue();
try {
BIG_ZIP_FILE = getTestFile("benchmarkBig.zip");
SMALL_ZIP_FILE = getTestFile("benchmarkSmall.zip");
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/SyncTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/SyncTests.java
index f4359140e..3f8e766d4 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/SyncTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/SyncTests.java
@@ -21,6 +21,12 @@ public class SyncTests extends BenchmarkTest {
private static final int FILE_SIZE_VARIANCE = 0;
private static final int PROB_BINARY = 0;
+ private static final String NO_CHANGES_GROUP_SUFFIX = "NoChanges";
+ private static final String ADDED_GROUP_SUFFIX = "AddedFiles";
+ private static final String REMOVED_GROUP_SUFFIX = "RemovedFiles";
+ private static final String MODIFIED_GROUP_SUFFIX = "ModifiedFiles";
+ private static final String[] PERFORMANCE_GROUPS = new String[] {ADDED_GROUP_SUFFIX, MODIFIED_GROUP_SUFFIX, REMOVED_GROUP_SUFFIX};
+
public SyncTests() {
super();
}
@@ -32,13 +38,16 @@ public class SyncTests extends BenchmarkTest {
public static Test suite() {
return suite(SyncTests.class);
}
-
+
public void testSync0() throws Exception {
- // test sync on project with no changes
+ setupGroups(new String[] {NO_CHANGES_GROUP_SUFFIX} );
IProject project = setupOutProject();
- startGroup("test sync with no changes");
- syncCommitResources(new IResource[] { project }, "");
- endGroup();
+ for (int i = 0; i < BenchmarkTestSetup.LOOP_COUNT; i++) {
+ startGroup(NO_CHANGES_GROUP_SUFFIX);
+ syncCommitResources(new IResource[] { project }, "");
+ endGroup();
+ }
+ commitGroups();
}
public void testSync1() throws Exception {
@@ -54,10 +63,8 @@ public class SyncTests extends BenchmarkTest {
}
protected IProject setupOutProject() throws Exception {
- disableLog();
IProject project = createUniqueProject(BenchmarkTestSetup.SMALL_ZIP_FILE);
shareProject(project);
- enableLog();
return project;
}
@@ -66,47 +73,39 @@ public class SyncTests extends BenchmarkTest {
* A parallel project is used to generate incoming changes.
*/
protected void runTestSync(int size) throws Exception {
- final SequenceGenerator gen = new SequenceGenerator();
-
- // setup out project then move it out of the way
- IProject outProject = setupOutProject();
- String moduleName = outProject.getName();
- BenchmarkUtils.renameResource(outProject, moduleName + "out");
- outProject = BenchmarkUtils.getProject(moduleName + "out");
-
- // setup in project
- IProject inProject = BenchmarkUtils.getProject(moduleName);
- checkoutProject(inProject, moduleName, null);
-
- /*** outgoing and incoming changes ***/
- startGroup("synchronize " + size + " added file(s)");
- BenchmarkUtils.createRandomDeepFiles(gen, outProject, size, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY);
- startGroup("as outgoing changes");
- syncCommitResources(new IResource[] { outProject }, "");
- endGroup();
- startGroup("as incoming changes");
- syncUpdateResources(new IResource[] { inProject });
- endGroup();
- endGroup();
-
- startGroup("synchronize " + size + " modified file(s)");
- BenchmarkUtils.modifyRandomDeepFiles(gen, outProject, size);
- startGroup("as outgoing changes");
- syncCommitResources(new IResource[] { outProject }, "");
- endGroup();
- startGroup("as incoming changes");
- syncUpdateResources(new IResource[] { inProject });
- endGroup();
- endGroup();
-
- startGroup("synchronize " + size + " removed file(s)");
- BenchmarkUtils.deleteRandomDeepFiles(gen, outProject, size);
- startGroup("as outgoing changes");
- syncCommitResources(new IResource[] { outProject }, "");
- endGroup();
- startGroup("as incoming changes");
- syncUpdateResources(new IResource[] { inProject });
- endGroup();
- endGroup();
+ setupGroups(PERFORMANCE_GROUPS);
+ for (int i = 0; i < BenchmarkTestSetup.LOOP_COUNT; i++) {
+ final SequenceGenerator gen = new SequenceGenerator();
+
+ // setup out project then move it out of the way
+ IProject outProject = setupOutProject();
+ String moduleName = outProject.getName();
+ BenchmarkUtils.renameResource(outProject, moduleName + "out");
+ outProject = BenchmarkUtils.getProject(moduleName + "out");
+
+ // setup in project
+ IProject inProject = BenchmarkUtils.getProject(moduleName);
+ checkoutProject(inProject, moduleName, null);
+
+ /*** outgoing and incoming changes ***/
+ startGroup(ADDED_GROUP_SUFFIX);
+ BenchmarkUtils.createRandomDeepFiles(gen, outProject, size, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY);
+ syncCommitResources(new IResource[] { outProject }, "");
+ syncUpdateResources(new IResource[] { inProject });
+ endGroup();
+
+ startGroup(MODIFIED_GROUP_SUFFIX);
+ BenchmarkUtils.modifyRandomDeepFiles(gen, outProject, size);
+ syncCommitResources(new IResource[] { outProject }, "");
+ syncUpdateResources(new IResource[] { inProject });
+ endGroup();
+
+ startGroup(REMOVED_GROUP_SUFFIX);
+ BenchmarkUtils.deleteRandomDeepFiles(gen, outProject, size);
+ syncCommitResources(new IResource[] { outProject }, "");
+ syncUpdateResources(new IResource[] { inProject });
+ endGroup();
+ }
+ commitGroups();
}
}

Back to the top