[FIR Native] Stop requiring :dist for native diagnostic test

Native uses its own klib stdlib generated
via `:kotlin-native:dist`.
This commit is contained in:
Nikolay Lunyak
2023-06-05 14:00:30 +03:00
committed by Space Team
parent 0f4cca6877
commit 45bbd432fc
10 changed files with 43 additions and 85 deletions
@@ -12,7 +12,7 @@ open class ProtectedInsideInlineError : ProtectedInsideInlineParent() {
protected fun protectedFun() = 0
<!NOTHING_TO_INLINE!>inline<!> fun publicInlineUserFun() {
<!UNRESOLVED_REFERENCE!>println<!>(<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedVar<!> + <!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedParentVar<!>)
println(<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedVar<!> + <!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedParentVar<!>)
<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedFun<!>()
<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>protectedParentFun<!>()
}
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.config.AnalysisFlags.allowFullyQualifiedNameInKClass
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.CompilerConfigurationKey
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.platform.CommonPlatforms
import org.jetbrains.kotlin.platform.isCommon
import org.jetbrains.kotlin.test.directives.ConfigurationDirectives
import org.jetbrains.kotlin.test.directives.ConfigurationDirectives.WITH_STDLIB
import org.jetbrains.kotlin.test.directives.model.DirectivesContainer
@@ -43,13 +43,11 @@ class CommonEnvironmentConfigurator(testServices: TestServices) : EnvironmentCon
configuration.put(key as CompilerConfigurationKey<Any>, value)
}
if (module.targetPlatform in CommonPlatforms.allDefaultTargetPlatforms) {
if (WITH_STDLIB in module.directives) {
configuration.add(
CLIConfigurationKeys.CONTENT_ROOTS,
JvmClasspathRoot(ForTestCompileRuntime.stdlibCommonForTests())
)
}
if (module.targetPlatform.isCommon() && WITH_STDLIB in module.directives) {
configuration.add(
CLIConfigurationKeys.CONTENT_ROOTS,
JvmClasspathRoot(ForTestCompileRuntime.stdlibCommonForTests())
)
}
}
}
-34
View File
@@ -1,34 +0,0 @@
plugins {
kotlin("jvm")
}
dependencies {
testImplementation(projectTests(":compiler:tests-common-new"))
testImplementation(projectTests(":generators:test-generator"))
testImplementation(project(":native:kotlin-native-utils"))
testApiJUnit5()
}
val generationRoot = projectDir.resolve("tests-gen")
sourceSets {
"main" { none() }
"test" {
projectDefault()
java.srcDirs(generationRoot.name)
}
}
val testTags = findProperty("kotlin.native.tests.tags")?.toString()
// Note: arbitrary JUnit tag expressions can be used in this property.
// See https://junit.org/junit5/docs/current/user-guide/#running-tests-tag-expressions
val test by nativeTest("test", testTags).apply {
configure {
dependsOn(":dist")
}
}
val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateNativeDiagnosticTestsKt") {
javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_11_0))
dependsOn(":compiler:generateTestData")
}
@@ -1,38 +0,0 @@
/*
* Copyright 2010-2022 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.generators.generateTestGroupSuiteWithJUnit5
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.utils.CUSTOM_TEST_DATA_EXTENSION_PATTERN
fun main() {
System.setProperty("java.awt.headless", "true")
val excludedCustomTestdataPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN
generateTestGroupSuiteWithJUnit5 {
// New frontend test infrastructure tests
testGroup(testsRoot = "native/dignostic-tests/tests-gen", testDataRoot = "compiler/testData") {
testClass<AbstractDiagnosticsNativeTest> {
model("diagnostics/nativeTests", excludedPattern = excludedCustomTestdataPattern)
}
testClass<AbstractFirPsiNativeDiagnosticsTest>(
suiteTestClassName = "FirPsiOldFrontendNativeDiagnosticsTestGenerated",
) {
model("diagnostics/nativeTests", excludedPattern = excludedCustomTestdataPattern)
}
testClass<AbstractFirLightTreeNativeDiagnosticsTest>(
suiteTestClassName = "FirLightTreeOldFrontendNativeDiagnosticsTestGenerated",
) {
model("diagnostics/nativeTests", excludedPattern = excludedCustomTestdataPattern)
}
}
}
}
@@ -14,7 +14,7 @@ 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.GenerateNativeDiagnosticTestsKt}. DO NOT MODIFY MANUALLY */
/** 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")
@@ -7,6 +7,8 @@ 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;
@@ -14,10 +16,12 @@ 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.GenerateNativeDiagnosticTestsKt}. DO NOT MODIFY MANUALLY */
/** 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 {
@@ -7,6 +7,8 @@ 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;
@@ -14,10 +16,12 @@ 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.GenerateNativeDiagnosticTestsKt}. DO NOT MODIFY MANUALLY */
/** 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 {
@@ -17,7 +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() {
@@ -216,6 +220,27 @@ fun main() {
model("lldb")
}
}
// New frontend test infrastructure tests
testGroup(testsRoot = "native/native.tests/tests-gen", testDataRoot = "compiler/testData") {
testClass<AbstractDiagnosticsNativeTest> {
model("diagnostics/nativeTests", excludedPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN)
}
testClass<AbstractFirPsiNativeDiagnosticsTest>(
suiteTestClassName = "FirPsiOldFrontendNativeDiagnosticsTestGenerated",
annotations = listOf(*frontendFir()),
) {
model("diagnostics/nativeTests", excludedPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN)
}
testClass<AbstractFirLightTreeNativeDiagnosticsTest>(
suiteTestClassName = "FirLightTreeOldFrontendNativeDiagnosticsTestGenerated",
annotations = listOf(*frontendFir()),
) {
model("diagnostics/nativeTests", excludedPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN)
}
}
}
}
-1
View File
@@ -99,7 +99,6 @@ include ":benchmarks",
":js:js.dce",
":js:js.tests",
":native:kotlin-native-utils",
":native:dignostic-tests",
":native:frontend.native",
":native:kotlin-klib-commonizer",
":native:kotlin-klib-commonizer-api",