[build] enable sanity tests (step 3)

This commit is contained in:
Vasily Levchenko
2020-11-18 13:55:34 +01:00
parent a7eaa35317
commit 17fc4a087b
4 changed files with 46 additions and 53 deletions
+43 -51
View File
@@ -3,7 +3,7 @@
* that can be found in the LICENSE file. * that can be found in the LICENSE file.
*/ */
import shadow.org.jetbrains.kotlin.gradle.plugin.tasks.KonanCompileNativeBinary import org.jetbrains.kotlin.gradle.plugin.tasks.KonanCompileNativeBinary
import org.jetbrains.kotlin.* import org.jetbrains.kotlin.*
import org.jetbrains.kotlin.konan.target.Family import org.jetbrains.kotlin.konan.target.Family
import org.jetbrains.kotlin.konan.target.KonanTarget import org.jetbrains.kotlin.konan.target.KonanTarget
@@ -18,17 +18,10 @@ buildscript {
url 'https://cache-redirector.jetbrains.com/maven-central' url 'https://cache-redirector.jetbrains.com/maven-central'
} }
mavenCentral() mavenCentral()
maven {
url buildKotlinCompilerRepo
}
maven { maven {
url kotlinCompilerRepo url project.bootstrapKotlinRepo
} }
} }
dependencies {
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$gradlePluginVersion"
}
ext.useCustomDist = project.hasProperty("kotlin.native.home") || ext.useCustomDist = project.hasProperty("kotlin.native.home") ||
project.hasProperty("org.jetbrains.kotlin.native.home") || project.hasProperty("org.jetbrains.kotlin.native.home") ||
project.hasProperty("konan.home") project.hasProperty("konan.home")
@@ -50,18 +43,15 @@ configurations {
cli_bc cli_bc
update_tests update_tests
update_stdlib_tests update_stdlib_tests
}
repositories { compile
ivy { nopPluginCompile
ivyPattern 'https://teamcity.jetbrains.com/guestAuth/repository/download/[module]/[revision]/teamcity-ivy.xml' compile.extendsFrom nopPluginCompile
artifactPattern 'https://teamcity.jetbrains.com/guestAuth/repository/download/[module]/[revision]/[artifact](.[ext])'
}
} }
dependencies { dependencies {
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7' compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
cli_bc project(path: ':backend.native', configuration: 'cli_bc') cli_bc project(path: ':kotlin-native:backend.native', configuration: 'cli_bc')
def updateTestData = true def updateTestData = true
if (project.hasProperty("kotlinProjectPath")) { if (project.hasProperty("kotlinProjectPath")) {
def kotlinProj = project.property("kotlinProjectPath").toString() def kotlinProj = project.property("kotlinProjectPath").toString()
@@ -80,20 +70,6 @@ dependencies {
println("WARNING: using stdlib tests provided by gradle.properties. Please execute :kotlin:zipTestData") println("WARNING: using stdlib tests provided by gradle.properties. Please execute :kotlin:zipTestData")
} }
} }
if (updateTestData) {
update_tests(group: 'org', name: 'Kotlin_KotlinPublic_Compiler', version: testKotlinCompilerVersion) {
artifact {
name = 'internal/kotlin-test-data'
type = 'zip'
}
}
update_stdlib_tests (group: 'org', name: 'Kotlin_KotlinPublic_Compiler', version: kotlinStdlibTestsVersion) {
artifact {
name = 'internal/kotlin-stdlib-tests'
type = 'zip'
}
}
}
} }
ext.testOutputRoot = rootProject.file("test.output").absolutePath ext.testOutputRoot = rootProject.file("test.output").absolutePath
ext.externalTestsDir = project.file("build/external") ext.externalTestsDir = project.file("build/external")
@@ -101,10 +77,10 @@ ext.externalStdlibTestsDir = project.file("build/stdlib_external/stdlib")
externalTestsDir.mkdirs() externalTestsDir.mkdirs()
externalStdlibTestsDir.mkdirs() externalStdlibTestsDir.mkdirs()
ext.platformManager = project.rootProject.platformManager ext.platformManager = project.project(":kotlin-native").platformManager
ext.target = platformManager.targetManager(project.testTarget).target ext.target = platformManager.targetManager(project.testTarget).target
ext.testLibraryDir = "${ext.kotlinNativeDist}/klib/platform/${project.target.name}" ext.testLibraryDir = "${ext.testOutputRoot}/klib/platform/${project.target.name}"
// Add executor to run tests depending on a target // Add executor to run tests depending on a target
project.convention.plugins.executor = ExecutorServiceKt.create(project) project.convention.plugins.executor = ExecutorServiceKt.create(project)
@@ -234,7 +210,6 @@ def update_external_tests() {
def stdlibTestsFiles = configurations.update_stdlib_tests.asFileTree def stdlibTestsFiles = configurations.update_stdlib_tests.asFileTree
copy { copy {
stdlibTestsFiles.each { stdlibTestsFiles.each {
from(zipTree(it))
into(externalStdlibTestsDir) into(externalStdlibTestsDir)
include 'common/**' include 'common/**'
include 'test/**' include 'test/**'
@@ -275,12 +250,7 @@ run {
} }
task sanity { task sanity {
doFirst { def platformLibsTasks = targetList.collect { ":kotlin-native:${it}PlatformLibs" } + ":distPlatformLibs"
if (!project.hasProperty("test.disable_update")) {
update_external_tests()
}
}
def platformLibsTasks = targetList.collect { ":${it}PlatformLibs" } + ":distPlatformLibs"
dependsOn(tasksOf(KonanTest) { task -> dependsOn(tasksOf(KonanTest) { task ->
task.getDependsOn().every { !platformLibsTasks.contains(it) } && task.getDependsOn().every { !platformLibsTasks.contains(it) } &&
task.name != "library_mismatch" // This test requires the wasm32 stdlib which is unavailable during a sanity run. task.name != "library_mismatch" // This test requires the wasm32 stdlib which is unavailable during a sanity run.
@@ -2224,7 +2194,7 @@ standaloneTest("link_testLib_explicitly") {
goldValue = "This is a side effect of a test library linked into the binary.\nYou should not be seeing this.\n\nHello\n" goldValue = "This is a side effect of a test library linked into the binary.\nYou should not be seeing this.\n\nHello\n"
source = "link/omit/hello.kt" source = "link/omit/hello.kt"
// We force library inclusion, so need to see the warning banner. // We force library inclusion, so need to see the warning banner.
flags = ['-l', 'testLibrary'] flags = ['-l', 'testLibrary', '-r', testLibraryDir]
doLast { doLast {
def file = new File("$testLibraryDir/testLibrary") def file = new File("$testLibraryDir/testLibrary")
file.deleteDir() file.deleteDir()
@@ -4777,7 +4747,7 @@ Task frameworkTest(String name, Closure<FrameworkTest> configurator) {
} }
if (!useCustomDist) { if (!useCustomDist) {
dependsOn ":${target.name}CrossDistRuntime", ':distCompiler' 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"
@@ -4829,7 +4799,7 @@ if (isAppleTarget(project)) {
artifactName "test-library" artifactName "test-library"
if (!useCustomDist) { if (!useCustomDist) {
dependsOn ":${target.name}CrossDistRuntime", ':distCompiler' dependsOn ":kotlin-native:${target.name}CrossDistRuntime", ':kotlin-native:distCompiler'
} }
extraOpts "-Xshort-module-name=MyLibrary" extraOpts "-Xshort-module-name=MyLibrary"
@@ -4856,7 +4826,7 @@ if (isAppleTarget(project)) {
artifactName "test-library" artifactName "test-library"
if (!useCustomDist) { if (!useCustomDist) {
dependsOn ":${target.name}CrossDistRuntime", ':distCompiler' dependsOn ":kotlin-native:${target.name}CrossDistRuntime", ':kotlin-native:distCompiler'
} }
extraOpts "-Xshort-module-name=MyLibrary" extraOpts "-Xshort-module-name=MyLibrary"
@@ -5155,11 +5125,13 @@ private void createStdlibTest(String name, boolean inWorker) {
*/ */
private void configureStdlibTest(KonanGTest task, boolean inWorker) { private void configureStdlibTest(KonanGTest task, boolean inWorker) {
def sources = UtilsKt.getFilesToCompile(project, def sources = UtilsKt.getFilesToCompile(project,
[ 'build/stdlib_external/stdlib', 'stdlib_external/utils.kt', [ '../../../libraries/stdlib/common/test',
'stdlib_external/collections', '../../../libraries/stdlib/test',
'stdlib_external/jsCollectionFactoriesActuals.kt', '../../../libraries/kotlin.test/common/src/test/kotlin',
'stdlib_external/text/StringEncodingTestNative.kt'], 'stdlib_external/utils.kt',
[ 'build/stdlib_external/stdlib/test/internalAnnotations.kt' ]) 'stdlib_external/jsCollectionFactoriesActuals.kt',
'stdlib_external/text/StringEncodingTestNative.kt'],
[ /*'build/stdlib_external/stdlib/test/internalAnnotations.kt'*/ ])
konanArtifacts { konanArtifacts {
program(task.name, targets: [target.name]) { program(task.name, targets: [target.name]) {
@@ -5237,6 +5209,13 @@ sourceSets {
srcDir 'debugger/src/test/kotlin' srcDir 'debugger/src/test/kotlin'
} }
} }
update_stdlib_tests{
kotlin {
srcDir '../../../libraries/stdlib/common/test'
srcDir '../../../libraries/stdlib/test'
srcDir '../../../libraries/kotlin.test/common/src/test/kotlin'
}
}
} }
compileNopPluginKotlin { compileNopPluginKotlin {
@@ -5276,9 +5255,22 @@ pluginTest("runtime_basic_init", "nopPlugin") {
} }
dependencies { dependencies {
nopPluginCompile kotlinCompilerModule nopPluginCompile project(kotlinCompilerModule)
compile kotlinCompilerModule nopPluginCompile project(":native:kotlin-native-utils")
compile project(path: ':backend.native', configuration: 'cli_bc') nopPluginCompile project(":core:descriptors")
nopPluginCompile project(":compiler:ir.tree")
nopPluginCompile project(":compiler:ir.tree.impl")
nopPluginCompile project(":compiler:ir.backend.common")
nopPluginCompile project(":compiler:util")
nopPluginCompile project(":native:frontend.native")
nopPluginCompile project(":compiler:cli-common")
nopPluginCompile project(":compiler:cli")
nopPluginCompile project(":kotlin-util-klib")
nopPluginCompile project(":kotlin-util-klib-metadata")
nopPluginCompile project(":compiler:ir.serialization.common")
compile project(kotlinCompilerModule)
compile project(path: ':kotlin-native:backend.native', configuration: 'cli_bc')
compile 'junit:junit:4.12' compile 'junit:junit:4.12'
} }
@@ -1,2 +1,2 @@
libraryPaths = backend.native/tests/build/embedStaticLibraries libraryPaths = kotlin-native/backend.native/tests/build/embedStaticLibraries
staticLibraries = 3.a 4.a staticLibraries = 3.a 4.a
@@ -1,2 +1,2 @@
libraryPaths = backend.native/tests/build/kt43502 libraryPaths = kotlin-native/backend.native/tests/build/kt43502
staticLibraries = kt43502.a staticLibraries = kt43502.a
+1
View File
@@ -599,3 +599,4 @@ include ':kotlin-native:llvmDebugInfoC'
include ':kotlin-native:utilities' include ':kotlin-native:utilities'
include ':kotlin-native:platformLibs' include ':kotlin-native:platformLibs'
include ':kotlin-native:libclangext' include ':kotlin-native:libclangext'
include ':kotlin-native:backend.native:tests'