Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Camelon2003-06-17 20:58:41 +0000
committerJohn Camelon2003-06-17 20:58:41 +0000
commitd45de32ff5fcec052d8908b93f9c7324897b3185 (patch)
tree0c3e9686bbf1cb28b6e6f3febaa535859991c658 /core/org.eclipse.cdt.ui.tests
parentb73e87b69b4732dc9a92dee576fa746ed546cbec (diff)
downloadorg.eclipse.cdt-d45de32ff5fcec052d8908b93f9c7324897b3185.tar.gz
org.eclipse.cdt-d45de32ff5fcec052d8908b93f9c7324897b3185.tar.xz
org.eclipse.cdt-d45de32ff5fcec052d8908b93f9c7324897b3185.zip
Patch for Vladimir Hirsl.
This patch adds some missing source folders to the ui.tests library.
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests')
-rw-r--r--core/org.eclipse.cdt.ui.tests/.classpath11
-rw-r--r--core/org.eclipse.cdt.ui.tests/.project1
-rw-r--r--core/org.eclipse.cdt.ui.tests/ChangeLog7
-rw-r--r--core/org.eclipse.cdt.ui.tests/build.properties13
-rw-r--r--core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IIncludeTests.java2
-rw-r--r--core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IMacroTests.java2
-rw-r--r--core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java2
-rw-r--r--core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/resources/cmodel/IIncludeTest.h42
-rw-r--r--core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/resources/cmodel/IMacroTest.h4
-rw-r--r--core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/resources/cmodel/IStructure.c4
-rw-r--r--core/org.eclipse.cdt.ui.tests/plugin.xml4
-rw-r--r--core/org.eclipse.cdt.ui.tests/suite/org/eclipse/cdt/core/suite/AISResultPrinter.java53
-rw-r--r--core/org.eclipse.cdt.ui.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java126
13 files changed, 229 insertions, 42 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/.classpath b/core/org.eclipse.cdt.ui.tests/.classpath
index f3b72f2ded..9802467f5c 100644
--- a/core/org.eclipse.cdt.ui.tests/.classpath
+++ b/core/org.eclipse.cdt.ui.tests/.classpath
@@ -4,11 +4,11 @@
<classpathentry kind="src" path="ui/"/>
<classpathentry kind="src" path="core/"/>
<classpathentry kind="src" path="model/"/>
- <classpathentry kind="src" path="build"/>
- <classpathentry kind="src" path="parser"/>
- <classpathentry kind="src" path="failures"/>
+ <classpathentry kind="src" path="build/"/>
+ <classpathentry kind="src" path="parser/"/>
+ <classpathentry kind="src" path="failures/"/>
+ <classpathentry kind="src" path="suite/"/>
<classpathentry kind="src" path="/org.apache.xerces"/>
- <classpathentry kind="src" path="/org.eclipse.core.boot"/>
<classpathentry kind="src" path="/org.eclipse.core.resources"/>
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
<classpathentry kind="src" path="/org.eclipse.cdt.core"/>
@@ -20,8 +20,7 @@
<classpathentry kind="src" path="/org.eclipse.swt"/>
<classpathentry kind="src" path="/org.eclipse.ui"/>
<classpathentry kind="src" path="/org.junit"/>
- <classpathentry kind="src" path="/org.eclipse.update.core"/>
+ <classpathentry kind="src" path="/org.eclipse.core.boot"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="src" path="suite"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/core/org.eclipse.cdt.ui.tests/.project b/core/org.eclipse.cdt.ui.tests/.project
index c82a6b0faf..24c36cc11e 100644
--- a/core/org.eclipse.cdt.ui.tests/.project
+++ b/core/org.eclipse.cdt.ui.tests/.project
@@ -15,7 +15,6 @@
<project>org.eclipse.core.runtime</project>
<project>org.eclipse.swt</project>
<project>org.eclipse.ui</project>
- <project>org.eclipse.update.core</project>
<project>org.junit</project>
</projects>
<buildSpec>
diff --git a/core/org.eclipse.cdt.ui.tests/ChangeLog b/core/org.eclipse.cdt.ui.tests/ChangeLog
index e4ef4a4761..057663c28c 100644
--- a/core/org.eclipse.cdt.ui.tests/ChangeLog
+++ b/core/org.eclipse.cdt.ui.tests/ChangeLog
@@ -3,6 +3,13 @@
Added testPointersToMembers() and testPointersToMemberFunctions() to DOMTests.
Added testBug36290() and testBug36931() to DOMTests.
+2003-06-16 Vladimir Hirsl
+ Added /build, /parser, /failures and /suite directories to the library.
+ Copied resources from /model/org.eclipse.cdt.core.model.tests.resources
+ to /model/org/clipse/cdt/core/model/tests/resources/cmodel.
+ Added class AISResultPrinter to format test results.
+ Class AutomatedIntegrationSuite now implements IPlatformRunnable.
+
2003-06-13 John Camelon
Added Class/Base infrastructure to public interfaces & requestor callback.
Moved many internal interfaces to external packages.
diff --git a/core/org.eclipse.cdt.ui.tests/build.properties b/core/org.eclipse.cdt.ui.tests/build.properties
index ac21a23089..0c6138ca04 100644
--- a/core/org.eclipse.cdt.ui.tests/build.properties
+++ b/core/org.eclipse.cdt.ui.tests/build.properties
@@ -1,14 +1,17 @@
source.cdtuitests.jar = src/,\
- ui/,\
- core/,\
- model/
+ ui/,\
+ core/,\
+ model/,\
+ build/,\
+ parser/,\
+ failures/,\
+ suite/
bin.includes = plugin.xml,\
about.html,\
plugin.properties,\
test.xml
- about.html
src.includes = plugin.xml,\
about.html,\
plugin.properties,\
test.xml
-
+about.html =
diff --git a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IIncludeTests.java b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IIncludeTests.java
index ee6d8e71d0..a76065acae 100644
--- a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IIncludeTests.java
+++ b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IIncludeTests.java
@@ -29,7 +29,7 @@ public class IIncludeTests extends IntegratedCModelTest {
* @see org.eclipse.cdt.internal.core.model.IntegratedCModelTest
*/
public String getSourcefileSubdir() {
- return "model/org.eclipse.cdt.core.model.tests.resources/";
+ return "model/org/eclipse/cdt/core/model/tests/resources/cmodel/";
}
/**
diff --git a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IMacroTests.java b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IMacroTests.java
index 5b86e6db75..6033a0c5c8 100644
--- a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IMacroTests.java
+++ b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IMacroTests.java
@@ -43,7 +43,7 @@ public class IMacroTests extends IntegratedCModelTest {
* @see org.eclipse.cdt.internal.core.model.IntegratedCModelTest
*/
public String getSourcefileSubdir() {
- return "model/org.eclipse.cdt.core.model.tests.resources/";
+ return "model/org/eclipse/cdt/core/model/tests/resources/cmodel/";
}
/**
diff --git a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java
index 36152dd2ab..d970aee949 100644
--- a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java
+++ b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java
@@ -28,7 +28,7 @@ public class IStructureTests extends IntegratedCModelTest {
* @see org.eclipse.cdt.internal.core.model.IntegratedCModelTest
*/
public String getSourcefileSubdir() {
- return "model/org.eclipse.cdt.core.model.tests.resources/";
+ return "model/org/eclipse/cdt/core/model/tests/resources/cmodel/";
}
/**
diff --git a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/resources/cmodel/IIncludeTest.h b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/resources/cmodel/IIncludeTest.h
new file mode 100644
index 0000000000..7083fa8d77
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/resources/cmodel/IIncludeTest.h
@@ -0,0 +1,42 @@
+// include
+#include <stdio.h>
+#include "whatever.h"
+#include <src/slash.h>
+#include <src\backslash.h>
+#include "Program Files/space.h"
+#include "../up1dir.h"
+#include "./samedir.h"
+#include "different_extension1.hpp"
+#include "different_extension2.hh"
+#include "different_extension3.x"
+#include <no_extension>
+# include "whitespace_after_hash"
+ #include "whitespace_before_hash"
+
+// failure cases:
+#include garbage
+#include "resync_after_bad_parse_1"
+#include
+#include "resync_after_bad_parse_2"
+#include "one" "two" "three"
+#include "resync_after_bad_parse_3"
+
+// from the Spec:
+
+// from [C, 6.10.p8]
+// should fail
+#define EMPTY
+EMPTY #include "invalid.h"
+
+// from [C, 6.10.2.p8]:
+// should equal #include "myInclude1.h"
+#define MYINCFILE "myInclude1.h"
+#include MYINCFILE
+
+// from [C, 6.10.3.5.p6]:
+// should equal #include "vers2.h"
+#define INCFILE(x) vers ## x
+#define xstr(x) str(x)
+#define str(x) #x
+#include xstr(INCFILE(2)).h
+
diff --git a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/resources/cmodel/IMacroTest.h b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/resources/cmodel/IMacroTest.h
new file mode 100644
index 0000000000..a5bf320efa
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/resources/cmodel/IMacroTest.h
@@ -0,0 +1,4 @@
+// macro
+#define SINGLETON
+#define NUMBER 1
+#define PRINT(string,msg) printf(string, msg)
diff --git a/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/resources/cmodel/IStructure.c b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/resources/cmodel/IStructure.c
new file mode 100644
index 0000000000..47b7675719
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/resources/cmodel/IStructure.c
@@ -0,0 +1,4 @@
+// IStructure
+struct foo {
+ int bar;
+};
diff --git a/core/org.eclipse.cdt.ui.tests/plugin.xml b/core/org.eclipse.cdt.ui.tests/plugin.xml
index bc7e3259c9..eb64199269 100644
--- a/core/org.eclipse.cdt.ui.tests/plugin.xml
+++ b/core/org.eclipse.cdt.ui.tests/plugin.xml
@@ -2,7 +2,7 @@
<plugin
id="org.eclipse.cdt.ui.tests"
name="org.eclipse.cdt.ui.tests"
- version="1.1.0"
+ version="1.2.0.5"
class="org.eclipse.cdt.testplugin.CTestPlugin">
<runtime>
@@ -12,7 +12,6 @@
</runtime>
<requires>
<import plugin="org.apache.xerces"/>
- <import plugin="org.eclipse.core.boot"/>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.cdt.core"/>
@@ -20,7 +19,6 @@
<import plugin="org.eclipse.swt"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.junit"/>
- <import plugin="org.eclipse.update.core"/>
</requires>
diff --git a/core/org.eclipse.cdt.ui.tests/suite/org/eclipse/cdt/core/suite/AISResultPrinter.java b/core/org.eclipse.cdt.ui.tests/suite/org/eclipse/cdt/core/suite/AISResultPrinter.java
new file mode 100644
index 0000000000..ad73bc2053
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/suite/org/eclipse/cdt/core/suite/AISResultPrinter.java
@@ -0,0 +1,53 @@
+/*
+ * Created on Jun 5, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.cdt.core.suite;
+
+import java.io.PrintStream;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.Test;
+import junit.textui.ResultPrinter;
+
+/**
+ * @author vhirsl
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class AISResultPrinter extends ResultPrinter {
+
+ /**
+ * @param writer
+ */
+ public AISResultPrinter(PrintStream writer) {
+ super(writer);
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestListener#addFailure(junit.framework.Test, junit.framework.AssertionFailedError)
+ */
+ public void addFailure(Test test, AssertionFailedError t) {
+ super.addFailure(test, t);
+ getWriter().print("---> ");
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestListener#addError(junit.framework.Test, java.lang.Throwable)
+ */
+ public void addError(Test test, Throwable t) {
+ super.addError(test, t);
+ getWriter().print("---> ");
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestListener#startTest(junit.framework.Test)
+ */
+ public void startTest(Test test) {
+ getWriter().print(".");
+ }
+
+}
diff --git a/core/org.eclipse.cdt.ui.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java b/core/org.eclipse.cdt.ui.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java
index 79133c9b6a..8d195362b4 100644
--- a/core/org.eclipse.cdt.ui.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java
+++ b/core/org.eclipse.cdt.ui.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java
@@ -12,8 +12,12 @@ import junit.framework.TestSuite;
import junit.framework.TestResult;
import junit.framework.TestListener;
import junit.framework.AssertionFailedError;
+import junit.textui.TestRunner;
import java.text.DecimalFormat;
+import java.util.ArrayList;
+
+import org.eclipse.core.boot.IPlatformRunnable;
import org.eclipse.cdt.core.build.managed.tests.AllBuildTests;
import org.eclipse.cdt.core.model.tests.AllCoreTests;
@@ -30,13 +34,11 @@ import org.eclipse.cdt.core.model.failedTests.*;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class AutomatedIntegrationSuite extends TestSuite implements TestListener {
+public class AutomatedIntegrationSuite extends TestSuite
+ implements TestListener, IPlatformRunnable {
+ private TestResult testResult = null;
private String currentTestName;
- // Statistical information
- private int numberOfRuns = 0;
- private int numberOfFailures = 0;
- private int numberOfErrors = 0;
// success tests
private int numberOfSuccessTests = 0;
private int numberOfFailedSuccessTests = 0;
@@ -65,6 +67,9 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
public static Test suite() {
final AutomatedIntegrationSuite suite = new AutomatedIntegrationSuite();
+ // First test to trigger report generation
+ suite.addTest(suite.new GenerateReport("startSuccessTests"));
+
// Add all success tests
suite.addTest(AllBuildTests.suite());
suite.addTest(ParserTestSuite.suite());
@@ -93,6 +98,8 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
* Overloaded method
*/
public void run(TestResult result) {
+ // To get counts from the result
+ testResult = result;
// Add oneself as a listener
result.addListener(this);
// Call a base class method
@@ -106,27 +113,25 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
* An error occurred.
*/
public void addError(Test test, Throwable t) {
- ++numberOfErrors;
- System.out.println("Error : " + test);
- System.out.println("\tReason : " + t);
- System.out.println("\tStack trace : ");
- t.printStackTrace(System.out);
+// System.out.println("Error : " + test);
+// System.out.println("\tReason : " + t);
+// System.out.println("\tStack trace : ");
+// t.printStackTrace(System.out);
}
/**
* A failure occurred.
*/
public void addFailure(Test test, AssertionFailedError t) {
- ++numberOfFailures;
if (failedTests) {
++numberOfFailedFailedTests;
}
else {
++numberOfFailedSuccessTests;
}
- System.out.println("Failure : " + test);
- System.out.println("\tReason : " + t);
- System.out.println("\tStackTrace : ");
- t.printStackTrace(System.out);
+// System.out.println("Failure : " + test);
+// System.out.println("\tReason : " + t);
+// System.out.println("\tStackTrace : ");
+// t.printStackTrace(System.out);
}
/**
* A test ended.
@@ -140,15 +145,14 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
skipTest = false;
}
else {
- ++numberOfRuns;
if (failedTests) {
++numberOfFailedTests;
- System.out.println(test);
+ // System.out.println(test);
}
else {
++numberOfSuccessTests;
}
- // System.out.println(test);
+ System.out.println(test);
}
currentTestName = null;
}
@@ -174,11 +178,17 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
* Window>Preferences>Java>Code Generation>Code and Comments
*/
protected void generateReport() {
- System.out.println("\n*** Generating report: ***\n");
+ int numberOfRuns = testResult.runCount();
+ int numberOfFailures = testResult.failureCount();
+ int numberOfErrors = testResult.errorCount();
+
+ System.out.println();
+ System.out.println("*** Generating report: ***");
+ System.out.println();
System.out.println("\tNumber of runs: " + numberOfRuns);
System.out.println("\tNumber of failures: " + numberOfFailures);
System.out.println("\tNumber of errors: " + numberOfErrors);
- float successRate = (numberOfRuns-numberOfFailures)/(float)numberOfRuns;
+ float successRate = (numberOfRuns-numberOfFailures-numberOfErrors)/(float)numberOfRuns;
DecimalFormat df = new DecimalFormat("##.##%");
System.out.println("Sanity success rate : " + df.format(successRate));
System.out.println("\tNumber of success tests: " + numberOfSuccessTests);
@@ -189,12 +199,23 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
(float)(numberOfSuccessTests+numberOfFailedTests-numberOfFailedFailedTests);
System.out.print("Observed success test rate : " + df.format(successRate));
System.out.println(" (failed success tests = " + numberOfFailedSuccessTests + ", failed failed tests = " + numberOfFailedFailedTests + ")");
+ System.out.println();
}
- private void startFailedTests() {
- failedTests = true;
- System.out.println("\n*** Starting failed tests ***\n");
- }
+ private void startSuccessTests() {
+ failedTests = false;
+ System.out.println();
+ System.out.println("*** Starting success tests ***");
+ System.out.println();
+ }
+
+ private void startFailedTests() {
+ failedTests = true;
+ System.out.println();
+ System.out.println("*** Starting failed tests ***");
+ System.out.println();
+ }
+
/*
* Public inner class to invoke generateReport
*
@@ -217,6 +238,14 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
AutomatedIntegrationSuite.this.generateReport();
}
+ public void startSuccessTests() {
+ // skip this one
+ AutomatedIntegrationSuite.this.skipTest = true;
+
+ // Calls a method of the outer class
+ AutomatedIntegrationSuite.this.startSuccessTests();
+ }
+
public void startFailedTests() {
// skip this one
AutomatedIntegrationSuite.this.skipTest = true;
@@ -224,5 +253,54 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
// Calls a method of the outer class
AutomatedIntegrationSuite.this.startFailedTests();
}
+
+ /* (non-Javadoc)
+ * @see junit.framework.Test#countTestCases()
+ * We don't want these test cases to be counted
+ */
+ public int countTestCases() {
+ return 0;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.boot.IPlatformRunnable#run(java.lang.Object)
+ */
+ public Object run(Object args) throws Exception {
+ // Used when started from as a regression test suite after the build
+ TestRunner testRunner = new TestRunner(new AISResultPrinter(System.out));
+ TestResult testResult = testRunner.doRun(suite());
+
+ return prepareReport(testResult);
+ }
+
+ protected ArrayList prepareReport(TestResult testResult) {
+ // TestRunner.run(suite());
+ ArrayList efMessages = new ArrayList();
+ int errorCount = testResult.errorCount();
+ int failureCount = testResult.failureCount();
+ if (errorCount > 0) {
+ String em = new String("There ");
+ em += (errorCount == 1)?"is ":"are ";
+ em += Integer.toString(errorCount);
+ em += " error";
+ em += (errorCount == 1)?"!":"s!";
+ efMessages.add(em);
+ }
+ if (failureCount > 0) {
+ String fm = new String("There ");
+ fm += (failureCount == 1)?"is ":"are ";
+ fm += Integer.toString(failureCount);
+ fm += " failure";
+ fm += (failureCount == 1)?"!":"s!";
+ efMessages.add(fm);
+ }
+ if (efMessages.isEmpty()) {
+ efMessages.add(new String("Regression test run SUCCESSFUL!"));
+ }
+ else {
+ efMessages.add(new String("Please see raw test suite output for details."));
+ }
+ return efMessages;
}
}

Back to the top