Add tests on variable spilling with debug mode enabled

#KT-48678 Fixed
This commit is contained in:
Nikita Nazarov
2022-06-29 18:45:34 +03:00
committed by Nikita Nazarov
parent 38d97d0621
commit 65bb6abae4
20 changed files with 710 additions and 0 deletions
@@ -13107,6 +13107,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/coroutines/varSpilling/cleanup/when.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/coroutines/varSpilling/debugMode")
@TestDataPath("$PROJECT_ROOT")
public class DebugMode {
@Test
public void testAllFilesPresentInDebugMode() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/varSpilling/debugMode"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
}
}
}
@@ -13227,6 +13227,64 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/coroutines/varSpilling/cleanup/when.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/coroutines/varSpilling/debugMode")
@TestDataPath("$PROJECT_ROOT")
public class DebugMode {
@Test
public void testAllFilesPresentInDebugMode() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/varSpilling/debugMode"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("backEdge.kt")
public void testBackEdge() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/backEdge.kt");
}
@Test
@TestMetadata("if.kt")
public void testIf() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/if.kt");
}
@Test
@TestMetadata("nullCleanup.kt")
public void testNullCleanup() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullCleanup.kt");
}
@Test
@TestMetadata("nullNotSpill.kt")
public void testNullNotSpill() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullNotSpill.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/simple.kt");
}
@Test
@TestMetadata("twoRefs.kt")
public void testTwoRefs() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/twoRefs.kt");
}
@Test
@TestMetadata("unusedParamNotSpill.kt")
public void testUnusedParamNotSpill() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/unusedParamNotSpill.kt");
}
@Test
@TestMetadata("when.kt")
public void testWhen() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/when.kt");
}
}
}
}
@@ -77,4 +77,6 @@ object JvmEnvironmentConfigurationDirectives : SimpleDirectivesContainer() {
description = "Enable serialization of JVM IR",
additionalParser = JvmSerializeIrMode.Companion::fromString
)
val ENABLE_DEBUG_MODE by directive("Enable debug mode for compilation")
}
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.USE_JAVAC_BASE
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JDK_KIND
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JVM_TARGET
import org.jetbrains.kotlin.test.directives.ConfigurationDirectives.WITH_STDLIB
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.ENABLE_DEBUG_MODE
import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicDiagnosticsHandler
import org.jetbrains.kotlin.test.frontend.fir.handlers.FirDiagnosticsHandler
import org.jetbrains.kotlin.test.model.*
@@ -81,6 +82,12 @@ abstract class AbstractJvmBlackBoxCodegenTestBase<R : ResultingArtifact.Frontend
configureModernJavaTest(TestJdkKind.FULL_JDK_17, JvmTarget.JVM_17)
}
forTestsMatching("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/*") {
defaultDirectives {
+ENABLE_DEBUG_MODE
}
}
enableMetaInfoHandler()
}
@@ -38,6 +38,7 @@ 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
@@ -171,6 +172,7 @@ class JvmEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfig
register(SERIALIZE_IR, JVMConfigurationKeys.SERIALIZE_IR)
register(JDK_RELEASE, JVMConfigurationKeys.JDK_RELEASE)
register(USE_TYPE_TABLE, JVMConfigurationKeys.USE_TYPE_TABLE)
register(ENABLE_DEBUG_MODE, JVMConfigurationKeys.ENABLE_DEBUG_MODE)
}
override fun configureCompilerConfiguration(configuration: CompilerConfiguration, module: TestModule) {