A couple of konanc driver tests.

This commit is contained in:
Alexander Gorshenev
2017-03-31 03:38:16 +03:00
committed by alexander-gorshenev
parent 742934a1d8
commit 9fd555471a
2 changed files with 45 additions and 0 deletions
+13
View File
@@ -1554,11 +1554,24 @@ task deserialized_inline0(type: RunKonanTest) {
source = "serialization/deserialized_inline0.kt"
flags = ["--enable", "deserializer"]
}
task deserialized_listof0(type: RunKonanTest) {
source = "serialization/deserialized_listof0.kt"
flags = ["--enable", "deserializer"]
}
// Just check that the driver is able to produce runnable binaries.
task driver0(type: RunDriverKonanTest) {
goldValue = "Hello, world!\n"
source = "runtime/basic/hello0.kt"
}
task driver_opt(type: RunDriverKonanTest) {
goldValue = "Hello, world!\n"
source = "runtime/basic/hello0.kt"
flags = ["-opt"]
}
// Enable when deserialization for default arguments is fixed.
task inline_defaultArgs_linkTest(type: LinkKonanTest) {
disabled = true
@@ -33,6 +33,7 @@ abstract class KonanTest extends JavaExec {
def launcherBc = new File("${dist.canonicalPath}/lib/launcher.bc").absolutePath
def startKtBc = new File("${dist.canonicalPath}/lib/start.kt.bc").absolutePath
def stdlibKtBc = new File("${dist.canonicalPath}/lib/stdlib.kt.bc").absolutePath
def konanc = new File("${dist.canonicalPath}/bin/konanc").absolutePath
def mainC = 'main.c'
def outputSourceSetName = "testOutputLocal"
String outputDirectory = null
@@ -219,6 +220,37 @@ class RunKonanTest extends KonanTest {
}
}
// This is another way to run the compiler.
// Don't use this task for regular testing as
// project.exec + a shell script isolate the jvm
// from IDEA. Use the RunKonanTest instead.
@ParallelizableTask
class RunDriverKonanTest extends KonanTest {
void compileTest(List<String> filesToCompile, String exe) {
runCompiler(filesToCompile, exe, flags?:[])
}
protected void runCompiler(List<String> filesToCompile, String output, List<String> moreArgs) {
def log = new ByteArrayOutputStream()
project.exec {
commandLine konanc
args = ["-output", output,
"-ea",
*filesToCompile,
*moreArgs,
*project.globalTestArgs]
if (project.testTarget) {
args "-target", project.testTarget
}
standardOutput = log
errorOutput = log
}
def logString = log.toString()
project.file("${output}.compilation.log").write(logString)
println(logString)
}
}
@ParallelizableTask
class RunInteropKonanTest extends KonanTest {