diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java index a2beffc986b..8eb9744c5f2 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java @@ -123,8 +123,4 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase { ? null : JvmFileClassUtil.getFileClassInfoNoResolve(file).getFacadeClassFqName().asString(); } - - protected TargetBackend getBackend() { - return TargetBackend.JVM; - } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeTextTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeTextTest.kt index 1fa1164458e..d6bea1b68cc 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeTextTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeTextTest.kt @@ -18,6 +18,7 @@ import java.util.regex.Pattern abstract class AbstractBytecodeTextTest : CodegenTestCase() { override fun doMultiFileTest(wholeFile: File, files: List) { + val isIgnored = InTextDirectivesUtils.isIgnoredTarget(backend, wholeFile) createEnvironmentWithMockJdkAndIdeaAnnotations( ConfigurationKind.ALL, files, @@ -27,15 +28,15 @@ abstract class AbstractBytecodeTextTest : CodegenTestCase() { loadMultiFiles(files) if (isMultiFileTest(files) && !InTextDirectivesUtils.isDirectiveDefined(wholeFile.readText(), "TREAT_AS_ONE_FILE")) { - doTestMultiFile(files) + doTestMultiFile(files, !isIgnored) } else { val expected = readExpectedOccurrences(wholeFile.path) val actual = generateToText("helpers/") - checkGeneratedTextAgainstExpectedOccurrences(actual, expected, getBackend()) + checkGeneratedTextAgainstExpectedOccurrences(actual, expected, backend, !isIgnored) } } - private fun doTestMultiFile(files: List) { + private fun doTestMultiFile(files: List, reportProblems: Boolean) { val expectedOccurrencesByOutputFile = LinkedHashMap>() for (file in files) { readExpectedOccurrencesForMultiFileTest(file, expectedOccurrencesByOutputFile) @@ -46,7 +47,7 @@ abstract class AbstractBytecodeTextTest : CodegenTestCase() { assertTextWasGenerated(expectedOutputFile, generated) val generatedText = generated[expectedOutputFile]!! val expectedOccurrences = expectedOccurrencesByOutputFile[expectedOutputFile]!! - checkGeneratedTextAgainstExpectedOccurrences(generatedText, expectedOccurrences, getBackend()) + checkGeneratedTextAgainstExpectedOccurrences(generatedText, expectedOccurrences, backend, reportProblems) } } @@ -92,7 +93,12 @@ abstract class AbstractBytecodeTextTest : CodegenTestCase() { return kotlinFiles > 1 } - fun checkGeneratedTextAgainstExpectedOccurrences(text: String, expectedOccurrences: List, currentBackend: TargetBackend) { + fun checkGeneratedTextAgainstExpectedOccurrences( + text: String, + expectedOccurrences: List, + currentBackend: TargetBackend, + reportProblems: Boolean + ) { val expected = StringBuilder() val actual = StringBuilder() var lastBackend = TargetBackend.ANY @@ -120,7 +126,9 @@ abstract class AbstractBytecodeTextTest : CodegenTestCase() { try { Assert.assertEquals(text, expected.toString(), actual.toString()) } catch (e: Throwable) { - println(text) + if (reportProblems) { + println(text) + } throw e } @@ -175,8 +183,4 @@ abstract class AbstractBytecodeTextTest : CodegenTestCase() { return OccurrenceInfo(numberOfOccurrences, needle, backend) } } - - protected open fun getBackend(): TargetBackend { - return TargetBackend.JVM - } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCheckLocalVariablesTableTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCheckLocalVariablesTableTest.kt index 70afc5c9bf5..c911759fb18 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCheckLocalVariablesTableTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCheckLocalVariablesTableTest.kt @@ -49,7 +49,7 @@ abstract class AbstractCheckLocalVariablesTableTest : CodegenTestCase() { doCompare(wholeFile, files.single().content, actualLocalVariables) } catch (e: Throwable) { - println(classFileFactory.createText()) + printReport(wholeFile) throw e } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstInlineKotlinTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstInlineKotlinTest.kt index 0fc57cf0043..82c5a5128c2 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstInlineKotlinTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstInlineKotlinTest.kt @@ -16,18 +16,25 @@ package org.jetbrains.kotlin.codegen +import org.jetbrains.kotlin.test.InTextDirectivesUtils import java.io.File abstract class AbstractCompileKotlinAgainstInlineKotlinTest : AbstractCompileKotlinAgainstKotlinTest() { override fun doMultiFileTest(wholeFile: File, files: List) { - val (factory1, factory2) = doTwoFileTest(files.filter { it.name.endsWith(".kt") }) + val isIgnored = InTextDirectivesUtils.isIgnoredTarget(backend, wholeFile) + val (factory1, factory2) = doTwoFileTest( + files.filter { it.name.endsWith(".kt") }, + !isIgnored + ) try { val allGeneratedFiles = factory1.asList() + factory2.asList() val sourceFiles = factory1.inputFiles + factory2.inputFiles InlineTestUtil.checkNoCallsToInline(allGeneratedFiles.filterClassFiles(), sourceFiles) SMAPTestUtil.checkSMAP(files, allGeneratedFiles.filterClassFiles(), true) } catch (e: Throwable) { - println("FIRST:\n\n${factory1.createText()}\n\nSECOND:\n\n${factory2.createText()}") + if (!isIgnored) { + println("FIRST:\n\n${factory1.createText()}\n\nSECOND:\n\n${factory2.createText()}") + } throw e } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java index 7aa5c88301b..4911c323b16 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager; import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils; import org.jetbrains.kotlin.psi.KtFile; import org.jetbrains.kotlin.test.ConfigurationKind; +import org.jetbrains.kotlin.test.InTextDirectivesUtils; import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.utils.ExceptionUtilsKt; @@ -49,11 +50,12 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest @Override protected void doMultiFileTest(@NotNull File wholeFile, @NotNull List files) { - doTwoFileTest(files); + boolean isIgnored = InTextDirectivesUtils.isIgnoredTarget(getBackend(), wholeFile); + doTwoFileTest(files, !isIgnored); } @NotNull - protected Pair doTwoFileTest(@NotNull List files) { + protected Pair doTwoFileTest(@NotNull List files, boolean reportProblems) { // Note that it may be beneficial to improve this test to handle many files, compiling them successively against all previous assert files.size() == 2 || (files.size() == 3 && files.get(2).name.equals("CoroutineUtil.kt")) : "There should be exactly two files in this test"; TestFile fileA = files.get(0); @@ -65,11 +67,13 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest invokeBox(PackagePartClassUtils.getFilePartShortName(new File(fileB.name).getName())); } catch (Throwable e) { - String result = "FIRST: \n\n" + factoryA.createText(); - if (factoryB != null) { - result += "\n\nSECOND: \n\n" + factoryB.createText(); + if (reportProblems) { + String result = "FIRST: \n\n" + factoryA.createText(); + if (factoryB != null) { + result += "\n\nSECOND: \n\n" + factoryB.createText(); + } + System.out.println(result); } - System.out.println(result); throw ExceptionUtilsKt.rethrow(e); } return new Pair<>(factoryA, factoryB); diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractLineNumberTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractLineNumberTest.kt index 70f17029a25..5c736e561c1 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractLineNumberTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractLineNumberTest.kt @@ -47,7 +47,7 @@ abstract class AbstractLineNumberTest : CodegenTestCase() { KtUsefulTestCase.assertSameElements(actualLineNumbers, expectedLineNumbers) } } catch (e: Throwable) { - println(classFileFactory.createText()) + printReport(wholeFile) throw e } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractScriptCodegenTest.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractScriptCodegenTest.java index 6a49e43787b..6f1456a1fe3 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractScriptCodegenTest.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractScriptCodegenTest.java @@ -23,6 +23,7 @@ import org.jetbrains.kotlin.name.FqName; import org.jetbrains.kotlin.test.ConfigurationKind; import org.jetbrains.kotlin.utils.ExceptionUtilsKt; +import java.io.File; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -77,7 +78,7 @@ public abstract class AbstractScriptCodegenTest extends CodegenTestCase { } } catch (Throwable e) { - System.out.println(generateToText()); + printReport(new File(filename)); throw ExceptionUtilsKt.rethrow(e); } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractTopLevelMembersInvocationTest.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractTopLevelMembersInvocationTest.java index 991ff4f8370..17a1e4d30b1 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractTopLevelMembersInvocationTest.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractTopLevelMembersInvocationTest.java @@ -59,6 +59,6 @@ public abstract class AbstractTopLevelMembersInvocationTest extends AbstractByte List expected = readExpectedOccurrences(KotlinTestUtils.getTestDataPathBase() + "/codegen/" + sourceFiles.get(0)); String actual = generateToText(); - Companion.checkGeneratedTextAgainstExpectedOccurrences(actual, expected, TargetBackend.ANY); + Companion.checkGeneratedTextAgainstExpectedOccurrences(actual, expected, TargetBackend.ANY, true); } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java index 626d3abfd31..c03bdf26e53 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java @@ -36,10 +36,7 @@ import org.jetbrains.kotlin.name.FqName; import org.jetbrains.kotlin.psi.KtFile; import org.jetbrains.kotlin.scripting.definitions.ScriptDependenciesProvider; import org.jetbrains.kotlin.scripting.resolve.ScriptCompilationConfigurationWrapper; -import org.jetbrains.kotlin.test.ConfigurationKind; -import org.jetbrains.kotlin.test.InTextDirectivesUtils; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.TestJdkKind; +import org.jetbrains.kotlin.test.*; import org.jetbrains.kotlin.test.clientserver.TestProxy; import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase; import org.jetbrains.kotlin.utils.ExceptionUtilsKt; @@ -741,6 +738,10 @@ public abstract class CodegenTestCase extends KtUsefulTestCase { } } + protected TargetBackend getBackend() { + return TargetBackend.JVM; + } + public static class TestFile implements Comparable { public final String name; public final String content; @@ -874,4 +875,11 @@ public abstract class CodegenTestCase extends KtUsefulTestCase { return new TestProxy(Integer.valueOf(BOX_IN_SEPARATE_PROCESS_PORT), aClass.getCanonicalName(), classPath).runTest(); } + + protected void printReport(File wholeFile) { + boolean isIgnored = InTextDirectivesUtils.isIgnoredTarget(getBackend(), wholeFile); + if (!isIgnored) { + System.out.println(generateToText()); + } + } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/defaultConstructor/AbstractDefaultArgumentsReflectionTest.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/defaultConstructor/AbstractDefaultArgumentsReflectionTest.java index fa035ec3997..5a0d51be8cb 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/defaultConstructor/AbstractDefaultArgumentsReflectionTest.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/defaultConstructor/AbstractDefaultArgumentsReflectionTest.java @@ -38,7 +38,8 @@ public abstract class AbstractDefaultArgumentsReflectionTest extends CodegenTest protected void doTest(String path) throws IOException { loadFileByFullPath(path); - String fileText = FileUtil.loadFile(new File(path), true); + File file = new File(path); + String fileText = FileUtil.loadFile(file, true); String className = loadInstructionValue(fileText, "CLASS"); boolean hasDefaultConstructor = loadInstructionValue(fileText, "HAS_DEFAULT_CONSTRUCTOR").equals("true"); @@ -53,12 +54,12 @@ public abstract class AbstractDefaultArgumentsReflectionTest extends CodegenTest } catch (NoSuchMethodException e) { if (hasDefaultConstructor) { - System.out.println(generateToText()); + printReport(file); throw new AssertionError("Cannot find default constructor"); } } catch (Throwable e) { - System.out.println(generateToText()); + printReport(file); throw new RuntimeException(e); } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrBlackBoxInlineCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrBlackBoxInlineCodegenTest.kt index 69235f4b7f3..3638ae1b88c 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrBlackBoxInlineCodegenTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrBlackBoxInlineCodegenTest.kt @@ -19,7 +19,9 @@ package org.jetbrains.kotlin.codegen.ir import org.jetbrains.kotlin.codegen.AbstractBlackBoxCodegenTest import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.config.JVMConfigurationKeys +import org.jetbrains.kotlin.test.TargetBackend abstract class AbstractIrBlackBoxInlineCodegenTest : AbstractBlackBoxCodegenTest() { override fun updateConfiguration(configuration: CompilerConfiguration) = configuration.put(JVMConfigurationKeys.IR, true) + override fun getBackend() = TargetBackend.JVM_IR } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrBytecodeTextTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrBytecodeTextTest.kt index ed07c4bc0d2..3a5c5c72c74 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrBytecodeTextTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrBytecodeTextTest.kt @@ -12,8 +12,5 @@ import org.jetbrains.kotlin.test.TargetBackend abstract class AbstractIrBytecodeTextTest : AbstractBytecodeTextTest() { override fun updateConfiguration(configuration: CompilerConfiguration) = configuration.put(JVMConfigurationKeys.IR, true) - - override fun getBackend(): TargetBackend { - return TargetBackend.JVM_IR - } + override fun getBackend() = TargetBackend.JVM_IR } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrCheckLocalVariablesTableTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrCheckLocalVariablesTableTest.kt index 58b96b92e54..392f64ab078 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrCheckLocalVariablesTableTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrCheckLocalVariablesTableTest.kt @@ -9,6 +9,7 @@ import com.intellij.openapi.util.Comparing import org.jetbrains.kotlin.codegen.AbstractCheckLocalVariablesTableTest import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.config.JVMConfigurationKeys +import org.jetbrains.kotlin.test.TargetBackend import org.junit.ComparisonFailure import java.io.File @@ -47,4 +48,6 @@ abstract class AbstractIrCheckLocalVariablesTableTest : AbstractCheckLocalVariab .map { line -> line.replaceFirst("INDEX=\\d+".toRegex(), "INDEX=*") } // Ignore index .sorted() } + + override fun getBackend() = TargetBackend.JVM_IR } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrCompileKotlinAgainstKotlinTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrCompileKotlinAgainstKotlinTest.kt index d4115704207..397674a500e 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrCompileKotlinAgainstKotlinTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrCompileKotlinAgainstKotlinTest.kt @@ -8,7 +8,9 @@ package org.jetbrains.kotlin.codegen.ir import org.jetbrains.kotlin.codegen.AbstractCompileKotlinAgainstKotlinTest import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.config.JVMConfigurationKeys +import org.jetbrains.kotlin.test.TargetBackend abstract class AbstractIrCompileKotlinAgainstKotlinTest : AbstractCompileKotlinAgainstKotlinTest() { override fun updateConfiguration(configuration: CompilerConfiguration) = configuration.put(JVMConfigurationKeys.IR, true) + override fun getBackend() = TargetBackend.JVM_IR } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrLineNumberTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrLineNumberTest.kt index a01faa8259b..9c1a845573f 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrLineNumberTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrLineNumberTest.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.codegen.AbstractLineNumberTest import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.config.JVMConfigurationKeys import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.test.TargetBackend import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase import org.jetbrains.org.objectweb.asm.ClassReader import org.jetbrains.org.objectweb.asm.Label @@ -76,4 +77,8 @@ abstract class AbstractIrLineNumberTest : AbstractLineNumberTest() { .toMutableList() .sortedBy { it.toInt() } .toList() + + override fun getBackend(): TargetBackend { + return TargetBackend.JVM_IR + } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrWriteFlagsTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrWriteFlagsTest.kt index d732babd232..aa8d32e4acc 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrWriteFlagsTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrWriteFlagsTest.kt @@ -14,4 +14,6 @@ abstract class AbstractIrWriteFlagsTest : AbstractWriteFlagsTest() { override fun updateConfiguration(configuration: CompilerConfiguration) { configuration.put(JVMConfigurationKeys.IR, true) } + + override fun getBackend() = TargetBackend.JVM_IR } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrWriteSignatureTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrWriteSignatureTest.kt index 63c0a183172..b0ba91145b0 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrWriteSignatureTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/ir/AbstractIrWriteSignatureTest.kt @@ -8,9 +8,12 @@ package org.jetbrains.kotlin.codegen.ir import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.config.JVMConfigurationKeys import org.jetbrains.kotlin.jvm.compiler.AbstractWriteSignatureTest +import org.jetbrains.kotlin.test.TargetBackend abstract class AbstractIrWriteSignatureTest : AbstractWriteSignatureTest() { override fun updateConfiguration(configuration: CompilerConfiguration) { configuration.put(JVMConfigurationKeys.IR, true) } + + override fun getBackend() = TargetBackend.JVM_IR } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractWriteSignatureTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractWriteSignatureTest.kt index f6c189942c6..c560bda1967 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractWriteSignatureTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractWriteSignatureTest.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.jvm.compiler import org.jetbrains.kotlin.codegen.CodegenTestCase +import org.jetbrains.kotlin.test.InTextDirectivesUtils import org.jetbrains.kotlin.utils.sure import org.jetbrains.org.objectweb.asm.* import org.junit.Assert @@ -15,11 +16,14 @@ import java.util.regex.MatchResult abstract class AbstractWriteSignatureTest : CodegenTestCase() { override fun doMultiFileTest(wholeFile: File, files: MutableList) { + val isIgnored = InTextDirectivesUtils.isIgnoredTarget(backend, wholeFile) compile(files) try { parseExpectations(wholeFile).check() } catch (e: Throwable) { - println(classFileFactory.createText()) + if (!isIgnored) { + println(classFileFactory.createText()) + } throw e } } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractCustomScriptCodegenTest.kt b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractCustomScriptCodegenTest.kt index 3d03d58f006..1e435777c84 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractCustomScriptCodegenTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractCustomScriptCodegenTest.kt @@ -85,7 +85,7 @@ abstract class AbstractCustomScriptCodegenTest : CodegenTestCase() { val expectedFields = extractAllKeyValPairs(content, "expected:") checkExpectedFields(expectedFields, scriptClass, scriptInstance) } catch (e: Throwable) { - println(generateToText()) + printReport(wholeFile) throw e } } diff --git a/plugins/android-extensions/android-extensions-compiler/test/org/jetbrains/kotlin/android/synthetic/test/AbstractAndroidBytecodeShapeTest.kt b/plugins/android-extensions/android-extensions-compiler/test/org/jetbrains/kotlin/android/synthetic/test/AbstractAndroidBytecodeShapeTest.kt index 8e71d81c5ad..da79d6cc0ee 100755 --- a/plugins/android-extensions/android-extensions-compiler/test/org/jetbrains/kotlin/android/synthetic/test/AbstractAndroidBytecodeShapeTest.kt +++ b/plugins/android-extensions/android-extensions-compiler/test/org/jetbrains/kotlin/android/synthetic/test/AbstractAndroidBytecodeShapeTest.kt @@ -40,6 +40,6 @@ abstract class AbstractAndroidBytecodeShapeTest : AbstractBytecodeTextTest() { loadFileByFullPath(fileName) val expected = readExpectedOccurrences(fileName) val actual = generateToText() - checkGeneratedTextAgainstExpectedOccurrences(actual, expected, TargetBackend.ANY) + checkGeneratedTextAgainstExpectedOccurrences(actual, expected, TargetBackend.ANY, true) } }