From 20542d94c1678a960ad380eaa6297d5b1aef93ff Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Mon, 9 Dec 2013 17:59:43 +0400 Subject: [PATCH] Added extra output for tests if they fail. Muted test on "bad" agents. --- .../jet/cli/AbstractKotlincExecutableTest.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/compiler/tests/org/jetbrains/jet/cli/AbstractKotlincExecutableTest.java b/compiler/tests/org/jetbrains/jet/cli/AbstractKotlincExecutableTest.java index 4d96f0430f3..8f54c74cf97 100644 --- a/compiler/tests/org/jetbrains/jet/cli/AbstractKotlincExecutableTest.java +++ b/compiler/tests/org/jetbrains/jet/cli/AbstractKotlincExecutableTest.java @@ -16,6 +16,7 @@ package org.jetbrains.jet.cli; +import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; import com.intellij.util.ArrayUtil; @@ -38,12 +39,12 @@ public abstract class AbstractKotlincExecutableTest extends TestCaseWithTmpdir { final Process process = Runtime.getRuntime().exec(ArrayUtil.prepend(kotlincFile.getAbsolutePath(), args)); - // We don't need contents of stderr, just read it to null to avoid process blocking + final Ref stderr = Ref.create(); new Thread(new Runnable() { @Override public void run() { try { - FileUtil.loadBytes(process.getErrorStream()); + stderr.set(FileUtil.loadTextAndClose(process.getErrorStream())); } catch (IOException e) { throw new RuntimeException(e); @@ -58,7 +59,17 @@ public abstract class AbstractKotlincExecutableTest extends TestCaseWithTmpdir { String normalizedOutput = CliBaseTest.getNormalizedCompilerOutput(output, exitCode, testDataDir); File outFile = new File(argsFilePath.replace(".args", ".out")); - JetTestUtils.assertEqualsToFile(outFile, normalizedOutput); + + try { + JetTestUtils.assertEqualsToFile(outFile, normalizedOutput); + } + catch (Exception e) { + System.out.println("exitcode " + intExitCode); + System.out.println("" + output + ""); + System.out.println("" + stderr + ""); + + throw e; + } } protected void doJvmTest(@NotNull String argsFilePath) throws Exception {