[Native] Add K2 version of LLDB tests

This commit is contained in:
Ivan Kylchik
2023-12-27 17:52:15 +01:00
committed by Space Team
parent 2ded62c53e
commit 69c83698fb
22 changed files with 205 additions and 24 deletions
@@ -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,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())
@@ -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()) }