Move independent pre-release tests to K2 group to avoid duplication

Without this commit these tests are run twice without any reason for it.
Related to KT-62058
This commit is contained in:
Mikhail Glukhikh
2023-09-21 13:32:30 +02:00
committed by Space Team
parent 156097fe17
commit 2603077db9
2 changed files with 24 additions and 22 deletions
@@ -18,7 +18,6 @@ import org.jetbrains.kotlin.cli.transformMetadataInClassFile
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.incremental.LocalFileKotlinClass
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
@@ -28,7 +27,6 @@ import org.jetbrains.kotlin.test.ConfigurationKind
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.MockLibraryUtil
import org.jetbrains.kotlin.test.TestJdkKind
import org.jetbrains.kotlin.utils.PathUtil
import org.jetbrains.kotlin.utils.toMetadataVersion
import org.jetbrains.org.objectweb.asm.*
import org.jetbrains.org.objectweb.asm.tree.ClassNode
@@ -708,25 +706,6 @@ abstract class AbstractCompileKotlinAgainstCustomBinariesTest : AbstractKotlinCo
assertEquals("Output:\n$output", ExitCode.COMPILATION_ERROR, exitCode)
}
// If this test fails, then bootstrap compiler most likely should be advanced
fun testPreReleaseFlagIsConsistentBetweenBootstrapAndCurrentCompiler() {
val bootstrapCompiler = JarFile(PathUtil.kotlinPathsForCompiler.compilerPath)
val classFromBootstrapCompiler = bootstrapCompiler.getEntry(LanguageFeature::class.java.name.replace(".", "/") + ".class")
checkPreReleaseness(
bootstrapCompiler.getInputStream(classFromBootstrapCompiler).readBytes(),
KotlinCompilerVersion.isPreRelease()
)
}
fun testPreReleaseFlagIsConsistentBetweenStdlibAndCurrentCompiler() {
val stdlib = JarFile(PathUtil.kotlinPathsForCompiler.stdlibPath)
val classFromStdlib = stdlib.getEntry(KotlinVersion::class.java.name.replace(".", "/") + ".class")
checkPreReleaseness(
stdlib.getInputStream(classFromStdlib).readBytes(),
KotlinCompilerVersion.isPreRelease()
)
}
fun testAnonymousObjectTypeMetadata() {
val library = compileCommonLibrary(
libraryName = "library",
@@ -786,7 +765,7 @@ abstract class AbstractCompileKotlinAgainstCustomBinariesTest : AbstractKotlinCo
}
}
private fun checkPreReleaseness(classFileBytes: ByteArray, shouldBePreRelease: Boolean) {
protected fun checkPreReleaseness(classFileBytes: ByteArray, shouldBePreRelease: Boolean) {
// If there's no "xi" field in the Metadata annotation, it's value is assumed to be 0, i.e. _not_ pre-release
var isPreRelease = false
@@ -5,8 +5,12 @@
package org.jetbrains.kotlin.jvm.compiler
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.utils.PathUtil
import org.jetbrains.kotlin.utils.toMetadataVersion
import java.util.jar.JarFile
class FirCompileKotlinAgainstCustomBinariesTest : AbstractCompileKotlinAgainstCustomBinariesTest() {
override val languageVersion: LanguageVersion
@@ -54,4 +58,23 @@ class FirCompileKotlinAgainstCustomBinariesTest : AbstractCompileKotlinAgainstCu
)
compileKotlin("source.kt", tmpdir, listOf(library))
}
// If this test fails, then bootstrap compiler most likely should be advanced
fun testPreReleaseFlagIsConsistentBetweenBootstrapAndCurrentCompiler() {
val bootstrapCompiler = JarFile(PathUtil.kotlinPathsForCompiler.compilerPath)
val classFromBootstrapCompiler = bootstrapCompiler.getEntry(LanguageFeature::class.java.name.replace(".", "/") + ".class")
checkPreReleaseness(
bootstrapCompiler.getInputStream(classFromBootstrapCompiler).readBytes(),
KotlinCompilerVersion.isPreRelease()
)
}
fun testPreReleaseFlagIsConsistentBetweenStdlibAndCurrentCompiler() {
val stdlib = JarFile(PathUtil.kotlinPathsForCompiler.stdlibPath)
val classFromStdlib = stdlib.getEntry(KotlinVersion::class.java.name.replace(".", "/") + ".class")
checkPreReleaseness(
stdlib.getInputStream(classFromStdlib).readBytes(),
KotlinCompilerVersion.isPreRelease()
)
}
}