IC mangling: Ignore FIR tests

This commit is contained in:
Ilmir Usmanov
2020-11-11 08:11:21 +01:00
parent 23184bae05
commit f7164404c9
57 changed files with 94 additions and 6 deletions
@@ -74,6 +74,24 @@ public class GenerateRangesCodegenTestData {
private static final List<String> JVM_IR_FAILING_UNSIGNED_EXPRESSION_TESTS = Collections.emptyList();
private static final List<String> FIR_FAILING_UNSIGNED_LITERAL_TESTS = new ArrayList<String>() {{
add("inexactDownToMinValue");
add("progressionMaxValueMinusTwoToMaxValue");
add("inexactToMaxValue");
add("simpleRangeWithNonConstantEnds");
add("maxValueMinusTwoToMaxValue");
add("progressionDownToMinValue");
}};
private static final List<String> FIR_FAILING_UNSIGNED_EXPRESSION_TESTS = new ArrayList<String>() {{
add("inexactDownToMinValue");
add("progressionMaxValueMinusTwoToMaxValue");
add("inexactToMaxValue");
add("simpleRangeWithNonConstantEnds");
add("maxValueMinusTwoToMaxValue");
add("progressionDownToMinValue");
}};
static {
for (String integerType : INTEGER_PRIMITIVES) {
String suffix = integerType.substring(0, integerType.startsWith("U") ? 2 : 1);
@@ -138,7 +156,7 @@ public class GenerateRangesCodegenTestData {
out.printf("// IGNORE_BACKEND: %s%n%n", backendName);
}
private static void writeToFile(File file, String generatedBody, boolean isForUnsigned, boolean ignoreJvmIR) {
private static void writeToFile(File file, String generatedBody, boolean isForUnsigned, boolean ignoreJvmIR, boolean ignoreFir) {
PrintWriter out;
try {
//noinspection IOResourceOpenedButNotSafelyClosed
@@ -155,6 +173,9 @@ public class GenerateRangesCodegenTestData {
out.println("// KJS_WITH_FULL_RUNTIME");
out.println("// Auto-generated by " + GenerateRangesCodegenTestData.class.getName() + ". DO NOT EDIT!");
out.println("// WITH_RUNTIME");
if (ignoreFir) {
out.println("// IGNORE_BACKEND_FIR: JVM_IR");
}
out.println();
// Import min/max values, but only in case when the generated test case actually uses them (not to clutter tests which don't)
out.println();
@@ -233,12 +254,14 @@ public class GenerateRangesCodegenTestData {
}
String fileName = testFunName + ".kt";
writeToFile(new File(AS_LITERAL_DIR, fileName), asLiteralBody.toString(), false, false);
writeToFile(new File(AS_EXPRESSION_DIR, fileName), asExpressionBody.toString(), false, false);
writeToFile(new File(AS_LITERAL_DIR, fileName), asLiteralBody.toString(), false, false, false);
writeToFile(new File(AS_EXPRESSION_DIR, fileName), asExpressionBody.toString(), false, false, false);
writeToFile(new File(UNSIGNED_AS_LITERAL_DIR, fileName), unsignedAsLiteralBody.toString(), true,
JVM_IR_FAILING_UNSIGNED_LITERAL_TESTS.contains(testFunName));
JVM_IR_FAILING_UNSIGNED_LITERAL_TESTS.contains(testFunName),
FIR_FAILING_UNSIGNED_LITERAL_TESTS.contains(testFunName));
writeToFile(new File(UNSIGNED_AS_EXPRESSION_DIR, fileName), unsignedAsExpressionBody.toString(), true,
JVM_IR_FAILING_UNSIGNED_EXPRESSION_TESTS.contains(testFunName));
JVM_IR_FAILING_UNSIGNED_EXPRESSION_TESTS.contains(testFunName),
FIR_FAILING_UNSIGNED_EXPRESSION_TESTS.contains(testFunName));
}
}
}
@@ -19,6 +19,7 @@ object GenerateSteppedRangesCodegenTestData {
private val KT_34166_AFFECTED_FILENAMES = setOf("illegalStepZero.kt", "illegalStepNegative.kt", "illegalStepNonConst.kt")
private val JVM_IR_FAILING_FOR_UNSIGNED_FILENAMES = setOf<String>()
private val FIR_FAILING_FOR_UNSIGNED_FILENAMES = setOf("minValueToMaxValueStepMaxValue.kt", "zeroToMaxValueStepMaxValue.kt")
private enum class Type(val type: String, val isLong: Boolean = false, val isUnsigned: Boolean = false) {
INT("Int"),
@@ -163,12 +164,16 @@ object GenerateSteppedRangesCodegenTestData {
extraCode: String?,
fullSubdir: File,
asLiteral: Boolean,
shouldIgnoreForJvmIR: Boolean = false
shouldIgnoreForJvmIR: Boolean = false,
shouldIgnoreForFir: Boolean = false,
) {
fullSubdir.mkdirs()
PrintWriter(File(fullSubdir, fileName)).use {
with(it) {
println("// $PREAMBLE_MESSAGE")
if (shouldIgnoreForFir) {
println("// IGNORE_BACKEND_FIR: JVM_IR")
}
if (shouldIgnoreForJvmIR) {
println("// IGNORE_BACKEND: JVM_IR")
}
@@ -220,6 +225,7 @@ object GenerateSteppedRangesCodegenTestData {
File(UNSIGNED_TEST_DATA_DIR, fullSubdirPath),
asLiteral,
shouldIgnoreForJvmIR = fileName in JVM_IR_FAILING_FOR_UNSIGNED_FILENAMES,
shouldIgnoreForFir = fileName in FIR_FAILING_FOR_UNSIGNED_FILENAMES,
)
}
if (signedTests.isNotEmpty()) {