[K/N] Issue deprecation warning when using legacy MM

Merge-request: KT-MR-9091
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
This commit is contained in:
Alexander Shabalin
2023-03-15 08:22:37 +00:00
committed by Space Team
parent 5bd0a1a0ba
commit e6297f92fa
3 changed files with 21 additions and 8 deletions
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.LibraryCompil
import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilationArtifact
import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilationResult
import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilationResult.Companion.assertSuccess
import org.jetbrains.kotlin.konan.blackboxtest.support.settings.MemoryModel
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.junit.jupiter.api.Test
import java.io.File
@@ -88,10 +89,14 @@ class CompilerOutputTest : AbstractNativeSimpleTest() {
}
private fun normalizeOutput(output: String, exitCode: ExitCode): String {
return AbstractCliTest.getNormalizedCompilerOutput(
var normalizedOutput = AbstractCliTest.getNormalizedCompilerOutput(
output,
exitCode,
"compiler/testData/compileKotlinAgainstCustomBinaries/"
)
if (testRunSettings.get<MemoryModel>() != MemoryModel.EXPERIMENTAL) {
normalizedOutput = normalizedOutput.replace("warning: legacy MM is deprecated and will be removed in version 1.9.20\n", "")
}
return normalizedOutput
}
}
}
@@ -72,7 +72,8 @@ internal class NativeTestGroupingMessageCollector(
|| isUnsafeCompilerArgumentsWarning(message)
|| isLibraryIncludedMoreThanOnceWarning(message)
|| isK2Experimental(message)
|| isPartialLinkageWarning(message) -> {
|| isPartialLinkageWarning(message)
|| isLegacyMMWarning(message) -> {
// These warnings are known and should not be reported as errors.
severity
}
@@ -117,6 +118,9 @@ internal class NativeTestGroupingMessageCollector(
private fun isK2Experimental(message: String): Boolean = message.startsWith(K2_NATIVE_EXPERIMENTAL_WARNING_PREFIX)
// Legacy MM is deprecated and will be removed in 1.9.20. Until that moment we still need to run tests with it.
private fun isLegacyMMWarning(message: String): Boolean = message.startsWith(LEGACY_MM_WARNING_PREFIX)
override fun hasErrors() = hasWarningsWithRaisedSeverity || super.hasErrors()
companion object {
@@ -125,6 +129,7 @@ internal class NativeTestGroupingMessageCollector(
private const val LIBRARY_INCLUDED_MORE_THAN_ONCE_WARNING_PREFIX = "library included more than once: "
private const val K2_NATIVE_EXPERIMENTAL_WARNING_PREFIX = "Language version 2.0 is experimental"
private val PARTIAL_LINKAGE_WARNING_REGEX = Regex(".+ uses unlinked symbols(:.*)?")
private const val LEGACY_MM_WARNING_PREFIX = "Legacy MM is deprecated and will be removed"
private fun parseLanguageFeatureArg(arg: String): String? =
substringAfter(arg, "-XXLanguage:-") ?: substringAfter(arg, "-XXLanguage:+")