Bug 135666 - The first run of the headless startup test should be excluded from the performance results
diff --git a/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF
index a19cf2f..f2378dd 100644
--- a/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF
@@ -20,6 +20,6 @@
 Require-Bundle: org.eclipse.core.runtime.compatibility,
  org.eclipse.core.tests.harness,
  org.junit,
- org.eclipse.test.performance;resolution:=optional
+ org.eclipse.test.performance
 Eclipse-AutoStart: true
 Plugin-Class: org.eclipse.core.tests.runtime.RuntimeTestsPlugin
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/AllTests.java
index 558fd77..6ca249b 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/AllTests.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/AllTests.java
@@ -12,12 +12,24 @@
 
 import junit.framework.*;
 import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
-import org.eclipse.core.tests.session.PerformanceSessionTestSuite;
-import org.eclipse.core.tests.session.UIPerformanceSessionTestSuite;
+import org.eclipse.core.tests.session.*;
+import org.eclipse.core.tests.session.SetupManager.SetupException;
 
 public class AllTests extends TestCase {
 	public static Test suite() {
 		TestSuite suite = new TestSuite(AllTests.class.getName());
+
+		// make sure that the first run of the startup test is not recorded - it is heavily 
+		// influenced by the presence and validity of the cached information
+		try {
+			PerformanceSessionTestSuite firstRun = new PerformanceSessionTestSuite(RuntimeTestsPlugin.PI_RUNTIME_TESTS, 1, StartupTest.class);
+			Setup setup = firstRun.getSetup();
+			setup.setSystemProperty("eclipseTest.ReportResults", "false");
+			suite.addTest(firstRun);
+		} catch (SetupException e) {
+			fail("Unable to create warm up test");
+		}
+
 		suite.addTest(new PerformanceSessionTestSuite(RuntimeTestsPlugin.PI_RUNTIME_TESTS, 5, StartupTest.class));
 		suite.addTest(new UIPerformanceSessionTestSuite(RuntimeTestsPlugin.PI_RUNTIME_TESTS, 5, UIStartupTest.class));
 		suite.addTest(BenchPath.suite());
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/StartupTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/StartupTest.java
index 47965fb..01740b5 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/StartupTest.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/StartupTest.java
@@ -29,7 +29,10 @@
 			meter.stop();
 			// tag for showing in the performance fingerprint graph
 			Performance.getDefault().tagAsGlobalSummary(meter, "Core Headless Startup", Dimension.ELAPSED_PROCESS);
-			meter.commit();
+			String reportOption = System.getProperty("eclipseTest.ReportResults");
+			boolean bReport = (reportOption == null) ? true : !("false".equalsIgnoreCase(reportOption));
+			if (bReport)
+				meter.commit();
 			Performance.getDefault().assertPerformanceInRelativeBand(meter, Dimension.ELAPSED_PROCESS, -100, 5);
 		} finally {
 			meter.dispose();