Temporarily mute unsigned tests in JVM_IR and FIR

This commit is contained in:
Dmitry Petrov
2020-05-15 23:27:05 +03:00
parent de4ebe4395
commit e625bb375f
172 changed files with 349 additions and 21 deletions
@@ -70,11 +70,17 @@ public class GenerateRangesCodegenTestData {
private static final Map<String, String> ELEMENT_TYPE_KNOWN_SUBSTRINGS = new HashMap<>();
private static final Map<String, String> MIN_MAX_CONSTANTS = new LinkedHashMap<>();
private static final List<String> FIR_FAILING_UNSIGNED_TESTS =
Arrays.asList("inexactDownToMinValue", "inexactToMaxValue", "maxValueMinusTwoToMaxValue", "maxValueToMaxValue",
"maxValueToMinValue", "overflowZeroDownToMaxValue", "overflowZeroToMinValue", "progressionDownToMinValue",
"progressionMaxValueMinusTwoToMaxValue", "progressionMaxValueToMaxValue", "progressionMaxValueToMinValue",
"progressionMinValueToMinValue");
private static final List<String> FIR_PASSING_UNSIGNED_LITERAL_TESTS = Collections.emptyList();
private static final List<String> FIR_PASSING_UNSIGNED_EXPRESSION_TESTS = Collections.emptyList();
private static final List<String> JVM_IR_PASSING_UNSIGNED_LITERAL_TESTS =
Arrays.asList(
"simpleRange",
"overflowZeroToMinValue", "overflowZeroDownToMaxValue", "overflowZeroDownToMinValue",
"maxValueToMaxValue", "maxValueToMinValue",
"progressionMaxValueToMaxValue", "maxValueMinusTwoToMaxValue", "progressionMaxValueToMinValue"
);
static {
for (String integerType : INTEGER_PRIMITIVES) {
@@ -140,7 +146,7 @@ public class GenerateRangesCodegenTestData {
out.printf("// IGNORE_BACKEND: %s%n%n", backendName);
}
private static void writeToFile(File file, String generatedBody, boolean isForUnsigned, boolean ignoreFrontendIR) {
private static void writeToFile(File file, String generatedBody, boolean isForUnsigned, boolean ignoreFrontendIR, boolean ignoreJvmIR) {
PrintWriter out;
try {
//noinspection IOResourceOpenedButNotSafelyClosed
@@ -150,6 +156,9 @@ public class GenerateRangesCodegenTestData {
throw new AssertionError(e);
}
if (ignoreJvmIR) {
out.println("// IGNORE_BACKEND: JVM_IR");
}
if (ignoreFrontendIR) {
out.println("// IGNORE_BACKEND_FIR: JVM_IR");
}
@@ -232,13 +241,14 @@ public class GenerateRangesCodegenTestData {
}
String fileName = testFunName + ".kt";
boolean isFirFailingUnsignedTest = FIR_FAILING_UNSIGNED_TESTS.contains(testFunName);
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,
isFirFailingUnsignedTest);
!FIR_PASSING_UNSIGNED_LITERAL_TESTS.contains(testFunName),
!JVM_IR_PASSING_UNSIGNED_LITERAL_TESTS.contains(testFunName));
writeToFile(new File(UNSIGNED_AS_EXPRESSION_DIR, fileName), unsignedAsExpressionBody.toString(), true,
isFirFailingUnsignedTest);
!FIR_PASSING_UNSIGNED_EXPRESSION_TESTS.contains(testFunName),
true);
}
}
}
@@ -27,6 +27,19 @@ object GenerateSteppedRangesCodegenTestData {
"zeroToMaxValueStepMaxValue.kt"
)
private val JVM_IR_FAILING_FOR_UNSIGNED_SUBDIRS =
setOf(
"expression/downTo",
"expression/downTo/reversed",
"expression/downTo/nestedStep",
"expression/rangeTo",
"expression/rangeTo/nestedStep",
"expression/rangeTo/reversed",
"expression/until",
"expression/until/nestedStep",
"expression/until/reversed"
)
private enum class Type(val type: String, val isLong: Boolean = false, val isUnsigned: Boolean = false) {
INT("Int"),
LONG("Long", isLong = true),
@@ -170,12 +183,16 @@ object GenerateSteppedRangesCodegenTestData {
extraCode: String?,
fullSubdir: File,
asLiteral: Boolean,
shouldIgnoreForFIR: Boolean = false
shouldIgnoreForFIR: Boolean = false,
shouldIgnoreForJvmIR: Boolean = false
) {
fullSubdir.mkdirs()
PrintWriter(File(fullSubdir, fileName)).use {
with(it) {
println("// $PREAMBLE_MESSAGE")
if (shouldIgnoreForJvmIR) {
println("// IGNORE_BACKEND: JVM_IR")
}
if (shouldIgnoreForFIR) {
println("// IGNORE_BACKEND_FIR: JVM_IR")
}
@@ -209,12 +226,13 @@ object GenerateSteppedRangesCodegenTestData {
subdir: String? = null,
asLiteral: Boolean
) {
val fullSubdirPath = StringBuilder((if (asLiteral) "literal" else "expression"))
fullSubdirPath.append("/").append(function.subdir)
if (subdir != null) {
fullSubdirPath.append("/").append(subdir)
val fullSubdirPath = buildString {
if (asLiteral) append("literal") else append("expression")
append("/").append(function.subdir)
if (subdir != null) {
append("/").append(subdir)
}
}
val (unsignedTests, signedTests) = typeToBuilderMap.asSequence().partition { (type, _) -> type.isUnsigned }
if (unsignedTests.isNotEmpty()) {
generateTestsForFunction(
@@ -222,9 +240,11 @@ object GenerateSteppedRangesCodegenTestData {
unsignedTests.associate { it.toPair() },
function,
extraCode,
File(UNSIGNED_TEST_DATA_DIR, fullSubdirPath.toString()),
File(UNSIGNED_TEST_DATA_DIR, fullSubdirPath),
asLiteral,
fileName in FIR_FAILING_FOR_UNSIGNED_FILENAMES
shouldIgnoreForFIR = fileName in FIR_FAILING_FOR_UNSIGNED_FILENAMES ||
fullSubdirPath in JVM_IR_FAILING_FOR_UNSIGNED_SUBDIRS,
shouldIgnoreForJvmIR = fullSubdirPath in JVM_IR_FAILING_FOR_UNSIGNED_SUBDIRS
)
}
if (signedTests.isNotEmpty()) {
@@ -233,7 +253,7 @@ object GenerateSteppedRangesCodegenTestData {
signedTests.associate { it.toPair() },
function,
extraCode,
File(TEST_DATA_DIR, fullSubdirPath.toString()),
File(TEST_DATA_DIR, fullSubdirPath),
asLiteral
)
}