/* * Copyright 2010-2018 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.generators.tests import org.jetbrains.kotlin.asJava.AbstractCompilerLightClassTest import org.jetbrains.kotlin.cfg.AbstractControlFlowTest import org.jetbrains.kotlin.cfg.AbstractDataFlowTest import org.jetbrains.kotlin.cfg.AbstractDiagnosticsWithModifiedMockJdkTest import org.jetbrains.kotlin.cfg.AbstractPseudoValueTest import org.jetbrains.kotlin.checkers.* import org.jetbrains.kotlin.checkers.javac.* import org.jetbrains.kotlin.cli.AbstractCliTest import org.jetbrains.kotlin.codegen.* import org.jetbrains.kotlin.codegen.debugInformation.AbstractIrLocalVariableTest import org.jetbrains.kotlin.codegen.debugInformation.AbstractIrSteppingTest import org.jetbrains.kotlin.codegen.debugInformation.AbstractLocalVariableTest import org.jetbrains.kotlin.codegen.debugInformation.AbstractSteppingTest import org.jetbrains.kotlin.codegen.defaultConstructor.AbstractDefaultArgumentsReflectionTest import org.jetbrains.kotlin.codegen.flags.AbstractWriteFlagsTest import org.jetbrains.kotlin.codegen.ir.* import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.builder.AbstractPartialRawFirBuilderTestCase import org.jetbrains.kotlin.fir.builder.AbstractRawFirBuilderLazyBodiesTestCase import org.jetbrains.kotlin.fir.builder.AbstractRawFirBuilderSourceElementMappingTestCase import org.jetbrains.kotlin.fir.builder.AbstractRawFirBuilderTestCase import org.jetbrains.kotlin.fir.java.AbstractFirOldFrontendLightClassesTest import org.jetbrains.kotlin.fir.java.AbstractFirTypeEnhancementTest import org.jetbrains.kotlin.fir.java.AbstractOwnFirTypeEnhancementTest import org.jetbrains.kotlin.fir.lightTree.AbstractLightTree2FirConverterTestCase import org.jetbrains.kotlin.generators.tests.generator.testGroupSuite import org.jetbrains.kotlin.generators.util.KT_OR_KTS_WITHOUT_DOTS_IN_NAME import org.jetbrains.kotlin.generators.util.KT_WITHOUT_DOTS_IN_NAME import org.jetbrains.kotlin.integration.AbstractAntTaskTest import org.jetbrains.kotlin.ir.AbstractIrCfgTestCase import org.jetbrains.kotlin.ir.AbstractIrJsTextTestCase import org.jetbrains.kotlin.ir.AbstractIrSourceRangesTestCase import org.jetbrains.kotlin.ir.AbstractIrTextTestCase import org.jetbrains.kotlin.jvm.compiler.* import org.jetbrains.kotlin.jvm.compiler.ir.AbstractIrCompileJavaAgainstKotlinTest import org.jetbrains.kotlin.jvm.compiler.ir.AbstractIrCompileKotlinAgainstJavaTest import org.jetbrains.kotlin.jvm.compiler.ir.AbstractIrLoadJavaTest import org.jetbrains.kotlin.jvm.compiler.javac.AbstractLoadJavaUsingJavacTest import org.jetbrains.kotlin.lexer.kdoc.AbstractKDocLexerTest import org.jetbrains.kotlin.lexer.kotlin.AbstractKotlinLexerTest import org.jetbrains.kotlin.modules.xml.AbstractModuleXmlParserTest import org.jetbrains.kotlin.multiplatform.AbstractMultiPlatformIntegrationTest import org.jetbrains.kotlin.parsing.AbstractParsingTest import org.jetbrains.kotlin.renderer.AbstractDescriptorRendererTest import org.jetbrains.kotlin.renderer.AbstractFunctionDescriptorInExpressionRendererTest import org.jetbrains.kotlin.repl.AbstractReplInterpreterTest import org.jetbrains.kotlin.resolve.AbstractResolveTest import org.jetbrains.kotlin.resolve.annotation.AbstractAnnotationParameterTest import org.jetbrains.kotlin.resolve.calls.AbstractResolvedCallsTest import org.jetbrains.kotlin.resolve.calls.AbstractResolvedConstructorDelegationCallsTests import org.jetbrains.kotlin.resolve.constants.evaluate.AbstractCompileTimeConstantEvaluatorTest import org.jetbrains.kotlin.resolve.constraintSystem.AbstractConstraintSystemTest import org.jetbrains.kotlin.serialization.AbstractLocalClassProtoTest import org.jetbrains.kotlin.test.TargetBackend import org.jetbrains.kotlin.types.AbstractTypeBindingTest import org.jetbrains.kotlin.visualizer.fir.AbstractFirVisualizer import org.jetbrains.kotlin.visualizer.psi.AbstractPsiVisualizer fun main(args: Array) { System.setProperty("java.awt.headless", "true") val excludedFirTestdataPattern = "^(.+)\\.fir\\.kts?\$" testGroupSuite(args) { testGroup("compiler/tests-gen", "compiler/testData") { testClass(suiteTestClassName = "DiagnosticsTestGenerated") { model("diagnostics/tests", pattern = "^(.*)\\.kts?$", excludedPattern = excludedFirTestdataPattern) model("codegen/box/diagnostics") } testClass { model("diagnostics/tests", excludedPattern = excludedFirTestdataPattern) model("codegen/box/diagnostics") } testClass { model("javac/diagnostics/tests", excludedPattern = excludedFirTestdataPattern) model( "javac/diagnostics/tests", testClassName = "TestsWithoutJavac", testMethod = "doTestWithoutJavacWrapper", excludedPattern = excludedFirTestdataPattern ) } testClass { model("javac/fieldsResolution/tests") model("javac/fieldsResolution/tests", testClassName = "TestsWithoutJavac", testMethod = "doTestWithoutJavacWrapper") } testClass { model("diagnostics/testsWithStdLib", excludedPattern = excludedFirTestdataPattern) } testClass { model("diagnostics/testsWithStdLib", excludedPattern = excludedFirTestdataPattern) } testClass { model("diagnostics/testsWithJsStdLib") } testClass { model("diagnostics/testsWithJsStdLibAndBackendCompilation") } testClass { model("diagnostics/nativeTests") } testClass { model("diagnostics/testWithModifiedMockJdk") } testClass { model("diagnostics/testsWithJava9") } testClass { model("diagnostics/testsWithJava15") } testClass { model("diagnostics/testsWithUnsignedTypes") } testClass { model("diagnostics/testsWithExplicitApi") } testClass { model("diagnostics/testsWithJvmBackend", targetBackend = TargetBackend.JVM_OLD) } testClass { model("diagnostics/testsWithJvmBackend", targetBackend = TargetBackend.JVM_IR) } testClass { model("multiplatform", extension = null, recursive = true, excludeParentDirs = true) } testClass { model("foreignAnnotations/tests") } testClass { model("foreignAnnotations/tests") } testClass { model("foreignAnnotations/tests") } testClass { model("foreignAnnotations/tests") } testClass { model("resolve", extension = "resolve") } testClass { model("resolvedCalls", excludeDirs = listOf("enhancedSignatures")) } testClass { model("resolveConstructorDelegationCalls") } testClass { model("constraintSystem", extension = "constraints") } testClass { model("psi", testMethod = "doParsingTest", pattern = "^(.*)\\.kts?$") model("parseCodeFragment/expression", testMethod = "doExpressionCodeFragmentParsingTest", extension = "kt") model("parseCodeFragment/block", testMethod = "doBlockCodeFragmentParsingTest", extension = "kt") } testClass { model("codegen/box", targetBackend = TargetBackend.JVM) } testClass { // "ranges/stepped" is excluded because it contains hundreds of generated tests and only have a box() method. // There isn't much to be gained from running light analysis tests on them. model("codegen/box", targetBackend = TargetBackend.JVM, skipIgnored = true, excludeDirs = listOf("ranges/stepped")) } testClass { model("codegen/kapt", targetBackend = TargetBackend.JVM) } testClass { model("codegen/asmLike", targetBackend = TargetBackend.JVM) } testClass { model("codegen/boxInline", targetBackend = TargetBackend.JVM) } testClass { model("codegen/boxAgainstJava") } testClass { model("codegen/java15/box") } testClass { model("codegen/java15/box", targetBackend = TargetBackend.JVM_IR) } testClass { model("codegen/java9/box") } testClass { model("codegen/script", extension = "kts") } testClass { model("codegen/customScript", pattern = "^(.*)$") } testClass { model("codegen/bytecodeText", targetBackend = TargetBackend.JVM) } testClass { model("ir/irText") } testClass { model("ir/irJsText", pattern = "^(.+)\\.kt(s)?\$") } testClass { model("ir/irCfg") } testClass { model("ir/sourceRanges") } testClass { model("codegen/bytecodeListing", targetBackend = TargetBackend.JVM) } testClass { model("codegen/topLevelMemberInvocation", extension = null, recursive = false) } testClass { model("checkLocalVariablesTable", targetBackend = TargetBackend.JVM) } testClass { model("writeFlags", targetBackend = TargetBackend.JVM) } testClass { model("codegen/defaultArguments/reflection") } testClass { model("codegen/dumpDeclarations") } testClass { model("loadJava/compiledJava", extension = "java", testMethod = "doTestCompiledJava") model("loadJava/compiledJavaAndKotlin", extension = "txt", testMethod = "doTestCompiledJavaAndKotlin") model( "loadJava/compiledJavaIncludeObjectMethods", extension = "java", testMethod = "doTestCompiledJavaIncludeObjectMethods" ) model("loadJava/compiledKotlin", testMethod = "doTestCompiledKotlin") model("loadJava/compiledKotlinWithStdlib", testMethod = "doTestCompiledKotlinWithStdlib") model("loadJava/javaAgainstKotlin", extension = "txt", testMethod = "doTestJavaAgainstKotlin") model( "loadJava/kotlinAgainstCompiledJavaWithKotlin", extension = "kt", testMethod = "doTestKotlinAgainstCompiledJavaWithKotlin", recursive = false ) model("loadJava/sourceJava", extension = "java", testMethod = "doTestSourceJava") } testClass { model("loadJava/compiledJava", extension = "java", testMethod = "doTestCompiledJava") model("loadJava/compiledJavaAndKotlin", extension = "txt", testMethod = "doTestCompiledJavaAndKotlin") model( "loadJava/compiledJavaIncludeObjectMethods", extension = "java", testMethod = "doTestCompiledJavaIncludeObjectMethods" ) model("loadJava/compiledKotlin", testMethod = "doTestCompiledKotlin") model("loadJava/compiledKotlinWithStdlib", testMethod = "doTestCompiledKotlinWithStdlib") model("loadJava/javaAgainstKotlin", extension = "txt", testMethod = "doTestJavaAgainstKotlin") model( "loadJava/kotlinAgainstCompiledJavaWithKotlin", extension = "kt", testMethod = "doTestKotlinAgainstCompiledJavaWithKotlin", recursive = false ) model("loadJava/sourceJava", extension = "java", testMethod = "doTestSourceJava") } testClass { model("loadJava/compiledKotlin") } testClass { model("loadJava/compiledJava", extension = "java", testMethod = "doTestCompiledJava") } testClass { model("loadJava15", extension = "java", testMethod = "doTestCompiledJava", testClassName = "CompiledJava") model("loadJava15", extension = "java", testMethod = "doTestSourceJava", testClassName = "SourceJava") } testClass { model("loadJava15", extension = "java", testMethod = "doTestCompiledJava") } testClass { model( "compileJavaAgainstKotlin", testClassName = "WithoutJavac", testMethod = "doTestWithoutJavac", targetBackend = TargetBackend.JVM ) model( "compileJavaAgainstKotlin", testClassName = "WithJavac", testMethod = "doTestWithJavac", targetBackend = TargetBackend.JVM ) } testClass { model( "compileKotlinAgainstJava", testClassName = "WithAPT", testMethod = "doTestWithAPT", targetBackend = TargetBackend.JVM ) model( "compileKotlinAgainstJava", testClassName = "WithoutAPT", testMethod = "doTestWithoutAPT", targetBackend = TargetBackend.JVM ) } testClass { model("compileKotlinAgainstKotlin") } testClass { model("compileKotlinAgainstKotlinJdk15") } testClass { model("compileKotlinAgainstKotlinJdk15", targetBackend = TargetBackend.JVM_IR) } testClass { model("renderer") } testClass { model("renderFunctionDescriptorInExpression") } testClass { model("modules.xml", extension = "xml") } testClass { model("writeSignature") } testClass { model("cli/jvm", extension = "args", testMethod = "doJvmTest", recursive = false) model("cli/js", extension = "args", testMethod = "doJsTest", recursive = false) model("cli/js-dce", extension = "args", testMethod = "doJsDceTest", recursive = false) model("cli/metadata", extension = "args", testMethod = "doMetadataTest", recursive = false) } testClass { model("repl", extension = "repl") } testClass { model("integration/ant/jvm", extension = null, recursive = false, excludeParentDirs = true) } testClass { model("cfg") model("cfgWithStdLib", testMethod = "doTestWithStdLib") } testClass { model("cfg-variables") model("cfgVariablesWithStdLib", testMethod = "doTestWithStdLib") } testClass { model("cfg") model("cfgWithStdLib", testMethod = "doTestWithStdLib") model("cfg-variables") model("cfgVariablesWithStdLib", testMethod = "doTestWithStdLib") } testClass { model("resolveAnnotations/parameters") } testClass { model("evaluate/constant", testMethod = "doConstantTest") model("evaluate/isPure", testMethod = "doIsPureTest") model("evaluate/usesVariableAsConstant", testMethod = "doUsesVariableAsConstantTest") } testClass { model("asJava/lightClasses", excludeDirs = listOf("local", "ideRegression"), pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) } testClass { model("type/binding") } testClass(useJunit4 = true) { model("debug/stepping", targetBackend = TargetBackend.JVM) } testClass(useJunit4 = true) { model("debug/localVariables", targetBackend = TargetBackend.JVM) } testClass { model("serialization/local") } testClass { model("lexer/kdoc") } testClass { model("lexer/kotlin") } testClass { model("codegen/composeLike", targetBackend = TargetBackend.JVM_IR) } testClass { model("codegen/composeLikeBytecodeText", targetBackend = TargetBackend.JVM_IR) } testClass { model("codegen/box", targetBackend = TargetBackend.JVM_IR, excludeDirs = listOf("oldLanguageVersions")) } testClass { model("codegen/boxAgainstJava", targetBackend = TargetBackend.JVM_IR, excludeDirs = listOf("oldLanguageVersions")) } testClass { model( "compileJavaAgainstKotlin", testClassName = "WithoutJavac", testMethod = "doTestWithoutJavac", targetBackend = TargetBackend.JVM_IR ) model( "compileJavaAgainstKotlin", testClassName = "WithJavac", testMethod = "doTestWithJavac", targetBackend = TargetBackend.JVM_IR ) } testClass { model( "compileKotlinAgainstJava", testClassName = "WithAPT", testMethod = "doTestWithAPT", targetBackend = TargetBackend.JVM_IR ) model( "compileKotlinAgainstJava", testClassName = "WithoutAPT", testMethod = "doTestWithoutAPT", targetBackend = TargetBackend.JVM_IR ) } testClass { model("compileKotlinAgainstKotlin", targetBackend = TargetBackend.JVM_IR) } testClass { model("compileKotlinAgainstKotlin", targetBackend = TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD) } testClass { model( "compileKotlinAgainstKotlin", targetBackend = TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR ) } testClass { model("codegen/bytecodeListing", targetBackend = TargetBackend.JVM_IR) } testClass { model("checkLocalVariablesTable", targetBackend = TargetBackend.JVM_IR) } testClass { model("writeFlags", targetBackend = TargetBackend.JVM_IR) } testClass { model("writeSignature", targetBackend = TargetBackend.JVM_IR) } testClass { model("loadJava/compiledJava", extension = "java", testMethod = "doTestCompiledJava", targetBackend = TargetBackend.JVM_IR) model( "loadJava/compiledJavaAndKotlin", extension = "txt", testMethod = "doTestCompiledJavaAndKotlin", targetBackend = TargetBackend.JVM_IR ) model( "loadJava/compiledJavaIncludeObjectMethods", extension = "java", testMethod = "doTestCompiledJavaIncludeObjectMethods", targetBackend = TargetBackend.JVM_IR ) model("loadJava/compiledKotlin", testMethod = "doTestCompiledKotlin", targetBackend = TargetBackend.JVM_IR) model( "loadJava/compiledKotlinWithStdlib", testMethod = "doTestCompiledKotlinWithStdlib", targetBackend = TargetBackend.JVM_IR ) model( "loadJava/javaAgainstKotlin", extension = "txt", testMethod = "doTestJavaAgainstKotlin", targetBackend = TargetBackend.JVM_IR ) model( "loadJava/kotlinAgainstCompiledJavaWithKotlin", extension = "kt", testMethod = "doTestKotlinAgainstCompiledJavaWithKotlin", recursive = false, targetBackend = TargetBackend.JVM_IR ) model("loadJava/sourceJava", extension = "java", testMethod = "doTestSourceJava", targetBackend = TargetBackend.JVM_IR) } testClass(useJunit4 = true) { model("debug/stepping", targetBackend = TargetBackend.JVM_IR) } testClass(useJunit4 = true) { model("debug/localVariables", targetBackend = TargetBackend.JVM_IR) } testClass { model("codegen/boxInline", targetBackend = TargetBackend.JVM_IR) } testClass { model("codegen/bytecodeText", targetBackend = TargetBackend.JVM_IR, excludeDirs = listOf("oldLanguageVersions")) } testClass { model("codegen/asmLike", targetBackend = TargetBackend.JVM_IR) } testClass { model("codegen/script", extension = "kts", targetBackend = TargetBackend.JVM_IR) } } testGroup( "compiler/fir/fir2ir/tests-gen", "compiler/testData", testRunnerMethodName = "runTestWithCustomIgnoreDirective", additionalRunnerArguments = listOf("\"// IGNORE_BACKEND_FIR: \"") ) { testClass { model("codegen/box", targetBackend = TargetBackend.JVM_IR, excludeDirs = listOf("oldLanguageVersions")) } testClass { model("codegen/boxInline", targetBackend = TargetBackend.JVM_IR, excludeDirs = listOf("oldLanguageVersions")) } testClass { model("codegen/boxAgainstJava", targetBackend = TargetBackend.JVM_IR, excludeDirs = listOf("oldLanguageVersions")) } testClass { model("codegen/bytecodeText", targetBackend = TargetBackend.JVM_IR, excludeDirs = listOf("oldLanguageVersions")) } testClass { model("compileKotlinAgainstKotlin", targetBackend = TargetBackend.JVM_IR) } } testGroup( "compiler/tests-gen", "compiler/testData", testRunnerMethodName = "runTestWithCustomIgnoreDirective", additionalRunnerArguments = listOf("\"// IGNORE_BACKEND_MULTI_MODULE: \"") ) { testClass { model("codegen/boxInline", targetBackend = TargetBackend.JVM) } testClass { model("codegen/boxInline", targetBackend = TargetBackend.JVM_IR) } testClass { model("codegen/boxInline", targetBackend = TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD) } testClass { model( "codegen/boxInline", targetBackend = TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR ) } } testGroup("compiler/fir/raw-fir/psi2fir/tests-gen", "compiler/fir/raw-fir/psi2fir/testData") { testClass { model("rawBuilder", testMethod = "doRawFirTest") } testClass { model("rawBuilder", testMethod = "doRawFirTest") } testClass { model("sourceElementMapping", testMethod = "doRawFirTest") } } testGroup("compiler/fir/raw-fir/psi2fir/tests-gen", "compiler/fir/raw-fir/psi2fir/testData") { testClass { model("partialRawBuilder", testMethod = "doRawFirTest") } } testGroup("compiler/fir/raw-fir/light-tree2fir/tests-gen", "compiler/fir/raw-fir/psi2fir/testData") { testClass { model("rawBuilder") } } testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/fir/analysis-tests/testData") { testClass { model("resolve", pattern = KT_WITHOUT_DOTS_IN_NAME) } testClass { model("resolve", pattern = KT_WITHOUT_DOTS_IN_NAME) } testClass { model("resolve", pattern = KT_WITHOUT_DOTS_IN_NAME) } } testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/fir/analysis-tests/testData") { testClass { model("resolveWithStdlib", pattern = KT_WITHOUT_DOTS_IN_NAME) } } testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/testData") { testClass { model("loadJava/compiledKotlin", extension = "kt") } } testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/testData") { testClass { model("loadJava/compiledJava", extension = "java") } } testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/fir/analysis-tests/testData") { testClass { model("enhancement", extension = "java") } } testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/testData") { testClass { model("diagnostics/tests", excludedPattern = excludedFirTestdataPattern) } testClass { model( "diagnostics/testsWithStdLib", excludedPattern = excludedFirTestdataPattern ) } } testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/fir/analysis-tests/testData") { testClass { model("lightClasses") } } testGroup( "compiler/fir/fir2ir/tests-gen", "compiler/testData", testRunnerMethodName = "runTestWithCustomIgnoreDirective", additionalRunnerArguments = listOf("\"// IGNORE_BACKEND_FIR: \"") ) { testClass { model("ir/irText") } } testGroup("compiler/visualizer/tests-gen", "compiler/fir/raw-fir/psi2fir/testData") { testClass("PsiVisualizerForRawFirDataGenerated") { model("rawBuilder", testMethod = "doFirBuilderDataTest") } testClass("FirVisualizerForRawFirDataGenerated") { model("rawBuilder", testMethod = "doFirBuilderDataTest") } } testGroup("compiler/visualizer/tests-gen", "compiler/visualizer/testData") { testClass("PsiVisualizerForUncommonCasesGenerated") { model("uncommonCases/testFiles", testMethod = "doUncommonCasesTest") } testClass("FirVisualizerForUncommonCasesGenerated") { model("uncommonCases/testFiles", testMethod = "doUncommonCasesTest") } } testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/fir/analysis-tests/testData") { testClass { model("extendedCheckers", pattern = KT_WITHOUT_DOTS_IN_NAME) } } testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/fir/analysis-tests/testData") { testClass { model("extendedCheckers", pattern = KT_WITHOUT_DOTS_IN_NAME) } } } }