[K/N] Tests for function attributes in bitcode generator

Besides, well, tests themselves, this commit extends FileCheck infra to
make it possible to test bitcode for direct and reverse interop.
This commit is contained in:
Sergey Bogolepov
2021-10-06 15:16:26 +07:00
committed by Space
parent 851f4d86d9
commit fdd020eab6
7 changed files with 364 additions and 9 deletions
@@ -5830,15 +5830,39 @@ Task fileCheckTest(String name, Closure<FileCheckTest> configureClosure) {
task.llvmIr = project.file("$testOutputFileCheck/$name/out.ll")
if (task.enabled) {
konanArtifacts {
// We could use `bitcode` here to make things faster. But:
// 1. `bitcode` has no other usages.
// 2. Unification should help porting to the new test infra.
// 3. Compiler might behave differently when outputting bitcode instead of object files.
program(name, targets: [ target ]) {
srcFiles task.annotatedSource
baseDir "$testOutputFileCheck/$name"
extraOpts project.globalTestArgs
extraOpts "-Xtemporary-files-dir=$testOutputFileCheck/$name", "-Xsave-llvm-ir"
def lib = task.interop
if (lib != null) {
UtilsKt.dependsOnKonanBuildingTask(task, lib, target)
}
if (!task.generateFramework) {
// We could use `bitcode` here to make things faster. But:
// 1. `bitcode` has no other usages.
// 2. Unification should help porting to the new test infra.
// 3. Compiler might behave differently when outputting bitcode instead of object files.
program(name, targets: [target]) {
srcFiles task.annotatedSource
baseDir "$testOutputFileCheck/$name"
extraOpts project.globalTestArgs
extraOpts "-Xtemporary-files-dir=$testOutputFileCheck/$name", "-Xsave-llvm-ir"
if (lib != null) {
libraries {
artifact lib
}
}
}
} else {
// Framework support is much weakier than `frameworkTest`, but we don't need much.
framework(name, targets: [target]) {
srcFiles task.annotatedSource
baseDir "$testOutputFileCheck/$name"
extraOpts project.globalTestArgs
extraOpts "-Xtemporary-files-dir=$testOutputFileCheck/$name", "-Xsave-llvm-ir", "-Xmeaningful-bridge-names"
if (lib != null) {
libraries {
artifact lib
}
}
}
}
UtilsKt.dependsOnKonanBuildingTask(task, name, target)
}
@@ -5874,6 +5898,30 @@ fileCheckTest("filecheck_bce") {
annotatedSource = project.file('filecheck/bce.kt')
}
fileCheckTest("filecheck_signext_zeroext0") {
annotatedSource = project.file('filecheck/signext_zeroext0.kt')
}
createInterop("filecheck_signext_zeroext_interop_input") {
it.defFile 'filecheck/signext_zeroext_interop_input.def'
}
fileCheckTest("filecheck_signext_zeroext_interop") {
annotatedSource = project.file('filecheck/signext_zeroext_interop.kt')
interop = "filecheck_signext_zeroext_interop_input"
}
fileCheckTest("filecheck_signext_zeroext_objc_export") {
annotatedSource = project.file('filecheck/signext_zeroext_objc_export.kt')
generateFramework = true
enabled = target.family.appleFamily
}
fileCheckTest("filecheck_function_attributes_at_callsite") {
annotatedSource = project.file('filecheck/function_attributes_at_callsite.kt')
}
dependencies {
nopPluginApi project(kotlinCompilerModule)
nopPluginApi project(":native:kotlin-native-utils")