[FIR Native] KT-58549: Ensure :dist is run before the native diagnostics

Turns out `:native:tests` prepares `:kotlin-native:dist` only.
This commit is contained in:
Nikolay Lunyak
2023-05-26 16:46:42 +03:00
committed by Space Team
parent 70605c84df
commit a3cd7d074e
8 changed files with 76 additions and 43 deletions
@@ -1,108 +0,0 @@
/*
* Copyright 2010-2023 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.konan.diagnostics;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.junit.jupiter.api.Tag;
import org.jetbrains.kotlin.konan.blackboxtest.support.group.FirPipeline;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/diagnostics/nativeTests")
@TestDataPath("$PROJECT_ROOT")
@Tag("frontend-fir")
@FirPipeline()
public class DiagnosticsNativeTestGenerated extends AbstractDiagnosticsNativeTest {
@Test
public void testAllFilesPresentInNativeTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/nativeTests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("cloneableInNative.kt")
public void testCloneableInNative() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/cloneableInNative.kt");
}
@Test
@TestMetadata("identifiers.kt")
public void testIdentifiers() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/identifiers.kt");
}
@Test
@TestMetadata("isInitialized.kt")
public void testIsInitialized() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/isInitialized.kt");
}
@Test
@TestMetadata("isInitializedError.kt")
public void testIsInitializedError() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/isInitializedError.kt");
}
@Test
@TestMetadata("nativeProtectedFunCall.kt")
public void testNativeProtectedFunCall() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/nativeProtectedFunCall.kt");
}
@Test
@TestMetadata("objCName.kt")
public void testObjCName() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/objCName.kt");
}
@Test
@TestMetadata("objCRefinement.kt")
public void testObjCRefinement() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt");
}
@Test
@TestMetadata("overridesMemberWithPlatformDependent.kt")
public void testOverridesMemberWithPlatformDependent() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/overridesMemberWithPlatformDependent.kt");
}
@Test
@TestMetadata("sharedImmutable.kt")
public void testSharedImmutable() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/sharedImmutable.kt");
}
@Test
@TestMetadata("threadLocal.kt")
public void testThreadLocal() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/threadLocal.kt");
}
@Test
@TestMetadata("throws.kt")
public void testThrows() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/throws.kt");
}
@Test
@TestMetadata("throwsClash.kt")
public void testThrowsClash() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/throwsClash.kt");
}
@Test
@TestMetadata("topLevelSingleton.kt")
public void testTopLevelSingleton() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/topLevelSingleton.kt");
}
}
@@ -1,108 +0,0 @@
/*
* Copyright 2010-2023 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.konan.diagnostics;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.junit.jupiter.api.Tag;
import org.jetbrains.kotlin.konan.blackboxtest.support.group.FirPipeline;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/diagnostics/nativeTests")
@TestDataPath("$PROJECT_ROOT")
@Tag("frontend-fir")
@FirPipeline()
public class FirLightTreeOldFrontendNativeDiagnosticsTestGenerated extends AbstractFirLightTreeNativeDiagnosticsTest {
@Test
public void testAllFilesPresentInNativeTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/nativeTests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("cloneableInNative.kt")
public void testCloneableInNative() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/cloneableInNative.kt");
}
@Test
@TestMetadata("identifiers.kt")
public void testIdentifiers() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/identifiers.kt");
}
@Test
@TestMetadata("isInitialized.kt")
public void testIsInitialized() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/isInitialized.kt");
}
@Test
@TestMetadata("isInitializedError.kt")
public void testIsInitializedError() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/isInitializedError.kt");
}
@Test
@TestMetadata("nativeProtectedFunCall.kt")
public void testNativeProtectedFunCall() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/nativeProtectedFunCall.kt");
}
@Test
@TestMetadata("objCName.kt")
public void testObjCName() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/objCName.kt");
}
@Test
@TestMetadata("objCRefinement.kt")
public void testObjCRefinement() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt");
}
@Test
@TestMetadata("overridesMemberWithPlatformDependent.kt")
public void testOverridesMemberWithPlatformDependent() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/overridesMemberWithPlatformDependent.kt");
}
@Test
@TestMetadata("sharedImmutable.kt")
public void testSharedImmutable() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/sharedImmutable.kt");
}
@Test
@TestMetadata("threadLocal.kt")
public void testThreadLocal() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/threadLocal.kt");
}
@Test
@TestMetadata("throws.kt")
public void testThrows() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/throws.kt");
}
@Test
@TestMetadata("throwsClash.kt")
public void testThrowsClash() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/throwsClash.kt");
}
@Test
@TestMetadata("topLevelSingleton.kt")
public void testTopLevelSingleton() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/topLevelSingleton.kt");
}
}
@@ -1,108 +0,0 @@
/*
* Copyright 2010-2023 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.konan.diagnostics;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.junit.jupiter.api.Tag;
import org.jetbrains.kotlin.konan.blackboxtest.support.group.FirPipeline;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/diagnostics/nativeTests")
@TestDataPath("$PROJECT_ROOT")
@Tag("frontend-fir")
@FirPipeline()
public class FirPsiOldFrontendNativeDiagnosticsTestGenerated extends AbstractFirPsiNativeDiagnosticsTest {
@Test
public void testAllFilesPresentInNativeTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/nativeTests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("cloneableInNative.kt")
public void testCloneableInNative() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/cloneableInNative.kt");
}
@Test
@TestMetadata("identifiers.kt")
public void testIdentifiers() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/identifiers.kt");
}
@Test
@TestMetadata("isInitialized.kt")
public void testIsInitialized() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/isInitialized.kt");
}
@Test
@TestMetadata("isInitializedError.kt")
public void testIsInitializedError() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/isInitializedError.kt");
}
@Test
@TestMetadata("nativeProtectedFunCall.kt")
public void testNativeProtectedFunCall() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/nativeProtectedFunCall.kt");
}
@Test
@TestMetadata("objCName.kt")
public void testObjCName() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/objCName.kt");
}
@Test
@TestMetadata("objCRefinement.kt")
public void testObjCRefinement() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt");
}
@Test
@TestMetadata("overridesMemberWithPlatformDependent.kt")
public void testOverridesMemberWithPlatformDependent() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/overridesMemberWithPlatformDependent.kt");
}
@Test
@TestMetadata("sharedImmutable.kt")
public void testSharedImmutable() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/sharedImmutable.kt");
}
@Test
@TestMetadata("threadLocal.kt")
public void testThreadLocal() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/threadLocal.kt");
}
@Test
@TestMetadata("throws.kt")
public void testThrows() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/throws.kt");
}
@Test
@TestMetadata("throwsClash.kt")
public void testThrowsClash() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/throwsClash.kt");
}
@Test
@TestMetadata("topLevelSingleton.kt")
public void testTopLevelSingleton() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/topLevelSingleton.kt");
}
}
@@ -17,16 +17,11 @@ import org.jetbrains.kotlin.konan.blackboxtest.support.group.*
import org.jetbrains.kotlin.konan.blackboxtest.support.group.DisabledTestsIfProperty
import org.jetbrains.kotlin.konan.blackboxtest.support.group.FirPipeline
import org.jetbrains.kotlin.konan.blackboxtest.support.group.UsePartialLinkage
import org.jetbrains.kotlin.konan.diagnostics.AbstractDiagnosticsNativeTest
import org.jetbrains.kotlin.konan.diagnostics.AbstractFirLightTreeNativeDiagnosticsTest
import org.jetbrains.kotlin.konan.diagnostics.AbstractFirPsiNativeDiagnosticsTest
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.utils.CUSTOM_TEST_DATA_EXTENSION_PATTERN
import org.junit.jupiter.api.Tag
fun main() {
System.setProperty("java.awt.headless", "true")
val excludedCustomTestdataPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN
generateTestGroupSuiteWithJUnit5 {
// Codegen box tests.
@@ -221,29 +216,6 @@ fun main() {
model("lldb")
}
}
// New frontend test infrastructure tests
testGroup(testsRoot = "native/native.tests/tests-gen", testDataRoot = "compiler/testData") {
testClass<AbstractDiagnosticsNativeTest>(
annotations = listOf(*frontendFir()),
) {
model("diagnostics/nativeTests", excludedPattern = excludedCustomTestdataPattern)
}
testClass<AbstractFirPsiNativeDiagnosticsTest>(
suiteTestClassName = "FirPsiOldFrontendNativeDiagnosticsTestGenerated",
annotations = listOf(*frontendFir()),
) {
model("diagnostics/nativeTests", excludedPattern = excludedCustomTestdataPattern)
}
testClass<AbstractFirLightTreeNativeDiagnosticsTest>(
suiteTestClassName = "FirLightTreeOldFrontendNativeDiagnosticsTestGenerated",
annotations = listOf(*frontendFir()),
) {
model("diagnostics/nativeTests", excludedPattern = excludedCustomTestdataPattern)
}
}
}
}
@@ -1,130 +0,0 @@
/*
* Copyright 2010-2023 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.konan.diagnostics
import org.jetbrains.kotlin.platform.konan.NativePlatforms
import org.jetbrains.kotlin.test.Constructor
import org.jetbrains.kotlin.test.FirParser
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.builders.classicFrontendHandlersStep
import org.jetbrains.kotlin.test.builders.firHandlersStep
import org.jetbrains.kotlin.test.directives.*
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendOutputArtifact
import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicDiagnosticsHandler
import org.jetbrains.kotlin.test.frontend.classic.handlers.DeclarationsDumpHandler
import org.jetbrains.kotlin.test.frontend.classic.handlers.OldNewInferenceMetaInfoProcessor
import org.jetbrains.kotlin.test.frontend.fir.FirFrontendFacade
import org.jetbrains.kotlin.test.frontend.fir.FirOutputArtifact
import org.jetbrains.kotlin.test.frontend.fir.handlers.*
import org.jetbrains.kotlin.test.model.*
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest
import org.jetbrains.kotlin.test.runners.configurationForClassicAndFirTestsAlongside
import org.jetbrains.kotlin.test.runners.enableLazyResolvePhaseChecking
import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator
import org.jetbrains.kotlin.test.services.configuration.NativeEnvironmentConfigurator
import org.jetbrains.kotlin.test.services.sourceProviders.AdditionalDiagnosticsSourceFilesProvider
import org.jetbrains.kotlin.test.services.sourceProviders.CoroutineHelpersSourceFilesProvider
abstract class AbstractDiagnosticsNativeTestBase<R : ResultingArtifact.FrontendOutput<R>> : AbstractKotlinCompilerTest() {
abstract val targetFrontend: FrontendKind<R>
abstract val frontend: Constructor<FrontendFacade<R>>
abstract fun handlersSetup(builder: TestConfigurationBuilder)
override fun TestConfigurationBuilder.configuration() {
globalDefaults {
frontend = targetFrontend
targetPlatform = NativePlatforms.unspecifiedNativePlatform
dependencyKind = DependencyKind.Source
}
defaultDirectives {
+JvmEnvironmentConfigurationDirectives.USE_PSI_CLASS_FILES_READING
}
enableMetaInfoHandler()
useConfigurators(
::CommonEnvironmentConfigurator,
::NativeEnvironmentConfigurator,
)
useMetaInfoProcessors(::OldNewInferenceMetaInfoProcessor)
useAdditionalSourceProviders(
::AdditionalDiagnosticsSourceFilesProvider,
::CoroutineHelpersSourceFilesProvider,
)
facadeStep(frontend)
handlersSetup(this)
forTestsMatching("testData/diagnostics/nativeTests/*") {
defaultDirectives {
+LanguageSettingsDirectives.ALLOW_KOTLIN_PACKAGE
+ConfigurationDirectives.WITH_STDLIB
}
}
forTestsMatching("testData/diagnostics/nativeTests/testsWithStdLib/*") {
defaultDirectives {
+ConfigurationDirectives.WITH_STDLIB
}
}
}
}
abstract class AbstractDiagnosticsNativeTest : AbstractDiagnosticsNativeTestBase<ClassicFrontendOutputArtifact>() {
override val targetFrontend: FrontendKind<ClassicFrontendOutputArtifact>
get() = FrontendKinds.ClassicFrontend
override val frontend: Constructor<FrontendFacade<ClassicFrontendOutputArtifact>>
get() = ::ClassicFrontendFacade
override fun handlersSetup(builder: TestConfigurationBuilder) {
builder.classicFrontendHandlersStep {
useHandlers(
::DeclarationsDumpHandler,
::ClassicDiagnosticsHandler,
)
}
}
}
abstract class AbstractFirNativeDiagnosticsTestBase(val parser: FirParser) : AbstractDiagnosticsNativeTestBase<FirOutputArtifact>() {
override val targetFrontend: FrontendKind<FirOutputArtifact>
get() = FrontendKinds.FIR
override val frontend: Constructor<FrontendFacade<FirOutputArtifact>>
get() = ::FirFrontendFacade
override fun handlersSetup(builder: TestConfigurationBuilder) {
builder.firHandlersStep {
useHandlers(
::FirDiagnosticsHandler,
::FirDumpHandler,
::FirCfgDumpHandler,
::FirCfgConsistencyHandler,
::FirResolvedTypesVerifier,
::FirScopeDumpHandler,
)
}
}
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
with(builder) {
configureFirParser(parser)
enableLazyResolvePhaseChecking()
forTestsMatching("compiler/testData/diagnostics/*") {
configurationForClassicAndFirTestsAlongside()
}
}
}
}
abstract class AbstractFirPsiNativeDiagnosticsTest : AbstractFirNativeDiagnosticsTestBase(FirParser.Psi)
abstract class AbstractFirLightTreeNativeDiagnosticsTest : AbstractFirNativeDiagnosticsTestBase(FirParser.LightTree)