From 0f6c23e1c4e4bc3a123e76b04287e06b7d4e342a Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 4 Jun 2015 22:02:23 +0300 Subject: [PATCH] Don't always run code in Ant task tests But when running code, do it via task, not via custom testing code. Most of the time the compiled code need not be runned, because it's irrelevant to the Ant task itself --- .../ant/jvm/additionalArguments/hello.run.expected | 4 ---- .../ant/jvm/doNotFailOnError/hello.run.expected | 12 ------------ .../ant/jvm/externalAnnotations/build.log.expected | 2 ++ .../ant/jvm/externalAnnotations/build.xml | 7 +++++++ .../ant/jvm/externalAnnotations/hello.run.expected | 5 ----- .../ant/jvm/helloWorld/build.log.expected | 1 + .../integration/ant/jvm/helloWorld/build.xml | 7 +++++++ .../ant/jvm/helloWorld/hello.run.expected | 4 ---- .../ant/jvm/jvmClasspath/build.log.expected | 1 + .../integration/ant/jvm/jvmClasspath/build.xml | 7 +++++++ .../integration/ant/jvm/jvmClasspath/hello.kt | 2 +- .../ant/jvm/jvmClasspath/hello.run.expected | 4 ---- .../ant/jvm/manySourceRoots/hello.run.expected | 4 ---- .../ant/jvm/noClasspathGiven/hello.run.expected | 4 ---- .../ant/jvm/suppressWarnings/hello.run.expected | 4 ---- .../integration/ant/jvm/verbose/hello.run.expected | 4 ---- .../integration/ant/jvm/version/hello.run.expected | 4 ---- .../jvm/withKotlinNoJavaSources/hello.run.expected | 4 ---- .../kotlin/integration/AntTaskBaseTest.java | 8 +++----- .../jetbrains/kotlin/integration/AntTaskJsTest.java | 5 +++++ .../kotlin/integration/AntTaskJvmTest.java | 13 ------------- 21 files changed, 34 insertions(+), 72 deletions(-) delete mode 100644 compiler/testData/integration/ant/jvm/additionalArguments/hello.run.expected delete mode 100644 compiler/testData/integration/ant/jvm/doNotFailOnError/hello.run.expected delete mode 100644 compiler/testData/integration/ant/jvm/externalAnnotations/hello.run.expected delete mode 100644 compiler/testData/integration/ant/jvm/helloWorld/hello.run.expected delete mode 100644 compiler/testData/integration/ant/jvm/jvmClasspath/hello.run.expected delete mode 100644 compiler/testData/integration/ant/jvm/manySourceRoots/hello.run.expected delete mode 100644 compiler/testData/integration/ant/jvm/noClasspathGiven/hello.run.expected delete mode 100644 compiler/testData/integration/ant/jvm/suppressWarnings/hello.run.expected delete mode 100644 compiler/testData/integration/ant/jvm/verbose/hello.run.expected delete mode 100644 compiler/testData/integration/ant/jvm/version/hello.run.expected delete mode 100644 compiler/testData/integration/ant/jvm/withKotlinNoJavaSources/hello.run.expected diff --git a/compiler/testData/integration/ant/jvm/additionalArguments/hello.run.expected b/compiler/testData/integration/ant/jvm/additionalArguments/hello.run.expected deleted file mode 100644 index 96c6fc52793..00000000000 --- a/compiler/testData/integration/ant/jvm/additionalArguments/hello.run.expected +++ /dev/null @@ -1,4 +0,0 @@ -OUT: -Hello, a! - -Return code: 0 diff --git a/compiler/testData/integration/ant/jvm/doNotFailOnError/hello.run.expected b/compiler/testData/integration/ant/jvm/doNotFailOnError/hello.run.expected deleted file mode 100644 index a9dec07cd07..00000000000 --- a/compiler/testData/integration/ant/jvm/doNotFailOnError/hello.run.expected +++ /dev/null @@ -1,12 +0,0 @@ - -ERR: -Exception in thread "main" java.lang.NoClassDefFoundError: hello/HelloPackage -Caused by: java.lang.ClassNotFoundException: hello.HelloPackage - at java.net.URLClassLoader$1.run(URLClassLoader.java:202) - at java.security.AccessController.doPrivileged(Native Method) - at java.net.URLClassLoader.findClass(URLClassLoader.java:190) - at java.lang.ClassLoader.loadClass(ClassLoader.java:306) - at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) - at java.lang.ClassLoader.loadClass(ClassLoader.java:247) - -Return code: 1 diff --git a/compiler/testData/integration/ant/jvm/externalAnnotations/build.log.expected b/compiler/testData/integration/ant/jvm/externalAnnotations/build.log.expected index b0482150f40..db3f99c32e0 100644 --- a/compiler/testData/integration/ant/jvm/externalAnnotations/build.log.expected +++ b/compiler/testData/integration/ant/jvm/externalAnnotations/build.log.expected @@ -7,6 +7,8 @@ build: [javac] Compiling [[TestData]/root1] => [[Temp]/classes] [javac] Running javac... [jar] Building jar: [Temp]/hello.jar + [java] Hello, a! + [java] Java Hello BUILD SUCCESSFUL Total time: [time] diff --git a/compiler/testData/integration/ant/jvm/externalAnnotations/build.xml b/compiler/testData/integration/ant/jvm/externalAnnotations/build.xml index 58c5c85af24..db112134871 100644 --- a/compiler/testData/integration/ant/jvm/externalAnnotations/build.xml +++ b/compiler/testData/integration/ant/jvm/externalAnnotations/build.xml @@ -12,5 +12,12 @@ + + + + + + + diff --git a/compiler/testData/integration/ant/jvm/externalAnnotations/hello.run.expected b/compiler/testData/integration/ant/jvm/externalAnnotations/hello.run.expected deleted file mode 100644 index f36d0378368..00000000000 --- a/compiler/testData/integration/ant/jvm/externalAnnotations/hello.run.expected +++ /dev/null @@ -1,5 +0,0 @@ -OUT: -Hello, a! -Java Hello - -Return code: 0 diff --git a/compiler/testData/integration/ant/jvm/helloWorld/build.log.expected b/compiler/testData/integration/ant/jvm/helloWorld/build.log.expected index bdd3291fcb4..051469bfee9 100644 --- a/compiler/testData/integration/ant/jvm/helloWorld/build.log.expected +++ b/compiler/testData/integration/ant/jvm/helloWorld/build.log.expected @@ -3,6 +3,7 @@ Buildfile: [TestData]/build.xml build: [kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar] + [java] Hello, a! BUILD SUCCESSFUL Total time: [time] diff --git a/compiler/testData/integration/ant/jvm/helloWorld/build.xml b/compiler/testData/integration/ant/jvm/helloWorld/build.xml index 477829a1a7c..23fc47d8f15 100644 --- a/compiler/testData/integration/ant/jvm/helloWorld/build.xml +++ b/compiler/testData/integration/ant/jvm/helloWorld/build.xml @@ -3,5 +3,12 @@ + + + + + + + diff --git a/compiler/testData/integration/ant/jvm/helloWorld/hello.run.expected b/compiler/testData/integration/ant/jvm/helloWorld/hello.run.expected deleted file mode 100644 index 96c6fc52793..00000000000 --- a/compiler/testData/integration/ant/jvm/helloWorld/hello.run.expected +++ /dev/null @@ -1,4 +0,0 @@ -OUT: -Hello, a! - -Return code: 0 diff --git a/compiler/testData/integration/ant/jvm/jvmClasspath/build.log.expected b/compiler/testData/integration/ant/jvm/jvmClasspath/build.log.expected index 96877f22514..c40d9ca3d8d 100644 --- a/compiler/testData/integration/ant/jvm/jvmClasspath/build.log.expected +++ b/compiler/testData/integration/ant/jvm/jvmClasspath/build.log.expected @@ -4,6 +4,7 @@ Buildfile: [TestData]/build.xml build: [kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar] [kotlinc] WARNING: [TestData]/hello.kt: (15, 9) Variable 'result' is never used + [java] OK BUILD SUCCESSFUL Total time: [time] diff --git a/compiler/testData/integration/ant/jvm/jvmClasspath/build.xml b/compiler/testData/integration/ant/jvm/jvmClasspath/build.xml index 477829a1a7c..23fc47d8f15 100644 --- a/compiler/testData/integration/ant/jvm/jvmClasspath/build.xml +++ b/compiler/testData/integration/ant/jvm/jvmClasspath/build.xml @@ -3,5 +3,12 @@ + + + + + + + diff --git a/compiler/testData/integration/ant/jvm/jvmClasspath/hello.kt b/compiler/testData/integration/ant/jvm/jvmClasspath/hello.kt index 87221d7424d..85d73c1bbd3 100644 --- a/compiler/testData/integration/ant/jvm/jvmClasspath/hello.kt +++ b/compiler/testData/integration/ant/jvm/jvmClasspath/hello.kt @@ -8,7 +8,7 @@ import sun.nio.ByteBuffered fun main(args : Array) { val a = Big5() // charsets.jar - val c = DNSNameService() // dnsns.ajr + val c = DNSNameService() // dnsns.jar val e : Cipher? = null // jce.jar val f : SunJCE? = null // sunjce_provider.jar val j : ByteBuffered? = null // rt.jar diff --git a/compiler/testData/integration/ant/jvm/jvmClasspath/hello.run.expected b/compiler/testData/integration/ant/jvm/jvmClasspath/hello.run.expected deleted file mode 100644 index 4000785a4d1..00000000000 --- a/compiler/testData/integration/ant/jvm/jvmClasspath/hello.run.expected +++ /dev/null @@ -1,4 +0,0 @@ -OUT: -OK - -Return code: 0 diff --git a/compiler/testData/integration/ant/jvm/manySourceRoots/hello.run.expected b/compiler/testData/integration/ant/jvm/manySourceRoots/hello.run.expected deleted file mode 100644 index 96c6fc52793..00000000000 --- a/compiler/testData/integration/ant/jvm/manySourceRoots/hello.run.expected +++ /dev/null @@ -1,4 +0,0 @@ -OUT: -Hello, a! - -Return code: 0 diff --git a/compiler/testData/integration/ant/jvm/noClasspathGiven/hello.run.expected b/compiler/testData/integration/ant/jvm/noClasspathGiven/hello.run.expected deleted file mode 100644 index fd58d467c30..00000000000 --- a/compiler/testData/integration/ant/jvm/noClasspathGiven/hello.run.expected +++ /dev/null @@ -1,4 +0,0 @@ -OUT: -Hello! - -Return code: 0 diff --git a/compiler/testData/integration/ant/jvm/suppressWarnings/hello.run.expected b/compiler/testData/integration/ant/jvm/suppressWarnings/hello.run.expected deleted file mode 100644 index 20c284504fb..00000000000 --- a/compiler/testData/integration/ant/jvm/suppressWarnings/hello.run.expected +++ /dev/null @@ -1,4 +0,0 @@ -OUT: -Hi! - -Return code: 0 diff --git a/compiler/testData/integration/ant/jvm/verbose/hello.run.expected b/compiler/testData/integration/ant/jvm/verbose/hello.run.expected deleted file mode 100644 index 20c284504fb..00000000000 --- a/compiler/testData/integration/ant/jvm/verbose/hello.run.expected +++ /dev/null @@ -1,4 +0,0 @@ -OUT: -Hi! - -Return code: 0 diff --git a/compiler/testData/integration/ant/jvm/version/hello.run.expected b/compiler/testData/integration/ant/jvm/version/hello.run.expected deleted file mode 100644 index 683c9b6f7ba..00000000000 --- a/compiler/testData/integration/ant/jvm/version/hello.run.expected +++ /dev/null @@ -1,4 +0,0 @@ -OUT: -Yo! - -Return code: 0 diff --git a/compiler/testData/integration/ant/jvm/withKotlinNoJavaSources/hello.run.expected b/compiler/testData/integration/ant/jvm/withKotlinNoJavaSources/hello.run.expected deleted file mode 100644 index fd58d467c30..00000000000 --- a/compiler/testData/integration/ant/jvm/withKotlinNoJavaSources/hello.run.expected +++ /dev/null @@ -1,4 +0,0 @@ -OUT: -Hello! - -Return code: 0 diff --git a/compiler/tests/org/jetbrains/kotlin/integration/AntTaskBaseTest.java b/compiler/tests/org/jetbrains/kotlin/integration/AntTaskBaseTest.java index 63db829dd98..0e26d157b53 100644 --- a/compiler/tests/org/jetbrains/kotlin/integration/AntTaskBaseTest.java +++ b/compiler/tests/org/jetbrains/kotlin/integration/AntTaskBaseTest.java @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.integration; import org.jetbrains.annotations.NotNull; import org.jetbrains.kotlin.cli.CliBaseTest; +import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime; import java.io.File; @@ -29,6 +30,8 @@ public abstract class AntTaskBaseTest extends KotlinIntegrationTestBase { "build.log", "-jar", getAntHome() + File.separator + "lib" + File.separator + "ant-launcher.jar", "-Dkotlin.lib=" + getCompilerLib(), + "-Dkotlin.runtime.jar=" + ForTestCompileRuntime.runtimeJarForTests().getAbsolutePath(), + "-Dkotlin.reflect.jar=" + ForTestCompileRuntime.reflectJarForTests().getAbsolutePath(), "-Dtest.data=" + getTestDataDir(), "-Dtemp=" + tmpdir.getTmpDir(), "-f", "build.xml" @@ -45,9 +48,4 @@ public abstract class AntTaskBaseTest extends KotlinIntegrationTestBase { private static String getAntHome() { return getKotlinProjectHome().getAbsolutePath() + File.separator + "dependencies" + File.separator + "ant-1.8"; } - - @NotNull - protected File getOutputFileByName(@NotNull String name) { - return new File(tmpdir.getTmpDir(), name); - } } diff --git a/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJsTest.java b/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJsTest.java index bd8933aa19d..d43c59ef0ad 100644 --- a/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJsTest.java +++ b/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJsTest.java @@ -47,6 +47,11 @@ public class AntTaskJsTest extends AntTaskBaseTest { return new File(new File(ANT_TASK_TEST_DATA_BASE_DIR, "js"), name.getMethodName()); } + @NotNull + private File getOutputFileByName(@NotNull String name) { + return new File(tmpdir.getTmpDir(), name); + } + private void doJsAntTest(String... jsFiles) throws Exception { doAntTest(); diff --git a/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJvmTest.java b/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJvmTest.java index 75e59ee3609..c3d35893b60 100644 --- a/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJvmTest.java +++ b/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJvmTest.java @@ -17,18 +17,13 @@ package org.jetbrains.kotlin.integration; import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime; -import org.jetbrains.kotlin.utils.UtilsPackage; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; import java.io.File; -import java.util.Arrays; public class AntTaskJvmTest extends AntTaskBaseTest { - private static final String JVM_OUT_FILE = "hello.jar"; - @Rule public final TestName name = new TestName(); @@ -40,14 +35,6 @@ public class AntTaskJvmTest extends AntTaskBaseTest { private void doJvmAntTest() throws Exception { doAntTest(); - - String classpath = UtilsPackage.join(Arrays.asList( - getOutputFileByName(JVM_OUT_FILE).getAbsolutePath(), - ForTestCompileRuntime.runtimeJarForTests().getAbsolutePath(), - ForTestCompileRuntime.reflectJarForTests().getAbsolutePath() - ), File.pathSeparator); - - runJava("hello.run", "-cp", classpath, "hello.HelloPackage"); } @Test