diff --git a/compiler/testData/codegen/box/assert/alwaysEnable.kt b/compiler/testData/codegen/box/assert/alwaysEnable.kt
index bbb81fbab3c..098d4d643e6 100644
--- a/compiler/testData/codegen/box/assert/alwaysEnable.kt
+++ b/compiler/testData/codegen/box/assert/alwaysEnable.kt
@@ -2,6 +2,7 @@
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// IGNORE_BACKEND: JS
+// IGNORE_NATIVE: optimizationMode=OPT
// ASSERTIONS_MODE: always-enable
// WITH_STDLIB
diff --git a/compiler/testData/codegen/box/fileCheck/redundant_safepoints.kt b/compiler/testData/codegen/box/fileCheck/redundant_safepoints.kt
index ad1bc5c3373..6245ba43843 100644
--- a/compiler/testData/codegen/box/fileCheck/redundant_safepoints.kt
+++ b/compiler/testData/codegen/box/fileCheck/redundant_safepoints.kt
@@ -1,9 +1,6 @@
// TARGET_BACKEND: NATIVE
// FILECHECK_STAGE: RemoveRedundantSafepoints
-// KT-64844
-// IGNORE_NATIVE: target=linux_x64 && optimizationMode=OPT
-
// This test checks:
// - there is only one safepoint per function
// - safepoint function is inlined in OPT mode, unless SMALLBINARY is needed (for ex, watchos_arm32)
diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilation.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilation.kt
index 4b30efd0cb7..ba2159dbaf0 100644
--- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilation.kt
+++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilation.kt
@@ -55,8 +55,8 @@ internal abstract class BasicCompilation(
private fun ArgsBuilder.applyCommonArgs() {
add("-target", targets.testTarget.name)
optimizationMode.compilerFlag?.let { compilerFlag -> add(compilerFlag) }
+ if (optimizationMode != OptimizationMode.OPT) add("-enable-assertions")
add(
- "-enable-assertions",
"-Xverify-ir=error"
)
addFlattened(binaryOptions.entries) { (name, value) -> listOf("-Xbinary=$name=$value") }
@@ -141,7 +141,7 @@ internal abstract class SourceBasedCompilation(
targets: KotlinNativeTargets,
home: KotlinNativeHome,
classLoader: KotlinNativeClassLoader,
- optimizationMode: OptimizationMode,
+ protected val optimizationMode: OptimizationMode,
compilerOutputInterceptor: CompilerOutputInterceptor,
private val threadStateChecker: ThreadStateChecker,
private val sanitizer: Sanitizer,
@@ -218,7 +218,7 @@ internal class LibraryCompilation(
dependencies = CategorizedDependencies(dependencies),
expectedArtifact = expectedArtifact
) {
- override val binaryOptions get() = BinaryOptions.RuntimeAssertionsMode.defaultForTesting
+ override val binaryOptions get() = BinaryOptions.RuntimeAssertionsMode.defaultForTesting(optimizationMode)
override fun applySpecificArgs(argsBuilder: ArgsBuilder) = with(argsBuilder) {
add(
@@ -253,7 +253,7 @@ internal class ObjCFrameworkCompilation(
dependencies = CategorizedDependencies(dependencies),
expectedArtifact = expectedArtifact
) {
- override val binaryOptions get() = BinaryOptions.RuntimeAssertionsMode.defaultForTesting
+ override val binaryOptions get() = BinaryOptions.RuntimeAssertionsMode.defaultForTesting(optimizationMode)
override fun applySpecificArgs(argsBuilder: ArgsBuilder) = with(argsBuilder) {
add(
@@ -356,7 +356,7 @@ internal class ExecutableCompilation(
expectedArtifact = expectedArtifact
) {
private val cacheMode: CacheMode = settings.get()
- override val binaryOptions = BinaryOptions.RuntimeAssertionsMode.chooseFor(cacheMode)
+ override val binaryOptions = BinaryOptions.RuntimeAssertionsMode.chooseFor(cacheMode, optimizationMode)
private val partialLinkageConfig: UsedPartialLinkageConfig = settings.get()
@@ -552,10 +552,15 @@ internal class CategorizedDependencies(uncategorizedDependencies: Iterable = mapOf("runtimeAssertionsMode" to "panic")
+ fun defaultForTesting(optimizationMode: OptimizationMode): Map = when (optimizationMode) {
+ OptimizationMode.OPT -> mapOf()
+ else -> mapOf("runtimeAssertionsMode" to "panic")
+ }
+
val forUseWithCache: Map = mapOf("runtimeAssertionsMode" to "ignore")
- fun chooseFor(cacheMode: CacheMode) = if (cacheMode.useStaticCacheForDistributionLibraries) forUseWithCache else defaultForTesting
+ fun chooseFor(cacheMode: CacheMode, optimizationMode: OptimizationMode) =
+ if (cacheMode.useStaticCacheForDistributionLibraries) forUseWithCache else defaultForTesting(optimizationMode)
}
}