Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2010-04-21 17:57:08 -0400
committerStephan Herrmann2010-04-21 17:57:08 -0400
commited07f3b80ee18c1625d42f5824fe018f349aadfe (patch)
tree2f498fd510f16b46f3a761c44fc118ebf59c2993 /org.eclipse.jdt.core.tests.compiler
parent54fd023152e6c169d4654022b935ae38eb84ad55 (diff)
downloadorg.eclipse.objectteams-ed07f3b80ee18c1625d42f5824fe018f349aadfe.tar.gz
org.eclipse.objectteams-ed07f3b80ee18c1625d42f5824fe018f349aadfe.tar.xz
org.eclipse.objectteams-ed07f3b80ee18c1625d42f5824fe018f349aadfe.zip
preparations for upcoming otjld-tests.
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java23
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InMemoryNameEnvironment.java3
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RegressionTestSetup.java3
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java26
4 files changed, 55 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
index 90e19f53f..38bb9bc3a 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
@@ -2227,7 +2227,12 @@ protected void runNegativeTest(String[] testFiles, String expectedCompilerLog) {
compilerOptions.produceReferenceInfo = true;
Throwable exception = null;
try {
+//{ObjectTeams: extracted as new hook:
+/* orig:
batchCompiler.compile(Util.compilationUnits(testFiles)); // compile all files together
+ :giro */
+ compileTestFiles(batchCompiler, testFiles);
+// SH}
} catch(RuntimeException e){
exception = e;
throw e;
@@ -2263,11 +2268,21 @@ protected void runNegativeTest(String[] testFiles, String expectedCompilerLog) {
String className = sourceFile.substring(0, sourceFile.length() - 5).replace('/', '.').replace('\\', '.');
if (className.endsWith(PACKAGE_INFO_NAME)) return;
+//{ObjectTeams: also reuse if same set of vmArguments:
+/* orig:
if (vmArguments != null) {
+ :giro */
+ if (this.verifier != null && !this.verifier.vmArgsEqual(vmArguments)) {
+// SH}
if (this.verifier != null) {
this.verifier.shutDown();
}
+//{ObjectTeams: make configurable:
+/* orig:
this.verifier = new TestVerifier(false);
+ :giro */
+ this.verifier = getTestVerifier(false);
+// SH}
this.createdVerifier = true;
}
boolean passed =
@@ -2313,6 +2328,14 @@ protected void runNegativeTest(String[] testFiles, String expectedCompilerLog) {
javacTestOptions, vmArguments);
}
}
+//{ObjectTeams: new hooks:
+ protected TestVerifier getTestVerifier(boolean reuseVM) {
+ return new TestVerifier(reuseVM);
+ }
+ protected void compileTestFiles(Compiler batchCompiler, String[] testFiles) {
+ batchCompiler.compile(Util.compilationUnits(testFiles)); // compile all files together
+ }
+// SH}
// runConformTest(
// // test directory preparation
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InMemoryNameEnvironment.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InMemoryNameEnvironment.java
index 4eb0b5413..39615c947 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InMemoryNameEnvironment.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InMemoryNameEnvironment.java
@@ -16,6 +16,9 @@ import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
public class InMemoryNameEnvironment implements INameEnvironment {
+//{ObjectTeams: visible for subclass:
+ protected
+// SH}
INameEnvironment[] classLibs;
HashtableOfObject compilationUnits = new HashtableOfObject();
public InMemoryNameEnvironment(String[] compilationUnits, INameEnvironment[] classLibs) {
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RegressionTestSetup.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RegressionTestSetup.java
index 32097a905..6686c8e15 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RegressionTestSetup.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RegressionTestSetup.java
@@ -18,6 +18,9 @@ import org.eclipse.jdt.internal.compiler.batch.FileSystem;
public class RegressionTestSetup extends CompilerTestSetup {
+//{ObjectTeams: visible for tests in other plugin:
+ public
+// SH}
TestVerifier verifier = new TestVerifier(true);
INameEnvironment javaClassLib;
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java
index 8c38c58d1..786394ad3 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java
@@ -22,6 +22,9 @@ public class TestVerifier {
public String failureReason;
boolean reuseVM = true;
+//{ObjectTeams: support reuse even in presence of vmargs, if unchanged:
+ protected String[] vmArguments = null;
+// SH}
String[] classpathCache;
LocalVirtualMachine vm;
StringBuffer outputBuffer;
@@ -236,6 +239,17 @@ private String getVerifyTestsCode() {
" if (name.startsWith(\"java\"))\n" +
" return true;\n" +
" \n" +
+//{ObjectTeams: don't process core OT-classes either (unpacked .class not available on classpath):
+" if (name.startsWith(\"org.objectteams\"))\n" +
+" return true;\n" +
+" \n" +
+" if (name.startsWith(\"org.eclipse.objectteams.otre\"))\n" +
+" return true;\n" +
+" \n" +
+" if (name.startsWith(\"de.fub.bytecode\"))\n" +
+" return true;\n" +
+" \n" +
+// SH}
" // exclude the user defined package paths\n" +
" for (int i= 0; i < fExcluded.length; i++) {\n" +
" if (name.startsWith(fExcluded[i])) {\n" +
@@ -650,4 +664,16 @@ private void waitForFullBuffers() {
this.errorBuffer.setLength(errorEndStringStart);
this.outputBuffer.setLength(outputEndStringStart);
}
+//{ObjectTeams: helper
+public boolean vmArgsEqual(String[] newArgs) {
+ if (this.vmArguments == null || newArgs == null)
+ return this.vmArguments == null && newArgs == null;
+ if (this.vmArguments.length != newArgs.length)
+ return false;
+ for (int i=0; i<newArgs.length; i++)
+ if (!this.vmArguments[i].equals(newArgs[i]))
+ return false;
+ return true;
+}
+// SH}
}

Back to the top