Don't always run code in Ant task tests

But when running code, do it via <java> 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
This commit is contained in:
Alexander Udalov
2015-06-04 22:02:23 +03:00
parent 968d362b77
commit 0f6c23e1c4
21 changed files with 34 additions and 72 deletions
@@ -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);
}
}
@@ -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();
@@ -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