[WASM] Run all std tests with d8
This commit is contained in:
committed by
Svyatoslav Kuzmich
parent
d1c81eb6ba
commit
9519d7998b
+1
-1
@@ -699,10 +699,10 @@ tasks {
|
||||
":kotlin-test:kotlin-test-js-ir:kotlin-test-js-ir-it".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
|
||||
":kotlinx-metadata-jvm",
|
||||
":tools:binary-compatibility-validator",
|
||||
":kotlin-stdlib-wasm",
|
||||
)).forEach {
|
||||
dependsOn("$it:check")
|
||||
}
|
||||
dependsOn(":kotlin-stdlib-wasm:runWasmStdLibTestsWithD8") //Instead of :kotlin-stdlib-wasm:check
|
||||
}
|
||||
|
||||
register("gradlePluginTest") {
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.test
|
||||
|
||||
import kotlin.test.FrameworkAdapter
|
||||
|
||||
internal class TeamcityAdapter : FrameworkAdapter {
|
||||
private enum class MessageType(val type: String) {
|
||||
Started("testStarted"),
|
||||
Finished("testFinished"),
|
||||
Failed("testFailed"),
|
||||
Ignored("testIgnored"),
|
||||
SuiteStarted("testSuiteStarted"),
|
||||
SuiteFinished("testSuiteFinished"),
|
||||
}
|
||||
|
||||
private fun String?.tcEscape(): String = this
|
||||
?.substring(0, length.coerceAtMost(7000))
|
||||
?.replace("|", "||")
|
||||
?.replace("\'", "|'")
|
||||
?.replace("\n", "|n")
|
||||
?.replace("\r", "|r")
|
||||
?.replace("\u0085", "|x") // next line
|
||||
?.replace("\u2028", "|l") // line separator
|
||||
?.replace("\u2029", "|p") // paragraph separator
|
||||
?.replace("[", "|[")
|
||||
?.replace("]", "|]")
|
||||
?: ""
|
||||
|
||||
private fun MessageType.report(name: String) {
|
||||
println("##teamcity[$type name='${name.tcEscape()}']")
|
||||
}
|
||||
|
||||
private fun MessageType.report(name: String, e: Throwable) {
|
||||
if (this == MessageType.Failed) {
|
||||
println("##teamcity[$type name='${name.tcEscape()}' message='${e.message.tcEscape()}' details='${e.stackTraceToString().tcEscape()}']")
|
||||
} else {
|
||||
println("##teamcity[$type name='${name.tcEscape()}' text='${e.message.tcEscape()}' errorDetails='${e.stackTraceToString().tcEscape()}' status='ERROR']")
|
||||
}
|
||||
}
|
||||
|
||||
override fun suite(name: String, ignored: Boolean, suiteFn: () -> Unit) {
|
||||
MessageType.SuiteStarted.report(name)
|
||||
if (!ignored) {
|
||||
try {
|
||||
suiteFn()
|
||||
MessageType.SuiteFinished.report(name)
|
||||
} catch (e: Throwable) {
|
||||
MessageType.SuiteFinished.report(name, e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun test(name: String, ignored: Boolean, testFn: () -> Any?) {
|
||||
if (ignored) {
|
||||
MessageType.Ignored.report(name)
|
||||
} else {
|
||||
try {
|
||||
MessageType.Started.report(name)
|
||||
testFn()
|
||||
MessageType.Finished.report(name)
|
||||
} catch (e: Throwable) {
|
||||
MessageType.Failed.report(name, e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ internal fun test(name: String, ignored: Boolean, testFn: () -> Any?) {
|
||||
currentAdapter.test(name, ignored, testFn)
|
||||
}
|
||||
|
||||
internal var currentAdapter: FrameworkAdapter = JasmineLikeAdapter()
|
||||
internal var currentAdapter: FrameworkAdapter = TeamcityAdapter()
|
||||
|
||||
// This is called from the js-launcher alongside wasm start function
|
||||
@JsExport
|
||||
|
||||
@@ -142,8 +142,27 @@ val compileTestKotlinWasm by tasks.existing(KotlinCompile::class) {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<KotlinJsIrLink>("compileTestDevelopmentExecutableKotlinWasm") {
|
||||
(this as KotlinCompile<*>).kotlinOptions.freeCompilerArgs += listOf("-Xwasm-enable-array-range-checks", "-Xwasm-enable-asserts")
|
||||
val compileTestDevelopmentExecutableKotlinWasm = tasks.named<KotlinJsIrLink>("compileTestDevelopmentExecutableKotlinWasm") {
|
||||
(this as KotlinCompile<*>).kotlinOptions.freeCompilerArgs += listOf("-Xwasm-enable-array-range-checks", "-Xwasm-launcher=d8")
|
||||
}
|
||||
|
||||
val runWasmStdLibTestsWithD8 by tasks.registering(Exec::class) {
|
||||
dependsOn(":js:js.tests:unzipV8")
|
||||
dependsOn(compileTestDevelopmentExecutableKotlinWasm)
|
||||
|
||||
val unzipV8Task = tasks.getByPath(":js:js.tests:unzipV8")
|
||||
val d8Path = File(unzipV8Task.outputs.files.single(), "d8")
|
||||
executable = d8Path.toString()
|
||||
|
||||
val compiledFile = compileTestDevelopmentExecutableKotlinWasm
|
||||
.get()
|
||||
.kotlinOptions
|
||||
.outputFile
|
||||
?.let { File(it) }
|
||||
check(compiledFile != null)
|
||||
|
||||
workingDir = compiledFile.parentFile
|
||||
args = listOf("--experimental-wasm-gc", "--experimental-wasm-eh", "--module", compiledFile.name)
|
||||
}
|
||||
|
||||
val runtimeElements by configurations.creating {}
|
||||
|
||||
Reference in New Issue
Block a user