Support sanitizers in runtime tests (#4622)

This commit is contained in:
Alexander Shabalin
2021-01-20 19:42:09 +03:00
committed by Nikolay Krasko
parent 3ee8d98726
commit 6cc60ad6a2
10 changed files with 256 additions and 66 deletions
+19 -16
View File
@@ -5,6 +5,8 @@
import org.jetbrains.kotlin.*
import org.jetbrains.kotlin.testing.native.*
import org.jetbrains.kotlin.bitcode.CompileToBitcode
import org.jetbrains.kotlin.bitcode.CompileToBitcodeExtension
import org.jetbrains.kotlin.konan.target.*
plugins {
id("compile-to-bitcode")
@@ -42,6 +44,7 @@ bitcode {
"${target}ExperimentalMemoryManager"
)
includeRuntime()
// TODO: Should depend on the sanitizer.
linkerArgs.add(project.file("../common/build/bitcode/main/$target/hash.bc").path)
}
@@ -107,9 +110,11 @@ bitcode {
}
targetList.forEach { targetName ->
createTestTask(
val allTests = mutableListOf<Task>()
allTests.addAll(createTestTasks(
project,
"StdAlloc",
targetName,
"${targetName}StdAllocRuntimeTests",
listOf(
"${targetName}Runtime",
@@ -120,11 +125,11 @@ targetList.forEach { targetName ->
)
) {
includeRuntime()
}
})
createTestTask(
allTests.addAll(createTestTasks(
project,
"Mimalloc",
targetName,
"${targetName}MimallocRuntimeTests",
listOf(
"${targetName}Runtime",
@@ -136,11 +141,11 @@ targetList.forEach { targetName ->
)
) {
includeRuntime()
}
})
createTestTask(
allTests.addAll(createTestTasks(
project,
"ExperimentalMMMimalloc",
targetName,
"${targetName}ExperimentalMMMimallocRuntimeTests",
listOf(
"${targetName}Runtime",
@@ -151,11 +156,11 @@ targetList.forEach { targetName ->
)
) {
includeRuntime()
}
})
createTestTask(
allTests.addAll(createTestTasks(
project,
"ExperimentalMMStdAlloc",
targetName,
"${targetName}ExperimentalMMStdAllocRuntimeTests",
listOf(
"${targetName}Runtime",
@@ -165,13 +170,11 @@ targetList.forEach { targetName ->
)
) {
includeRuntime()
}
})
// TODO: This "all tests" tasks should be provided by `CompileToBitcodeExtension`
tasks.register("${targetName}RuntimeTests") {
dependsOn("${targetName}StdAllocRuntimeTests")
dependsOn("${targetName}MimallocRuntimeTests")
dependsOn("${targetName}ExperimentalMMStdAllocRuntimeTests")
dependsOn("${targetName}ExperimentalMMMimallocRuntimeTests")
dependsOn(allTests)
}
}