[Native][tests] Always run DumpedTestListing test at the host target

This is for simplification’s sake. We need to run executable file with --ktest_list_tests flag and compare test listing with the test listing produced during the compilation.

^KT-50316
This commit is contained in:
Dmitriy Dolovov
2022-02-14 12:27:04 +03:00
parent 26ffd66a54
commit b44c0f6789
2 changed files with 13 additions and 3 deletions
@@ -34,6 +34,7 @@ import org.junit.jupiter.api.Test
import java.io.File
@Tag("infrastructure")
@EnforcedHostTarget
@TestMetadata(TEST_SUITE_PATH)
@TestDataPath("\$PROJECT_ROOT")
class InfrastructureDumpedTestListingTest : AbstractNativeSimpleTest() {
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.konan.blackboxtest.support
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.kotlin.test.services.JUnit5Assertions.fail
/*************** Process-level system properties ***************/
@@ -23,10 +24,18 @@ internal enum class ProcessLevelProperty(shortName: String) {
@Target(AnnotationTarget.CLASS)
internal annotation class EnforcedProperty(val property: ClassLevelProperty, val propertyValue: String)
@Target(AnnotationTarget.CLASS)
internal annotation class EnforcedHostTarget
internal class EnforcedProperties(testClass: Class<*>) {
private val enforcedAnnotations: Map<ClassLevelProperty, String> = testClass.annotations
.filterIsInstance<EnforcedProperty>()
.associate { it.property to it.propertyValue }
private val enforcedAnnotations: Map<ClassLevelProperty, String> = buildMap {
testClass.annotations.forEach { annotation ->
when (annotation) {
is EnforcedProperty -> this[annotation.property] = annotation.propertyValue
is EnforcedHostTarget -> this[ClassLevelProperty.TEST_TARGET] = HostManager.host.name
}
}
}
operator fun get(propertyType: ClassLevelProperty): String? = enforcedAnnotations[propertyType]
}