Add new set of tests to run JVM checks with IR inliner

This commit is contained in:
Ivan Kylchik
2022-12-08 18:25:33 +01:00
committed by Space Team
parent 1c210822ea
commit 86b3ec73d1
21 changed files with 71091 additions and 25 deletions
@@ -19,7 +19,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/boxInline")
@TestDataPath("$PROJECT_ROOT")
public class FirPsiBlackBoxInlineCodegenTestGenerated extends AbstractFirPsiBlackBoxInlineCodegenTest {
public class FirPsiBlackBoxInlineCodegenWithIrInlinerTestGenerated extends AbstractFirPsiBlackBoxInlineCodegenWithIrInlinerTest {
@Test
public void testAllFilesPresentInBoxInline() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
@@ -6,7 +6,6 @@
package org.jetbrains.kotlin.test.directives
import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.config.ConstraintSystemForOverloadResolutionMode
import org.jetbrains.kotlin.config.ExplicitApiMode
import org.jetbrains.kotlin.config.JvmDefaultMode
import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
@@ -77,6 +76,7 @@ object LanguageSettingsDirectives : SimpleDirectivesContainer() {
val NO_NEW_JAVA_ANNOTATION_TARGETS by directive("Do not generate Java annotation targets TYPE_USE/TYPE_PARAMETER for Kotlin annotation classes with Kotlin targets TYPE/TYPE_PARAMETER")
val OLD_INNER_CLASSES_LOGIC by directive("Use old logic for generation of InnerClasses attributes")
val LINK_VIA_SIGNATURES by directive("Use linkage via signatures instead of descriptors / FIR")
val ENABLE_JVM_IR_INLINER by directive("Enable inlining on IR, instead of inlining on bytecode")
// --------------------- Utils ---------------------
@@ -19,7 +19,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/boxInline")
@TestDataPath("$PROJECT_ROOT")
public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInlineCodegenTest {
public class IrBlackBoxInlineCodegenWithBytecodeInlinerTestGenerated extends AbstractIrBlackBoxInlineCodegenWithBytecodeInlinerTest {
@Test
public void testAllFilesPresentInBoxInline() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
@@ -19,7 +19,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/boxInline")
@TestDataPath("$PROJECT_ROOT")
public class FirLightTreeBlackBoxInlineCodegenTestGenerated extends AbstractFirLightTreeBlackBoxInlineCodegenTest {
public class IrBlackBoxInlineCodegenWithIrInlinerTestGenerated extends AbstractIrBlackBoxInlineCodegenWithIrInlinerTest {
@Test
public void testAllFilesPresentInBoxInline() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
@@ -0,0 +1,585 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.test.runners.codegen;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.test.generators.GenerateCompilerTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/debug/stepping")
@TestDataPath("$PROJECT_ROOT")
public class IrSteppingWithBytecodeInlinerTestGenerated extends AbstractIrSteppingWithBytecodeInlinerTest {
@Test
public void testAllFilesPresentInStepping() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/stepping"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("anonymousFunction.kt")
public void testAnonymousFunction() throws Exception {
runTest("compiler/testData/debug/stepping/anonymousFunction.kt");
}
@Test
@TestMetadata("anonymousFunctionDirect.kt")
public void testAnonymousFunctionDirect() throws Exception {
runTest("compiler/testData/debug/stepping/anonymousFunctionDirect.kt");
}
@Test
@TestMetadata("assertion.kt")
public void testAssertion() throws Exception {
runTest("compiler/testData/debug/stepping/assertion.kt");
}
@Test
@TestMetadata("beforeGotoToWhileStart.kt")
public void testBeforeGotoToWhileStart() throws Exception {
runTest("compiler/testData/debug/stepping/beforeGotoToWhileStart.kt");
}
@Test
@TestMetadata("callWithCallInArguments.kt")
public void testCallWithCallInArguments() throws Exception {
runTest("compiler/testData/debug/stepping/callWithCallInArguments.kt");
}
@Test
@TestMetadata("callWithReceiver.kt")
public void testCallWithReceiver() throws Exception {
runTest("compiler/testData/debug/stepping/callWithReceiver.kt");
}
@Test
@TestMetadata("callableReference.kt")
public void testCallableReference() throws Exception {
runTest("compiler/testData/debug/stepping/callableReference.kt");
}
@Test
@TestMetadata("chainCall.kt")
public void testChainCall() throws Exception {
runTest("compiler/testData/debug/stepping/chainCall.kt");
}
@Test
@TestMetadata("class.kt")
public void testClass() throws Exception {
runTest("compiler/testData/debug/stepping/class.kt");
}
@Test
@TestMetadata("classObject.kt")
public void testClassObject() throws Exception {
runTest("compiler/testData/debug/stepping/classObject.kt");
}
@Test
@TestMetadata("compileTimeConstant.kt")
public void testCompileTimeConstant() throws Exception {
runTest("compiler/testData/debug/stepping/compileTimeConstant.kt");
}
@Test
@TestMetadata("conjunction.kt")
public void testConjunction() throws Exception {
runTest("compiler/testData/debug/stepping/conjunction.kt");
}
@Test
@TestMetadata("constantConditions.kt")
public void testConstantConditions() throws Exception {
runTest("compiler/testData/debug/stepping/constantConditions.kt");
}
@Test
@TestMetadata("constructorCall.kt")
public void testConstructorCall() throws Exception {
runTest("compiler/testData/debug/stepping/constructorCall.kt");
}
@Test
@TestMetadata("constructors.kt")
public void testConstructors() throws Exception {
runTest("compiler/testData/debug/stepping/constructors.kt");
}
@Test
@TestMetadata("dataClass.kt")
public void testDataClass() throws Exception {
runTest("compiler/testData/debug/stepping/dataClass.kt");
}
@Test
@TestMetadata("defaultParameter.kt")
public void testDefaultParameter() throws Exception {
runTest("compiler/testData/debug/stepping/defaultParameter.kt");
}
@Test
@TestMetadata("enum.kt")
public void testEnum() throws Exception {
runTest("compiler/testData/debug/stepping/enum.kt");
}
@Test
@TestMetadata("for.kt")
public void testFor() throws Exception {
runTest("compiler/testData/debug/stepping/for.kt");
}
@Test
@TestMetadata("functionCallWithDefault.kt")
public void testFunctionCallWithDefault() throws Exception {
runTest("compiler/testData/debug/stepping/functionCallWithDefault.kt");
}
@Test
@TestMetadata("functionCallWithInlinedLambdaParam.kt")
public void testFunctionCallWithInlinedLambdaParam() throws Exception {
runTest("compiler/testData/debug/stepping/functionCallWithInlinedLambdaParam.kt");
}
@Test
@TestMetadata("functionCallWithLambdaParam.kt")
public void testFunctionCallWithLambdaParam() throws Exception {
runTest("compiler/testData/debug/stepping/functionCallWithLambdaParam.kt");
}
@Test
@TestMetadata("functionInAnotherFile.kt")
public void testFunctionInAnotherFile() throws Exception {
runTest("compiler/testData/debug/stepping/functionInAnotherFile.kt");
}
@Test
@TestMetadata("if.kt")
public void testIf() throws Exception {
runTest("compiler/testData/debug/stepping/if.kt");
}
@Test
@TestMetadata("if2.kt")
public void testIf2() throws Exception {
runTest("compiler/testData/debug/stepping/if2.kt");
}
@Test
@TestMetadata("ifThen.kt")
public void testIfThen() throws Exception {
runTest("compiler/testData/debug/stepping/ifThen.kt");
}
@Test
@TestMetadata("ifThenElse.kt")
public void testIfThenElse() throws Exception {
runTest("compiler/testData/debug/stepping/ifThenElse.kt");
}
@Test
@TestMetadata("ifThenElseFalse.kt")
public void testIfThenElseFalse() throws Exception {
runTest("compiler/testData/debug/stepping/ifThenElseFalse.kt");
}
@Test
@TestMetadata("IfTrueThenFalse.kt")
public void testIfTrueThenFalse() throws Exception {
runTest("compiler/testData/debug/stepping/IfTrueThenFalse.kt");
}
@Test
@TestMetadata("ifWithInlineInCondition.kt")
public void testIfWithInlineInCondition() throws Exception {
runTest("compiler/testData/debug/stepping/ifWithInlineInCondition.kt");
}
@Test
@TestMetadata("iincStepping.kt")
public void testIincStepping() throws Exception {
runTest("compiler/testData/debug/stepping/iincStepping.kt");
}
@Test
@TestMetadata("inTheEndOfLambdaArgumentOfInlineCall.kt")
public void testInTheEndOfLambdaArgumentOfInlineCall() throws Exception {
runTest("compiler/testData/debug/stepping/inTheEndOfLambdaArgumentOfInlineCall.kt");
}
@Test
@TestMetadata("initBlocks.kt")
public void testInitBlocks() throws Exception {
runTest("compiler/testData/debug/stepping/initBlocks.kt");
}
@Test
@TestMetadata("initBlocksCompanion.kt")
public void testInitBlocksCompanion() throws Exception {
runTest("compiler/testData/debug/stepping/initBlocksCompanion.kt");
}
@Test
@TestMetadata("inlineCallableReference.kt")
public void testInlineCallableReference() throws Exception {
runTest("compiler/testData/debug/stepping/inlineCallableReference.kt");
}
@Test
@TestMetadata("inlineNamedCallableReference.kt")
public void testInlineNamedCallableReference() throws Exception {
runTest("compiler/testData/debug/stepping/inlineNamedCallableReference.kt");
}
@Test
@TestMetadata("inlineSimpleCall.kt")
public void testInlineSimpleCall() throws Exception {
runTest("compiler/testData/debug/stepping/inlineSimpleCall.kt");
}
@Test
@TestMetadata("kt15259.kt")
public void testKt15259() throws Exception {
runTest("compiler/testData/debug/stepping/kt15259.kt");
}
@Test
@TestMetadata("kt29179.kt")
public void testKt29179() throws Exception {
runTest("compiler/testData/debug/stepping/kt29179.kt");
}
@Test
@TestMetadata("kt42208.kt")
public void testKt42208() throws Exception {
runTest("compiler/testData/debug/stepping/kt42208.kt");
}
@Test
@TestMetadata("kt42208b.kt")
public void testKt42208b() throws Exception {
runTest("compiler/testData/debug/stepping/kt42208b.kt");
}
@Test
@TestMetadata("kt42208c.kt")
public void testKt42208c() throws Exception {
runTest("compiler/testData/debug/stepping/kt42208c.kt");
}
@Test
@TestMetadata("lambdaStepInline.kt")
public void testLambdaStepInline() throws Exception {
runTest("compiler/testData/debug/stepping/lambdaStepInline.kt");
}
@Test
@TestMetadata("lambdaStepInlineWithDefaults.kt")
public void testLambdaStepInlineWithDefaults() throws Exception {
runTest("compiler/testData/debug/stepping/lambdaStepInlineWithDefaults.kt");
}
@Test
@TestMetadata("lineNumberAfterInline.kt")
public void testLineNumberAfterInline() throws Exception {
runTest("compiler/testData/debug/stepping/lineNumberAfterInline.kt");
}
@Test
@TestMetadata("linenumberForOneParametersArgumentCall.kt")
public void testLinenumberForOneParametersArgumentCall() throws Exception {
runTest("compiler/testData/debug/stepping/linenumberForOneParametersArgumentCall.kt");
}
@Test
@TestMetadata("localFunction.kt")
public void testLocalFunction() throws Exception {
runTest("compiler/testData/debug/stepping/localFunction.kt");
}
@Test
@TestMetadata("localFunctionWIthOnelineExpressionBody.kt")
public void testLocalFunctionWIthOnelineExpressionBody() throws Exception {
runTest("compiler/testData/debug/stepping/localFunctionWIthOnelineExpressionBody.kt");
}
@Test
@TestMetadata("localProperty.kt")
public void testLocalProperty() throws Exception {
runTest("compiler/testData/debug/stepping/localProperty.kt");
}
@Test
@TestMetadata("multiModule.kt")
public void testMultiModule() throws Exception {
runTest("compiler/testData/debug/stepping/multiModule.kt");
}
@Test
@TestMetadata("multilineExpression.kt")
public void testMultilineExpression() throws Exception {
runTest("compiler/testData/debug/stepping/multilineExpression.kt");
}
@Test
@TestMetadata("multilineFunctionCall.kt")
public void testMultilineFunctionCall() throws Exception {
runTest("compiler/testData/debug/stepping/multilineFunctionCall.kt");
}
@Test
@TestMetadata("multilineInfixCall.kt")
public void testMultilineInfixCall() throws Exception {
runTest("compiler/testData/debug/stepping/multilineInfixCall.kt");
}
@Test
@TestMetadata("namedCallableReference.kt")
public void testNamedCallableReference() throws Exception {
runTest("compiler/testData/debug/stepping/namedCallableReference.kt");
}
@Test
@TestMetadata("nestedInline.kt")
public void testNestedInline() throws Exception {
runTest("compiler/testData/debug/stepping/nestedInline.kt");
}
@Test
@TestMetadata("noParametersArgumentCallInExpression.kt")
public void testNoParametersArgumentCallInExpression() throws Exception {
runTest("compiler/testData/debug/stepping/noParametersArgumentCallInExpression.kt");
}
@Test
@TestMetadata("nullcheck.kt")
public void testNullcheck() throws Exception {
runTest("compiler/testData/debug/stepping/nullcheck.kt");
}
@Test
@TestMetadata("primitiveNullChecks.kt")
public void testPrimitiveNullChecks() throws Exception {
runTest("compiler/testData/debug/stepping/primitiveNullChecks.kt");
}
@Test
@TestMetadata("propertyAccessor.kt")
public void testPropertyAccessor() throws Exception {
runTest("compiler/testData/debug/stepping/propertyAccessor.kt");
}
@Test
@TestMetadata("psvm.kt")
public void testPsvm() throws Exception {
runTest("compiler/testData/debug/stepping/psvm.kt");
}
@Test
@TestMetadata("recursion.kt")
public void testRecursion() throws Exception {
runTest("compiler/testData/debug/stepping/recursion.kt");
}
@Test
@TestMetadata("simpleDefaultArg.kt")
public void testSimpleDefaultArg() throws Exception {
runTest("compiler/testData/debug/stepping/simpleDefaultArg.kt");
}
@Test
@TestMetadata("simpleDefaultArgWithInline.kt")
public void testSimpleDefaultArgWithInline() throws Exception {
runTest("compiler/testData/debug/stepping/simpleDefaultArgWithInline.kt");
}
@Test
@TestMetadata("simpleInlineDefaultArg.kt")
public void testSimpleInlineDefaultArg() throws Exception {
runTest("compiler/testData/debug/stepping/simpleInlineDefaultArg.kt");
}
@Test
@TestMetadata("simpleSmap.kt")
public void testSimpleSmap() throws Exception {
runTest("compiler/testData/debug/stepping/simpleSmap.kt");
}
@Test
@TestMetadata("smapInlineAsArgument.kt")
public void testSmapInlineAsArgument() throws Exception {
runTest("compiler/testData/debug/stepping/smapInlineAsArgument.kt");
}
@Test
@TestMetadata("smapInlineAsInfixArgument.kt")
public void testSmapInlineAsInfixArgument() throws Exception {
runTest("compiler/testData/debug/stepping/smapInlineAsInfixArgument.kt");
}
@Test
@TestMetadata("smapInlineAsInlineArgument.kt")
public void testSmapInlineAsInlineArgument() throws Exception {
runTest("compiler/testData/debug/stepping/smapInlineAsInlineArgument.kt");
}
@Test
@TestMetadata("smapInlineInIntrinsicArgument.kt")
public void testSmapInlineInIntrinsicArgument() throws Exception {
runTest("compiler/testData/debug/stepping/smapInlineInIntrinsicArgument.kt");
}
@Test
@TestMetadata("stringSwitches.kt")
public void testStringSwitches() throws Exception {
runTest("compiler/testData/debug/stepping/stringSwitches.kt");
}
@Test
@TestMetadata("stringSwitchesSmall.kt")
public void testStringSwitchesSmall() throws Exception {
runTest("compiler/testData/debug/stepping/stringSwitchesSmall.kt");
}
@Test
@TestMetadata("suspendFunWithLambdaParameter.kt")
public void testSuspendFunWithLambdaParameter() throws Exception {
runTest("compiler/testData/debug/stepping/suspendFunWithLambdaParameter.kt");
}
@Test
@TestMetadata("suspendFunWithSuspendLambdaParameter.kt")
public void testSuspendFunWithSuspendLambdaParameter() throws Exception {
runTest("compiler/testData/debug/stepping/suspendFunWithSuspendLambdaParameter.kt");
}
@Test
@TestMetadata("throwException.kt")
public void testThrowException() throws Exception {
runTest("compiler/testData/debug/stepping/throwException.kt");
}
@Test
@TestMetadata("topLevel.kt")
public void testTopLevel() throws Exception {
runTest("compiler/testData/debug/stepping/topLevel.kt");
}
@Test
@TestMetadata("trait.kt")
public void testTrait() throws Exception {
runTest("compiler/testData/debug/stepping/trait.kt");
}
@Test
@TestMetadata("tryCatch.kt")
public void testTryCatch() throws Exception {
runTest("compiler/testData/debug/stepping/tryCatch.kt");
}
@Test
@TestMetadata("tryCatchExpression.kt")
public void testTryCatchExpression() throws Exception {
runTest("compiler/testData/debug/stepping/tryCatchExpression.kt");
}
@Test
@TestMetadata("tryCatchFinally.kt")
public void testTryCatchFinally() throws Exception {
runTest("compiler/testData/debug/stepping/tryCatchFinally.kt");
}
@Test
@TestMetadata("tryFinally.kt")
public void testTryFinally() throws Exception {
runTest("compiler/testData/debug/stepping/tryFinally.kt");
}
@Test
@TestMetadata("variablesWithoutInitializer.kt")
public void testVariablesWithoutInitializer() throws Exception {
runTest("compiler/testData/debug/stepping/variablesWithoutInitializer.kt");
}
@Test
@TestMetadata("voidLambdaStepInline.kt")
public void testVoidLambdaStepInline() throws Exception {
runTest("compiler/testData/debug/stepping/voidLambdaStepInline.kt");
}
@Test
@TestMetadata("when.kt")
public void testWhen() throws Exception {
runTest("compiler/testData/debug/stepping/when.kt");
}
@Test
@TestMetadata("whenComplicatedSubject.kt")
public void testWhenComplicatedSubject() throws Exception {
runTest("compiler/testData/debug/stepping/whenComplicatedSubject.kt");
}
@Test
@TestMetadata("whenConstant.kt")
public void testWhenConstant() throws Exception {
runTest("compiler/testData/debug/stepping/whenConstant.kt");
}
@Test
@TestMetadata("whenIsChecks.kt")
public void testWhenIsChecks() throws Exception {
runTest("compiler/testData/debug/stepping/whenIsChecks.kt");
}
@Test
@TestMetadata("whenMultiLine.kt")
public void testWhenMultiLine() throws Exception {
runTest("compiler/testData/debug/stepping/whenMultiLine.kt");
}
@Test
@TestMetadata("whenMultiLineSubject.kt")
public void testWhenMultiLineSubject() throws Exception {
runTest("compiler/testData/debug/stepping/whenMultiLineSubject.kt");
}
@Test
@TestMetadata("whenNullalbeSubject.kt")
public void testWhenNullalbeSubject() throws Exception {
runTest("compiler/testData/debug/stepping/whenNullalbeSubject.kt");
}
@Test
@TestMetadata("whenSubject.kt")
public void testWhenSubject() throws Exception {
runTest("compiler/testData/debug/stepping/whenSubject.kt");
}
@Test
@TestMetadata("whenSubject2.kt")
public void testWhenSubject2() throws Exception {
runTest("compiler/testData/debug/stepping/whenSubject2.kt");
}
@Test
@TestMetadata("whenWithInlineInCondition.kt")
public void testWhenWithInlineInCondition() throws Exception {
runTest("compiler/testData/debug/stepping/whenWithInlineInCondition.kt");
}
@Test
@TestMetadata("while.kt")
public void testWhile() throws Exception {
runTest("compiler/testData/debug/stepping/while.kt");
}
}
@@ -19,7 +19,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("compiler/testData/debug/stepping")
@TestDataPath("$PROJECT_ROOT")
public class IrSteppingTestGenerated extends AbstractIrSteppingTest {
public class IrSteppingWithIrInlinerTestGenerated extends AbstractIrSteppingWithIrInlinerTest {
@Test
public void testAllFilesPresentInStepping() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/stepping"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
@@ -0,0 +1,40 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.test.backend
import org.jetbrains.kotlin.test.WrappedException
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
import org.jetbrains.kotlin.test.directives.model.DirectivesContainer
import org.jetbrains.kotlin.test.model.AfterAnalysisChecker
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.moduleStructure
enum class TargetInliner {
IR, BYTECODE
}
class BlackBoxInlinerCodegenSuppressor(testServices: TestServices) : AfterAnalysisChecker(testServices) {
override val directiveContainers: List<DirectivesContainer>
get() = listOf(CodegenTestDirectives)
override fun suppressIfNeeded(failedAssertions: List<WrappedException>): List<WrappedException> {
val ignoreDirectives = testServices.moduleStructure.allDirectives[CodegenTestDirectives.IGNORE_INLINER]
if (ignoreDirectives.size > 1) {
throw IllegalArgumentException("Directive should contain IGNORE_INLINER only one value")
}
val ignoreDirective = ignoreDirectives.singleOrNull() ?: return failedAssertions
val enabledIrInliner = LanguageSettingsDirectives.ENABLE_JVM_IR_INLINER in testServices.moduleStructure.allDirectives
val unmuteError = listOf(AssertionError("Looks like this test can be unmuted. Please remove IGNORE_INLINER directive.").wrap())
return when {
ignoreDirective == TargetInliner.IR && enabledIrInliner -> if (failedAssertions.isNotEmpty()) emptyList() else unmuteError
ignoreDirective == TargetInliner.BYTECODE && !enabledIrInliner -> if (failedAssertions.isNotEmpty()) emptyList() else unmuteError
else -> failedAssertions
}
}
}
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.test.directives
import org.jetbrains.kotlin.backend.common.phaser.AnyNamedPhase
import org.jetbrains.kotlin.test.FirParser
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.backend.TargetInliner
import org.jetbrains.kotlin.test.backend.handlers.*
import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade
import org.jetbrains.kotlin.test.directives.model.DirectiveApplicability.File
@@ -49,6 +50,11 @@ object CodegenTestDirectives : SimpleDirectivesContainer() {
applicability = Global
)
val IGNORE_INLINER by enumDirective<TargetInliner>(
description = "Ignore failures of tests with given inliner",
applicability = Global
)
val USE_JAVAC_BASED_ON_JVM_TARGET by directive(
description = """
Determine version of javac for compilation of java files based
@@ -14,14 +14,38 @@ open class AbstractBlackBoxInlineCodegenTest : AbstractBlackBoxCodegenTest() {
}
}
open class AbstractIrBlackBoxInlineCodegenTest : AbstractIrBlackBoxCodegenTest() {
open class AbstractIrBlackBoxInlineCodegenWithBytecodeInlinerTest : AbstractIrBlackBoxCodegenTest() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.useInlineHandlers()
}
}
open class AbstractFirLightTreeBlackBoxInlineCodegenTest : AbstractFirLightTreeBlackBoxCodegenTest() {
open class AbstractIrBlackBoxInlineCodegenWithIrInlinerTest : AbstractIrBlackBoxCodegenTest() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.useInlineHandlers()
builder.useIrInliner()
}
}
open class AbstractFirLightTreeBlackBoxInlineCodegenWithBytecodeInlinerTest : AbstractFirLightTreeBlackBoxCodegenTest() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.useInlineHandlers()
}
}
open class AbstractFirLightTreeBlackBoxInlineCodegenWithIrInlinerTest : AbstractFirLightTreeBlackBoxCodegenTest() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.useInlineHandlers()
builder.useIrInliner()
}
}
@FirPsiCodegenTest
open class AbstractFirPsiBlackBoxInlineCodegenWithBytecodeInlinerTest : AbstractFirPsiBlackBoxCodegenTest() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.useInlineHandlers()
@@ -29,9 +53,11 @@ open class AbstractFirLightTreeBlackBoxInlineCodegenTest : AbstractFirLightTreeB
}
@FirPsiCodegenTest
open class AbstractFirPsiBlackBoxInlineCodegenTest : AbstractFirPsiBlackBoxCodegenTest() {
open class AbstractFirPsiBlackBoxInlineCodegenWithIrInlinerTest : AbstractFirPsiBlackBoxCodegenTest() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.useInlineHandlers()
builder.useIrInliner()
}
}
@@ -10,14 +10,14 @@ import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.backend.ir.IrBackendInput
import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2IrConverter
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendOutputArtifact
import org.jetbrains.kotlin.test.model.*
open class AbstractIrBlackBoxCodegenTest : AbstractJvmBlackBoxCodegenTestBase<ClassicFrontendOutputArtifact, IrBackendInput>(
FrontendKinds.ClassicFrontend,
TargetBackend.JVM_IR
FrontendKinds.ClassicFrontend, TargetBackend.JVM_IR
) {
override val frontendFacade: Constructor<FrontendFacade<ClassicFrontendOutputArtifact>>
get() = ::ClassicFrontendFacade
@@ -30,6 +30,15 @@ open class AbstractIrBlackBoxCodegenTest : AbstractJvmBlackBoxCodegenTestBase<Cl
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.configureDumpHandlersForCodegenTest()
with(builder) {
configureDumpHandlersForCodegenTest()
}
}
}
open class AbstractIrBlackBoxCodegenWithIrInlinerTest : AbstractIrBlackBoxCodegenTest() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.useIrInliner()
}
}
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.test.Constructor
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.TestJdkKind
import org.jetbrains.kotlin.test.backend.BlackBoxCodegenSuppressor
import org.jetbrains.kotlin.test.backend.BlackBoxInlinerCodegenSuppressor
import org.jetbrains.kotlin.test.backend.handlers.BytecodeListingHandler
import org.jetbrains.kotlin.test.backend.handlers.BytecodeTextHandler
import org.jetbrains.kotlin.test.backend.handlers.IrInterpreterDumpHandler
@@ -69,6 +70,9 @@ abstract class AbstractJvmBlackBoxCodegenTestBase<R : ResultingArtifact.Frontend
}
useAfterAnalysisCheckers(::BlackBoxCodegenSuppressor)
if (targetBackend.isIR) {
useAfterAnalysisCheckers(::BlackBoxInlinerCodegenSuppressor)
}
defaultDirectives {
+REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.FirParser
import org.jetbrains.kotlin.test.directives.configureFirParser
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2ClassicBackendConverter
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2IrConverter
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade
@@ -23,10 +24,9 @@ import org.jetbrains.kotlin.test.frontend.fir.FirFrontendFacade
import org.jetbrains.kotlin.test.frontend.fir.FirOutputArtifact
import org.jetbrains.kotlin.test.model.*
open class AbstractIrSteppingTest : AbstractSteppingTestBase<ClassicFrontendOutputArtifact, IrBackendInput>(
FrontendKinds.ClassicFrontend,
TargetBackend.JVM_IR
) {
open class AbstractIrSteppingWithBytecodeInlinerTest(
private val useIrInliner: Boolean = false
) : AbstractSteppingTestBase<ClassicFrontendOutputArtifact, IrBackendInput>(FrontendKinds.ClassicFrontend, TargetBackend.JVM_IR) {
override val frontendFacade: Constructor<FrontendFacade<ClassicFrontendOutputArtifact>>
get() = ::ClassicFrontendFacade
@@ -39,9 +39,14 @@ open class AbstractIrSteppingTest : AbstractSteppingTestBase<ClassicFrontendOutp
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.configureDumpHandlersForCodegenTest()
if (useIrInliner) {
builder.defaultDirectives { +LanguageSettingsDirectives.ENABLE_JVM_IR_INLINER }
}
}
}
open class AbstractIrSteppingWithIrInlinerTest : AbstractIrSteppingWithBytecodeInlinerTest(useIrInliner = true) {}
open class AbstractSteppingTest : AbstractSteppingTestBase<ClassicFrontendOutputArtifact, ClassicBackendInput>(
FrontendKinds.ClassicFrontend,
TargetBackend.JVM
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.test.runners.codegen
import org.jetbrains.kotlin.test.Constructor
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.backend.BlackBoxCodegenSuppressor
import org.jetbrains.kotlin.test.backend.BlackBoxInlinerCodegenSuppressor
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.REQUIRES_SEPARATE_PROCESS
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO
@@ -29,7 +30,7 @@ abstract class AbstractSteppingTestBase<R : ResultingArtifact.FrontendOutput<R>,
configureCommonHandlersForSteppingTest()
useAfterAnalysisCheckers(::BlackBoxCodegenSuppressor)
useAfterAnalysisCheckers(::BlackBoxCodegenSuppressor, ::BlackBoxInlinerCodegenSuppressor)
defaultDirectives {
+REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.test.backend.ir.IrBackendInput
import org.jetbrains.kotlin.test.builders.*
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.DUMP_SMAP
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.RUN_DEX_CHECKER
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendOutputArtifact
import org.jetbrains.kotlin.test.frontend.fir.FirOutputArtifact
import org.jetbrains.kotlin.test.model.*
@@ -85,6 +86,12 @@ fun TestConfigurationBuilder.useInlineHandlers() {
applyDumpSmapDirective()
}
fun TestConfigurationBuilder.useIrInliner() {
defaultDirectives {
+LanguageSettingsDirectives.ENABLE_JVM_IR_INLINER
}
}
fun TestConfigurationBuilder.applyDumpSmapDirective() {
forTestsMatching("compiler/testData/codegen/boxInline/smap/*") {
defaultDirectives {
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirective
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.ALL_JAVA_AS_BINARY
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.ASSERTIONS_MODE
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.COMPILE_JAVA_USING
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.ENABLE_DEBUG_MODE
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.INCLUDE_JAVA_AS_BINARY
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JVM_TARGET
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.LAMBDAS
@@ -38,19 +39,19 @@ import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirective
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.SERIALIZE_IR
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.STRING_CONCAT
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.ENABLE_DEBUG_MODE
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.DISABLE_CALL_ASSERTIONS
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.DISABLE_PARAM_ASSERTIONS
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.EMIT_JVM_TYPE_ANNOTATIONS
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.ENABLE_JVM_IR_INLINER
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.ENABLE_JVM_PREVIEW
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.NO_OPTIMIZED_CALLABLE_REFERENCES
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.NO_UNIFIED_NULL_CHECKS
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.PARAMETERS_METADATA
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.JDK_RELEASE
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.LINK_VIA_SIGNATURES
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.NO_NEW_JAVA_ANNOTATION_TARGETS
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.NO_OPTIMIZED_CALLABLE_REFERENCES
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.NO_UNIFIED_NULL_CHECKS
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.OLD_INNER_CLASSES_LOGIC
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.PARAMETERS_METADATA
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.USE_TYPE_TABLE
import org.jetbrains.kotlin.test.directives.model.DirectivesContainer
import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives
@@ -178,6 +179,7 @@ class JvmEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfig
register(NO_NEW_JAVA_ANNOTATION_TARGETS, JVMConfigurationKeys.NO_NEW_JAVA_ANNOTATION_TARGETS)
register(OLD_INNER_CLASSES_LOGIC, JVMConfigurationKeys.OLD_INNER_CLASSES_LOGIC)
register(LINK_VIA_SIGNATURES, JVMConfigurationKeys.LINK_VIA_SIGNATURES)
register(ENABLE_JVM_IR_INLINER, JVMConfigurationKeys.ENABLE_IR_INLINER)
}
override fun configureCompilerConfiguration(configuration: CompilerConfiguration, module: TestModule) {
@@ -25,7 +25,7 @@ import org.junit.runner.RunWith
CompileKotlinAgainstInlineKotlinTestGenerated::class,
IrBlackBoxCodegenTestGenerated::class,
IrBlackBoxInlineCodegenTestGenerated::class,
IrBlackBoxInlineCodegenWithBytecodeInlinerTestGenerated::class,
IrCompileKotlinAgainstInlineKotlinTestGenerated::class
)
@IncludeClassNamePatterns(".*Test.*Generated")
@@ -88,11 +88,19 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
model("codegen/box")
}
testClass<AbstractIrBlackBoxCodegenWithIrInlinerTest> {
model("codegen/box")
}
testClass<AbstractSteppingTest> {
model("debug/stepping")
}
testClass<AbstractIrSteppingTest> {
testClass<AbstractIrSteppingWithBytecodeInlinerTest> {
model("debug/stepping")
}
testClass<AbstractIrSteppingWithIrInlinerTest> {
model("debug/stepping")
}
@@ -136,7 +144,11 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
model("codegen/boxInline")
}
testClass<AbstractIrBlackBoxInlineCodegenTest> {
testClass<AbstractIrBlackBoxInlineCodegenWithBytecodeInlinerTest> {
model("codegen/boxInline")
}
testClass<AbstractIrBlackBoxInlineCodegenWithIrInlinerTest> {
model("codegen/boxInline")
}
@@ -254,11 +266,19 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
model("codegen/boxModernJdk")
}
testClass<AbstractFirLightTreeBlackBoxInlineCodegenTest> {
testClass<AbstractFirPsiBlackBoxInlineCodegenWithBytecodeInlinerTest> {
model("codegen/boxInline")
}
testClass<AbstractFirPsiBlackBoxInlineCodegenTest> {
testClass<AbstractFirPsiBlackBoxInlineCodegenWithIrInlinerTest> {
model("codegen/boxInline")
}
testClass<AbstractFirLightTreeBlackBoxInlineCodegenWithBytecodeInlinerTest> {
model("codegen/boxInline")
}
testClass<AbstractFirLightTreeBlackBoxInlineCodegenWithIrInlinerTest> {
model("codegen/boxInline")
}