[Test] Migrate tests for java 15 to regular test infrastructure
This commit is contained in:
committed by
teamcityserver
parent
4f73ebbcbd
commit
c168a561df
-27
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
|
||||
abstract class AbstractCompileKotlinAgainstKotlinJdk15Test : AbstractCompileKotlinAgainstKotlinTest() {
|
||||
override fun invokeBox(className: String) {
|
||||
runJvmInstance(
|
||||
KtTestUtil.getJdk15Home(),
|
||||
additionalArgs = listOf("--enable-preview"),
|
||||
classPath = listOfNotNull(
|
||||
aDir, bDir, ForTestCompileRuntime.runtimeJarForTests(),
|
||||
),
|
||||
className
|
||||
)
|
||||
}
|
||||
|
||||
override fun getTestJdkKind(files: List<TestFile>): TestJdkKind {
|
||||
return TestJdkKind.FULL_JDK_15
|
||||
}
|
||||
}
|
||||
-55
@@ -15,61 +15,6 @@ import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import java.io.File
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@OptIn(ObsoleteTestInfrastructure::class)
|
||||
abstract class AbstractCustomJDKBlackBoxCodegenTest : AbstractBlackBoxCodegenTest() {
|
||||
@Throws(Exception::class)
|
||||
override fun doTest(filePath: String) {
|
||||
val file = File(filePath)
|
||||
val expectedText =
|
||||
KtTestUtil.doLoadFile(file) +
|
||||
"\n" +
|
||||
"""
|
||||
fun main() {
|
||||
val res = box()
|
||||
if (res != "OK") throw AssertionError(res)
|
||||
}
|
||||
""".trimIndent()
|
||||
val testFiles = createTestFilesFromFile(file, expectedText)
|
||||
doMultiFileTest(file, testFiles)
|
||||
}
|
||||
|
||||
override fun extractConfigurationKind(files: List<TestFile>): ConfigurationKind {
|
||||
return ConfigurationKind.NO_KOTLIN_REFLECT
|
||||
}
|
||||
|
||||
override fun runJavacTask(files: MutableCollection<File>, options: List<String>) {
|
||||
assert(KotlinTestUtils.compileJavaFilesExternally(files, options, getJdkHome())) {
|
||||
"Javac failed: $options on $files"
|
||||
}
|
||||
}
|
||||
|
||||
override fun getTestJdkKind(files: List<TestFile>): TestJdkKind {
|
||||
return getTestJdkKind()
|
||||
}
|
||||
|
||||
abstract fun getTestJdkKind(): TestJdkKind
|
||||
abstract fun getJdkHome(): File
|
||||
|
||||
open fun getAdditionalJvmArgs(): List<String> = emptyList()
|
||||
|
||||
abstract override fun getPrefix(): String
|
||||
|
||||
override fun blackBox(reportProblems: Boolean, unexpectedBehaviour: Boolean) {
|
||||
val tmpdir = KotlinTestUtils.tmpDirForTest(this)
|
||||
val fileFactory = generateClassesInFile()
|
||||
fileFactory.writeAll(tmpdir, null)
|
||||
|
||||
runJvmInstance(
|
||||
getJdkHome(), getAdditionalJvmArgs(),
|
||||
classPath = listOfNotNull(
|
||||
tmpdir, ForTestCompileRuntime.runtimeJarForTests(),
|
||||
javaClassesOutputDirectory
|
||||
),
|
||||
classNameToRun = getFacadeFqName(myFiles.psiFile)!!
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ObsoleteTestInfrastructure::class)
|
||||
internal fun runJvmInstance(
|
||||
jdkHome: File,
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
|
||||
abstract class AbstractIrCompileKotlinAgainstKotlinJdk15Test : AbstractCompileKotlinAgainstKotlinJdk15Test() {
|
||||
override fun getBackendA(): TargetBackend {
|
||||
return TargetBackend.JVM_IR
|
||||
}
|
||||
|
||||
override fun getBackendB(): TargetBackend {
|
||||
return TargetBackend.JVM_IR
|
||||
}
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractJdk15BlackBoxCodegenTest : AbstractCustomJDKBlackBoxCodegenTest() {
|
||||
override fun getTestJdkKind(): TestJdkKind = TestJdkKind.FULL_JDK_15
|
||||
override fun getJdkHome(): File = KtTestUtil.getJdk15Home()
|
||||
override fun getPrefix(): String = "java15/box"
|
||||
|
||||
override fun getAdditionalJvmArgs(): List<String> = listOf("--enable-preview")
|
||||
|
||||
override fun verifyWithDex(): Boolean = false
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
|
||||
abstract class AbstractJdk15IrBlackBoxCodegenTest : AbstractJdk15BlackBoxCodegenTest() {
|
||||
override val backend: TargetBackend
|
||||
get() = TargetBackend.JVM_IR
|
||||
}
|
||||
Reference in New Issue
Block a user