KT-63592 Add testGenerateLLDBInitFile test
This commit is contained in:
committed by
Space Team
parent
4176c50107
commit
c6bf5b8ef1
+27
-4
@@ -18,20 +18,17 @@ import org.jetbrains.kotlin.gradle.util.capitalize
|
|||||||
import org.jetbrains.kotlin.gradle.util.replaceText
|
import org.jetbrains.kotlin.gradle.util.replaceText
|
||||||
import org.jetbrains.kotlin.gradle.util.runProcess
|
import org.jetbrains.kotlin.gradle.util.runProcess
|
||||||
import org.jetbrains.kotlin.konan.target.*
|
import org.jetbrains.kotlin.konan.target.*
|
||||||
import org.jetbrains.kotlin.tooling.core.KotlinToolingVersion
|
|
||||||
import org.junit.jupiter.api.Disabled
|
import org.junit.jupiter.api.Disabled
|
||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import org.junit.jupiter.api.condition.OS
|
import org.junit.jupiter.api.condition.OS
|
||||||
import org.junit.jupiter.api.io.TempDir
|
import org.junit.jupiter.api.io.TempDir
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.util.*
|
|
||||||
import kotlin.io.path.absolutePathString
|
import kotlin.io.path.absolutePathString
|
||||||
import kotlin.io.path.appendText
|
import kotlin.io.path.appendText
|
||||||
import kotlin.io.path.deleteIfExists
|
import kotlin.io.path.deleteIfExists
|
||||||
import kotlin.io.path.readText
|
import kotlin.io.path.readLines
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
import kotlin.test.fail
|
|
||||||
|
|
||||||
@DisplayName("Tests for general K/N builds")
|
@DisplayName("Tests for general K/N builds")
|
||||||
@NativeGradlePluginTests
|
@NativeGradlePluginTests
|
||||||
@@ -365,6 +362,32 @@ class GeneralNativeIT : KGPBaseTest() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DisplayName("Checks generating lldbinit file")
|
||||||
|
@GradleTest
|
||||||
|
fun testGenerateLLDBInitFile(gradleVersion: GradleVersion) {
|
||||||
|
nativeProject("native-binaries/frameworks", gradleVersion = gradleVersion) {
|
||||||
|
val lldbPath = projectPath.resolve("build").resolve("lldbinit")
|
||||||
|
|
||||||
|
build(":setupLldbScript") {
|
||||||
|
assertFileInProjectExists(lldbPath.absolutePathString())
|
||||||
|
assertFileContains(lldbPath, "command script import")
|
||||||
|
assertFileContains(lldbPath, "konan_lldb.py")
|
||||||
|
|
||||||
|
val scriptContent = lldbPath.readLines()
|
||||||
|
assert(scriptContent.size == 1) {
|
||||||
|
"lldbinit file contains more than 1 line or doesn't contains lines at all"
|
||||||
|
}
|
||||||
|
|
||||||
|
val scriptPath = scriptContent
|
||||||
|
.first()
|
||||||
|
.replace("command script import", "")
|
||||||
|
.trimIndent()
|
||||||
|
|
||||||
|
assertFileInProjectExists(scriptPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private data class ExportApiTestData(val taskName: String, val binaryName: String)
|
private data class ExportApiTestData(val taskName: String, val binaryName: String)
|
||||||
|
|
||||||
private fun testExportApi(project: TestProject, testData: List<ExportApiTestData>) = with(project) {
|
private fun testExportApi(project: TestProject, testData: List<ExportApiTestData>) = with(project) {
|
||||||
|
|||||||
Reference in New Issue
Block a user