backend/tests: Add compilation logging

This commit is contained in:
Ilya Matveev
2017-01-20 10:16:16 +03:00
parent 8ec33334a4
commit 6efe2b6d31
@@ -38,17 +38,25 @@ abstract class KonanTest extends DefaultTask {
abstract void compileTest(List<String> filesToCompile, String exe)
protected void runCompiler(List<String> filesToCompile, String output, List<String> moreArgs) {
project.javaexec {
main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt'
classpath = project.configurations.cli_bc
jvmArgs "-ea",
"-Dkonan.home=${dist.canonicalPath}",
"-Djava.library.path=${dist.canonicalPath}/konan/nativelib"
args("-output", output,
*filesToCompile,
*moreArgs,
*project.globalArgs)
def log = new ByteArrayOutputStream()
try {
project.javaexec {
main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt'
classpath = project.configurations.cli_bc
jvmArgs "-ea",
"-Dkonan.home=${dist.canonicalPath}",
"-Djava.library.path=${dist.canonicalPath}/konan/nativelib"
args("-output", output,
*filesToCompile,
*moreArgs,
*project.globalArgs)
standardOutput = log
errorOutput = log
}
} finally {
def logString = log.toString()
project.file("${output}.compilation.log").write(logString)
println(logString)
}
}
@@ -128,12 +136,6 @@ class RunExternalTestGroup extends RunKonanTest {
String filter = project.findProperty("filter")
String goldValue = "OK"
String buildExePath() {
def exeName = "${name}.kt.exe"
def tempDir = temporaryDir.absolutePath
return "$tempDir/$exeName"
}
// TODO refactor
List<String> buildCompileList() {
def result = []