diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibABITest.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibABITest.kt index ec19621803b..e404f4b9e67 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibABITest.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibABITest.kt @@ -76,7 +76,7 @@ abstract class AbstractNativeKlibABITest : AbstractNativeSimpleTest() { text = generateBoxFunctionLauncher("box") ) - val testCase = createTestCase(module, COMPILER_ARGS_FOR_EXECUTABLE) + val testCase = createTestCase(module, COMPILER_ARGS_FOR_STATIC_CACHE_AND_EXECUTABLE) val compilation = ExecutableCompilation( settings = testRunSettings, @@ -96,6 +96,7 @@ abstract class AbstractNativeKlibABITest : AbstractNativeSimpleTest() { private fun buildCacheForKlib(moduleDependencies: Collection, klibArtifact: KLIB) { val compilation = StaticCacheCompilation( settings = testRunSettings, + freeCompilerArgs = COMPILER_ARGS_FOR_STATIC_CACHE_AND_EXECUTABLE, dependencies = createLibraryCacheDependencies(moduleDependencies) + klibArtifact.toDependency(), expectedArtifact = klibArtifact.toStaticCacheArtifact() ) @@ -145,7 +146,7 @@ abstract class AbstractNativeKlibABITest : AbstractNativeSimpleTest() { listOf("-nostdlib") // stdlib is passed explicitly. ) - private val COMPILER_ARGS_FOR_EXECUTABLE = TestCompilerArgs( + private val COMPILER_ARGS_FOR_STATIC_CACHE_AND_EXECUTABLE = TestCompilerArgs( COMPILER_ARGS_FOR_KLIB.compilerArgs + "-Xpartial-linkage" ) diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilation.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilation.kt index 745bbe54532..8ae9eb99179 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilation.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilation.kt @@ -28,11 +28,11 @@ internal abstract class BasicCompilation( protected val home: KotlinNativeHome, private val classLoader: KotlinNativeClassLoader, private val optimizationMode: OptimizationMode, + protected val freeCompilerArgs: TestCompilerArgs, protected val dependencies: Iterable>, protected val expectedArtifact: A ) : TestCompilation() { protected abstract val sourceModules: Collection - protected abstract val freeCompilerArgs: TestCompilerArgs // Runs the compiler and memorizes the result on property access. final override val result: TestCompilationResult by lazy { @@ -143,7 +143,7 @@ internal abstract class SourceBasedCompilation( private val memoryModel: MemoryModel, private val threadStateChecker: ThreadStateChecker, private val gcType: GCType, - override val freeCompilerArgs: TestCompilerArgs, + freeCompilerArgs: TestCompilerArgs, override val sourceModules: Collection, dependencies: Iterable>, expectedArtifact: A @@ -152,6 +152,7 @@ internal abstract class SourceBasedCompilation( home = home, classLoader = classLoader, optimizationMode = optimizationMode, + freeCompilerArgs = freeCompilerArgs, dependencies = dependencies, expectedArtifact = expectedArtifact ) { @@ -255,6 +256,7 @@ internal class ExecutableCompilation( internal class StaticCacheCompilation( settings: Settings, + freeCompilerArgs: TestCompilerArgs, dependencies: Iterable>, expectedArtifact: KLIBStaticCache ) : BasicCompilation( @@ -262,11 +264,11 @@ internal class StaticCacheCompilation( home = settings.get(), classLoader = settings.get(), optimizationMode = settings.get(), + freeCompilerArgs = freeCompilerArgs, dependencies = dependencies, expectedArtifact = expectedArtifact ) { override val sourceModules get() = emptyList() - override val freeCompilerArgs get() = TestCompilerArgs.EMPTY private val cacheRootDir: File = run { val cacheKind = settings.get() diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilationFactory.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilationFactory.kt index 9ba814332e1..f1a3a3af179 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilationFactory.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilationFactory.kt @@ -94,6 +94,7 @@ internal class TestCompilationFactory { val staticCacheCompilation: StaticCacheCompilation? = if (staticCacheArtifact != null) { StaticCacheCompilation( settings = settings, + freeCompilerArgs = freeCompilerArgs, dependencies = dependencies.staticCacheDependenciesWith(klibCompilation.asKlibDependency(type = /* does not matter in fact*/ Library)), expectedArtifact = staticCacheArtifact )