From 05ef7056093f66dc57711f3797f4242cb0ad61eb Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Mon, 13 Mar 2017 19:21:33 +0300 Subject: [PATCH] Add IGNORE_BACKEND directive for native automatically Also parse correctly case IGNORE_BACKEND: JS, NATIVE --- .../expression/inexactDownToMinValue.kt | 5 +++- .../ranges/expression/inexactToMaxValue.kt | 5 +++- .../expression/maxValueMinusTwoToMaxValue.kt | 5 +++- .../ranges/expression/maxValueToMaxValue.kt | 5 +++- .../ranges/expression/maxValueToMinValue.kt | 5 +++- .../expression/progressionDownToMinValue.kt | 5 +++- .../progressionMaxValueMinusTwoToMaxValue.kt | 5 +++- .../progressionMaxValueToMaxValue.kt | 5 +++- .../progressionMaxValueToMinValue.kt | 5 +++- .../progressionMinValueToMinValue.kt | 5 +++- .../ranges/literal/inexactDownToMinValue.kt | 5 +++- .../box/ranges/literal/inexactToMaxValue.kt | 5 +++- .../literal/maxValueMinusTwoToMaxValue.kt | 5 +++- .../box/ranges/literal/maxValueToMaxValue.kt | 5 +++- .../box/ranges/literal/maxValueToMinValue.kt | 5 +++- .../literal/progressionDownToMinValue.kt | 5 +++- .../progressionMaxValueMinusTwoToMaxValue.kt | 5 +++- .../literal/progressionMaxValueToMaxValue.kt | 5 +++- .../literal/progressionMaxValueToMinValue.kt | 5 +++- .../literal/progressionMinValueToMinValue.kt | 5 +++- .../kotlin/test/InTextDirectivesUtils.java | 4 +-- .../tests/GenerateRangesCodegenTestData.java | 28 ++++++++++++++++--- 22 files changed, 106 insertions(+), 26 deletions(-) diff --git a/compiler/testData/codegen/box/ranges/expression/inexactDownToMinValue.kt b/compiler/testData/codegen/box/ranges/expression/inexactDownToMinValue.kt index e0fd14c2983..cd4f47398a1 100644 --- a/compiler/testData/codegen/box/ranges/expression/inexactDownToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/expression/inexactDownToMinValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/expression/inexactToMaxValue.kt b/compiler/testData/codegen/box/ranges/expression/inexactToMaxValue.kt index 74712e4df72..6181201dc99 100644 --- a/compiler/testData/codegen/box/ranges/expression/inexactToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/expression/inexactToMaxValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/expression/maxValueMinusTwoToMaxValue.kt b/compiler/testData/codegen/box/ranges/expression/maxValueMinusTwoToMaxValue.kt index 0cc89f13224..57ef91abc6b 100644 --- a/compiler/testData/codegen/box/ranges/expression/maxValueMinusTwoToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/expression/maxValueMinusTwoToMaxValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/expression/maxValueToMaxValue.kt b/compiler/testData/codegen/box/ranges/expression/maxValueToMaxValue.kt index c60b83b3d93..67a34700482 100644 --- a/compiler/testData/codegen/box/ranges/expression/maxValueToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/expression/maxValueToMaxValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/expression/maxValueToMinValue.kt b/compiler/testData/codegen/box/ranges/expression/maxValueToMinValue.kt index d7e7f98a24a..b636e72842a 100644 --- a/compiler/testData/codegen/box/ranges/expression/maxValueToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/expression/maxValueToMinValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/expression/progressionDownToMinValue.kt b/compiler/testData/codegen/box/ranges/expression/progressionDownToMinValue.kt index 20ef6402572..bda317415de 100644 --- a/compiler/testData/codegen/box/ranges/expression/progressionDownToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/expression/progressionDownToMinValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt b/compiler/testData/codegen/box/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt index cd579903938..3f8621c2fca 100644 --- a/compiler/testData/codegen/box/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/expression/progressionMaxValueToMaxValue.kt b/compiler/testData/codegen/box/ranges/expression/progressionMaxValueToMaxValue.kt index 691b83d6f48..48a8af62402 100644 --- a/compiler/testData/codegen/box/ranges/expression/progressionMaxValueToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/expression/progressionMaxValueToMaxValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/expression/progressionMaxValueToMinValue.kt b/compiler/testData/codegen/box/ranges/expression/progressionMaxValueToMinValue.kt index 1083ef991a2..86eb6031690 100644 --- a/compiler/testData/codegen/box/ranges/expression/progressionMaxValueToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/expression/progressionMaxValueToMinValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/expression/progressionMinValueToMinValue.kt b/compiler/testData/codegen/box/ranges/expression/progressionMinValueToMinValue.kt index c85495c3743..fee9a5f92c7 100644 --- a/compiler/testData/codegen/box/ranges/expression/progressionMinValueToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/expression/progressionMinValueToMinValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/literal/inexactDownToMinValue.kt b/compiler/testData/codegen/box/ranges/literal/inexactDownToMinValue.kt index a66daa50878..72d497bb477 100644 --- a/compiler/testData/codegen/box/ranges/literal/inexactDownToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/literal/inexactDownToMinValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/literal/inexactToMaxValue.kt b/compiler/testData/codegen/box/ranges/literal/inexactToMaxValue.kt index a55c76920aa..9de5402fe11 100644 --- a/compiler/testData/codegen/box/ranges/literal/inexactToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/literal/inexactToMaxValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/literal/maxValueMinusTwoToMaxValue.kt b/compiler/testData/codegen/box/ranges/literal/maxValueMinusTwoToMaxValue.kt index 1c76fabe3cc..dabb4b7eec1 100644 --- a/compiler/testData/codegen/box/ranges/literal/maxValueMinusTwoToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/literal/maxValueMinusTwoToMaxValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/literal/maxValueToMaxValue.kt b/compiler/testData/codegen/box/ranges/literal/maxValueToMaxValue.kt index cdedbbb8c7b..5c174a24557 100644 --- a/compiler/testData/codegen/box/ranges/literal/maxValueToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/literal/maxValueToMaxValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/literal/maxValueToMinValue.kt b/compiler/testData/codegen/box/ranges/literal/maxValueToMinValue.kt index 2439eab980c..bfb2f4c0d39 100644 --- a/compiler/testData/codegen/box/ranges/literal/maxValueToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/literal/maxValueToMinValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/literal/progressionDownToMinValue.kt b/compiler/testData/codegen/box/ranges/literal/progressionDownToMinValue.kt index fccb2044c9f..a62ca845133 100644 --- a/compiler/testData/codegen/box/ranges/literal/progressionDownToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/literal/progressionDownToMinValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt b/compiler/testData/codegen/box/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt index 7c81034ef7a..ed239fc2925 100644 --- a/compiler/testData/codegen/box/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/literal/progressionMaxValueToMaxValue.kt b/compiler/testData/codegen/box/ranges/literal/progressionMaxValueToMaxValue.kt index 4c4555326fc..af2334ee40b 100644 --- a/compiler/testData/codegen/box/ranges/literal/progressionMaxValueToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/literal/progressionMaxValueToMaxValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/literal/progressionMaxValueToMinValue.kt b/compiler/testData/codegen/box/ranges/literal/progressionMaxValueToMinValue.kt index cd29a83cb6f..7a8a189025d 100644 --- a/compiler/testData/codegen/box/ranges/literal/progressionMaxValueToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/literal/progressionMaxValueToMinValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/literal/progressionMinValueToMinValue.kt b/compiler/testData/codegen/box/ranges/literal/progressionMinValueToMinValue.kt index f0b5a5a9041..b0f74526ec6 100644 --- a/compiler/testData/codegen/box/ranges/literal/progressionMinValueToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/literal/progressionMinValueToMinValue.kt @@ -1,5 +1,8 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS + +// TODO: muted automatically, investigate should it be ran for NATIVE or not +// IGNORE_BACKEND: NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/compiler/tests-common/org/jetbrains/kotlin/test/InTextDirectivesUtils.java b/compiler/tests-common/org/jetbrains/kotlin/test/InTextDirectivesUtils.java index 5b47b65c4d4..d86c80f96cd 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/test/InTextDirectivesUtils.java +++ b/compiler/tests-common/org/jetbrains/kotlin/test/InTextDirectivesUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. + * Copyright 2010-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -236,7 +236,7 @@ public final class InTextDirectivesUtils { private static boolean isIgnoredTargetByPrefix(TargetBackend targetBackend, File file, String prefix) { if (targetBackend == TargetBackend.ANY) return false; - List ignoredBackends = findLinesWithPrefixesRemoved(textWithDirectives(file), prefix); + List ignoredBackends = findListWithPrefixes(textWithDirectives(file), prefix); return ignoredBackends.contains(targetBackend.name()); } diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateRangesCodegenTestData.java b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateRangesCodegenTestData.java index 32e2f18775a..67c84993c54 100644 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateRangesCodegenTestData.java +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateRangesCodegenTestData.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. + * Copyright 2010-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -118,6 +118,24 @@ public class GenerateRangesCodegenTestData { "progressionMaxValueToMinValue.kt", "progressionMinValueToMinValue.kt"); + private static final List IGNORED_FOR_NATIVE_BACKEND = Arrays.asList( + "inexactDownToMinValue.kt", + "inexactToMaxValue.kt", + "maxValueMinusTwoToMaxValue.kt", + "maxValueToMaxValue.kt", + "maxValueToMinValue.kt", + "progressionDownToMinValue.kt", + "progressionMaxValueMinusTwoToMaxValue.kt", + "progressionMaxValueToMaxValue.kt", + "progressionMaxValueToMinValue.kt", + "progressionMinValueToMinValue.kt" + ); + + private static void writeIgnoreBackendDirective(PrintWriter out, String backendName) { + out.printf("// TODO: muted automatically, investigate should it be ran for %s or not%n", backendName); + out.printf("// IGNORE_BACKEND: %s%n%n", backendName); + } + private static void writeToFile(File file, String generatedBody) { PrintWriter out; try { @@ -129,10 +147,12 @@ public class GenerateRangesCodegenTestData { } if (IGNORED_FOR_JS_BACKEND.contains(file.getName())) { - out.println("// TODO: muted automatically, investigate should it be ran for JS or not"); - out.println("// IGNORE_BACKEND: JS"); - out.println(); + writeIgnoreBackendDirective(out, "JS"); } + if (IGNORED_FOR_NATIVE_BACKEND.contains(file.getName())) { + writeIgnoreBackendDirective(out, "NATIVE"); + } + out.println("// Auto-generated by " + GenerateRangesCodegenTestData.class.getName() + ". DO NOT EDIT!"); out.println("// WITH_RUNTIME"); out.println();