From 93f9caf5682b4a8ee3a750b3aa9de39ea57eaa33 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 16 Oct 2020 15:57:46 +0700 Subject: [PATCH] Add a test for -Xoverride-konan-properties Add a trivial test that checks that `-Xoverride-konan-properties` overrides corresponding properties of LLVM optimization pipeline. --- .../backend.native/tests/build.gradle | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index b6bb39c9f1f..072a924b0ea 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -4767,6 +4767,29 @@ standaloneTest("local_ea_arraysfieldwrite") { source = "codegen/localEscapeAnalysis/arraysFieldWrite.kt" } +task override_konan_properties0(type: KonanDriverTest) { + + def overrides = PlatformInfo.isWindows() + ? '-Xoverride-konan-properties="llvmInlineThreshold=76"' + : '-Xoverride-konan-properties=llvmInlineThreshold=76' + flags = [ + "-opt", + "-Xverbose-phases=BitcodeOptimization", + overrides + ] + compilerMessages = true + source = "link/ir_providers/hello.kt" + def messages = + "inline_threshold: 76\n" + + "hello\n" + goldValue = PlatformInfo.isWindows() ? messages.replaceAll('\\/', '\\\\') : messages + outputChecker = { out -> + goldValue.split("\n") + .collect { line -> out.contains(line) } + .every { it == true } + } +} + /** * Creates tasks to build and execute stdlib tests. */