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
@@ -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
));
}