Update tests before the run

This commit is contained in:
Pavel Punegov
2018-08-07 12:55:13 +03:00
committed by Pavel Punegov
parent 32135429e4
commit 7dbfdc047d
2 changed files with 31 additions and 37 deletions
+30 -36
View File
@@ -63,9 +63,10 @@ dependencies {
} }
ext.testOutputRoot = rootProject.file("test.output").absolutePath ext.testOutputRoot = rootProject.file("test.output").absolutePath
ext.externalTestsDir = project.file("external") ext.externalTestsDir = project.file("build/external")
ext.externalStdlibTestsDir = project.file("stdlib_external") ext.externalStdlibTestsDir = project.file("build/stdlib_external")
externalTestsDir.mkdirs() externalTestsDir.mkdirs()
externalStdlibTestsDir.mkdirs()
ext.platformManager = project.rootProject.platformManager ext.platformManager = project.rootProject.platformManager
ext.target = platformManager.targetManager(project.testTarget).target ext.target = platformManager.targetManager(project.testTarget).target
@@ -114,43 +115,32 @@ task installTestLibrary(type: KlibInstall) {
} }
// Gets tests from the same Kotlin compiler build // Gets tests from the same Kotlin compiler build
task update_external_tests() { def update_external_tests() {
doLast { // Copy only used tests into the test directory.
// Unzip. externalTestsDir.mkdirs()
delete temporaryDir delete("${externalTestsDir.canonicalPath}/codegen")
copy { delete("${externalTestsDir.canonicalPath}/compileKotlinAgainstKotlin")
configurations.update_tests.asFileTree.each {
from(zipTree(it)) {
include('compiler/**', 'stdlib/**')
}
into(temporaryDir)
}
}
// Copy only used tests into the test directory.
externalTestsDir.mkdirs()
delete("${externalTestsDir.canonicalPath}/codegen")
delete("${externalTestsDir.canonicalPath}/compileKotlinAgainstKotlin")
copy { copy {
from temporaryDir.absolutePath + "/compiler" configurations.update_tests.asFileTree.each {
from(zipTree(it))
into(externalTestsDir) into(externalTestsDir)
include 'codegen/box/**' include 'compiler/codegen/box/**'
include 'codegen/boxInline/**' include 'compiler/codegen/boxInline/**'
include 'compileKotlinAgainstKotlin/**' include 'compiler/compileKotlinAgainstKotlin/**'
} }
}
externalStdlibTestsDir.mkdirs() externalStdlibTestsDir.mkdirs()
delete("${externalStdlibTestsDir.canonicalPath}/common") delete("${externalStdlibTestsDir.canonicalPath}/common")
delete("${externalStdlibTestsDir.canonicalPath}/test") delete("${externalStdlibTestsDir.canonicalPath}/test")
copy { copy {
from temporaryDir.absolutePath + "/stdlib" configurations.update_tests.asFileTree.each {
from(zipTree(it))
into(externalStdlibTestsDir) into(externalStdlibTestsDir)
include 'common/**' include 'stdlib/common/**'
include 'test/**' include 'stdlib/test/**'
} }
//clean tmp dir.
delete temporaryDir
} }
} }
@@ -216,6 +206,8 @@ def createTestTasks(File testRoot, Class<Task> taskType, Closure taskConfigurati
} }
task run_external () { task run_external () {
update_external_tests()
// Create tasks for external tests. // Create tasks for external tests.
createTestTasks(externalTestsDir, RunExternalTestGroup) { } createTestTasks(externalTestsDir, RunExternalTestGroup) { }
@@ -2938,15 +2930,17 @@ task runKonanRegexTests(type: RunKonanTest) {
task buildKonanStdlibTests(type: BuildKonanTest) { task buildKonanStdlibTests(type: BuildKonanTest) {
outputSourceSetName = "testOutputStdlib" outputSourceSetName = "testOutputStdlib"
flags = [ "-Xmulti-platform" ] flags = [ "-Xmulti-platform", "-friend-modules", project.rootProject.file("dist/klib/common/stdlib") ]
compileList = [ "stdlib_external/test", "stdlib_external/common", def testSources = externalStdlibTestsDir.absolutePath
compileList = [ "$testSources/stdlib/test", "$testSources/stdlib/common",
"stdlib_external/utils.kt", "stdlib_external/jsCollectionFactoriesActuals.kt" ] "stdlib_external/utils.kt", "stdlib_external/jsCollectionFactoriesActuals.kt" ]
excludeList = [ "$testSources/stdlib/test/internalAnnotations.kt" ]
} }
task runStdlibTests(type: RunStdlibTest) { task runStdlibTests(type: RunStdlibTest) {
outputSourceSetName = "testOutputStdlib" outputSourceSetName = "testOutputStdlib"
// runs all tests and hence source name should be not null // runs all tests and hence source name should be not null
source = "stdlib_external/testUtils.kt" source = "stdlib_external/utils.kt"
useFilter = false useFilter = false
runnerLogger = RunKonanTest.Logger.GTEST runnerLogger = RunKonanTest.Logger.GTEST
} }
@@ -12,4 +12,4 @@ public actual fun assertTypeEquals(expected: Any?, actual: Any?) {
public actual fun randomInt(limit: Int): Int = kotlin.random.Random.nextInt(limit) public actual fun randomInt(limit: Int): Int = kotlin.random.Random.nextInt(limit)
internal actual fun String.removeLeadingPlusOnJava6(): String = this internal actual fun String.removeLeadingPlusOnJava6(): String = this