From b44c0f6789f19bd8ceaaf4439be271f6b4bec15a Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Mon, 14 Feb 2022 12:27:04 +0300 Subject: [PATCH] [Native][tests] Always run DumpedTestListing test at the host target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../InfrastructureDumpedTestListingTest.kt | 1 + .../support/ConfigurationProperties.kt | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/InfrastructureDumpedTestListingTest.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/InfrastructureDumpedTestListingTest.kt index 766d3fab88b..10fe679c784 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/InfrastructureDumpedTestListingTest.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/InfrastructureDumpedTestListingTest.kt @@ -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() { diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/ConfigurationProperties.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/ConfigurationProperties.kt index 51634d649f8..bbe8e7df4ec 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/ConfigurationProperties.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/ConfigurationProperties.kt @@ -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 = testClass.annotations - .filterIsInstance() - .associate { it.property to it.propertyValue } + private val enforcedAnnotations: Map = 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] }