Don't check exit code in Ant tests

It's already checked in the build log in each test
This commit is contained in:
Alexander Udalov
2015-06-03 13:48:19 +03:00
parent 89408f45bb
commit 968d362b77
3 changed files with 13 additions and 22 deletions
@@ -21,16 +21,18 @@ import org.jetbrains.kotlin.cli.CliBaseTest;
import java.io.File; import java.io.File;
import static org.junit.Assert.assertEquals;
public abstract class AntTaskBaseTest extends KotlinIntegrationTestBase { public abstract class AntTaskBaseTest extends KotlinIntegrationTestBase {
protected static final File ANT_TASK_TEST_DATA_BASE_DIR = new File(INTEGRATION_TEST_DATA_BASE_DIR, "ant"); protected static final File ANT_TASK_TEST_DATA_BASE_DIR = new File(INTEGRATION_TEST_DATA_BASE_DIR, "ant");
protected static final int SUCCESSFUL = 0; protected void doAntTest() throws Exception {
protected static final int FAILED = 1; runJava(
"build.log",
protected void doAntTest(int expectedExitCode) throws Exception { "-jar", getAntHome() + File.separator + "lib" + File.separator + "ant-launcher.jar",
assertEquals("Compilation failed", expectedExitCode, runAnt("build.log", "build.xml")); "-Dkotlin.lib=" + getCompilerLib(),
"-Dtest.data=" + getTestDataDir(),
"-Dtemp=" + tmpdir.getTmpDir(),
"-f", "build.xml"
);
} }
@Override @Override
@@ -39,17 +41,6 @@ public abstract class AntTaskBaseTest extends KotlinIntegrationTestBase {
.replaceAll("Total time: .+\n", "Total time: [time]\n"); .replaceAll("Total time: .+\n", "Total time: [time]\n");
} }
private int runAnt(@NotNull String logName, @NotNull String scriptName) throws Exception {
return runJava(
logName,
"-jar", getAntHome() + File.separator + "lib" + File.separator + "ant-launcher.jar",
"-Dkotlin.lib=" + getCompilerLib(),
"-Dtest.data=" + getTestDataDir(),
"-Dtemp=" + tmpdir.getTmpDir(),
"-f", scriptName
);
}
@NotNull @NotNull
private static String getAntHome() { private static String getAntHome() {
return getKotlinProjectHome().getAbsolutePath() + File.separator + "dependencies" + File.separator + "ant-1.8"; return getKotlinProjectHome().getAbsolutePath() + File.separator + "dependencies" + File.separator + "ant-1.8";
@@ -48,7 +48,7 @@ public class AntTaskJsTest extends AntTaskBaseTest {
} }
private void doJsAntTest(String... jsFiles) throws Exception { private void doJsAntTest(String... jsFiles) throws Exception {
doAntTest(SUCCESSFUL); doAntTest();
List<String> fileNames = new ArrayList<String>(Arrays.asList(jsFiles)); List<String> fileNames = new ArrayList<String>(Arrays.asList(jsFiles));
fileNames.add(JS_OUT_FILE); fileNames.add(JS_OUT_FILE);
@@ -179,12 +179,12 @@ public class AntTaskJsTest extends AntTaskBaseTest {
@Test @Test
public void noSrcParam() throws Exception { public void noSrcParam() throws Exception {
doAntTest(FAILED); doAntTest();
} }
@Test @Test
public void noOutputParam() throws Exception { public void noOutputParam() throws Exception {
doAntTest(FAILED); doAntTest();
} }
@Test @Test
@@ -39,7 +39,7 @@ public class AntTaskJvmTest extends AntTaskBaseTest {
} }
private void doJvmAntTest() throws Exception { private void doJvmAntTest() throws Exception {
doAntTest(SUCCESSFUL); doAntTest();
String classpath = UtilsPackage.join(Arrays.asList( String classpath = UtilsPackage.join(Arrays.asList(
getOutputFileByName(JVM_OUT_FILE).getAbsolutePath(), getOutputFileByName(JVM_OUT_FILE).getAbsolutePath(),