[Native][tests] Keep KLIB dirs in KotlinNativeHome settings

^KT-50775
This commit is contained in:
Dmitriy Dolovov
2022-01-24 13:16:52 +03:00
parent 33ca8b528c
commit f2bd2f3e7d
5 changed files with 8 additions and 7 deletions
@@ -108,7 +108,7 @@ abstract class AbstractNativeKlibABITest : AbstractNativeSimpleTest() {
dependencies.map { ExistingLibraryDependency(TestCompilationArtifact.KLIB(it), Library) } dependencies.map { ExistingLibraryDependency(TestCompilationArtifact.KLIB(it), Library) }
private val buildDir: File get() = testRunSettings.get<SimpleTestDirectories>().testBuildDir private val buildDir: File get() = testRunSettings.get<SimpleTestDirectories>().testBuildDir
private val stdlibFile: File get() = testRunSettings.get<KotlinNativeHome>().dir.resolve("klib/common/stdlib") private val stdlibFile: File get() = testRunSettings.get<KotlinNativeHome>().stdlibFile
companion object { companion object {
private val COMPILER_ARGS_FOR_KLIB = TestCompilerArgs( private val COMPILER_ARGS_FOR_KLIB = TestCompilerArgs(
@@ -45,7 +45,7 @@ class NativeBlackBoxTestSupport : BeforeEachCallback {
val settings = createTestRunSettings() val settings = createTestRunSettings()
// Set the essential compiler property. // Set the essential compiler property.
System.setProperty("kotlin.native.home", settings.get<KotlinNativeHome>().path) System.setProperty("kotlin.native.home", settings.get<KotlinNativeHome>().dir.path)
// Inject the required properties to test instance. // Inject the required properties to test instance.
with(settings.get<BlackBoxTestInstances>().enclosingTestInstance) { with(settings.get<BlackBoxTestInstances>().enclosingTestInstance) {
@@ -60,7 +60,7 @@ class NativeSimpleTestSupport : BeforeEachCallback {
val settings = createSimpleTestRunSettings() val settings = createSimpleTestRunSettings()
// Set the essential compiler property. // Set the essential compiler property.
System.setProperty("kotlin.native.home", settings.get<KotlinNativeHome>().path) System.setProperty("kotlin.native.home", settings.get<KotlinNativeHome>().dir.path)
// Inject the required properties to test instance. // Inject the required properties to test instance.
with(settings.get<SimpleTestInstances>().enclosingTestInstance) { with(settings.get<SimpleTestInstances>().enclosingTestInstance) {
@@ -96,7 +96,7 @@ private object NativeTestSupport {
} }
val nativeHome = computeNativeHome() val nativeHome = computeNativeHome()
val hostManager = HostManager(distribution = Distribution(nativeHome.path), experimental = false) val hostManager = HostManager(distribution = Distribution(nativeHome.dir.path), experimental = false)
val nativeTargets = computeNativeTargets(hostManager) val nativeTargets = computeNativeTargets(hostManager)
@@ -157,7 +157,7 @@ internal abstract class SourceBasedCompilation<A : TestCompilationArtifact>(
) { ) {
override fun applySpecificArgs(argsBuilder: ArgsBuilder): Unit = with(argsBuilder) { override fun applySpecificArgs(argsBuilder: ArgsBuilder): Unit = with(argsBuilder) {
add( add(
"-repo", home.dir.resolve("klib").path, "-repo", home.librariesDir.path,
"-output", expectedArtifact.path "-output", expectedArtifact.path
) )
memoryModel.compilerFlags?.let { compilerFlags -> add(compilerFlags) } memoryModel.compilerFlags?.let { compilerFlags -> add(compilerFlags) }
@@ -104,7 +104,7 @@ internal class PredefinedTestCaseGroupProvider(annotation: PredefinedTestCases)
private fun substituteRealPaths(value: String, settings: Settings): String = private fun substituteRealPaths(value: String, settings: Settings): String =
if ('$' in value) { if ('$' in value) {
// N.B. Here, more substitutions can be supported in the future if it would be necessary. // N.B. Here, more substitutions can be supported in the future if it would be necessary.
value.replace(PredefinedPaths.KOTLIN_NATIVE_DISTRIBUTION, settings.get<KotlinNativeHome>().path) value.replace(PredefinedPaths.KOTLIN_NATIVE_DISTRIBUTION, settings.get<KotlinNativeHome>().dir.path)
} else } else
value value
} }
@@ -18,7 +18,8 @@ internal class KotlinNativeTargets(val testTarget: KonanTarget, val hostTarget:
* The Kotlin/Native home. * The Kotlin/Native home.
*/ */
internal class KotlinNativeHome(val dir: File) { internal class KotlinNativeHome(val dir: File) {
val path: String get() = dir.path val librariesDir: File = dir.resolve("klib")
val stdlibFile: File = librariesDir.resolve("common/stdlib")
} }
/** /**