[K/N][Tests] Patch package names also for .def files

To separate interop modules to different packages,
.def files should be treated similarly to .kt files:
1) package directive should be prepended with test-specific synthetic package,
or, if, absent, package directive with synthetic package should be added.
2) in .kt files, import directives and fully-qualified import from interop modules
should be prepended with same test-specific synthetic package.
This commit is contained in:
Vladimir Sukharev
2024-01-06 11:11:07 +01:00
committed by Space Team
parent 55a78bf499
commit 9f2558f640
28 changed files with 556 additions and 27 deletions
@@ -6292,6 +6292,16 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/exceptions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/cinterop/packages")
@TestDataPath("$PROJECT_ROOT")
public class Packages {
@Test
public void testAllFilesPresentInPackages() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/packages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
}
@Nested
@@ -6292,6 +6292,16 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/exceptions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/cinterop/packages")
@TestDataPath("$PROJECT_ROOT")
public class Packages {
@Test
public void testAllFilesPresentInPackages() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/packages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
}
@Nested
@@ -6292,6 +6292,16 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/exceptions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/cinterop/packages")
@TestDataPath("$PROJECT_ROOT")
public class Packages {
@Test
public void testAllFilesPresentInPackages() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/packages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
}
@Nested
+2 -2
View File
@@ -4,14 +4,14 @@
*/
// TARGET_BACKEND: NATIVE
// MODULE: cinterop
// FILE: cstdlib_3.def
// FILE: cstdlib.def
headers = stdlib.h
// MODULE: main(cinterop)
// FILE: main.kt
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
import cstdlib_3.*
import cstdlib.*
import kotlinx.cinterop.*
import kotlin.test.*
@@ -0,0 +1,17 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
// TARGET_BACKEND: NATIVE
// MODULE: cinterop
// FILE: part1.part2.def
package package1
---
#define OK_STRING "OK"
// MODULE: main(cinterop)
// FILE: main.kt
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
import package1.*
fun box(): String = OK_STRING
@@ -0,0 +1,17 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
// TARGET_BACKEND: NATIVE
// MODULE: cinterop
// FILE: filename1.filename2.def
package package1.package2
---
#define OK_STRING "OK"
// MODULE: main(cinterop)
// FILE: main.kt
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
import package1.package2.*
fun box(): String = OK_STRING
@@ -0,0 +1,16 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
// TARGET_BACKEND: NATIVE
// MODULE: cinterop
// FILE: root1.root2.def
---
#define OK_STRING "OK"
// MODULE: main(cinterop)
// FILE: main.kt
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
import root2.root1.*
fun box(): String = OK_STRING
@@ -0,0 +1,17 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
// TARGET_BACKEND: NATIVE
// MODULE: cinterop
// FILE: packages.def
package package1
---
#define OK_STRING "OK"
// MODULE: main(cinterop)
// FILE: main.kt
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
import package1.*
fun box(): String = OK_STRING
@@ -0,0 +1,17 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
// TARGET_BACKEND: NATIVE
// MODULE: cinterop
// FILE: packages.def
package package1.package2
---
#define OK_STRING "OK"
// MODULE: main(cinterop)
// FILE: main.kt
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
import package1.package2.*
fun box(): String = OK_STRING
+16
View File
@@ -0,0 +1,16 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
// TARGET_BACKEND: NATIVE
// MODULE: cinterop
// FILE: root1.def
---
#define OK_STRING "OK"
// MODULE: main(cinterop)
// FILE: main.kt
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
import root1.*
fun box(): String = OK_STRING
@@ -6292,6 +6292,16 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/exceptions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/cinterop/packages")
@TestDataPath("$PROJECT_ROOT")
public class Packages {
@Test
public void testAllFilesPresentInPackages() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/packages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
}
@Nested
@@ -6058,6 +6058,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/exceptions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/cinterop/packages")
@TestDataPath("$PROJECT_ROOT")
public class Packages {
@Test
public void testAllFilesPresentInPackages() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/packages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
}
}
@Nested
@@ -6292,6 +6292,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/exceptions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/cinterop/packages")
@TestDataPath("$PROJECT_ROOT")
public class Packages {
@Test
public void testAllFilesPresentInPackages() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/packages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
}
@Nested
@@ -6292,6 +6292,16 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/exceptions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/cinterop/packages")
@TestDataPath("$PROJECT_ROOT")
public class Packages {
@Test
public void testAllFilesPresentInPackages() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/packages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
}
@Nested
@@ -5509,6 +5509,19 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/exceptions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
@TestMetadata("compiler/testData/codegen/box/cinterop/packages")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Packages extends AbstractLightAnalysisModeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
public void testAllFilesPresentInPackages() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/packages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
}
}
@TestMetadata("compiler/testData/codegen/box/classLiteral")