Files
kotlin-fork/backend.native/tests/build.gradle
T
2017-04-21 16:23:27 +07:00

1705 lines
42 KiB
Groovy

/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import groovy.json.JsonOutput
import org.jetbrains.kotlin.*
apply plugin: NativeInteropPlugin
configurations {
cli_bc
update_tests
}
repositories {
ivy {
ivyPattern 'http://teamcity.jetbrains.com/guestAuth/repository/download/[module]/[revision]/teamcity-ivy.xml'
artifactPattern 'http://teamcity.jetbrains.com/guestAuth/repository/download/[module]/[revision]/[artifact](.[ext])'
}
}
dependencies {
cli_bc project(path: ':backend.native', configuration: 'cli_bc')
update_tests (group: 'org', name: 'bt345', version: testDataVersion) {
artifact {
name = 'internal/kotlin-test-data'
type = 'zip'
}
}
}
ext.testOutputRoot = rootProject.file("test.output").absolutePath
ext.externalTestsDir = project.file("external")
externalTestsDir.mkdirs()
project.convention.plugins.remoteExec = new org.jetbrains.kotlin.ExecRemote(project)
allprojects {
// Root directories for test output (logs, compiled files, statistics etc). Only single path must be in each set.
sourceSets {
// backend.native/tests
testOutputLocal {
output.dir(rootProject.file("$testOutputRoot/local"))
}
// backend.native/tests/external
testOutputExternal {
output.dir(rootProject.file("$testOutputRoot/external"))
}
}
}
// TODO: use lastSuccessful teamcity build.
task update_external_tests() {
doLast {
// Unzip.
delete temporaryDir
copy {
configurations.update_tests.asFileTree.each {
from(zipTree(it)) {
include 'compiler/**'
}
}
into(temporaryDir)
}
// Copy only used tests into the test directory.
externalTestsDir.mkdirs()
delete(externalTestsDir.listFiles())
copy {
from temporaryDir.absolutePath + "/compiler"
into(externalTestsDir)
include 'codegen/box/**'
include 'codegen/boxInline/**'
include 'compileKotlinAgainstKotlin/**'
}
//clean tmp dir.
delete temporaryDir
}
}
task clean {
doLast {
delete(rootProject.file(testOutputRoot))
}
}
task run() {
String prefix = project.findProperty("prefix")
if (prefix != null)
dependsOn(tasks.withType(KonanTest).matching { !(it instanceof RunExternalTestGroup) && it.enabled && it.name.startsWith(prefix) })
else
dependsOn(tasks.withType(KonanTest).matching { !(it instanceof RunExternalTestGroup) && it.enabled })
}
Set<RunExternalTestGroup> createExternalTests(File testRoot, Closure taskConfiguration) {
def result = new HashSet<RunExternalTestGroup>()
testRoot.eachDirRecurse {
// Skip build directory and directories without *.kt files.
if (it.name == "build" || it.listFiles().count {it.name.endsWith(".kt") && it.isFile()} == 0) {
return
}
def taskDirectory = project.relativePath(it)
def taskName = taskDirectory.replaceAll("[-/]", '_')
def task = (RunExternalTestGroup)project.task("$taskName", type: RunExternalTestGroup){
groupDirectory = "$taskDirectory"
}
taskConfiguration(task)
result.add(task)
}
return result
}
task run_external () {
// TODO Consider test output directory cleaning before execution.
// TODO Consider using some logger instead of println
// Create tasks for external tests.
for (testDir in ["codegen", "compileKotlinAgainstKotlin"]) {
createExternalTests(new File(externalTestsDir, testDir)) {
it.goldValue = "OK"
}
}
createExternalTests(new File(externalTestsDir, "stdlib")) {}
// Set up dependencies.
def testTasks = tasks.withType(RunExternalTestGroup).matching { it.enabled }
String prefix = project.findProperty("prefix")
if (prefix != null) {
testTasks = testTasks.matching { it.name.startsWith(prefix) }
}
dependsOn(testTasks)
// Collect results in one json.
doLast {
Map<String, Map<String, RunExternalTestGroup.TestResult>> results = [:]
def statistics = new RunExternalTestGroup.Statistics()
testTasks.matching { it.state.executed }.each {
results.put(it.name, it.results)
statistics.add(it.statistics)
}
def output = ["statistics" : statistics, "tests" : results]
def json = JsonOutput.toJson(output)
def reportFile = new File(sourceSets.testOutputExternal.output.getDirs().getSingleFile(), "results.json")
reportFile.write(JsonOutput.prettyPrint(json))
println("DONE.\n\n" +
"TOTAL: $statistics.total\n" +
"PASSED: $statistics.passed\n" +
"FAILED: $statistics.failed\n" +
"ERROR: $statistics.error\n" +
"SKIPPED: $statistics.skipped")
}
}
task daily() {
dependsOn(run_external)
}
task slackReport(type:Reporter) {
reportHome = rootProject.file("test.output").absoluteFile
}
task sum (type:RunKonanTest) {
source = "codegen/function/sum.kt"
}
task method_call(type: RunKonanTest) {
source = "codegen/object/method_call.kt"
}
task fields(type: RunKonanTest) {
source = "codegen/object/fields.kt"
}
task fields1(type: RunKonanTest) {
source = "codegen/object/fields1.kt"
}
task fields2(type: RunKonanTest) {
goldValue =
"Set global = 1\n" +
"Set member = 42\n" +
"Get member = 42\n" +
"Set global = 42\n" +
"Get global = 42\n" +
"Set member = 42\n"
source = "codegen/object/fields2.kt"
}
// This test checks object layout can't be done in
// RunKonanTest paradigm
//task constructor(type: UnitKonanTest) {
// source = "codegen/object/constructor.kt"
//}
task objectInitialization(type: RunKonanTest) {
source = "codegen/object/initialization.kt"
}
task objectInitialization1(type: RunKonanTest) {
goldValue = "init\nfield\nconstructor1\ninit\nfield\nconstructor1\nconstructor2\n"
source = "codegen/object/initialization1.kt"
}
task check_type(type: RunKonanTest) {
goldValue = "true\nfalse\ntrue\ntrue\ntrue\ntrue\n"
source = "codegen/basics/check_type.kt"
}
task safe_cast(type: RunKonanTest) {
goldValue = "safe_cast_positive: true\n" +
"safe_cast_negative: true\n"
source = "codegen/basics/safe_cast.kt"
}
task typealias1(type: RunKonanTest) {
goldValue = "42\n"
source = "codegen/basics/typealias1.kt"
}
task aritmetic(type: RunKonanTest) {
source = "codegen/function/arithmetic.kt"
}
task sum1(type: RunKonanTest) {
source = "codegen/function/sum_foo_bar.kt"
}
task sum2(type: RunKonanTest) {
source = "codegen/function/sum_imm.kt"
}
task defaults(type: RunKonanTest) {
source = "codegen/function/defaults.kt"
}
task defaults1(type: RunKonanTest) {
source = "codegen/function/defaults1.kt"
}
task defaults2(type: RunKonanTest) {
source = "codegen/function/defaults2.kt"
}
task defaults3(type: RunKonanTest) {
source = "codegen/function/defaults3.kt"
}
task defaults4(type: RunKonanTest) {
goldValue = "43\n"
source = "codegen/function/defaults4.kt"
}
task defaults5(type: RunKonanTest) {
goldValue = "5\n6\n"
source = "codegen/function/defaults5.kt"
}
task defaults6(type: RunKonanTest) {
goldValue = "42\n"
source = "codegen/function/defaults6.kt"
}
task defaults7(type: RunKonanTest) {
goldValue = "42\n"
source = "codegen/function/defaults7.kt"
}
task defaults8(type: RunKonanTest) {
goldValue = "2\n"
source = "codegen/function/defaults8.kt"
}
task defaults9(type: RunKonanTest) {
goldValue = "1\n"
source = "codegen/function/defaults9.kt"
}
task sum_3const(type: RunKonanTest) {
source = "codegen/function/sum_3const.kt"
}
task local_variable(type: RunKonanTest) {
source = "codegen/basics/local_variable.kt"
}
task canonical_name(type: RunKonanTest) {
goldValue = "A:foo\nA:qux\n"
source = "codegen/basics/canonical_name.kt"
}
task cast_simple(type: RunKonanTest) {
source = "codegen/basics/cast_simple.kt"
}
task cast_null(type: RunKonanTest) {
goldValue = "Ok\n"
source = "codegen/basics/cast_null.kt"
}
task unchecked_cast1(type: RunKonanTest) {
goldValue = "17\n17\n42\n42\n"
source = "codegen/basics/unchecked_cast1.kt"
}
task unchecked_cast2(type: RunKonanTest) {
disabled = true
goldValue = "Ok\n"
source = "codegen/basics/unchecked_cast2.kt"
}
task unchecked_cast3(type: RunKonanTest) {
goldValue = "Ok\n"
source = "codegen/basics/unchecked_cast3.kt"
}
task null_check(type: RunKonanTest) {
source = "codegen/basics/null_check.kt"
}
task array_to_any(type: RunKonanTest) {
source = "codegen/basics/array_to_any.kt"
}
task hello0(type: RunKonanTest) {
goldValue = "Hello, world!\n"
source = "runtime/basic/hello0.kt"
}
task hello1(type: RunKonanTest) {
goldValue = "Hello World"
testData = "Hello World"
source = "runtime/basic/hello1.kt"
}
task hello2(type: RunKonanTest) {
goldValue = "you entered 'Hello World'"
testData = "Hello World"
source = "runtime/basic/hello2.kt"
}
task hello3(type: RunKonanTest) {
goldValue = "239\ntrue\n3.14159\nA\n"
source = "runtime/basic/hello3.kt"
}
task hello4(type: RunKonanTest) {
goldValue = "Hello\nПока\n"
source = "runtime/basic/hello4.kt"
}
task tostring0(type: RunKonanTest) {
goldValue = "127\n-1\n239\nA\nЁ\nト\n1122334455\n112233445566778899\n3.14159\n1E+27\n1E-300\ntrue\nfalse\n"
source = "runtime/basic/tostring0.kt"
}
task tostring1(type: RunKonanTest) {
goldValue = "ello\n"
source = "runtime/basic/tostring1.kt"
}
task tostring2(type: RunKonanTest) {
goldValue = "H e l l o \nHello\n"
source = "runtime/basic/tostring2.kt"
}
task tostring3(type: RunKonanTest) {
goldValue = "-128\n127\n-32768\n32767\n" +
"-2147483648\n2147483647\n-9223372036854775808\n9223372036854775807\n" +
"1.17549E-38\n3.40282E+38\n-INF\nINF\n" +
// Linux version prints -NAN.
// "NAN\n" +
"4.94066E-324\n1.79769E+308\n-INF\nINF\n"
// "NAN\n"
source = "runtime/basic/tostring3.kt"
}
task empty_substring(type: RunKonanTest) {
goldValue = "\n"
source = "runtime/basic/empty_substring.kt"
}
task superFunCall(type: RunKonanTest) {
goldValue = "<fun:C><fun:C1>\n<fun:C><fun:C3>\n"
source = "codegen/basics/superFunCall.kt"
}
task superGetterCall(type: RunKonanTest) {
goldValue = "<prop:C><prop:C1>\n<prop:C><prop:C3>\n"
source = "codegen/basics/superGetterCall.kt"
}
task superSetterCall(type: RunKonanTest) {
goldValue = "<prop:C1><prop:C>zzz\n<prop:C3><prop:C>zzz\n"
source = "codegen/basics/superSetterCall.kt"
}
task enum0(type: RunKonanTest) {
goldValue = "VALUE\n"
source = "codegen/enum/test0.kt"
}
task enum1(type: RunKonanTest) {
goldValue = "z12\n"
source = "codegen/enum/test1.kt"
}
task enum_valueOf(type: RunKonanTest) {
goldValue = "E1\nE2\nE3\nE1\nE2\nE3\n"
source = "codegen/enum/valueOf.kt"
}
task enum_values(type: RunKonanTest) {
goldValue = "E3\nE1\nE2\nE3\nE1\nE2\n"
source = "codegen/enum/values.kt"
}
task enum_vCallNoEntryClass(type: RunKonanTest) {
goldValue = "('z3', 3)\n"
source = "codegen/enum/vCallNoEntryClass.kt"
}
task enum_vCallWithEntryClass(type: RunKonanTest) {
goldValue = "z1z2\n"
source = "codegen/enum/vCallWithEntryClass.kt"
}
task enum_companionObject(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/enum/companionObject.kt"
}
task enum_interfaceCallNoEntryClass(type: RunKonanTest) {
goldValue = "('z3', 3)\n('z3', 3)\n"
source = "codegen/enum/interfaceCallNoEntryClass.kt"
}
task enum_interfaceCallWithEntryClass(type: RunKonanTest) {
goldValue = "z1z2\nz1z2\n"
source = "codegen/enum/interfaceCallWithEntryClass.kt"
}
task enum_linkTest(type: LinkKonanTest) {
goldValue = "42\n117\n-1\n"
source = "codegen/enum/linkTest_main.kt"
lib = "codegen/enum/linkTest_lib.kt"
}
task mangling(type: LinkKonanTest) {
goldValue =
"Int direct [1, 2, 3, 4]\n" +
"out Number direct [9, 10, 11, 12]\n" +
"star direct [5, 6, 7, 8]\n" +
"Int param [1, 2, 3, 4]\n" +
"out Number param [9, 10, 11, 12]\n" +
"star param [5, 6, 7, 8]\n" +
"no constructors {}\n" +
"single constructor some string\n" +
"two constructors 17\n"
source = "mangling/mangling.kt"
lib = "mangling/manglinglib.kt"
}
task innerClass_simple(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/innerClass/simple.kt"
}
task innerClass_getOuterVal(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/innerClass/getOuterVal.kt"
}
task innerClass_generic(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/innerClass/generic.kt"
}
task innerClass_doubleInner(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/innerClass/doubleInner.kt"
}
task innerClass_qualifiedThis(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/innerClass/qualifiedThis.kt"
}
task innerClass_superOuter(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/innerClass/superOuter.kt"
}
task innerClass_noPrimaryConstructor(type: RunKonanTest) {
goldValue = "OK\nOK\n"
source = "codegen/innerClass/noPrimaryConstructor.kt"
}
task innerClass_secondaryConstructor(type: RunKonanTest) {
goldValue = "42\n"
source = "codegen/innerClass/secondaryConstructor.kt"
}
task localClass_localHierarchy(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/localClass/localHierarchy.kt"
}
task localClass_objectExpressionInProperty(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/localClass/objectExpressionInProperty.kt"
}
task localClass_objectExpressionInInitializer(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/localClass/objectExpressionInInitializer.kt"
}
task localClass_innerWithCapture(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/localClass/innerWithCapture.kt"
}
task localClass_innerTakesCapturedFromOuter(type: RunKonanTest) {
goldValue = "0\n1\n"
source = "codegen/localClass/innerTakesCapturedFromOuter.kt"
}
task localClass_virtualCallFromConstructor(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/localClass/virtualCallFromConstructor.kt"
}
task localClass_noPrimaryConstructor(type: RunKonanTest) {
goldValue = "OKOK\n"
source = "codegen/localClass/noPrimaryConstructor.kt"
}
task localClass_localFunctionCallFromLocalClass(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/localClass/localFunctionCallFromLocalClass.kt"
}
task localClass_localFunctionInLocalClass(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/localClass/localFunctionInLocalClass.kt"
}
task function_localFunction(type : RunKonanTest) {
goldValue = "OK\n"
source = "codegen/function/localFunction.kt"
}
task function_localFunction2(type : RunKonanTest) {
goldValue = "OK\n"
source = "codegen/function/localFunction2.kt"
}
task function_localFunction3(type : RunKonanTest) {
goldValue = "OK\n"
source = "codegen/function/localFunction3.kt"
}
task initializers_correctOrder1(type: RunKonanTest) {
goldValue = "42\n"
source = "codegen/initializers/correctOrder1.kt"
}
task initializers_correctOrder2(type: RunKonanTest) {
goldValue = "42\n"
source = "codegen/initializers/correctOrder2.kt"
}
task bridges_test0(type: RunKonanTest) {
goldValue = "42\n42\n"
source = "codegen/bridges/test0.kt"
}
task bridges_test1(type: RunKonanTest) {
goldValue = "1042\n"
source = "codegen/bridges/test1.kt"
}
task bridges_test2(type: RunKonanTest) {
goldValue = "42\n42\n"
source = "codegen/bridges/test2.kt"
}
task bridges_test3(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/bridges/test3.kt"
}
task bridges_test4(type: RunKonanTest) {
goldValue = "42\n42\n"
source = "codegen/bridges/test4.kt"
}
task bridges_test5(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/bridges/test5.kt"
}
task bridges_test6(type: RunKonanTest) {
goldValue = "42\n42\n42\n42\n42\n"
source = "codegen/bridges/test6.kt"
}
task bridges_test7(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/bridges/test7.kt"
}
task bridges_test8(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/bridges/test8.kt"
}
task bridges_test9(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/bridges/test9.kt"
}
task bridges_test10(type: RunKonanTest) {
goldValue = "42\n42\n"
source = "codegen/bridges/test10.kt"
}
task bridges_test11(type: RunKonanTest) {
goldValue = "42\n42\n42\n"
source = "codegen/bridges/test11.kt"
}
task bridges_test12(type: RunKonanTest) {
goldValue = "B: 42\nC: 42\n"
source = "codegen/bridges/test12.kt"
}
task bridges_test13(type: RunKonanTest) {
goldValue = "42\n42\n"
source = "codegen/bridges/test13.kt"
}
task bridges_test14(type: RunKonanTest) {
goldValue = "42\n56\n42\n56\n56\n42\n156\n142\n"
source = "codegen/bridges/test14.kt"
}
task bridges_test15(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/bridges/test15.kt"
}
task bridges_test16(type: RunKonanTest) {
goldValue = "OK\nOK\n"
source = "codegen/bridges/test16.kt"
}
task bridges_linkTest(type: LinkKonanTest) {
goldValue = "42\n42\n42\n"
source = "codegen/bridges/linkTest_main.kt"
lib = "codegen/bridges/linkTest_lib.kt"
}
task classDelegation_method(type: RunKonanTest) {
goldValue = "OKOK\n"
source = "codegen/classDelegation/method.kt"
}
task classDelegation_property(type: RunKonanTest) {
goldValue = "4242\n"
source = "codegen/classDelegation/property.kt"
}
task classDelegation_generic(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/classDelegation/generic.kt"
}
task classDelegation_withBridge(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/classDelegation/withBridge.kt"
}
task delegatedProperty_simpleVal(type: RunKonanTest) {
goldValue = "x\n42\n"
source = "codegen/delegatedProperty/simpleVal.kt"
}
task delegatedProperty_simpleVar(type: RunKonanTest) {
goldValue = "get x\n42\nset x\nget x\n117\n"
source = "codegen/delegatedProperty/simpleVar.kt"
}
task delegatedProperty_packageLevel(type: RunKonanTest) {
goldValue = "x\n42\n"
source = "codegen/delegatedProperty/packageLevel.kt"
}
task delegatedProperty_local(type: RunKonanTest) {
goldValue = "x\n42\n"
source = "codegen/delegatedProperty/local.kt"
}
task delegatedProperty_delegatedOverride(type: LinkKonanTest) {
goldValue = "156\nx\n117\n42\n"
source = "codegen/delegatedProperty/delegatedOverride_main.kt"
lib = "codegen/delegatedProperty/delegatedOverride_lib.kt"
}
task delegatedProperty_lazy(type: RunKonanTest) {
goldValue = "computed!\nHello\nHello\n"
source = "codegen/delegatedProperty/lazy.kt"
}
task delegatedProperty_observable(type: RunKonanTest) {
goldValue = "<no name> -> first\nfirst -> second\n"
source = "codegen/delegatedProperty/observable.kt"
}
task delegatedProperty_map(type: RunKonanTest) {
goldValue = "John Doe\n25\n"
source = "codegen/delegatedProperty/map.kt"
}
task propertyCallableReference_valClass(type: RunKonanTest) {
goldValue = "42\n117\n"
source = "codegen/propertyCallableReference/valClass.kt"
}
task propertyCallableReference_valModule(type: RunKonanTest) {
goldValue = "42\n"
source = "codegen/propertyCallableReference/valModule.kt"
}
task propertyCallableReference_varClass(type: RunKonanTest) {
goldValue = "117\n117\n42\n42\n"
source = "codegen/propertyCallableReference/varClass.kt"
}
task propertyCallableReference_varModule(type: RunKonanTest) {
goldValue = "117\n117\n"
source = "codegen/propertyCallableReference/varModule.kt"
}
task propertyCallableReference_valExtension(type: RunKonanTest) {
goldValue = "42\n117\n"
source = "codegen/propertyCallableReference/valExtension.kt"
}
task propertyCallableReference_varExtension(type: RunKonanTest) {
goldValue = "117\n117\n42\n42\n"
source = "codegen/propertyCallableReference/varExtension.kt"
}
task propertyCallableReference_linkTest(type: LinkKonanTest) {
goldValue = "42\n117\n"
source = "codegen/propertyCallableReference/linkTest_main.kt"
lib = "codegen/propertyCallableReference/linkTest_lib.kt"
}
task lateinit_initialized(type: RunKonanTest) {
goldValue = "zzz\n"
source = "codegen/lateinit/initialized.kt"
}
task lateinit_notInitialized(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/lateinit/notInitialized.kt"
}
task AbstractMutableCollection(type: RunKonanTest) {
expectedExitStatus = 0
source = "runtime/collections/AbstractMutableCollection.kt"
}
task array0(type: RunKonanTest) {
goldValue = "5\n6\n7\n8\n9\n10\n11\n12\n13\n"
source = "runtime/collections/array0.kt"
}
task array1(type: RunKonanTest) {
goldValue = "4 2\n1-1\n69\n38\n"
source = "runtime/collections/array1.kt"
}
task array2(type: RunKonanTest) {
goldValue = "0\n2\n4\n6\n8\n40\n"
source = "runtime/collections/array2.kt"
}
task sort0(type: RunKonanTest) {
goldValue = "[a, b, x]\n[-1, 0, 42, 239, 100500]\n"
source = "runtime/collections/sort0.kt"
}
task sort1(type: RunKonanTest) {
goldValue = "[a, b, x]\n[-1, 0, 42, 239, 100500]\n"
source = "runtime/collections/sort1.kt"
}
task if_else(type: RunKonanTest) {
source = "codegen/branching/if_else.kt"
}
task when2(type: RunKonanTest) {
source = "codegen/branching/when2.kt"
}
task when5(type: RunKonanTest) {
source = "codegen/branching/when5.kt"
}
task when6(type: RunKonanTest) {
source = "codegen/branching/when6.kt"
}
task when7(type: RunKonanTest) {
source = "codegen/branching/when7.kt"
}
task when8(type: RunKonanTest) {
source = "codegen/branching/when8.kt"
goldValue = "true\n"
}
task when9(type: RunKonanTest) {
goldValue = "Ok\n"
source = "codegen/branching/when9.kt"
}
task when_through(type: RunKonanTest) {
source = "codegen/branching/when_through.kt"
}
task advanced_when2(type: RunKonanTest) {
source = "codegen/branching/advanced_when2.kt"
}
task advanced_when5(type: RunKonanTest) {
source = "codegen/branching/advanced_when5.kt"
}
task bool_yes(type: RunKonanTest) {
source = "codegen/function/boolean.kt"
}
task named(type: RunKonanTest) {
source = "codegen/function/named.kt"
}
task plus_eq(type: RunKonanTest) {
source = "codegen/function/plus_eq.kt"
}
task minus_eq(type: RunKonanTest) {
source = "codegen/function/minus_eq.kt"
}
task eqeq(type: RunKonanTest) {
source = "codegen/function/eqeq.kt"
}
task cycle(type: RunKonanTest) {
source = "codegen/cycles/cycle.kt"
}
task cycle_do(type: RunKonanTest) {
source = "codegen/cycles/cycle_do.kt"
}
task abstract_super(type: RunKonanTest) {
source = "datagen/rtti/abstract_super.kt"
}
task vtable1(type: RunKonanTest) {
source = "datagen/rtti/vtable1.kt"
}
task strdedup1(type: RunKonanTest) {
goldValue = "true\ntrue\n"
source = "datagen/literals/strdedup1.kt"
}
task strdedup2(type: RunKonanTest) {
// TODO: string deduplication across several components seems to require
// linking them as bitcode modules before translating to machine code.
disabled = true
goldValue = "true\ntrue\n"
source = "datagen/literals/strdedup2.kt"
}
task empty_string(type: RunKonanTest) {
goldValue = "\n"
source = "datagen/literals/empty_string.kt"
}
task intrinsic(type: RunKonanTest) {
source = "codegen/function/intrinsic.kt"
}
/*
Disabled until we extract the classes that should be
always present from stdlib.kt.bc into a separate binary.
task link(type: LinkKonanTest) {
goldValue = "0\n"
source = "link/src/bar.kt"
lib = "link/lib"
}
*/
task for0(type: RunKonanTest) {
goldValue = "2\n3\n4\n"
source = "runtime/basic/for0.kt"
}
task throw0(type: RunKonanTest) {
goldValue = "Done\n"
source = "runtime/basic/throw0.kt"
}
task statements0(type: RunKonanTest) {
goldValue = "239\n238\n30\n29\n"
source = "runtime/basic/statements0.kt"
}
task boxing0(type: RunKonanTest) {
goldValue = "17\n"
source = "codegen/boxing/boxing0.kt"
}
task boxing1(type: RunKonanTest) {
goldValue = "1\nfalse\nHello\n"
source = "codegen/boxing/boxing1.kt"
}
task boxing2(type: RunKonanTest) {
goldValue = "1\ntrue\nother\n"
source = "codegen/boxing/boxing2.kt"
}
task boxing3(type: RunKonanTest) {
goldValue = "42\n"
source = "codegen/boxing/boxing3.kt"
}
task boxing4(type: RunKonanTest) {
goldValue = "16\n"
source = "codegen/boxing/boxing4.kt"
}
task boxing5(type: RunKonanTest) {
goldValue = "16\n42\n"
source = "codegen/boxing/boxing5.kt"
}
task boxing6(type: RunKonanTest) {
goldValue = "42\n16\n"
source = "codegen/boxing/boxing6.kt"
}
task boxing7(type: RunKonanTest) {
goldValue = "1\n0\n"
source = "codegen/boxing/boxing7.kt"
}
task boxing8(type: RunKonanTest) {
goldValue = "1\nnull\ntrue\nHello\n"
source = "codegen/boxing/boxing8.kt"
}
task boxing9(type: RunKonanTest) {
goldValue = "1\nnull\ntrue\nHello\n2\nnull\ntrue\nHello\n3\n"
source = "codegen/boxing/boxing9.kt"
}
task boxing10(type: RunKonanTest) {
goldValue = "Ok\n"
source = "codegen/boxing/boxing10.kt"
}
task boxing11(type: RunKonanTest) {
goldValue = "17\n42\n"
source = "codegen/boxing/boxing11.kt"
}
task boxing12(type: RunKonanTest) {
goldValue = "18\n"
source = "codegen/boxing/boxing12.kt"
}
task boxing13(type: RunKonanTest) {
goldValue = "false\nfalse\ntrue\ntrue\nfalse\nfalse\n"
source = "codegen/boxing/boxing13.kt"
}
task boxing14(type: RunKonanTest) {
goldValue = "42\n"
source = "codegen/boxing/boxing14.kt"
}
task boxing15(type: RunKonanTest) {
goldValue = "17\n"
source = "codegen/boxing/boxing15.kt"
}
task interface0(type: RunKonanTest) {
goldValue = "PASSED\n"
source = "runtime/basic/interface0.kt"
}
task hash0(type: RunKonanTest) {
goldValue = "239\n0\n97\n1065353216\n1072693248\n1\n0\ntrue\ntrue\n"
source = "runtime/basic/hash0.kt"
}
task array_list1(type: RunKonanTest) {
goldValue = "OK\n"
source = "runtime/collections/array_list1.kt"
}
task hash_map0(type: RunKonanTest) {
goldValue = "OK\n"
source = "runtime/collections/hash_map0.kt"
}
task hash_set0(type: RunKonanTest) {
goldValue = "OK\n"
source = "runtime/collections/hash_set0.kt"
}
task listof0(type: RunKonanTest) {
goldValue = "abc\n[a, b, c, d]\n[n, s, a]\n"
arguments = ["a"]
source = "runtime/collections/listof0.kt"
}
task listof1(type: RunKonanTest) {
goldValue = "true\n[a, b, c]\n"
source = "datagen/literals/listof1.kt"
}
task moderately_large_array(type: RunKonanTest) {
goldValue = "0\n"
source = "runtime/collections/moderately_large_array.kt"
}
task moderately_large_array1(type: RunKonanTest) {
goldValue = "-45392\n"
source = "runtime/collections/moderately_large_array1.kt"
}
task string_builder0(type: RunKonanTest) {
goldValue = "OK\n"
source = "runtime/text/string_builder0.kt"
}
task string_builder_reverse(type: RunKonanTest) {
goldValue = "OK\n"
source = "runtime/text/string_builder_reverse.kt"
}
task string0(type: RunKonanTest) {
goldValue = "true\ntrue\nПРИВЕТ\nпривет\nПока\ntrue\n"
source = "runtime/text/string0.kt"
}
task parse0(type: RunKonanTest) {
goldValue = "false\n" +
"true\n" +
"-1\n" +
"-86\n" +
"30\n" +
"4294967295\n" +
"bad format\n" +
"0.5\n" +
"2.39\n"
source = "runtime/text/parse0.kt"
}
task catch1(type: RunKonanTest) {
goldValue = "Before\nCaught Throwable\nDone\n"
source = "runtime/exceptions/catch1.kt"
}
task catch2(type: RunKonanTest) {
goldValue = "Before\nCaught Error\nDone\n"
source = "runtime/exceptions/catch2.kt"
}
task catch7(type: RunKonanTest) {
goldValue = "Error happens\n"
source = "runtime/exceptions/catch7.kt"
}
task extend_exception(type: RunKonanTest) {
goldValue = "OK\n"
source = "runtime/exceptions/extend0.kt"
}
task catch3(type: RunKonanTest) {
goldValue = "Before\nCaught Throwable\nDone\n"
source = "codegen/try/catch3.kt"
}
task catch4(type: RunKonanTest) {
goldValue = "Before\nCaught Error\nDone\n"
source = "codegen/try/catch4.kt"
}
task catch5(type: RunKonanTest) {
goldValue = "Before\nCaught Error\nDone\n"
source = "codegen/try/catch5.kt"
}
task catch6(type: RunKonanTest) {
goldValue = "Before\nCaught Error\nDone\n"
source = "codegen/try/catch6.kt"
}
task catch8(type: RunKonanTest) {
goldValue = "Error happens\n"
source = "codegen/try/catch8.kt"
}
task finally1(type: RunKonanTest) {
goldValue = "Try\nFinally\nDone\n"
source = "codegen/try/finally1.kt"
}
task finally2(type: RunKonanTest) {
goldValue = "Try\nCaught Error\nFinally\nDone\n"
source = "codegen/try/finally2.kt"
}
task finally3(type: RunKonanTest) {
goldValue = "Try\nFinally\nCaught Error\nDone\n"
source = "codegen/try/finally3.kt"
}
task finally4(type: RunKonanTest) {
goldValue = "Try\nCatch\nFinally\nCaught Exception\nDone\n"
source = "codegen/try/finally4.kt"
}
task finally5(type: RunKonanTest) {
goldValue = "Done\nFinally\n0\n"
source = "codegen/try/finally5.kt"
}
task finally6(type: RunKonanTest) {
goldValue = "Done\nFinally\n1\n"
source = "codegen/try/finally6.kt"
}
task finally7(type: RunKonanTest) {
goldValue = "Done\nFinally\n1\n"
source = "codegen/try/finally7.kt"
}
task finally8(type: RunKonanTest) {
goldValue = "Finally 1\nFinally 2\n42\n"
source = "codegen/try/finally8.kt"
}
task finally9(type: RunKonanTest) {
goldValue = "Finally 1\nFinally 2\nAfter\n"
source = "codegen/try/finally9.kt"
}
task finally10(type: RunKonanTest) {
goldValue = "Finally\nAfter\n"
source = "codegen/try/finally10.kt"
}
task finally11(type: RunKonanTest) {
goldValue = "Finally\nCatch 2\nDone\n"
source = "codegen/try/finally11.kt"
}
task scope1(type: RunKonanTest) {
goldValue = "1\n"
source = "codegen/dataflow/scope1.kt"
}
task uninitialized_val(type: RunKonanTest) {
goldValue = "1\n2\n"
source = "codegen/dataflow/uninitialized_val.kt"
}
task try1(type: RunKonanTest) {
goldValue = "5\n"
source = "codegen/try/try1.kt"
}
task try2(type: RunKonanTest) {
goldValue = "6\n"
source = "codegen/try/try2.kt"
}
task try3(type: RunKonanTest) {
goldValue = "6\n"
source = "codegen/try/try3.kt"
}
task try4(type: RunKonanTest) {
goldValue = "Try\n5\n"
source = "codegen/try/try4.kt"
}
task unreachable1(type: RunKonanTest) {
goldValue = "1\n"
source = "codegen/controlflow/unreachable1.kt"
}
task break_continue(type: RunKonanTest) {
goldValue = "foo@l1\nfoo@l2\nfoo@l2\nfoo@l2\nbar@l1\nbar@l2\nbar@l2\nbar@l2\nqux@t1\nqux@l2\nqux@l2\nqux@l2\n"
source = "codegen/controlflow/break.kt"
}
task break1(type: RunKonanTest) {
goldValue = "Body\nDone\n"
source = "codegen/controlflow/break1.kt"
}
task range0(type: RunKonanTest) {
goldValue = "123\nabcd\n"
source = "runtime/collections/range0.kt"
}
task args0(type: RunKonanTest) {
arguments = ["AAA", "BB", "C"]
goldValue = "AAA\nBB\nC\n"
source = "runtime/basic/args0.kt"
}
task spread_operator_0(type: RunKonanTest) {
goldValue = "[K, o, t, l, i, n, , i, s, , c, o, o, l, , l, a, n, g, u, a, g, e]\n"
source = "codegen/basics/spread_operator_0.kt"
}
task main_exception(type: RunKonanTest) {
// TODO: cannot currently check the output because the exact stacktrace strings are unpredictable.
// goldValue = "Uncaught exception from Kotlin's main: Throwable\n"
expectedExitStatus = 1
source = "runtime/basic/main_exception.kt"
}
task failed_assert(type: RunKonanTest) {
expectedExitStatus = 1
source = "runtime/basic/failed_assert.kt"
}
task initializers0(type: RunKonanTest) {
goldValue = "main\n" +
"B::constructor(1)\n" +
"A::companion\n" +
"A::companion::foo\n" +
"A::companion::foo\n" +
"B::constructor(0)\n" +
"B::constructor()\n" +
"A::Obj\n" +
"A::AObj::foo\n" +
"A::AObj::foo\n"
source = "runtime/basic/initializers0.kt"
}
task initializers1(type: RunKonanTest) {
goldValue = "Init Test\n" +
"Done\n"
disabled = true
source = "runtime/basic/initializers1.kt"
}
task concatenation(type: RunKonanTest) {
goldValue = "Hello world 1 2\nHello, a\nHello, b\n"
source = "codegen/basics/concatenation.kt"
}
task lambda1(type: RunKonanTest) {
goldValue = "lambda\n"
source = "codegen/lambda/lambda1.kt"
}
task lambda2(type: RunKonanTest) {
arguments = ["arg0"]
goldValue = "arg0\n"
source = "codegen/lambda/lambda2.kt"
}
task lambda3(type: RunKonanTest) {
goldValue = "lambda\n"
source = "codegen/lambda/lambda3.kt"
}
task lambda4(type: RunKonanTest) {
goldValue = "1\n2\n3\n3\n4\n"
source = "codegen/lambda/lambda4.kt"
}
task lambda5(type: RunKonanTest) {
goldValue = "42\n"
source = "codegen/lambda/lambda5.kt"
}
task lambda6(type: RunKonanTest) {
goldValue = "42\ncaptured\n"
source = "codegen/lambda/lambda6.kt"
}
task lambda7(type: RunKonanTest) {
goldValue = "43\n"
source = "codegen/lambda/lambda7.kt"
}
task lambda8(type: RunKonanTest) {
goldValue = "first\n0\nsecond\n0\nfirst\n1\nsecond\n1\n"
source = "codegen/lambda/lambda8.kt"
}
task lambda9(type: RunKonanTest) {
goldValue = "0\n0\n1\n0\n0\n1\n1\n1\n"
source = "codegen/lambda/lambda9.kt"
}
task lambda10(type: RunKonanTest) {
goldValue = "original\nchanged\n"
source = "codegen/lambda/lambda10.kt"
}
task lambda11(type: RunKonanTest) {
goldValue = "first\nsecond\n"
source = "codegen/lambda/lambda11.kt"
}
task lambda12(type: RunKonanTest) {
goldValue = "one\ntwo\n"
source = "codegen/lambda/lambda12.kt"
}
task lambda13(type: RunKonanTest) {
goldValue = "foo\n"
source = "codegen/lambda/lambda13.kt"
}
task objectExpression1(type: RunKonanTest) {
goldValue = "aabb\n"
source = "codegen/objectExpression/1.kt"
}
task objectExpression2(type: RunKonanTest) {
goldValue = "a\n"
source = "codegen/objectExpression/2.kt"
}
task objectExpression3(type: RunKonanTest) {
goldValue = "\n1\n2\n"
source = "codegen/objectExpression/3.kt"
}
task initializers2(type: RunKonanTest) {
goldValue = "init globalValue2\n" +
"init globalValue3\n" +
"1\n" +
"globalValue2\n" +
"globalValue3\n"
source = "runtime/basic/initializers2.kt"
}
task initializers3(type: RunKonanTest) {
goldValue = "42\n"
source = "runtime/basic/initializers3.kt"
}
task initializers4(type: RunKonanTest) {
goldValue = "1073741824\ntrue\n"
source = "runtime/basic/initializers4.kt"
}
task initializers5(type: RunKonanTest) {
goldValue = "42\n"
source = "runtime/basic/initializers5.kt"
}
task expression_as_statement(type: RunKonanTest) {
goldValue = "Ok\n"
source = "codegen/basics/expression_as_statement.kt"
}
task memory_var1(type: RunKonanTest) {
source = "runtime/memory/var1.kt"
}
task memory_var2(type: RunKonanTest) {
source = "runtime/memory/var2.kt"
}
task memory_var3(type: RunKonanTest) {
source = "runtime/memory/var3.kt"
}
task memory_var4(type: RunKonanTest) {
source = "runtime/memory/var4.kt"
}
task memory_throw_cleanup(type: RunKonanTest) {
goldValue = "Ok\n"
source = "runtime/memory/throw_cleanup.kt"
}
task unit1(type: RunKonanTest) {
goldValue = "First\nkotlin.Unit\n"
source = "codegen/basics/unit1.kt"
}
task unit2(type: RunKonanTest) {
goldValue = "kotlin.Unit\n"
source = "codegen/basics/unit2.kt"
}
task unit3(type: RunKonanTest) {
goldValue = "kotlin.Unit\n"
source = "codegen/basics/unit3.kt"
}
task unit4(type: RunKonanTest) {
goldValue = "Done\n"
source = "codegen/basics/unit4.kt"
}
task inline0(type: RunKonanTest) {
goldValue = "84\n"
source = "codegen/inline/inline0.kt"
}
task vararg0(type: RunKonanTest) {
source = "lower/vararg.kt"
}
task vararg_of_literals(type: RunKonanTest) {
disabled = true
goldValue = "a\na\n"
source = "lower/vararg_of_literals.kt"
}
task tailrec(type: RunKonanTest) {
goldValue = "12\n100000000\n" +
"8\n" +
"1\n" +
"3 ...\n2 ...\n1 ...\nready!\n" +
"2\n-1\n" +
"true\nfalse\n" +
"default\n" +
"42\n"
source = "lower/tailrec.kt"
}
task inline1(type: RunKonanTest) {
goldValue = "Hello world\n"
source = "codegen/inline/inline1.kt"
}
task inline2(type: RunKonanTest) {
goldValue = "hello 1 8\n"
source = "codegen/inline/inline2.kt"
}
task inline3(type: RunKonanTest) {
goldValue = "5\n"
source = "codegen/inline/inline3.kt"
}
task inline4(type: RunKonanTest) {
goldValue = "3\n"
source = "codegen/inline/inline4.kt"
}
task inline5(type: RunKonanTest) {
goldValue = "33\n"
source = "codegen/inline/inline5.kt"
}
task inline6(type: RunKonanTest) {
goldValue = "hello1\nhello2\nhello3\nhello4\n"
source = "codegen/inline/inline6.kt"
}
task inline7(type: RunKonanTest) {
goldValue = "1\n2\n3\n"
source = "codegen/inline/inline7.kt"
}
task inline8(type: RunKonanTest) {
goldValue = "8\n"
source = "codegen/inline/inline8.kt"
}
task inline9(type: RunKonanTest) {
goldValue = "hello\n6\n"
source = "codegen/inline/inline9.kt"
}
task inline10(type: RunKonanTest) {
goldValue = "2\n"
source = "codegen/inline/inline10.kt"
}
task inline13(type: RunKonanTest) {
goldValue = "true\n"
source = "codegen/inline/inline13.kt"
}
task inline14(type: RunKonanTest) {
goldValue = "9\n"
source = "codegen/inline/inline14.kt"
}
task inline15(type: RunKonanTest) {
goldValue = "4\n"
source = "codegen/inline/inline15.kt"
}
task inline16(type: RunKonanTest) {
goldValue = "false\n"
source = "codegen/inline/inline16.kt"
}
task inline17(type: RunKonanTest) {
goldValue = "[1, 2]\n"
source = "codegen/inline/inline17.kt"
}
task inline18(type: RunKonanTest) {
goldValue = "true\n"
source = "codegen/inline/inline18.kt"
}
task inline19(type: RunKonanTest) {
goldValue = "6\n"
source = "codegen/inline/inline19.kt"
}
task inline20(type: RunKonanTest) {
goldValue = "def\n"
source = "codegen/inline/inline20.kt"
}
task inline21(type: RunKonanTest) {
goldValue = "bar\nfoo1\nfoo2\n33\n"
source = "codegen/inline/inline21.kt"
}
task inline22(type: RunKonanTest) {
goldValue = "14\n"
source = "codegen/inline/inline22.kt"
}
task inline23(type: RunKonanTest) {
goldValue = "33\n"
source = "codegen/inline/inline23.kt"
}
task deserialized_inline0(type: RunKonanTest) {
source = "serialization/deserialized_inline0.kt"
}
task deserialized_listof0(type: RunKonanTest) {
source = "serialization/deserialized_listof0.kt"
}
// 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) {
goldValue = "122\n47\n"
source = "codegen/inline/defaultArgs_linkTest_main.kt"
lib = "codegen/inline/defaultArgs_linkTest_lib.kt"
}
kotlinNativeInterop {
sysstat {
pkg 'sysstat'
headers 'sys/stat.h'
flavor 'native'
}
cstdlib {
pkg 'cstdlib'
headers 'stdlib.h'
flavor 'native'
}
cstdio {
defFile 'interop/basics/cstdio.def'
flavor 'native'
compilerOpts '-D_POSIX_SOURCE' // Exclude Darwin extensions causing link errors.
}
sockets {
defFile 'interop/basics/sockets.def'
flavor 'native'
}
if (isMac()) {
opengl {
flavor 'native'
compilerOpts '-framework', 'OpenGL', '-framework', 'GLUT'
linkerOpts '-framework', 'OpenGL', '-framework', 'GLUT'
pkg 'opengl'
headers 'GLUT/glut.h'
}
}
}
task interop0(type: RunInteropKonanTest) {
goldValue = "0\n0\n"
source = "interop/basics/0.kt"
interop = 'sysstat'
}
task interop1(type: RunInteropKonanTest) {
goldValue = "257\n-1\n-2\n"
source = "interop/basics/1.kt"
interop = 'cstdlib'
}
task interop2(type: RunInteropKonanTest) {
goldValue = "Hello\n"
source = "interop/basics/2.kt"
interop = 'cstdio'
}
task interop3(type: RunInteropKonanTest) {
// We disable this test on Raspberry Pi because
// qsort accepts size_t args. So the .kt file
// should be different depending on the bitness of the target.
// There are plans to provide a solution and turn this
// test back on.
disabled = (project.testTarget == 'raspberrypi')
goldValue = "8 9 12 13 14 \n"
source = "interop/basics/3.kt"
interop = 'cstdlib'
}
task interop4(type: RunInteropKonanTest) {
goldValue = "a b -1 2 3 9223372036854775807 0.1 0.2\n1 42\n"
source = "interop/basics/4.kt"
interop = 'cstdio'
}
task interop_echo_server(type: RunInteropKonanTest) {
if (isLinux()) {
disabled = true
}
run = false
source = "interop/basics/echo_server.kt"
interop = 'sockets'
}
if (isMac()) {
task interop_opengl_teapot(type: RunInteropKonanTest) {
run = false
source = "interop/basics/opengl_teapot.kt"
interop = 'opengl'
}
}