[Testing] Simplify test functions
This commit is contained in:
committed by
Space Team
parent
bcfdbaa6a6
commit
041f9c4700
+1
-1
@@ -43,7 +43,7 @@ abstract class AbstractAsmLikeInstructionListingTestBase<R : ResultingArtifact.F
|
||||
+CHECK_ASM_LIKE_INSTRUCTIONS
|
||||
}
|
||||
|
||||
commonConfigurationForCodegenTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
commonConfigurationForTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
|
||||
configureClassicFrontendHandlersStep {
|
||||
useHandlers(
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ abstract class AbstractBytecodeListingTestBase<R : ResultingArtifact.FrontendOut
|
||||
+CodegenTestDirectives.CHECK_BYTECODE_LISTING
|
||||
}
|
||||
|
||||
commonConfigurationForCodegenTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
commonConfigurationForTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
commonHandlersForCodegenTest()
|
||||
|
||||
configureJvmArtifactsHandlersStep {
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ abstract class AbstractBytecodeTextTestBase<R : ResultingArtifact.FrontendOutput
|
||||
+WITH_REFLECT
|
||||
}
|
||||
|
||||
commonConfigurationForCodegenTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
commonConfigurationForTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
|
||||
commonHandlersForCodegenTest()
|
||||
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ abstract class AbstractCompileKotlinAgainstInlineKotlinTestBase<R : ResultingArt
|
||||
open val directiveToSuppressTest: ValueDirective<TargetBackend> = IGNORE_BACKEND_MULTI_MODULE
|
||||
|
||||
override fun TestConfigurationBuilder.configuration() {
|
||||
commonConfigurationForCodegenTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
commonConfigurationForTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
useInlineHandlers()
|
||||
configureCommonHandlersForBoxTest()
|
||||
useModuleStructureTransformers(
|
||||
|
||||
+5
-5
@@ -17,17 +17,17 @@ import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.builders.configureClassicFrontendHandlersStep
|
||||
import org.jetbrains.kotlin.test.builders.configureFirHandlersStep
|
||||
import org.jetbrains.kotlin.test.builders.configureJvmArtifactsHandlersStep
|
||||
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.DIAGNOSTICS
|
||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.IGNORE_DEXING
|
||||
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO
|
||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.USE_JAVAC_BASED_ON_JVM_TARGET
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JDK_KIND
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JVM_TARGET
|
||||
import org.jetbrains.kotlin.test.directives.ConfigurationDirectives.WITH_STDLIB
|
||||
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.DIAGNOSTICS
|
||||
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO
|
||||
import org.jetbrains.kotlin.test.directives.ForeignAnnotationsDirectives
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.WITH_FOREIGN_ANNOTATIONS
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.ENABLE_DEBUG_MODE
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JDK_KIND
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JVM_TARGET
|
||||
import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicDiagnosticsHandler
|
||||
import org.jetbrains.kotlin.test.frontend.fir.handlers.FirDiagnosticsHandler
|
||||
import org.jetbrains.kotlin.test.model.*
|
||||
@@ -44,7 +44,7 @@ abstract class AbstractJvmBlackBoxCodegenTestBase<R : ResultingArtifact.Frontend
|
||||
abstract val backendFacade: Constructor<BackendFacade<I, BinaryArtifacts.Jvm>>
|
||||
|
||||
override fun TestConfigurationBuilder.configuration() {
|
||||
commonConfigurationForCodegenTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
commonConfigurationForTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
|
||||
configureClassicFrontendHandlersStep {
|
||||
useHandlers(
|
||||
|
||||
+3
-1
@@ -23,7 +23,9 @@ abstract class AbstractLocalVariableTestBase<R : ResultingArtifact.FrontendOutpu
|
||||
abstract val backendFacade: Constructor<BackendFacade<I, BinaryArtifacts.Jvm>>
|
||||
|
||||
override fun TestConfigurationBuilder.configuration() {
|
||||
commonConfigurationForDebugTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
commonConfigurationForTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade) {
|
||||
commonServicesConfigurationForDebugTest(it)
|
||||
}
|
||||
|
||||
configureCommonHandlersForLocalVariableTest()
|
||||
|
||||
|
||||
+3
-2
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.test.Constructor
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.test.backend.BlackBoxCodegenSuppressor
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.builders.configureFirHandlersStep
|
||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.REQUIRES_SEPARATE_PROCESS
|
||||
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO
|
||||
import org.jetbrains.kotlin.test.model.*
|
||||
@@ -24,7 +23,9 @@ abstract class AbstractSteppingTestBase<R : ResultingArtifact.FrontendOutput<R>,
|
||||
abstract val backendFacade: Constructor<BackendFacade<I, BinaryArtifacts.Jvm>>
|
||||
|
||||
override fun TestConfigurationBuilder.configuration() {
|
||||
commonConfigurationForDebugTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
commonConfigurationForTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade) {
|
||||
commonServicesConfigurationForDebugTest(it)
|
||||
}
|
||||
|
||||
configureCommonHandlersForSteppingTest()
|
||||
|
||||
|
||||
+8
-39
@@ -21,40 +21,21 @@ import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurat
|
||||
import org.jetbrains.kotlin.test.services.configuration.ScriptingEnvironmentConfigurator
|
||||
import org.jetbrains.kotlin.test.services.sourceProviders.*
|
||||
|
||||
fun <F : ResultingArtifact.FrontendOutput<F>, B : ResultingArtifact.BackendInput<B>> TestConfigurationBuilder.commonConfigurationForCodegenAndDebugTest(
|
||||
fun <F : ResultingArtifact.FrontendOutput<F>, B : ResultingArtifact.BackendInput<B>> TestConfigurationBuilder.commonConfigurationForTest(
|
||||
targetFrontend: FrontendKind<F>,
|
||||
frontendFacade: Constructor<FrontendFacade<F>>,
|
||||
frontendToBackendConverter: Constructor<Frontend2BackendConverter<F, B>>,
|
||||
backendFacade: Constructor<BackendFacade<B, BinaryArtifacts.Jvm>>,
|
||||
commonServicesConfiguration: (FrontendKind<*>) -> Unit = { commonServicesConfigurationForCodegenTest(it) }
|
||||
) {
|
||||
commonServicesConfiguration(targetFrontend)
|
||||
facadeStep(frontendFacade)
|
||||
classicFrontendHandlersStep()
|
||||
firHandlersStep()
|
||||
commonBackendStepsConfiguration(
|
||||
frontendToBackendConverter,
|
||||
irHandlersInit = {},
|
||||
backendFacade,
|
||||
jvmHandlersInit = {}
|
||||
)
|
||||
}
|
||||
|
||||
fun <F : ResultingArtifact.FrontendOutput<F>, B : ResultingArtifact.BackendInput<B>> TestConfigurationBuilder.commonConfigurationForCodegenTest(
|
||||
targetFrontend: FrontendKind<F>,
|
||||
frontendFacade: Constructor<FrontendFacade<F>>,
|
||||
frontendToBackendConverter: Constructor<Frontend2BackendConverter<F, B>>,
|
||||
backendFacade: Constructor<BackendFacade<B, BinaryArtifacts.Jvm>>,
|
||||
) {
|
||||
commonServicesConfigurationForCodegenTest(targetFrontend)
|
||||
commonConfigurationForCodegenAndDebugTest(frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
}
|
||||
|
||||
fun <F : ResultingArtifact.FrontendOutput<F>, B : ResultingArtifact.BackendInput<B>> TestConfigurationBuilder.commonConfigurationForDebugTest(
|
||||
targetFrontend: FrontendKind<F>,
|
||||
frontendFacade: Constructor<FrontendFacade<F>>,
|
||||
frontendToBackendConverter: Constructor<Frontend2BackendConverter<F, B>>,
|
||||
backendFacade: Constructor<BackendFacade<B, BinaryArtifacts.Jvm>>,
|
||||
) {
|
||||
commonServicesConfigurationForDebugTest(targetFrontend)
|
||||
commonConfigurationForCodegenAndDebugTest(frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
facadeStep(frontendToBackendConverter)
|
||||
irHandlersStep(init = {})
|
||||
facadeStep(backendFacade)
|
||||
jvmArtifactsHandlersStep(init = {})
|
||||
}
|
||||
|
||||
private fun TestConfigurationBuilder.commonServicesConfigurationForCodegenAndDebugTest(targetFrontend: FrontendKind<*>) {
|
||||
@@ -96,18 +77,6 @@ fun TestConfigurationBuilder.commonServicesConfigurationForDebugTest(targetFront
|
||||
)
|
||||
}
|
||||
|
||||
inline fun <B : ResultingArtifact.BackendInput<B>, F : ResultingArtifact.FrontendOutput<F>> TestConfigurationBuilder.commonBackendStepsConfiguration(
|
||||
noinline frontendToBackendConverter: Constructor<Frontend2BackendConverter<F, B>>,
|
||||
irHandlersInit: HandlersStepBuilder<IrBackendInput>.() -> Unit,
|
||||
noinline backendFacade: Constructor<BackendFacade<B, BinaryArtifacts.Jvm>>,
|
||||
jvmHandlersInit: HandlersStepBuilder<BinaryArtifacts.Jvm>.() -> Unit,
|
||||
) {
|
||||
facadeStep(frontendToBackendConverter)
|
||||
irHandlersStep(irHandlersInit)
|
||||
facadeStep(backendFacade)
|
||||
jvmArtifactsHandlersStep(jvmHandlersInit)
|
||||
}
|
||||
|
||||
fun TestConfigurationBuilder.useInlineHandlers() {
|
||||
configureJvmArtifactsHandlersStep {
|
||||
inlineHandlers()
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.test.frontend.fir.FirOutputArtifact
|
||||
import org.jetbrains.kotlin.test.frontend.fir.handlers.FirDiagnosticsHandler
|
||||
import org.jetbrains.kotlin.test.model.*
|
||||
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerWithTargetBackendTest
|
||||
import org.jetbrains.kotlin.test.runners.codegen.commonConfigurationForCodegenTest
|
||||
import org.jetbrains.kotlin.test.runners.codegen.commonConfigurationForTest
|
||||
import org.jetbrains.kotlin.test.runners.codegen.configureCommonHandlersForBoxTest
|
||||
import org.jetbrains.kotlin.test.services.jvm.JvmBoxMainClassProvider
|
||||
import org.jetbrains.kotlin.test.services.service
|
||||
@@ -54,7 +54,7 @@ abstract class AbstractParcelizeBoxTestBase<R : ResultingArtifact.FrontendOutput
|
||||
+REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO
|
||||
}
|
||||
|
||||
commonConfigurationForCodegenTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
commonConfigurationForTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
|
||||
|
||||
configureClassicFrontendHandlersStep {
|
||||
useHandlers(
|
||||
|
||||
Reference in New Issue
Block a user