[Test] Add test for KT-66338
This commit is contained in:
committed by
Space Team
parent
55f9f74d5c
commit
c818ce9220
+10
-1
@@ -1,5 +1,10 @@
|
|||||||
// IGNORE_NATIVE: cacheMode=STATIC_EVERYWHERE && target=linux_x64
|
// IGNORE_NATIVE: cacheMode=STATIC_EVERYWHERE && target=linux_x64
|
||||||
// IGNORE_NATIVE: cacheMode=STATIC_PER_FILE_EVERYWHERE && target=linux_x64
|
// IGNORE_NATIVE: cacheMode=STATIC_PER_FILE_EVERYWHERE && target=linux_x64
|
||||||
|
// IGNORE_BACKEND_K1: JVM, JVM_IR
|
||||||
|
// DONT_CHECK_IGNORED
|
||||||
|
// LightAnalysisModeTestGenerated passes because it doesn't compile the body of function `box` actually
|
||||||
|
|
||||||
|
// ISSUE: KT-33411, KT-66338
|
||||||
|
|
||||||
// MODULE: m1
|
// MODULE: m1
|
||||||
// FILE: m1.kt
|
// FILE: m1.kt
|
||||||
@@ -13,4 +18,8 @@ fun getK() = "K"
|
|||||||
|
|
||||||
// MODULE: main(m1)(m2)
|
// MODULE: main(m1)(m2)
|
||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
fun box() = getO() + getK()
|
|
||||||
|
fun box(): String {
|
||||||
|
f()
|
||||||
|
return getO() + getK()
|
||||||
|
}
|
||||||
|
|||||||
@@ -63,8 +63,7 @@ import java.util.*;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.IGNORE_BACKEND_DIRECTIVE_PREFIXES;
|
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.*;
|
||||||
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.isIgnoredTarget;
|
|
||||||
|
|
||||||
public class KotlinTestUtils {
|
public class KotlinTestUtils {
|
||||||
public static String TEST_MODULE_NAME = "test-module";
|
public static String TEST_MODULE_NAME = "test-module";
|
||||||
@@ -83,6 +82,13 @@ public class KotlinTestUtils {
|
|||||||
|
|
||||||
private static final Pattern DIRECTIVE_PATTERN = Pattern.compile("^//\\s*[!]?([A-Z_0-9]+)(:[ \\t]*(.*))?$", Pattern.MULTILINE);
|
private static final Pattern DIRECTIVE_PATTERN = Pattern.compile("^//\\s*[!]?([A-Z_0-9]+)(:[ \\t]*(.*))?$", Pattern.MULTILINE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This directive removes checks if ignored test actually passes or not
|
||||||
|
* It is very hacky and supposed to be use only in cases when some test passes in one configuration and fails in the other,
|
||||||
|
* and both those configurations share the same ignore directive
|
||||||
|
*/
|
||||||
|
private static final String DONT_CHECK_IGNORED = "DONT_CHECK_IGNORED";
|
||||||
|
|
||||||
private KotlinTestUtils() {
|
private KotlinTestUtils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,7 +577,9 @@ public class KotlinTestUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isIgnored) {
|
boolean dontCheckIgnored = InTextDirectivesUtils.isDirectiveDefined(textWithDirectives(testDataFile), DONT_CHECK_IGNORED);
|
||||||
|
|
||||||
|
if (isIgnored && !dontCheckIgnored) {
|
||||||
StringBuilder directivesToRemove = new StringBuilder();
|
StringBuilder directivesToRemove = new StringBuilder();
|
||||||
if (AUTOMATICALLY_UNMUTE_PASSED_TESTS) {
|
if (AUTOMATICALLY_UNMUTE_PASSED_TESTS) {
|
||||||
for (String ignoreDirective: ignoreDirectives){
|
for (String ignoreDirective: ignoreDirectives){
|
||||||
|
|||||||
+5
-5
@@ -30865,6 +30865,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public static class Klib extends AbstractLightAnalysisModeTest {
|
public static class Klib extends AbstractLightAnalysisModeTest {
|
||||||
|
@TestMetadata("kt33411.kt")
|
||||||
|
public void ignoreKt33411() {
|
||||||
|
runTest("compiler/testData/codegen/box/klib/kt33411.kt");
|
||||||
|
}
|
||||||
|
|
||||||
private void runTest(String testDataFilePath) {
|
private void runTest(String testDataFilePath) {
|
||||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||||
}
|
}
|
||||||
@@ -30872,11 +30877,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
public void testAllFilesPresentInKlib() {
|
public void testAllFilesPresentInKlib() {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/klib"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/klib"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("kt33411.kt")
|
|
||||||
public void testKt33411() {
|
|
||||||
runTest("compiler/testData/codegen/box/klib/kt33411.kt");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/ktype")
|
@TestMetadata("compiler/testData/codegen/box/ktype")
|
||||||
|
|||||||
Reference in New Issue
Block a user