Revert "[K/N][Tests] Migrate test override_konan_properties0 and add testDriverVersion"
This reverts commit fbe8db4b45.
This commit is contained in:
committed by
Space Team
parent
876be8f17a
commit
8518c3f54f
@@ -1331,6 +1331,26 @@ standaloneTest("split_compilation_pipeline") {
|
|||||||
useGoldenData = true
|
useGoldenData = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register("override_konan_properties0", KonanDriverTest) {
|
||||||
|
disabled = isAggressiveGC // No need to test with different GC schedulers
|
||||||
|
def overrides = PlatformInfo.isWindows()
|
||||||
|
? '-Xoverride-konan-properties="llvmInlineThreshold=76"'
|
||||||
|
: '-Xoverride-konan-properties=llvmInlineThreshold=76'
|
||||||
|
flags = [
|
||||||
|
"-opt",
|
||||||
|
"-Xverbose-phases=MandatoryBitcodeLLVMPostprocessingPhase",
|
||||||
|
overrides
|
||||||
|
]
|
||||||
|
compilerMessages = true
|
||||||
|
source = "link/ir_providers/hello.kt"
|
||||||
|
def messages = "inline_threshold: 76\nhello\n"
|
||||||
|
outputChecker = { out ->
|
||||||
|
messages.split("\n")
|
||||||
|
.collect { line -> out.contains(line) }
|
||||||
|
.every { it == true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds tests into a single binary with TestRunner
|
* Builds tests into a single binary with TestRunner
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
|
* that can be found in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// TODO: remove kotlin_native.io once overrides are in place.
|
||||||
|
fun main(args : Array<String>) {
|
||||||
|
println("Hello, world!")
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Hello, world!
|
||||||
@@ -14,7 +14,6 @@ import org.jetbrains.kotlin.konan.test.blackbox.support.TestCompilerArgs
|
|||||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestModule
|
import org.jetbrains.kotlin.konan.test.blackbox.support.TestModule
|
||||||
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.ExecutableCompilation
|
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.ExecutableCompilation
|
||||||
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.TestCompilationArtifact
|
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.TestCompilationArtifact
|
||||||
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.executor
|
|
||||||
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.Binaries
|
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.Binaries
|
||||||
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.GCScheduler
|
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.GCScheduler
|
||||||
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.KotlinNativeHome
|
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.KotlinNativeHome
|
||||||
@@ -44,29 +43,14 @@ class KonanDriverTest : AbstractNativeSimpleTest() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testLLVMVariantDev() {
|
fun testLLVMVariantDev() {
|
||||||
// On macOS for apple targets, clang++ from Xcode is used, which is not switchable as `dev/user`,
|
// We use clang from Xcode on macOS for apple targets,
|
||||||
// so the test cannot detect LLVM variant for apple targets on macOS host.
|
// so it is hard to reliably detect LLVM variant for these targets.
|
||||||
Assumptions.assumeFalse(targets.hostTarget.family.isAppleFamily && targets.testTarget.family.isAppleFamily)
|
Assumptions.assumeFalse(targets.hostTarget.family.isAppleFamily && targets.testTarget.family.isAppleFamily)
|
||||||
// No need to test with different GC schedulers
|
// No need to test with different GC schedulers
|
||||||
Assumptions.assumeFalse(testRunSettings.get<GCScheduler>() == GCScheduler.AGGRESSIVE)
|
Assumptions.assumeFalse(testRunSettings.get<GCScheduler>() == GCScheduler.AGGRESSIVE)
|
||||||
|
|
||||||
compileSimpleFile(listOf("-Xllvm-variant=dev", "-Xverbose-phases=ObjectFiles")).let {
|
val flags = listOf("-Xllvm-variant=dev", "-Xverbose-phases=ObjectFiles")
|
||||||
assertFalse(
|
val args = mutableListOf("-output", buildDir.resolve("kexe.kexe").absolutePath).apply {
|
||||||
it.stdout.contains("-essentials"),
|
|
||||||
"`-essentials` must not be in stdout of dev LLVM.\nSTDOUT: ${it.stdout}\nSTDERR: ${it.stderr}\n---"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
compileSimpleFile(listOf("-Xllvm-variant=user", "-Xverbose-phases=ObjectFiles")).let {
|
|
||||||
assertTrue(
|
|
||||||
it.stdout.contains("-essentials"),
|
|
||||||
"`-essentials` must be in stdout of user LLVM.\nSTDOUT: ${it.stdout}\nSTDERR: ${it.stderr}\n---"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun compileSimpleFile(flags: List<String>): RunProcessResult {
|
|
||||||
val kexe = buildDir.resolve("kexe.kexe").also { it.delete() }
|
|
||||||
val args = mutableListOf("-output", kexe.absolutePath).apply {
|
|
||||||
add("-target")
|
add("-target")
|
||||||
add(targets.testTarget.visibleName)
|
add(targets.testTarget.visibleName)
|
||||||
addAll(flags)
|
addAll(flags)
|
||||||
@@ -75,17 +59,22 @@ class KonanDriverTest : AbstractNativeSimpleTest() {
|
|||||||
add("-Xpartial-linkage-loglevel=error")
|
add("-Xpartial-linkage-loglevel=error")
|
||||||
}
|
}
|
||||||
|
|
||||||
val compilationResult = runProcess(konanc.absolutePath, source.absolutePath, *args.toTypedArray<String>()) {
|
val compilationResult: RunProcessResult = runProcess(konanc.absolutePath, source.absolutePath, *args.toTypedArray()) {
|
||||||
timeout = Duration.parse("5m")
|
timeout = Duration.parse("5m")
|
||||||
}
|
}
|
||||||
testRunSettings.executor.runProcess(kexe.absolutePath) // run generated executable just to check its sanity
|
assertFalse(
|
||||||
return compilationResult
|
compilationResult.stdout.contains("-essentials"),
|
||||||
|
"`-essentials` must not be in stdout of dev LLVM.\nSTDOUT: ${compilationResult.stdout}\nSTDERR: ${compilationResult.stderr}\n---"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDriverProducesRunnableBinaries() {
|
fun testDriverProducesRunnableBinaries() {
|
||||||
|
// No need to test with different GC schedulers
|
||||||
|
Assumptions.assumeFalse(testRunSettings.get<GCScheduler>() == GCScheduler.AGGRESSIVE)
|
||||||
|
|
||||||
val module = TestModule.Exclusive("moduleName", emptySet(), emptySet(), emptySet())
|
val module = TestModule.Exclusive("moduleName", emptySet(), emptySet(), emptySet())
|
||||||
val kexe = buildDir.resolve("kexe.kexe").also { it.delete() }
|
val kexe = buildDir.resolve("kexe.kexe")
|
||||||
val compilation = ExecutableCompilation(
|
val compilation = ExecutableCompilation(
|
||||||
settings = testRunSettings,
|
settings = testRunSettings,
|
||||||
freeCompilerArgs = TestCompilerArgs.EMPTY,
|
freeCompilerArgs = TestCompilerArgs.EMPTY,
|
||||||
@@ -98,34 +87,10 @@ class KonanDriverTest : AbstractNativeSimpleTest() {
|
|||||||
runProcess(konanc.absolutePath, source.absolutePath, *compilation.getCompilerArgs()) {
|
runProcess(konanc.absolutePath, source.absolutePath, *compilation.getCompilerArgs()) {
|
||||||
timeout = Duration.parse("5m")
|
timeout = Duration.parse("5m")
|
||||||
}
|
}
|
||||||
val runResult: RunProcessResult = with(testRunSettings) {
|
val runResult: RunProcessResult = runProcess(kexe.absolutePath) {
|
||||||
executor.runProcess(kexe.absolutePath) {
|
|
||||||
timeout = Duration.parse("1m")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assertEquals("Hello, world!", runResult.stdout)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testDriverVersion() {
|
|
||||||
// No need to test with different GC schedulers
|
|
||||||
Assumptions.assumeFalse(testRunSettings.get<GCScheduler>() == GCScheduler.AGGRESSIVE)
|
|
||||||
|
|
||||||
val module = TestModule.Exclusive("moduleName", emptySet(), emptySet(), emptySet())
|
|
||||||
val kexe = buildDir.resolve("kexe.kexe").also { it.delete() }
|
|
||||||
val compilation = ExecutableCompilation(
|
|
||||||
settings = testRunSettings,
|
|
||||||
freeCompilerArgs = TestCompilerArgs(listOf("-version")),
|
|
||||||
sourceModules = listOf(module),
|
|
||||||
extras = TestCase.NoTestRunnerExtras("main"),
|
|
||||||
dependencies = emptyList(),
|
|
||||||
expectedArtifact = TestCompilationArtifact.Executable(kexe),
|
|
||||||
tryPassSystemCacheDirectory = true
|
|
||||||
)
|
|
||||||
runProcess(konanc.absolutePath, source.absolutePath, *compilation.getCompilerArgs()) {
|
|
||||||
timeout = Duration.parse("5m")
|
timeout = Duration.parse("5m")
|
||||||
}
|
}
|
||||||
assertFalse(kexe.exists())
|
assertEquals("Hello, world!", runResult.stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -134,7 +99,7 @@ class KonanDriverTest : AbstractNativeSimpleTest() {
|
|||||||
Assumptions.assumeFalse(testRunSettings.get<GCScheduler>() == GCScheduler.AGGRESSIVE)
|
Assumptions.assumeFalse(testRunSettings.get<GCScheduler>() == GCScheduler.AGGRESSIVE)
|
||||||
|
|
||||||
val module = TestModule.Exclusive("moduleName", emptySet(), emptySet(), emptySet())
|
val module = TestModule.Exclusive("moduleName", emptySet(), emptySet(), emptySet())
|
||||||
val kexe = buildDir.resolve("kexe.kexe").also { it.delete() }
|
val kexe = buildDir.resolve("kexe.kexe")
|
||||||
val compilation = ExecutableCompilation(
|
val compilation = ExecutableCompilation(
|
||||||
settings = testRunSettings,
|
settings = testRunSettings,
|
||||||
freeCompilerArgs = TestCompilerArgs(
|
freeCompilerArgs = TestCompilerArgs(
|
||||||
@@ -160,6 +125,5 @@ class KonanDriverTest : AbstractNativeSimpleTest() {
|
|||||||
"Compiler's stdout must contain string: $expected\n" +
|
"Compiler's stdout must contain string: $expected\n" +
|
||||||
"STDOUT:\n${compilationResult.stdout}\nSTDERR:${compilationResult.stderr}"
|
"STDOUT:\n${compilationResult.stdout}\nSTDERR:${compilationResult.stderr}"
|
||||||
)
|
)
|
||||||
testRunSettings.executor.runProcess(kexe.absolutePath)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user