[K/N] Support also MM files in new native test infra

^KT-61259
This commit is contained in:
Vladimir Sukharev
2023-12-12 00:48:02 +01:00
committed by Space Team
parent c09e8909d4
commit dc2ea15dee
2 changed files with 7 additions and 2 deletions
@@ -215,6 +215,10 @@ internal enum class MutedOption {
K2
}
internal val CINTEROP_SOURCE_EXTENSIONS = setOf("c", "cpp", "m", "mm")
internal val CINTEROP_DEFINITION_EXTENSIONS = setOf("def", "h")
internal val KNOWN_EXTENSIONS = setOf("kt") + CINTEROP_DEFINITION_EXTENSIONS + CINTEROP_SOURCE_EXTENSIONS
internal class TestCInteropArgs(cinteropArgs: List<String>) : TestCompilerArgs(emptyList(), cinteropArgs) {
constructor(vararg cinteropArgs: String) : this(cinteropArgs.asList())
}
@@ -344,7 +348,7 @@ internal fun parseFileName(parsedDirective: RegisteredDirectivesParser.ParsedDir
}
val fileExtension = fileName.split(".").last()
if (fileExtension in setOf("kt", "def", "h", "c", "cpp", "m"))
if (fileExtension in KNOWN_EXTENSIONS)
assertTrue(fileName.length > 3 && '/' !in fileName && '\\' !in fileName) {
"$location: Invalid file name with extension $fileExtension in ${parsedDirective.directive} directive: $fileName"
}
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.konan.test.blackbox.support.compilation
import org.jetbrains.kotlin.container.topologicalSort
import org.jetbrains.kotlin.konan.test.blackbox.muteCInteropTestIfNecessary
import org.jetbrains.kotlin.konan.test.blackbox.support.CINTEROP_SOURCE_EXTENSIONS
import org.jetbrains.kotlin.konan.test.blackbox.support.PackageName
import org.jetbrains.kotlin.konan.test.blackbox.support.TestCase
import org.jetbrains.kotlin.konan.test.blackbox.support.TestCase.*
@@ -216,7 +217,7 @@ internal class TestCompilationFactory {
muteCInteropTestIfNecessary(defFile, settings.get<KotlinNativeTargets>().testTarget)
val cSourceFiles = buildList {
for (ext in listOf("cpp", "c", "m")) {
for (ext in CINTEROP_SOURCE_EXTENSIONS) {
filesByExtension[ext]?.let { addAll(it) }
}
}