In LightAnalysisModeTestGenerated skip tests ignored in JVM

When a test is marked as ignored in JVM BE (i.e. IGNORE_BACKEND: JVM)
it's ignored in LightAnalysisModeTestGenerated. This means that
this tests is expected to fail. However, often tests that fail
in JVM blackbox tests, don't fail in LAMTG, therefore it's reasonable
to skip these tests in LAMTG at all.
This commit is contained in:
Alexey Andreev
2017-05-26 14:58:29 +03:00
parent 2c98bd053a
commit 383e273fed
11 changed files with 196 additions and 35 deletions
@@ -1,6 +1,4 @@
// TARGET_BACKEND: JS
// This test causes JVM to generate incorrect bytecode
// Could not use IGNORE_BACKEND directive, since it makes LightAnalysisModeCodegenTestsGenerated fail on this test
// IGNORE_BACKEND: JVM
interface I<T> {
val prop: T
@@ -1,5 +1,5 @@
// Enable for JVM backend when KT-8120 gets fixed
// TARGET_BACKEND: JS
// IGNORE_BACKEND: JVM
fun box(): String {
var log = ""
@@ -1,5 +1,5 @@
// Enable for JVM backend when KT-8120 gets fixed
// TARGET_BACKEND: JS
// IGNORE_BACKEND: JVM
fun box(): String {
val capturedInConstructor = 1
@@ -1,5 +1,5 @@
// Enable when KT-14833 is fixed.
// TARGET_BACKEND: JS
// IGNORE_BACKEND: JVM
import kotlin.reflect.KProperty
var a = 0
@@ -6269,6 +6269,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/defaultArguments"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("implementedByFake.kt")
public void testImplementedByFake() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/implementedByFake.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("kt6382.kt")
public void testKt6382() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/kt6382.kt");
@@ -10466,12 +10478,36 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
doTest(fileName);
}
@TestMetadata("closureOfInnerLocalClass.kt")
public void testClosureOfInnerLocalClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureOfInnerLocalClass.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("closureOfLambdaInLocalClass.kt")
public void testClosureOfLambdaInLocalClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureOfLambdaInLocalClass.kt");
doTest(fileName);
}
@TestMetadata("closureWithSelfInstantiation.kt")
public void testClosureWithSelfInstantiation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureWithSelfInstantiation.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("inExtensionFunction.kt")
public void testInExtensionFunction() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/inExtensionFunction.kt");
@@ -12533,6 +12569,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/properties"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("augmentedAssignmentsAndIncrements.kt")
public void testAugmentedAssignmentsAndIncrements() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/augmentedAssignmentsAndIncrements.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("classArtificialFieldInsideNested.kt")
public void testClassArtificialFieldInsideNested() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/classArtificialFieldInsideNested.kt");
@@ -6269,6 +6269,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/defaultArguments"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("implementedByFake.kt")
public void testImplementedByFake() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/implementedByFake.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("kt6382.kt")
public void testKt6382() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/kt6382.kt");
@@ -10466,12 +10478,36 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("closureOfInnerLocalClass.kt")
public void testClosureOfInnerLocalClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureOfInnerLocalClass.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("closureOfLambdaInLocalClass.kt")
public void testClosureOfLambdaInLocalClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureOfLambdaInLocalClass.kt");
doTest(fileName);
}
@TestMetadata("closureWithSelfInstantiation.kt")
public void testClosureWithSelfInstantiation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureWithSelfInstantiation.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("inExtensionFunction.kt")
public void testInExtensionFunction() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/inExtensionFunction.kt");
@@ -12533,6 +12569,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/properties"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("augmentedAssignmentsAndIncrements.kt")
public void testAugmentedAssignmentsAndIncrements() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/augmentedAssignmentsAndIncrements.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("classArtificialFieldInsideNested.kt")
public void testClassArtificialFieldInsideNested() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/classArtificialFieldInsideNested.kt");
@@ -40,6 +40,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Annotations extends AbstractLightAnalysisModeTest {
@TestMetadata("wrongAnnotationArgumentInCtor.kt")
public void ignoreWrongAnnotationArgumentInCtor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
public void testAllFilesPresentInAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@@ -152,18 +164,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
doTest(fileName);
}
@TestMetadata("wrongAnnotationArgumentInCtor.kt")
public void testWrongAnnotationArgumentInCtor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -5646,12 +5646,8 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SuspendFunctionAsCoroutine extends AbstractLightAnalysisModeTest {
public void testAllFilesPresentInSuspendFunctionAsCoroutine() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("augmentedAssignment.kt")
public void testAugmentedAssignment() throws Exception {
public void ignoreAugmentedAssignment() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/augmentedAssignment.kt");
try {
doTest(fileName);
@@ -5662,6 +5658,10 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
public void testAllFilesPresentInSuspendFunctionAsCoroutine() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt");
@@ -6265,6 +6265,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DefaultArguments extends AbstractLightAnalysisModeTest {
@TestMetadata("implementedByFake.kt")
public void ignoreImplementedByFake() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/implementedByFake.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
public void testAllFilesPresentInDefaultArguments() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/defaultArguments"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@@ -10450,6 +10462,30 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class LocalClasses extends AbstractLightAnalysisModeTest {
@TestMetadata("closureOfInnerLocalClass.kt")
public void ignoreClosureOfInnerLocalClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureOfInnerLocalClass.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("closureWithSelfInstantiation.kt")
public void ignoreClosureWithSelfInstantiation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureWithSelfInstantiation.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
public void testAllFilesPresentInLocalClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/localClasses"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@@ -12517,6 +12553,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Properties extends AbstractLightAnalysisModeTest {
@TestMetadata("augmentedAssignmentsAndIncrements.kt")
public void ignoreAugmentedAssignmentsAndIncrements() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/augmentedAssignmentsAndIncrements.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("accessToPrivateProperty.kt")
public void testAccessToPrivateProperty() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/accessToPrivateProperty.kt");
@@ -255,7 +255,7 @@ fun main(args: Array<String>) {
}
testClass<AbstractLightAnalysisModeTest> {
model("codegen/box", targetBackend = TargetBackend.JVM)
model("codegen/box", targetBackend = TargetBackend.JVM, skipIgnored = true)
}
testClass<AbstractKapt3BuilderModeBytecodeShapeTest> {
@@ -1436,7 +1436,8 @@ class TestGroup(val testsRoot: String, val testDataRoot: String) {
testClassName: String? = null,
targetBackend: TargetBackend = TargetBackend.ANY,
excludeDirs: List<String> = listOf(),
filenameStartsLowerCase: Boolean? = null
filenameStartsLowerCase: Boolean? = null,
skipIgnored: Boolean = false
) {
val rootFile = File(testDataRoot + "/" + relativeRootPath)
val compiledPattern = Pattern.compile(pattern)
@@ -1444,12 +1445,13 @@ class TestGroup(val testsRoot: String, val testDataRoot: String) {
testModels.add(
if (singleClass) {
if (excludeDirs.isNotEmpty()) error("excludeDirs is unsupported for SingleClassTestModel yet")
SingleClassTestModel(rootFile, compiledPattern, filenameStartsLowerCase, testMethod, className, targetBackend)
SingleClassTestModel(rootFile, compiledPattern, filenameStartsLowerCase, testMethod, className, targetBackend,
skipIgnored)
}
else {
SimpleTestClassModel(rootFile, recursive, excludeParentDirs,
compiledPattern, filenameStartsLowerCase, testMethod, className,
targetBackend, excludeDirs)
targetBackend, excludeDirs, skipIgnored)
}
)
}
@@ -53,6 +53,8 @@ public class SimpleTestClassModel implements TestClassModel {
@Nullable
private Collection<MethodModel> testMethods;
private final boolean skipIgnored;
public SimpleTestClassModel(
@NotNull File rootFile,
boolean recursive,
@@ -62,7 +64,8 @@ public class SimpleTestClassModel implements TestClassModel {
@NotNull String doTestMethodName,
@NotNull String testClassName,
@NotNull TargetBackend targetBackend,
@NotNull Collection<String> excludeDirs
@NotNull Collection<String> excludeDirs,
boolean skipIgnored
) {
this.rootFile = rootFile;
this.recursive = recursive;
@@ -73,6 +76,7 @@ public class SimpleTestClassModel implements TestClassModel {
this.targetBackend = targetBackend;
this.checkFilenameStartsLowerCase = checkFilenameStartsLowerCase;
this.excludeDirs = excludeDirs.isEmpty() ? Collections.emptySet() : new LinkedHashSet<>(excludeDirs);
this.skipIgnored = skipIgnored;
}
@NotNull
@@ -91,7 +95,8 @@ public class SimpleTestClassModel implements TestClassModel {
String innerTestClassName = TestGeneratorUtil.fileNameToJavaIdentifier(file);
children.add(new SimpleTestClassModel(
file, true, excludeParentDirs, filenamePattern, checkFilenameStartsLowerCase,
doTestMethodName, innerTestClassName, targetBackend, excludesStripOneDirectory(file.getName()))
doTestMethodName, innerTestClassName, targetBackend, excludesStripOneDirectory(file.getName()),
skipIgnored)
);
}
}
@@ -140,7 +145,7 @@ public class SimpleTestClassModel implements TestClassModel {
if (testMethods == null) {
if (!rootFile.isDirectory()) {
testMethods = Collections.singletonList(new SimpleTestMethodModel(
rootFile, rootFile, doTestMethodName, filenamePattern, checkFilenameStartsLowerCase, targetBackend
rootFile, rootFile, doTestMethodName, filenamePattern, checkFilenameStartsLowerCase, targetBackend, skipIgnored
));
}
else {
@@ -157,7 +162,8 @@ public class SimpleTestClassModel implements TestClassModel {
continue;
}
result.add(new SimpleTestMethodModel(rootFile, file, doTestMethodName, filenamePattern, checkFilenameStartsLowerCase, targetBackend));
result.add(new SimpleTestMethodModel(rootFile, file, doTestMethodName, filenamePattern,
checkFilenameStartsLowerCase, targetBackend, skipIgnored));
}
}
}
@@ -45,19 +45,23 @@ public class SimpleTestMethodModel implements TestMethodModel {
@NotNull
private final TargetBackend targetBackend;
private final boolean skipIgnored;
public SimpleTestMethodModel(
@NotNull File rootDir,
@NotNull File file,
@NotNull String doTestMethodName,
@NotNull Pattern filenamePattern,
@Nullable Boolean checkFilenameStartsLowerCase,
@NotNull TargetBackend targetBackend
@NotNull TargetBackend targetBackend,
boolean skipIgnored
) {
this.rootDir = rootDir;
this.file = file;
this.doTestMethodName = doTestMethodName;
this.filenamePattern = filenamePattern;
this.targetBackend = targetBackend;
this.skipIgnored = skipIgnored;
if (checkFilenameStartsLowerCase != null) {
char c = file.getName().charAt(0);
@@ -124,7 +128,10 @@ public class SimpleTestMethodModel implements TestMethodModel {
String relativePath = FileUtil.getRelativePath(rootDir, file.getParentFile());
unescapedName = relativePath + "-" + StringUtil.capitalize(extractedName);
}
return (isIgnoredTargetWithoutCheck(targetBackend, file) ? "ignore" : "test") + StringUtil.capitalize(TestGeneratorUtil.escapeForJavaIdentifier(unescapedName));
boolean ignored = isIgnoredTargetWithoutCheck(targetBackend, file) ||
skipIgnored && isIgnoredTarget(targetBackend, file);
return (ignored ? "ignore" : "test") + StringUtil.capitalize(TestGeneratorUtil.escapeForJavaIdentifier(unescapedName));
}
@Override
@@ -48,13 +48,16 @@ public class SingleClassTestModel implements TestClassModel {
@Nullable
private Collection<MethodModel> methods;
private final boolean skipIgnored;
public SingleClassTestModel(
@NotNull File rootFile,
@NotNull Pattern filenamePattern,
@Nullable Boolean checkFilenameStartsLowerCase,
@NotNull String doTestMethodName,
@NotNull String testClassName,
@NotNull TargetBackend targetBackend
@NotNull TargetBackend targetBackend,
boolean skipIgnored
) {
this.rootFile = rootFile;
this.filenamePattern = filenamePattern;
@@ -62,6 +65,7 @@ public class SingleClassTestModel implements TestClassModel {
this.doTestMethodName = doTestMethodName;
this.testClassName = testClassName;
this.targetBackend = targetBackend;
this.skipIgnored = skipIgnored;
}
@NotNull
@@ -97,7 +101,7 @@ public class SingleClassTestModel implements TestClassModel {
@NotNull
private Collection<TestMethodModel> getTestMethodsFromFile(File file) {
return Collections.singletonList(new SimpleTestMethodModel(
rootFile, file, doTestMethodName, filenamePattern, checkFilenameStartsLowerCase, targetBackend
rootFile, file, doTestMethodName, filenamePattern, checkFilenameStartsLowerCase, targetBackend, skipIgnored
));
}