From a72eafc92bdfbcb9b2f48000b9bb6d78b94f39d2 Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Wed, 4 Oct 2023 13:32:30 +0200 Subject: [PATCH] [K/N][test] Fix cache mode selection for test targets without cache Execution of tests without cache support should be restricted. Such runs should use default cache mode (without). --- .../konan/test/blackbox/support/NativeTestSupport.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/NativeTestSupport.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/NativeTestSupport.kt index 75d99fb9684..71b4272f93e 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/NativeTestSupport.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/NativeTestSupport.kt @@ -262,10 +262,11 @@ private object NativeTestSupport { kotlinNativeTargets: KotlinNativeTargets, optimizationMode: OptimizationMode ): CacheMode { + val defaultCache = CacheMode.defaultForTestTarget(distribution, kotlinNativeTargets) val cacheMode = ClassLevelProperty.CACHE_MODE.readValue( enforcedProperties, CacheMode.Alias.values(), - default = CacheMode.defaultForTestTarget(distribution, kotlinNativeTargets) + default = defaultCache ) val useStaticCacheForUserLibraries = when (cacheMode) { CacheMode.Alias.NO -> return CacheMode.WithoutCache @@ -275,7 +276,9 @@ private object NativeTestSupport { } val makePerFileCaches = cacheMode == CacheMode.Alias.STATIC_PER_FILE_EVERYWHERE - return CacheMode.WithStaticCache( + return if (defaultCache == CacheMode.Alias.NO) + CacheMode.WithoutCache + else CacheMode.WithStaticCache( distribution, kotlinNativeTargets, optimizationMode,