diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 755b30a766a..edb255b0b6d 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -1766,6 +1766,20 @@ task driver_opt(type: RunDriverKonanTest) { flags = ["-opt"] } +// Check that cross-compilation completes successfully. We can't run such +// binaries, but we verify that the compiler has been built, operational +// and accepts the -target flag, resulting in a successful compilation. +task driver_cross(type: RunDriverKonanTest) { + goldValue = "Hello, world!\n" + source = "runtime/basic/hello0.kt" + run = false + if (isLinux()) { + flags = ["-target", "raspberrypi"] + } else if (isMac()) { + flags = ["-target", "iphone"] + } +} + // Enable when deserialization for default arguments is fixed. task inline_defaultArgs_linkTest(type: LinkKonanTest) { goldValue = "122\n47\n" diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 9f36f80acfa..c1bcddd2f1b 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -262,6 +262,12 @@ class RunKonanTest extends KonanTest { // from IDEA. Use the RunKonanTest instead. @ParallelizableTask class RunDriverKonanTest extends KonanTest { + + RunDriverKonanTest() { + super() + dependsOn(project.rootProject.tasks['cross_dist']) + } + void compileTest(List filesToCompile, String exe) { runCompiler(filesToCompile, exe, flags?:[]) }