[Test] Require specifying parser for FIR test. Unify names for FIR tests

Now all tests with `Fir` in name are named accordingly to parser which
  is used in them -- `FirPsi` or `FirLightTree`. This is needed to keep
  consistency between different types of tests, because there is no
  single default in parser mode between different scenarios of using FIR
This commit is contained in:
Dmitriy Novozhilov
2023-02-20 12:14:46 +02:00
committed by Space Team
parent 7e36a88b82
commit da581f38e1
95 changed files with 361 additions and 306 deletions
@@ -17,12 +17,14 @@
package org.jetbrains.kotlin.allopen
import org.jetbrains.kotlin.test.Constructor
import org.jetbrains.kotlin.test.FirParser
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.backend.classic.ClassicBackendInput
import org.jetbrains.kotlin.test.backend.classic.ClassicJvmBackendFacade
import org.jetbrains.kotlin.test.backend.ir.IrBackendInput
import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.configureFirParser
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2ClassicBackendConverter
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2IrConverter
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade
@@ -69,7 +71,7 @@ open class AbstractIrBytecodeListingTestForAllOpen :
get() = ::JvmIrBackendFacade
}
open class AbstractFirBytecodeListingTestForAllOpen :
open class AbstractFirPsiBytecodeListingTestForAllOpen :
AbstractBytecodeListingTestForAllOpenBase<FirOutputArtifact, IrBackendInput>(
TargetBackend.JVM_IR, FrontendKinds.FIR
) {
@@ -79,4 +81,9 @@ open class AbstractFirBytecodeListingTestForAllOpen :
get() = ::Fir2IrResultsConverter
override val backendFacade: Constructor<BackendFacade<IrBackendInput, BinaryArtifacts.Jvm>>
get() = ::JvmIrBackendFacade
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.configureFirParser(FirParser.Psi)
}
}
@@ -17,11 +17,11 @@
package org.jetbrains.kotlin.allopen
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives
import org.jetbrains.kotlin.test.runners.AbstractFirDiagnosticTest
import org.jetbrains.kotlin.test.FirParser
import org.jetbrains.kotlin.test.runners.AbstractFirDiagnosticTestBase
import org.jetbrains.kotlin.test.runners.configurationForClassicAndFirTestsAlongside
abstract class AbstractFirDiagnosticTestForAllOpen : AbstractFirDiagnosticTest() {
abstract class AbstractFirDiagnosticTestForAllOpenBase(parser: FirParser) : AbstractFirDiagnosticTestBase(parser) {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
@@ -32,14 +32,5 @@ abstract class AbstractFirDiagnosticTestForAllOpen : AbstractFirDiagnosticTest()
}
}
abstract class AbstractFirDiagnosticsWithLightTreeTestForAllOpen : AbstractFirDiagnosticTestForAllOpen() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
with(builder) {
defaultDirectives {
+FirDiagnosticsDirectives.USE_LIGHT_TREE
}
}
}
}
abstract class AbstractFirPsiDiagnosticTestForAllOpen : AbstractFirDiagnosticTestForAllOpenBase(FirParser.Psi)
abstract class AbstractFirLightTreeDiagnosticTestForAllOpen : AbstractFirDiagnosticTestForAllOpenBase(FirParser.LightTree)
@@ -18,7 +18,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("plugins/allopen/testData/diagnostics")
@TestDataPath("$PROJECT_ROOT")
public class FirDiagnosticsWithLightTreeTestForAllOpenGenerated extends AbstractFirDiagnosticsWithLightTreeTestForAllOpen {
public class FirLightTreeDiagnosticTestForAllOpenGenerated extends AbstractFirLightTreeDiagnosticTestForAllOpen {
@Test
public void testAllFilesPresentInDiagnostics() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/allopen/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
@@ -19,7 +19,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("plugins/allopen/testData/bytecodeListing")
@TestDataPath("$PROJECT_ROOT")
public class FirBytecodeListingTestForAllOpenGenerated extends AbstractFirBytecodeListingTestForAllOpen {
public class FirPsiBytecodeListingTestForAllOpenGenerated extends AbstractFirPsiBytecodeListingTestForAllOpen {
@Test
public void testAllFilesPresentInBytecodeListing() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/allopen/testData/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), TargetBackend.JVM_IR, true);
@@ -18,7 +18,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("plugins/allopen/testData/diagnostics")
@TestDataPath("$PROJECT_ROOT")
public class FirDiagnosticTestForAllOpenGenerated extends AbstractFirDiagnosticTestForAllOpen {
public class FirPsiDiagnosticTestForAllOpenGenerated extends AbstractFirPsiDiagnosticTestForAllOpen {
@Test
public void testAllFilesPresentInDiagnostics() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/allopen/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);