[K/N][Tests] Change assertions and runtime assertions modes to default, when optimizationMode=OPT
^KT-64844 Fixed
This commit is contained in:
committed by
Space Team
parent
2a55aa782d
commit
809d652bdf
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
+12
-7
@@ -55,8 +55,8 @@ internal abstract class BasicCompilation<A : TestCompilationArtifact>(
|
||||
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<A : TestCompilationArtifact>(
|
||||
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<TestC
|
||||
private object BinaryOptions {
|
||||
object RuntimeAssertionsMode {
|
||||
// Here the 'default' is in the sense the default for testing, not the default for the compiler.
|
||||
val defaultForTesting: Map<String, String> = mapOf("runtimeAssertionsMode" to "panic")
|
||||
fun defaultForTesting(optimizationMode: OptimizationMode): Map<String, String> = when (optimizationMode) {
|
||||
OptimizationMode.OPT -> mapOf()
|
||||
else -> mapOf("runtimeAssertionsMode" to "panic")
|
||||
}
|
||||
|
||||
val forUseWithCache: Map<String, String> = 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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user