[JVM_IR] Run KotlinSteppingTests with the JVM_IR backend.
Implement support for supressing failures by backend.
This commit is contained in:
@@ -216,6 +216,31 @@ fun main(args: Array<String>) {
|
|||||||
model("stepping/custom", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doCustomTest")
|
model("stepping/custom", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doCustomTest")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testClass<AbstractIrKotlinSteppingTest> {
|
||||||
|
model(
|
||||||
|
"stepping/stepIntoAndSmartStepInto",
|
||||||
|
pattern = KT_WITHOUT_DOTS_IN_NAME,
|
||||||
|
testMethod = "doStepIntoTest",
|
||||||
|
testClassName = "StepInto"
|
||||||
|
)
|
||||||
|
model(
|
||||||
|
"stepping/stepIntoAndSmartStepInto",
|
||||||
|
pattern = KT_WITHOUT_DOTS_IN_NAME,
|
||||||
|
testMethod = "doSmartStepIntoTest",
|
||||||
|
testClassName = "SmartStepInto"
|
||||||
|
)
|
||||||
|
model(
|
||||||
|
"stepping/stepInto",
|
||||||
|
pattern = KT_WITHOUT_DOTS_IN_NAME,
|
||||||
|
testMethod = "doStepIntoTest",
|
||||||
|
testClassName = "StepIntoOnly"
|
||||||
|
)
|
||||||
|
model("stepping/stepOut", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOutTest")
|
||||||
|
model("stepping/stepOver", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOverTest")
|
||||||
|
model("stepping/filters", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepIntoTest")
|
||||||
|
model("stepping/custom", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doCustomTest")
|
||||||
|
}
|
||||||
|
|
||||||
testClass<AbstractKotlinEvaluateExpressionTest> {
|
testClass<AbstractKotlinEvaluateExpressionTest> {
|
||||||
model("evaluation/singleBreakpoint", testMethod = "doSingleBreakpointTest")
|
model("evaluation/singleBreakpoint", testMethod = "doSingleBreakpointTest")
|
||||||
model("evaluation/multipleBreakpoints", testMethod = "doMultipleBreakpointsTest")
|
model("evaluation/multipleBreakpoints", testMethod = "doMultipleBreakpointsTest")
|
||||||
|
|||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 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.idea.debugger.test
|
||||||
|
|
||||||
|
abstract class AbstractIrKotlinSteppingTest : AbstractKotlinSteppingTest() {
|
||||||
|
override fun useIrBackend() = true
|
||||||
|
}
|
||||||
+23
-3
@@ -16,6 +16,9 @@ import com.intellij.openapi.vfs.LocalFileSystem
|
|||||||
import com.intellij.openapi.vfs.VirtualFile
|
import com.intellij.openapi.vfs.VirtualFile
|
||||||
import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem
|
import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem
|
||||||
import com.intellij.psi.PsiManager
|
import com.intellij.psi.PsiManager
|
||||||
|
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
|
||||||
|
import org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory
|
||||||
|
import org.jetbrains.kotlin.backend.jvm.jvmPhases
|
||||||
import org.jetbrains.kotlin.caches.resolve.KotlinCacheService
|
import org.jetbrains.kotlin.caches.resolve.KotlinCacheService
|
||||||
import org.jetbrains.kotlin.cli.common.output.writeAllTo
|
import org.jetbrains.kotlin.cli.common.output.writeAllTo
|
||||||
import org.jetbrains.kotlin.cli.jvm.compiler.findMainClass
|
import org.jetbrains.kotlin.cli.jvm.compiler.findMainClass
|
||||||
@@ -35,7 +38,11 @@ import org.jetbrains.kotlin.test.MockLibraryUtil
|
|||||||
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class DebuggerTestCompilerFacility(files: List<TestFile>, private val jvmTarget: JvmTarget) {
|
class DebuggerTestCompilerFacility(
|
||||||
|
files: List<TestFile>,
|
||||||
|
private val jvmTarget: JvmTarget,
|
||||||
|
private val useIrBackend: Boolean
|
||||||
|
) {
|
||||||
private val kotlinStdlibPath = ForTestCompileRuntime.runtimeJarForTests().absolutePath
|
private val kotlinStdlibPath = ForTestCompileRuntime.runtimeJarForTests().absolutePath
|
||||||
|
|
||||||
private val mainFiles: TestFilesByLanguage
|
private val mainFiles: TestFilesByLanguage
|
||||||
@@ -86,11 +93,17 @@ class DebuggerTestCompilerFacility(files: List<TestFile>, private val jvmTarget:
|
|||||||
if (kotlinStdlibInMavenArtifacts() == null)
|
if (kotlinStdlibInMavenArtifacts() == null)
|
||||||
mavenArtifacts.add(kotlinStdlibPath)
|
mavenArtifacts.add(kotlinStdlibPath)
|
||||||
|
|
||||||
|
val options = mutableListOf("-jvm-target", jvmTarget.description)
|
||||||
|
|
||||||
|
if (useIrBackend) {
|
||||||
|
options.add("-Xuse-ir")
|
||||||
|
}
|
||||||
|
|
||||||
if (kotlin.isNotEmpty()) {
|
if (kotlin.isNotEmpty()) {
|
||||||
MockLibraryUtil.compileKotlin(
|
MockLibraryUtil.compileKotlin(
|
||||||
srcDir.absolutePath,
|
srcDir.absolutePath,
|
||||||
classesDir,
|
classesDir,
|
||||||
listOf("-jvm-target", jvmTarget.description),
|
options,
|
||||||
*(mavenArtifacts.toTypedArray())
|
*(mavenArtifacts.toTypedArray())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -162,10 +175,17 @@ class DebuggerTestCompilerFacility(files: List<TestFile>, private val jvmTarget:
|
|||||||
|
|
||||||
val configuration = CompilerConfiguration()
|
val configuration = CompilerConfiguration()
|
||||||
configuration.put(JVMConfigurationKeys.JVM_TARGET, jvmTarget)
|
configuration.put(JVMConfigurationKeys.JVM_TARGET, jvmTarget)
|
||||||
|
configuration.put(JVMConfigurationKeys.IR, useIrBackend)
|
||||||
|
|
||||||
val state = GenerationState.Builder(project, ClassBuilderFactories.BINARIES, moduleDescriptor, bindingContext, files, configuration)
|
val state = GenerationState.Builder(project, ClassBuilderFactories.BINARIES, moduleDescriptor, bindingContext, files, configuration)
|
||||||
.generateDeclaredClassFilter(GenerationState.GenerateClassFilter.GENERATE_ALL)
|
.generateDeclaredClassFilter(GenerationState.GenerateClassFilter.GENERATE_ALL)
|
||||||
.codegenFactory(DefaultCodegenFactory)
|
.codegenFactory(
|
||||||
|
if (useIrBackend) {
|
||||||
|
JvmIrCodegenFactory(PhaseConfig(jvmPhases))
|
||||||
|
} else {
|
||||||
|
DefaultCodegenFactory
|
||||||
|
}
|
||||||
|
)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
KotlinCodegenFacade.compileCorrectFiles(state)
|
KotlinCodegenFacade.compileCorrectFiles(state)
|
||||||
|
|||||||
+1309
File diff suppressed because it is too large
Load Diff
+4
-2
@@ -96,6 +96,8 @@ abstract class KotlinDescriptorTestCase : DescriptorTestCase() {
|
|||||||
super.tearDown()
|
super.tearDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open fun useIrBackend() = false
|
||||||
|
|
||||||
fun doTest(path: String) {
|
fun doTest(path: String) {
|
||||||
val wholeFile = File(path)
|
val wholeFile = File(path)
|
||||||
val wholeFileContents = FileUtil.loadFile(wholeFile, true)
|
val wholeFileContents = FileUtil.loadFile(wholeFile, true)
|
||||||
@@ -108,7 +110,7 @@ abstract class KotlinDescriptorTestCase : DescriptorTestCase() {
|
|||||||
val rawJvmTarget = preferences[DebuggerPreferenceKeys.JVM_TARGET]
|
val rawJvmTarget = preferences[DebuggerPreferenceKeys.JVM_TARGET]
|
||||||
val jvmTarget = JvmTarget.fromString(rawJvmTarget) ?: error("Invalid JVM target value: $rawJvmTarget")
|
val jvmTarget = JvmTarget.fromString(rawJvmTarget) ?: error("Invalid JVM target value: $rawJvmTarget")
|
||||||
|
|
||||||
val compilerFacility = DebuggerTestCompilerFacility(testFiles, jvmTarget)
|
val compilerFacility = DebuggerTestCompilerFacility(testFiles, jvmTarget, useIrBackend())
|
||||||
|
|
||||||
for (library in preferences[DebuggerPreferenceKeys.ATTACH_LIBRARY]) {
|
for (library in preferences[DebuggerPreferenceKeys.ATTACH_LIBRARY]) {
|
||||||
if (library.startsWith("maven("))
|
if (library.startsWith("maven("))
|
||||||
@@ -151,7 +153,7 @@ abstract class KotlinDescriptorTestCase : DescriptorTestCase() {
|
|||||||
abstract fun doMultiFileTest(files: TestFiles, preferences: DebuggerPreferences)
|
abstract fun doMultiFileTest(files: TestFiles, preferences: DebuggerPreferences)
|
||||||
|
|
||||||
override fun initOutputChecker(): OutputChecker {
|
override fun initOutputChecker(): OutputChecker {
|
||||||
return KotlinOutputChecker(getTestDirectoryPath(), testAppPath, appOutputPath)
|
return KotlinOutputChecker(getTestDirectoryPath(), testAppPath, appOutputPath, useIrBackend())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setUpModule() {
|
override fun setUpModule() {
|
||||||
|
|||||||
+15
-3
@@ -14,6 +14,8 @@ import com.intellij.openapi.util.io.FileUtil
|
|||||||
import com.intellij.openapi.util.io.FileUtilRt
|
import com.intellij.openapi.util.io.FileUtilRt
|
||||||
import com.intellij.openapi.util.text.StringUtilRt
|
import com.intellij.openapi.util.text.StringUtilRt
|
||||||
import com.intellij.openapi.vfs.CharsetToolkit
|
import com.intellij.openapi.vfs.CharsetToolkit
|
||||||
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
|
import org.jetbrains.kotlin.test.TargetBackend
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
@@ -21,7 +23,8 @@ import kotlin.math.min
|
|||||||
internal class KotlinOutputChecker(
|
internal class KotlinOutputChecker(
|
||||||
private val testDir: String,
|
private val testDir: String,
|
||||||
appPath: String,
|
appPath: String,
|
||||||
outputPath: String
|
outputPath: String,
|
||||||
|
private val useIrBackend: Boolean
|
||||||
) : OutputChecker(appPath, outputPath) {
|
) : OutputChecker(appPath, outputPath) {
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@@ -75,7 +78,10 @@ internal class KotlinOutputChecker(
|
|||||||
LOG.error("Test file created ${outFile.path}\n**************** Don't forget to put it into VCS! *******************")
|
LOG.error("Test file created ${outFile.path}\n**************** Don't forget to put it into VCS! *******************")
|
||||||
} else {
|
} else {
|
||||||
val originalText = FileUtilRt.loadFile(outFile, CharsetToolkit.UTF8)
|
val originalText = FileUtilRt.loadFile(outFile, CharsetToolkit.UTF8)
|
||||||
val expected = StringUtilRt.convertLineSeparators(originalText)
|
val isIgnored = InTextDirectivesUtils.isIgnoredTarget(if (useIrBackend) TargetBackend.JVM_IR else TargetBackend.JVM, outFile)
|
||||||
|
val expected = StringUtilRt.convertLineSeparators(originalText).split("\n").filter {
|
||||||
|
!it.trim().startsWith(InTextDirectivesUtils.IGNORE_BACKEND_DIRECTIVE_PREFIX)
|
||||||
|
}.joinToString("\n")
|
||||||
if (expected != actual) {
|
if (expected != actual) {
|
||||||
println("expected:")
|
println("expected:")
|
||||||
println(originalText)
|
println(originalText)
|
||||||
@@ -92,7 +98,13 @@ internal class KotlinOutputChecker(
|
|||||||
println("Rest from actual text is: \"" + actual.substring(len) + "\"")
|
println("Rest from actual text is: \"" + actual.substring(len) + "\"")
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertEquals(originalText, actual)
|
// Ignore test failure if marked as ignored.
|
||||||
|
if (isIgnored) return
|
||||||
|
|
||||||
|
Assert.assertEquals(expected, actual)
|
||||||
|
} else if (isIgnored) {
|
||||||
|
// Fail if tests are marked as failing, but actually pass.
|
||||||
|
throw AssertionError("Test passes and could be unmuted, remove IGNORE_BACKEND directive from ${outFile.path}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at coroutine.kt:17
|
LineBreakpoint created at coroutine.kt:17
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at initBlocks.kt:6
|
LineBreakpoint created at initBlocks.kt:6
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at smartStepIntoConstructor.kt:7
|
LineBreakpoint created at smartStepIntoConstructor.kt:7
|
||||||
LineBreakpoint created at smartStepIntoConstructor.kt:11
|
LineBreakpoint created at smartStepIntoConstructor.kt:11
|
||||||
LineBreakpoint created at smartStepIntoConstructor.kt:15
|
LineBreakpoint created at smartStepIntoConstructor.kt:15
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at smartStepIntoInterfaceImpl.kt:91
|
LineBreakpoint created at smartStepIntoInterfaceImpl.kt:91
|
||||||
LineBreakpoint created at smartStepIntoInterfaceImpl.kt:96
|
LineBreakpoint created at smartStepIntoInterfaceImpl.kt:96
|
||||||
LineBreakpoint created at smartStepIntoInterfaceImpl.kt:101
|
LineBreakpoint created at smartStepIntoInterfaceImpl.kt:101
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at smartStepIntoWithDelegates.kt:24
|
LineBreakpoint created at smartStepIntoWithDelegates.kt:24
|
||||||
LineBreakpoint created at smartStepIntoWithDelegates.kt:32
|
LineBreakpoint created at smartStepIntoWithDelegates.kt:32
|
||||||
LineBreakpoint created at smartStepIntoWithDelegates.kt:40
|
LineBreakpoint created at smartStepIntoWithDelegates.kt:40
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at stepIntoMultiFileFacade.kt:6
|
LineBreakpoint created at stepIntoMultiFileFacade.kt:6
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at accessors.kt:10
|
LineBreakpoint created at accessors.kt:10
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at functionReference.kt:11
|
LineBreakpoint created at functionReference.kt:11
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at stepIntoSuspendFunctionSimple.kt:20
|
LineBreakpoint created at stepIntoSuspendFunctionSimple.kt:20
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at syntheticMethods.kt:6
|
LineBreakpoint created at syntheticMethods.kt:6
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at whenExpr.kt:5
|
LineBreakpoint created at whenExpr.kt:5
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
KotlinFieldBreakpoint created at fwBackingField.kt:5
|
KotlinFieldBreakpoint created at fwBackingField.kt:5
|
||||||
KotlinFieldBreakpoint created at fwBackingField.kt:8
|
KotlinFieldBreakpoint created at fwBackingField.kt:8
|
||||||
KotlinFieldBreakpoint created at fwBackingField.kt:18
|
KotlinFieldBreakpoint created at fwBackingField.kt:18
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at sequenceNested.kt:6
|
LineBreakpoint created at sequenceNested.kt:6
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at sequenceNested2.kt:8
|
LineBreakpoint created at sequenceNested2.kt:8
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at sequenceSimple.kt:6
|
LineBreakpoint created at sequenceSimple.kt:6
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at kt34905.kt:13
|
LineBreakpoint created at kt34905.kt:13
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at noParameterExtensionLambdaArgumentCallInInline3.kt:12
|
LineBreakpoint created at noParameterExtensionLambdaArgumentCallInInline3.kt:12
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at soInlineLibFun.kt:6
|
LineBreakpoint created at soInlineLibFun.kt:6
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at soSuspendableCallInEndOfFun.kt:29
|
LineBreakpoint created at soSuspendableCallInEndOfFun.kt:29
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at stepOverInlinedLambdaStdlib.kt:5
|
LineBreakpoint created at stepOverInlinedLambdaStdlib.kt:5
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at stepOverWhenWithInline.kt:5
|
LineBreakpoint created at stepOverWhenWithInline.kt:5
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
Reference in New Issue
Block a user