From 7dbfdc047da542d09f68d40e0e70abcdde97dda0 Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Tue, 7 Aug 2018 12:55:13 +0300 Subject: [PATCH] Update tests before the run --- backend.native/tests/build.gradle | 66 +++++++++---------- backend.native/tests/stdlib_external/utils.kt | 2 +- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index f0b37129f1e..7ddce6539dc 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -63,9 +63,10 @@ dependencies { } ext.testOutputRoot = rootProject.file("test.output").absolutePath -ext.externalTestsDir = project.file("external") -ext.externalStdlibTestsDir = project.file("stdlib_external") +ext.externalTestsDir = project.file("build/external") +ext.externalStdlibTestsDir = project.file("build/stdlib_external") externalTestsDir.mkdirs() +externalStdlibTestsDir.mkdirs() ext.platformManager = project.rootProject.platformManager ext.target = platformManager.targetManager(project.testTarget).target @@ -114,43 +115,32 @@ task installTestLibrary(type: KlibInstall) { } // Gets tests from the same Kotlin compiler build -task update_external_tests() { - doLast { - // Unzip. - delete temporaryDir - copy { - 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") +def update_external_tests() { + // Copy only used tests into the test directory. + externalTestsDir.mkdirs() + delete("${externalTestsDir.canonicalPath}/codegen") + delete("${externalTestsDir.canonicalPath}/compileKotlinAgainstKotlin") - copy { - from temporaryDir.absolutePath + "/compiler" + copy { + configurations.update_tests.asFileTree.each { + from(zipTree(it)) into(externalTestsDir) - include 'codegen/box/**' - include 'codegen/boxInline/**' - include 'compileKotlinAgainstKotlin/**' + include 'compiler/codegen/box/**' + include 'compiler/codegen/boxInline/**' + include 'compiler/compileKotlinAgainstKotlin/**' } + } - externalStdlibTestsDir.mkdirs() - delete("${externalStdlibTestsDir.canonicalPath}/common") - delete("${externalStdlibTestsDir.canonicalPath}/test") - copy { - from temporaryDir.absolutePath + "/stdlib" + externalStdlibTestsDir.mkdirs() + delete("${externalStdlibTestsDir.canonicalPath}/common") + delete("${externalStdlibTestsDir.canonicalPath}/test") + copy { + configurations.update_tests.asFileTree.each { + from(zipTree(it)) into(externalStdlibTestsDir) - include 'common/**' - include 'test/**' + include 'stdlib/common/**' + include 'stdlib/test/**' } - - //clean tmp dir. - delete temporaryDir } } @@ -216,6 +206,8 @@ def createTestTasks(File testRoot, Class taskType, Closure taskConfigurati } task run_external () { + update_external_tests() + // Create tasks for external tests. createTestTasks(externalTestsDir, RunExternalTestGroup) { } @@ -2938,15 +2930,17 @@ task runKonanRegexTests(type: RunKonanTest) { task buildKonanStdlibTests(type: BuildKonanTest) { outputSourceSetName = "testOutputStdlib" - flags = [ "-Xmulti-platform" ] - compileList = [ "stdlib_external/test", "stdlib_external/common", + flags = [ "-Xmulti-platform", "-friend-modules", project.rootProject.file("dist/klib/common/stdlib") ] + def testSources = externalStdlibTestsDir.absolutePath + compileList = [ "$testSources/stdlib/test", "$testSources/stdlib/common", "stdlib_external/utils.kt", "stdlib_external/jsCollectionFactoriesActuals.kt" ] + excludeList = [ "$testSources/stdlib/test/internalAnnotations.kt" ] } task runStdlibTests(type: RunStdlibTest) { outputSourceSetName = "testOutputStdlib" // runs all tests and hence source name should be not null - source = "stdlib_external/testUtils.kt" + source = "stdlib_external/utils.kt" useFilter = false runnerLogger = RunKonanTest.Logger.GTEST } diff --git a/backend.native/tests/stdlib_external/utils.kt b/backend.native/tests/stdlib_external/utils.kt index 7ad94d22702..b6a1034b568 100644 --- a/backend.native/tests/stdlib_external/utils.kt +++ b/backend.native/tests/stdlib_external/utils.kt @@ -12,4 +12,4 @@ public actual fun assertTypeEquals(expected: Any?, actual: Any?) { public actual fun randomInt(limit: Int): Int = kotlin.random.Random.nextInt(limit) -internal actual fun String.removeLeadingPlusOnJava6(): String = this \ No newline at end of file +internal actual fun String.removeLeadingPlusOnJava6(): String = this