[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).
This commit is contained in:
Pavel Punegov
2023-10-04 13:32:30 +02:00
committed by Space Team
parent cd4c241fa3
commit a72eafc92b
@@ -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,