[Test infra] Take into account transitive compatible targets while checking compatibility.

This commit is contained in:
Zalim Bashorov
2020-07-10 02:29:24 +03:00
parent ca37c6bfe6
commit c552933459
2 changed files with 62 additions and 2 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -231,7 +231,12 @@ public final class InTextDirectivesUtils {
return false;
List<String> backends = findLinesWithPrefixesRemoved(textWithDirectives(file), "// TARGET_BACKEND: ");
return backends.isEmpty() || backends.contains(targetBackend.name()) || backends.contains(targetBackend.getCompatibleWith().name());
return isCompatibleTargetExceptAny(targetBackend, backends);
}
private static boolean isCompatibleTargetExceptAny(TargetBackend targetBackend, List<String> backends) {
if (targetBackend == TargetBackend.ANY) return false;
return backends.isEmpty() || backends.contains(targetBackend.name()) || isCompatibleTargetExceptAny(targetBackend.getCompatibleWith(), backends);
}
public static boolean isIgnoredTarget(TargetBackend targetBackend, File file, String ignoreBackendDirectivePrefix) {
@@ -1077,6 +1077,16 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/bridges/genericProperty.kt");
}
@TestMetadata("jsName.kt")
public void testJsName() throws Exception {
runTest("compiler/testData/codegen/box/bridges/jsName.kt");
}
@TestMetadata("jsNative.kt")
public void testJsNative() throws Exception {
runTest("compiler/testData/codegen/box/bridges/jsNative.kt");
}
@TestMetadata("kt12416.kt")
public void testKt12416() throws Exception {
runTest("compiler/testData/codegen/box/bridges/kt12416.kt");
@@ -15739,6 +15749,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/primitiveTypes/conversions.kt");
}
@TestMetadata("crossTypeEquals.kt")
public void testCrossTypeEquals() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/crossTypeEquals.kt");
}
@TestMetadata("ea35963.kt")
public void testEa35963() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/ea35963.kt");
@@ -22297,6 +22312,46 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
public void testAllFilesPresentInJs() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/typeOf/js"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@TestMetadata("classes.kt")
public void testClasses() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/js/classes.kt");
}
@TestMetadata("inlineClasses.kt")
public void testInlineClasses() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/js/inlineClasses.kt");
}
@TestMetadata("kType.kt")
public void testKType() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/js/kType.kt");
}
@TestMetadata("manyTypeArguments.kt")
public void testManyTypeArguments() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/js/manyTypeArguments.kt");
}
@TestMetadata("multipleLayers.kt")
public void testMultipleLayers() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/js/multipleLayers.kt");
}
@TestMetadata("multipleModules.kt")
public void testMultipleModules() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/js/multipleModules.kt");
}
@TestMetadata("typeOfCapturedStar.kt")
public void testTypeOfCapturedStar() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/js/typeOfCapturedStar.kt");
}
@TestMetadata("typeOfReifiedUnit.kt")
public void testTypeOfReifiedUnit() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/js/typeOfReifiedUnit.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/reflection/typeOf/noReflect")