[build][tests][g/c] fix dependencies on platform and dist
This commit is contained in:
@@ -130,19 +130,16 @@ testOutputStdlib.mkdirs()
|
|||||||
|
|
||||||
konanArtifacts {
|
konanArtifacts {
|
||||||
library('testLibrary') {
|
library('testLibrary') {
|
||||||
if (!useCustomDist) {
|
|
||||||
dependsOn ':dist'
|
|
||||||
}
|
|
||||||
srcDir 'testLibrary'
|
srcDir 'testLibrary'
|
||||||
}
|
}
|
||||||
def target = project.testTarget ?: 'host'
|
def target = project.testTarget ?: 'host'
|
||||||
library('baseTestClass', targets: [target]) {
|
library('baseTestClass', targets: [target]) {
|
||||||
if (!useCustomDist) {
|
|
||||||
dependsOn ':dist'
|
|
||||||
}
|
|
||||||
srcFiles 'testing/library.kt'
|
srcFiles 'testing/library.kt'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
configure(project.tasks.findByName("compileKonanBaseTestClass${UtilsKt.getTestTargetSuffix(project)}")) {
|
||||||
|
UtilsKt.dependsOnDist(it)
|
||||||
|
}
|
||||||
|
|
||||||
def installTestLib = tasks.register("installTestLibrary", KlibInstall) {
|
def installTestLib = tasks.register("installTestLibrary", KlibInstall) {
|
||||||
dependsOn "compileKonanTestLibraryHost"
|
dependsOn "compileKonanTestLibraryHost"
|
||||||
@@ -187,14 +184,8 @@ run {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task sanity {
|
task sanity {
|
||||||
def platformLibsTasks = targetList.collect { ":kotlin-native:${it}PlatformLibs" } + ":distPlatformLibs"
|
dependsOn(tasksOf(KonanTest))
|
||||||
dependsOn(tasksOf(KonanTest) { task ->
|
dependsOn(tasksOf(FrameworkTest))
|
||||||
task.getDependsOn().every { !platformLibsTasks.contains(it) } &&
|
|
||||||
task.name != "library_mismatch" // This test requires the wasm32 stdlib which is unavailable during a sanity run.
|
|
||||||
})
|
|
||||||
dependsOn(tasksOf(FrameworkTest) { task ->
|
|
||||||
task.getDependsOn().every { !platformLibsTasks.contains(it) }
|
|
||||||
})
|
|
||||||
dependsOn(tasksOf(MetadataComparisonTest))
|
dependsOn(tasksOf(MetadataComparisonTest))
|
||||||
// Add regular gradle test tasks
|
// Add regular gradle test tasks
|
||||||
dependsOn(tasksOf(Test))
|
dependsOn(tasksOf(Test))
|
||||||
@@ -240,17 +231,6 @@ boolean isExcluded(String dir) {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
void dependsOnPlatformLibs(Task t) {
|
|
||||||
if (!useCustomDist) {
|
|
||||||
def testTarget = project.target
|
|
||||||
if (testTarget != project.platformManager.Companion.host) {
|
|
||||||
t.dependsOn(":${testTarget}PlatformLibs")
|
|
||||||
} else {
|
|
||||||
t.dependsOn(':kotlin-native:distPlatformLibs')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a task for a standalone test. Configures runner and adds building task.
|
* Creates a task for a standalone test. Configures runner and adds building task.
|
||||||
*/
|
*/
|
||||||
@@ -2112,10 +2092,10 @@ linkTest("link_omit_unused") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("link_default_libs") {
|
standaloneTest("link_default_libs") {
|
||||||
dependsOnPlatformLibs(it)
|
|
||||||
enabled = (project.testTarget != 'wasm32') // there will be no posix.klib for wasm
|
enabled = (project.testTarget != 'wasm32') // there will be no posix.klib for wasm
|
||||||
goldValue = "sizet = 0\n"
|
goldValue = "sizet = 0\n"
|
||||||
source = "link/default/default.kt"
|
source = "link/default/default.kt"
|
||||||
|
UtilsKt.dependsOnPlatformLibs(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("link_testLib_explicitly") {
|
standaloneTest("link_testLib_explicitly") {
|
||||||
@@ -2134,11 +2114,11 @@ standaloneTest("link_testLib_explicitly") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
linkTest("no_purge_for_dependencies") {
|
linkTest("no_purge_for_dependencies") {
|
||||||
dependsOnPlatformLibs(it)
|
|
||||||
enabled = (project.testTarget != 'wasm32') // there will be no posix.klib for wasm
|
enabled = (project.testTarget != 'wasm32') // there will be no posix.klib for wasm
|
||||||
goldValue = "linked library\nand symbols from posix available: 17; 1.0\n"
|
goldValue = "linked library\nand symbols from posix available: 17; 1.0\n"
|
||||||
source = "link/purge1/prog.kt"
|
source = "link/purge1/prog.kt"
|
||||||
lib = "link/purge1/lib.kt"
|
lib = "link/purge1/lib.kt"
|
||||||
|
UtilsKt.dependsOnPlatformLibs(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
task for0(type: KonanLocalTest) {
|
task for0(type: KonanLocalTest) {
|
||||||
@@ -3943,10 +3923,10 @@ Task interopTestMultifile(String name, Closure<KonanInteropTest> configureClosur
|
|||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("interop_objc_allocException") {
|
standaloneTest("interop_objc_allocException") {
|
||||||
dependsOnPlatformLibs(it)
|
|
||||||
disabled = !isAppleTarget(project)
|
disabled = !isAppleTarget(project)
|
||||||
expectedExitStatus = 0
|
expectedExitStatus = 0
|
||||||
source = "interop/objc/allocException.kt"
|
source = "interop/objc/allocException.kt"
|
||||||
|
UtilsKt.dependsOnPlatformLibs(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
interopTest("interop0") {
|
interopTest("interop0") {
|
||||||
@@ -3997,10 +3977,10 @@ interopTest("interop4") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("interop5") {
|
standaloneTest("interop5") {
|
||||||
dependsOnPlatformLibs(it)
|
|
||||||
enabled = (project.testTarget != 'wasm32') // No interop for wasm yet.
|
enabled = (project.testTarget != 'wasm32') // No interop for wasm yet.
|
||||||
goldValue = "Hello!\n"
|
goldValue = "Hello!\n"
|
||||||
source = "interop/basics/5.kt"
|
source = "interop/basics/5.kt"
|
||||||
|
UtilsKt.dependsOnPlatformLibs(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
interopTest("interop_bitfields") {
|
interopTest("interop_bitfields") {
|
||||||
@@ -4317,7 +4297,7 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
interopTest("interop_objc_foreignException") {
|
interopTest("interop_objc_foreignException") {
|
||||||
source = "interop/objc/foreignException/objc_wrap.kt"
|
source = "interop/objc/foreignException/objc_wrap.kt"
|
||||||
interop = 'foreignException'
|
interop = 'foreignException'
|
||||||
dependsOnPlatformLibs(it)
|
UtilsKt.dependsOnPlatformLibs(it)
|
||||||
|
|
||||||
doBeforeBuild {
|
doBeforeBuild {
|
||||||
mkdir(buildDir)
|
mkdir(buildDir)
|
||||||
@@ -4336,7 +4316,7 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
source = "interop/objc/foreignException/objcExceptionMode.kt"
|
source = "interop/objc/foreignException/objcExceptionMode.kt"
|
||||||
interop = 'foreignExceptionMode_wrap'
|
interop = 'foreignExceptionMode_wrap'
|
||||||
goldValue = "OK: ForeignException\n"
|
goldValue = "OK: ForeignException\n"
|
||||||
dependsOnPlatformLibs(it)
|
UtilsKt.dependsOnPlatformLibs(it)
|
||||||
|
|
||||||
doBeforeBuild {
|
doBeforeBuild {
|
||||||
mkdir(buildDir)
|
mkdir(buildDir)
|
||||||
@@ -4355,7 +4335,7 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
source = "interop/objc/foreignException/objcExceptionMode.kt"
|
source = "interop/objc/foreignException/objcExceptionMode.kt"
|
||||||
interop = 'foreignExceptionMode_default'
|
interop = 'foreignExceptionMode_default'
|
||||||
goldValue = "OK: Ends with uncaught exception handler\n"
|
goldValue = "OK: Ends with uncaught exception handler\n"
|
||||||
dependsOnPlatformLibs(it)
|
UtilsKt.dependsOnPlatformLibs(it)
|
||||||
|
|
||||||
doBeforeBuild {
|
doBeforeBuild {
|
||||||
mkdir(buildDir)
|
mkdir(buildDir)
|
||||||
@@ -4426,24 +4406,24 @@ standaloneTest("jsinterop_math") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("interop_libiconv") {
|
standaloneTest("interop_libiconv") {
|
||||||
dependsOnPlatformLibs(it)
|
|
||||||
enabled = (project.testTarget == null)
|
enabled = (project.testTarget == null)
|
||||||
source = "interop/libiconv.kt"
|
source = "interop/libiconv.kt"
|
||||||
goldValue = "72 72\n101 101\n108 108\n108 108\n111 111\n33 33\n"
|
goldValue = "72 72\n101 101\n108 108\n108 108\n111 111\n33 33\n"
|
||||||
|
UtilsKt.dependsOnPlatformLibs(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("interop_zlib") {
|
standaloneTest("interop_zlib") {
|
||||||
dependsOnPlatformLibs(it)
|
|
||||||
enabled = (project.testTarget == null)
|
enabled = (project.testTarget == null)
|
||||||
source = "interop/platform_zlib.kt"
|
source = "interop/platform_zlib.kt"
|
||||||
goldValue = "Hello!\nHello!\n"
|
goldValue = "Hello!\nHello!\n"
|
||||||
|
UtilsKt.dependsOnPlatformLibs(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("interop_objc_illegal_sharing") {
|
standaloneTest("interop_objc_illegal_sharing") {
|
||||||
dependsOnPlatformLibs(it)
|
|
||||||
disabled = !isAppleTarget(project) ||
|
disabled = !isAppleTarget(project) ||
|
||||||
isExperimentalMM // Experimental MM doesn't support multiple mutators yet.
|
isExperimentalMM // Experimental MM doesn't support multiple mutators yet.
|
||||||
source = "interop/objc/illegal_sharing.kt"
|
source = "interop/objc/illegal_sharing.kt"
|
||||||
|
UtilsKt.dependsOnPlatformLibs(it)
|
||||||
expectedExitStatusChecker = { it != 0 }
|
expectedExitStatusChecker = { it != 0 }
|
||||||
outputChecker = {
|
outputChecker = {
|
||||||
it.startsWith("Before") && !it.contains("After")
|
it.startsWith("Before") && !it.contains("After")
|
||||||
@@ -4578,8 +4558,8 @@ tasks.register("library_mismatch", KonanDriverTest) {
|
|||||||
|
|
||||||
if (!useCustomDist) {
|
if (!useCustomDist) {
|
||||||
// we actually need any target other than the current one.
|
// we actually need any target other than the current one.
|
||||||
dependsOn ':wasm32CrossDistRuntime'
|
dependsOn ':kotlin-native:wasm32CrossDistRuntime'
|
||||||
dependsOn ':wasm32CrossDistEndorsedLibraries'
|
dependsOn ':kotlin-native:wasm32CrossDistEndorsedLibraries'
|
||||||
}
|
}
|
||||||
|
|
||||||
doBeforeBuild {
|
doBeforeBuild {
|
||||||
@@ -4659,6 +4639,7 @@ linkTest("private_fake_overrides_1") {
|
|||||||
Task frameworkTest(String name, Closure<FrameworkTest> configurator) {
|
Task frameworkTest(String name, Closure<FrameworkTest> configurator) {
|
||||||
return KotlinNativeTestKt.createTest(project, name, FrameworkTest) { task ->
|
return KotlinNativeTestKt.createTest(project, name, FrameworkTest) { task ->
|
||||||
configurator.delegate = task
|
configurator.delegate = task
|
||||||
|
UtilsKt.dependsOnDist(task)
|
||||||
configurator()
|
configurator()
|
||||||
if (task.enabled) {
|
if (task.enabled) {
|
||||||
konanArtifacts {
|
konanArtifacts {
|
||||||
@@ -4678,10 +4659,6 @@ Task frameworkTest(String name, Closure<FrameworkTest> configurator) {
|
|||||||
UtilsKt.dependsOnKonanBuildingTask(task, fr.library, target)
|
UtilsKt.dependsOnKonanBuildingTask(task, fr.library, target)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!useCustomDist) {
|
|
||||||
dependsOn ":kotlin-native:${target.name}CrossDistRuntime", ':kotlin-native:distCompiler'
|
|
||||||
}
|
|
||||||
|
|
||||||
extraOpts fr.bitcode ? "-Xembed-bitcode" : "-Xembed-bitcode-marker"
|
extraOpts fr.bitcode ? "-Xembed-bitcode" : "-Xembed-bitcode-marker"
|
||||||
if (fr.isStatic) extraOpts "-Xstatic-framework"
|
if (fr.isStatic) extraOpts "-Xstatic-framework"
|
||||||
extraOpts fr.opts
|
extraOpts fr.opts
|
||||||
@@ -4689,6 +4666,7 @@ Task frameworkTest(String name, Closure<FrameworkTest> configurator) {
|
|||||||
|
|
||||||
artifactName fr.artifact
|
artifactName fr.artifact
|
||||||
}
|
}
|
||||||
|
UtilsKt.dependsOnDist(project.tasks.findByName("compileKonan${fr.name.capitalize()}${UtilsKt.getTestTargetSuffix(project)}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user