[PL][tests] Add Native K2 ABI compatibility tests

This commit is contained in:
Dmitriy Dolovov
2023-03-28 14:02:05 +02:00
committed by Space Team
parent 8147aa7dd6
commit b677112992
4 changed files with 162 additions and 2 deletions
@@ -0,0 +1,148 @@
/*
* 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.blackboxtest;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
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/klibABI")
@TestDataPath("$PROJECT_ROOT")
@FirPipeline()
public class FirKlibABITestGenerated extends AbstractNativeKlibABITest {
@Test
@TestMetadata("addEnumEntry")
public void testAddEnumEntry() throws Exception {
runTest("compiler/testData/klibABI/addEnumEntry/");
}
@Test
@TestMetadata("addSealedSubclass")
public void testAddSealedSubclass() throws Exception {
runTest("compiler/testData/klibABI/addSealedSubclass/");
}
@Test
public void testAllFilesPresentInKlibABI() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/klibABI"), Pattern.compile("^([^_](.+))$"), null, false);
}
@Test
@TestMetadata("changeClassVisibility")
public void testChangeClassVisibility() throws Exception {
runTest("compiler/testData/klibABI/changeClassVisibility/");
}
@Test
@TestMetadata("changeFunctionVisibility")
public void testChangeFunctionVisibility() throws Exception {
runTest("compiler/testData/klibABI/changeFunctionVisibility/");
}
@Test
@TestMetadata("changePropertyVisibility")
public void testChangePropertyVisibility() throws Exception {
runTest("compiler/testData/klibABI/changePropertyVisibility/");
}
@Test
@TestMetadata("classTransformations")
public void testClassTransformations() throws Exception {
runTest("compiler/testData/klibABI/classTransformations/");
}
@Test
@TestMetadata("functionTransformations")
public void testFunctionTransformations() throws Exception {
runTest("compiler/testData/klibABI/functionTransformations/");
}
@Test
@TestMetadata("inheritanceIssues")
public void testInheritanceIssues() throws Exception {
runTest("compiler/testData/klibABI/inheritanceIssues/");
}
@Test
@TestMetadata("noNonImplementedCallableFalsePositives")
public void testNoNonImplementedCallableFalsePositives() throws Exception {
runTest("compiler/testData/klibABI/noNonImplementedCallableFalsePositives/");
}
@Test
@TestMetadata("nonAbstractCallableBecomesAbstract")
public void testNonAbstractCallableBecomesAbstract() throws Exception {
runTest("compiler/testData/klibABI/nonAbstractCallableBecomesAbstract/");
}
@Test
@TestMetadata("nonExhaustivenessOfWhenClause")
public void testNonExhaustivenessOfWhenClause() throws Exception {
runTest("compiler/testData/klibABI/nonExhaustivenessOfWhenClause/");
}
@Test
@TestMetadata("propertyTransformations")
public void testPropertyTransformations() throws Exception {
runTest("compiler/testData/klibABI/propertyTransformations/");
}
@Test
@TestMetadata("referencingUnusableDeclarations")
public void testReferencingUnusableDeclarations() throws Exception {
runTest("compiler/testData/klibABI/referencingUnusableDeclarations/");
}
@Test
@TestMetadata("removeAbstractCallableFromAbstractClassOrInterface")
public void testRemoveAbstractCallableFromAbstractClassOrInterface() throws Exception {
runTest("compiler/testData/klibABI/removeAbstractCallableFromAbstractClassOrInterface/");
}
@Test
@TestMetadata("removeCallable")
public void testRemoveCallable() throws Exception {
runTest("compiler/testData/klibABI/removeCallable/");
}
@Test
@TestMetadata("removeClass")
public void testRemoveClass() throws Exception {
runTest("compiler/testData/klibABI/removeClass/");
}
@Test
@TestMetadata("removeEnumEntry")
public void testRemoveEnumEntry() throws Exception {
runTest("compiler/testData/klibABI/removeEnumEntry/");
}
@Test
@TestMetadata("removeSealedSubclass")
public void testRemoveSealedSubclass() throws Exception {
runTest("compiler/testData/klibABI/removeSealedSubclass/");
}
@Test
@TestMetadata("replaceCallableReturnType")
public void testReplaceCallableReturnType() throws Exception {
runTest("compiler/testData/klibABI/replaceCallableReturnType/");
}
@Test
@TestMetadata("typeAliasChanges")
public void testTypeAliasChanges() throws Exception {
runTest("compiler/testData/klibABI/typeAliasChanges/");
}
}
@@ -18,7 +18,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("compiler/testData/klibABI")
@TestDataPath("$PROJECT_ROOT")
public class KlibABITestGenerated extends AbstractNativeKlibABITest {
public class K1KlibABITestGenerated extends AbstractNativeKlibABITest {
@Test
@TestMetadata("addEnumEntry")
public void testAddEnumEntry() throws Exception {
@@ -56,7 +56,13 @@ fun main() {
// KLIB ABI tests.
testGroup("native/native.tests/tests-gen", "compiler/testData") {
testClass<AbstractNativeKlibABITest>(
suiteTestClassName = "KlibABITestGenerated"
suiteTestClassName = "K1KlibABITestGenerated"
) {
model("klibABI/", pattern = "^([^_](.+))$", recursive = false)
}
testClass<AbstractNativeKlibABITest>(
suiteTestClassName = "FirKlibABITestGenerated",
annotations = listOf(provider<FirPipeline>())
) {
model("klibABI/", pattern = "^([^_](.+))$", recursive = false)
}
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.konan.blackboxtest
import com.intellij.testFramework.TestDataFile
import org.jetbrains.kotlin.codegen.ProjectInfo
import org.jetbrains.kotlin.klib.KlibABITestUtils
import org.jetbrains.kotlin.klib.KlibABITestUtils.Dependencies
import org.jetbrains.kotlin.klib.KlibABITestUtils.MAIN_MODULE_NAME
@@ -53,6 +54,11 @@ abstract class AbstractNativeKlibABITest : AbstractNativeSimpleTest() {
override fun onNonEmptyBuildDirectory(directory: File) = backupDirectoryContents(directory)
// Temporarily mute TA tests on FIR FE with caches.
override fun isIgnoredTest(projectInfo: ProjectInfo) = super.isIgnoredTest(projectInfo)
|| (projectInfo.name == "typeAliasChanges" && testModeName.endsWith("STATIC_EVERYWHERE")
&& this@AbstractNativePartialLinkageTest::class.java.simpleName.startsWith("Fir"))
override fun onIgnoredTest() = throw TestAbortedException()
}