[Native] Add K2 version of LLDB tests
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
|
||||
// FIR_IDENTICAL
|
||||
fun main(args: Array<String>) {
|
||||
val xs = intArrayOf(3, 5, 8)
|
||||
return
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
|
||||
// FIR_IDENTICAL
|
||||
fun main(args: Array<String>) {
|
||||
val xs = IntArray(3)
|
||||
xs[0] = 1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
|
||||
// FIR_IDENTICAL
|
||||
fun main() {
|
||||
try {
|
||||
throw Exception("message 1")
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
|
||||
// FIR_IDENTICAL
|
||||
fun main(args: Array<String>) {
|
||||
val point = Point(1, 2)
|
||||
val person = Person()
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
|
||||
// FIR_IDENTICAL
|
||||
fun main(args: Array<String>) {
|
||||
val a = "string literal"
|
||||
val b = buildString {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
|
||||
// FIR_IDENTICAL
|
||||
fun main(args: Array<String>) {
|
||||
var a: Byte = 1
|
||||
var b: Int = 2
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
|
||||
// FIR_IDENTICAL
|
||||
fun main(args: Array<String>) {
|
||||
var x = 1
|
||||
var y = 2
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
// FREE_COMPILER_ARGS: -Xg-generate-debug-trampoline=enable
|
||||
|
||||
// FIR_IDENTICAL
|
||||
// FILE: kt33055.kt
|
||||
fun question(subject: String, names: Array<String> = emptyArray()): String {
|
||||
return buildString { // breakpoint here
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
// FREE_COMPILER_ARGS: -Xg-generate-debug-trampoline=enable
|
||||
|
||||
// FIR_IDENTICAL
|
||||
// FILE: kt33364.kt
|
||||
fun main() {
|
||||
val param = 3
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
|
||||
// FIR_IDENTICAL
|
||||
// FILE: kt42208-1.kt
|
||||
fun main() {
|
||||
foo()()
|
||||
|
||||
+3
@@ -1,5 +1,8 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
// FREE_COMPILER_ARGS: -XXLanguage:+UnitConversionsOnArbitraryExpressions
|
||||
// IGNORE_BACKEND_K2: NATIVE
|
||||
// FIR_IDENTICAL
|
||||
// Not really `FIR_IDENTICAL`, because we ignore thois test for FIR, but with this directive presented we don't need to create separate `fir.txt` file for dump.
|
||||
|
||||
// FILE: kt42208-1.kt
|
||||
fun main() {
|
||||
|
||||
+6
-6
@@ -1,13 +1,13 @@
|
||||
> b kt42208-2.kt:14
|
||||
> b kt42208-2.kt:17
|
||||
> r
|
||||
> bt
|
||||
* thread #1, [..] stop reason = breakpoint 1.1
|
||||
* frame #0: [..]`kfun:[..]main$lambda$0[..] at kt42208-2.kt:14:5
|
||||
frame #1: [..]`kfun:$main$lambda$0$FUNCTION_REFERENCE$0.[..]invoke[..](_this=[..])[..] at kt42208-2.kt:13:20
|
||||
frame #2: [..]`kfun:$main$lambda$0$FUNCTION_REFERENCE$0.[..]$<bridge-BNN>invoke(_this=[..]){}kotlin.Boolean[..] at kt42208-2.kt:13:20
|
||||
* frame #0: [..]`kfun:[..]main$lambda$0[..] at kt42208-2.kt:17:5
|
||||
frame #1: [..]`kfun:$main$lambda$0$FUNCTION_REFERENCE$0.[..]invoke[..](_this=[..])[..] at kt42208-2.kt:16:20
|
||||
frame #2: [..]`kfun:$main$lambda$0$FUNCTION_REFERENCE$0.[..]$<bridge-BNN>invoke(_this=[..]){}kotlin.Boolean[..] at kt42208-2.kt:16:20
|
||||
frame #3: [..]`kfun:kotlin.Function0#invoke(){}1:0-trampoline at [K][Suspend]Functions:1:1
|
||||
frame #4: [..]`kfun:#bar(v=[..]){} at kt42208-3.kt:18:5
|
||||
frame #5: [..]`kfun:#main(){} at kt42208-1.kt:7:5
|
||||
frame #4: [..]`kfun:#bar(v=[..]){} at kt42208-3.kt:21:5
|
||||
frame #5: [..]`kfun:#main(){} at kt42208-1.kt:10:5
|
||||
frame #6: [..]`Konan_start(args=[..]) at [..]
|
||||
> c
|
||||
> q
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
|
||||
// FIR_IDENTICAL
|
||||
// FILE: kt42208-1.kt
|
||||
fun main() {
|
||||
val a = foo()
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
|
||||
// FIR_IDENTICAL
|
||||
// FILE: kt47198.kt
|
||||
fun foo(a:Int) = print("a: $a")
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
|
||||
// FIR_IDENTICAL
|
||||
// FILE: kt47198.kt
|
||||
fun foo(a:Int){
|
||||
print("a: ${'$'}a")
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
> b call_bar
|
||||
> r
|
||||
> s
|
||||
> s
|
||||
> bt
|
||||
* thread #1, [..] stop reason = step in
|
||||
* frame #0: [..]`kfun:Foo#bar(){}kotlin.String-trampoline at kt61131-2.kt:20:5
|
||||
frame #1: [..]`kfun:#call_bar(foo=[..]){} at kt61131-1.kt:9:18
|
||||
frame #2: [..]`kfun:#main(){} at kt61131-1.kt:15:5
|
||||
frame #3: [..]`Konan_start(args=[..]) at [..]
|
||||
frame #4: [..]
|
||||
frame #5: [..]
|
||||
> s
|
||||
> bt
|
||||
* thread #1, [..] stop reason = step in
|
||||
* frame #0: [..]`kfun:FooImpl#bar(_this=[..]]){}kotlin.String at kt61131-1.kt:5:5
|
||||
frame #1: [..]`kfun:Foo#bar(){}kotlin.String-trampoline at kt61131-2.kt:20:5
|
||||
frame #2: [..]`kfun:#call_bar(foo=[..]){} at kt61131-1.kt:9:18
|
||||
frame #3: [..]`kfun:#main(){} at kt61131-1.kt:15:5
|
||||
frame #4: [..]`Konan_start(args=[..]) at [..]
|
||||
frame #5: [..]
|
||||
frame #6: [..]
|
||||
> q
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
|
||||
// FIR_IDENTICAL
|
||||
// FILE: main.kt
|
||||
fun bar(x: Int): Int {
|
||||
val res = foo(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// KIND: STANDALONE_LLDB
|
||||
|
||||
// FIR_IDENTICAL
|
||||
import kotlin.test.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
Generated
+134
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright 2010-2024 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.konan.test.blackbox;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.group.UseStandardTestCaseGroupProvider;
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.EnforcedProperty;
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.ClassLevelProperty;
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.EnforcedHostTarget;
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.group.FirPipeline;
|
||||
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.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("native/native.tests/testData/lldb")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("debugger")
|
||||
@UseStandardTestCaseGroupProvider()
|
||||
@EnforcedProperty(property = ClassLevelProperty.OPTIMIZATION_MODE, propertyValue = "DEBUG")
|
||||
@EnforcedHostTarget()
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
public class FirLldbTestGenerated extends AbstractNativeBlackBoxTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInLldb() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/lldb"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("canInspectArrayChildren.kt")
|
||||
public void testCanInspectArrayChildren() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/canInspectArrayChildren.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("canInspectArrays.kt")
|
||||
public void testCanInspectArrays() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/canInspectArrays.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("canInspectCatchParameter.kt")
|
||||
public void testCanInspectCatchParameter() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/canInspectCatchParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("canInspectClasses.kt")
|
||||
public void testCanInspectClasses() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/canInspectClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("canInspectStrings.kt")
|
||||
public void testCanInspectStrings() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/canInspectStrings.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("canInspectValuesOfPrimitiveTypes.kt")
|
||||
public void testCanInspectValuesOfPrimitiveTypes() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/canInspectValuesOfPrimitiveTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("canStepThroughCode.kt")
|
||||
public void testCanStepThroughCode() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/canStepThroughCode.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt33055.kt")
|
||||
public void testKt33055() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/kt33055.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt33364.kt")
|
||||
public void testKt33364() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/kt33364.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt42208.kt")
|
||||
public void testKt42208() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/kt42208.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt42208WithPassingLambdaToAnotherFunction.kt")
|
||||
public void testKt42208WithPassingLambdaToAnotherFunction() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/kt42208WithPassingLambdaToAnotherFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt42208WithVariable.kt")
|
||||
public void testKt42208WithVariable() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/kt42208WithVariable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt47198.kt")
|
||||
public void testKt47198() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/kt47198.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt47198WithBody.kt")
|
||||
public void testKt47198WithBody() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/kt47198WithBody.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt61131.kt")
|
||||
public void testKt61131() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/kt61131.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("stepThroughInlineArguments.kt")
|
||||
public void testStepThroughInlineArguments() throws Exception {
|
||||
runTest("native/native.tests/testData/lldb/stepThroughInlineArguments.kt");
|
||||
}
|
||||
}
|
||||
+14
@@ -317,6 +317,20 @@ fun main() {
|
||||
model("lldb")
|
||||
}
|
||||
}
|
||||
testGroup("native/native.tests/tests-gen", "native/native.tests/testData") {
|
||||
testClass<AbstractNativeBlackBoxTest>(
|
||||
suiteTestClassName = "FirLldbTestGenerated",
|
||||
annotations = listOf(
|
||||
debugger(),
|
||||
provider<UseStandardTestCaseGroupProvider>(),
|
||||
forceDebugMode(),
|
||||
forceHostTarget(),
|
||||
*frontendFir()
|
||||
)
|
||||
) {
|
||||
model("lldb")
|
||||
}
|
||||
}
|
||||
|
||||
// New frontend test infrastructure tests
|
||||
testGroup(testsRoot = "native/native.tests/tests-gen", testDataRoot = "compiler/testData") {
|
||||
|
||||
+8
-2
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.konan.test.blackbox.support
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.ENTRY_POINT
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.EXIT_CODE
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.EXPECTED_TIMEOUT_FAILURE
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.FIR_IDENTICAL
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.FREE_CINTEROP_ARGS
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.FREE_COMPILER_ARGS
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.INPUT_DATA_FILE
|
||||
@@ -18,6 +19,8 @@ import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.PROGRAM_A
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.TEST_RUNNER
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.runner.TestRunCheck
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.runner.TestRunCheck.OutputDataFile
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.PipelineType
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.Settings
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.util.LLDBSessionSpec
|
||||
import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives
|
||||
import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
|
||||
@@ -320,8 +323,11 @@ internal fun parseEntryPoint(registeredDirectives: RegisteredDirectives, locatio
|
||||
return entryPoint
|
||||
}
|
||||
|
||||
internal fun parseLLDBSpec(testDataFile: File): LLDBSessionSpec {
|
||||
val specFileLocation = testDataFile.absolutePath.removeSuffix(testDataFile.extension) + "txt"
|
||||
internal fun parseLLDBSpec(testDataFile: File, registeredDirectives: RegisteredDirectives, settings: Settings): LLDBSessionSpec {
|
||||
val firIdentical = FIR_IDENTICAL in registeredDirectives
|
||||
val firSpecificExt = if (settings.get<PipelineType>() == PipelineType.K2 && !firIdentical) "fir." else ""
|
||||
val specFilePathWithoutExtension = testDataFile.absolutePath.removeSuffix(testDataFile.extension)
|
||||
val specFileLocation = "$specFilePathWithoutExtension${firSpecificExt}txt"
|
||||
val specFile = File(specFileLocation)
|
||||
return try {
|
||||
LLDBSessionSpec.parse(specFile.readText())
|
||||
|
||||
+1
-1
@@ -204,7 +204,7 @@ internal class StandardTestCaseGroupProvider : TestCaseGroupProvider {
|
||||
fixPackageNames(testModules.values, nominalPackageName, testDataFile)
|
||||
}
|
||||
|
||||
val lldbSpec = if (testKind == TestKind.STANDALONE_LLDB) parseLLDBSpec(testDataFile) else null
|
||||
val lldbSpec = if (testKind == TestKind.STANDALONE_LLDB) parseLLDBSpec(testDataFile, registeredDirectives, settings) else null
|
||||
|
||||
val outputMatcher = lldbSpec?.let {
|
||||
OutputMatcher(Output.STDOUT) { output -> lldbSpec.checkLLDBOutput(output, settings.get()) }
|
||||
|
||||
Reference in New Issue
Block a user