[Wasm] Move compiler tests to :wasm:wasm.tests module
They don't belong in K/JS test module.
This commit is contained in:
committed by
teamcity
parent
46c8cbe1bb
commit
bebb9b1392
@@ -57,6 +57,7 @@ build/
|
||||
.idea/artifacts/kotlin_stdlib_js_ir_*
|
||||
.idea/artifacts/kotlin_test_js_ir_*
|
||||
.idea/artifacts/kotlin_stdlib_wasm_*
|
||||
.idea/artifacts/kotlin_test_wasm_*
|
||||
.idea/artifacts/kotlinx_atomicfu_runtime_*
|
||||
.idea/artifacts/kotlinx_cli_jvm_*
|
||||
.idea/jarRepositories.xml
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<option value=":js:js.tests:generateTests" />
|
||||
<option value=":native:native.tests:generateTests" />
|
||||
<option value=":core:descriptors.runtime:generateTests" />
|
||||
<option value=":wasm:wasm.tests:generateTests" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" value="" />
|
||||
|
||||
@@ -242,9 +242,6 @@
|
||||
/jps/ "Kotlin Build Tools"
|
||||
|
||||
/js/ "Kotlin JS"
|
||||
/js/js.tests/test/org/jetbrains/kotlin/js/testOld/BasicWasmBoxTest.kt "Kotlin Wasm"
|
||||
/js/js.tests/test/org/jetbrains/kotlin/js/testOld/wasm/ "Kotlin Wasm"
|
||||
/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/ "Kotlin Wasm"
|
||||
|
||||
/kotlin-js-store/ "Kotlin JS"
|
||||
|
||||
|
||||
+1
-1
@@ -665,7 +665,7 @@ tasks {
|
||||
}
|
||||
|
||||
register("wasmCompilerTest") {
|
||||
dependsOn(":js:js.tests:wasmTest")
|
||||
dependsOn(":wasm:wasm.tests:test")
|
||||
// Windows WABT release requires Visual C++ Redistributable
|
||||
if (!kotlinBuildProperties.isTeamcityBuild || !org.gradle.internal.os.OperatingSystem.current().isWindows) {
|
||||
dependsOn(":wasm:wasm.ir:test")
|
||||
|
||||
@@ -354,7 +354,7 @@ For example, to debug Kotlin/JS tests, run:
|
||||
|
||||
To debug WASM tests, run:
|
||||
```
|
||||
./gradlew :js:js.tests:wasmTest -Pfd.kotlin.wasm.debugMode=2
|
||||
./gradlew :wasm:wasm.tests:test -Pfd.kotlin.wasm.debugMode=2
|
||||
```
|
||||
|
||||
Values of the debug mode: `0` (or `false`), `1` (or `true`), `2`.
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import com.github.gradle.node.npm.task.NpmTask
|
||||
import de.undercouch.gradle.tasks.download.Download
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
|
||||
import org.jetbrains.kotlin.gradle.targets.js.d8.D8RootPlugin
|
||||
@@ -13,7 +11,6 @@ plugins {
|
||||
kotlin("plugin.serialization")
|
||||
id("jps-compatible")
|
||||
id("com.github.node-gradle.node") version "3.2.1"
|
||||
id("de.undercouch.download")
|
||||
}
|
||||
|
||||
val nodeDir = buildDir.resolve("node")
|
||||
@@ -48,7 +45,6 @@ dependencies {
|
||||
testCompileOnly(project(":compiler:util"))
|
||||
testCompileOnly(intellijCore())
|
||||
testApi(project(":compiler:backend.js"))
|
||||
testApi(project(":compiler:backend.wasm"))
|
||||
testApi(project(":js:js.translator"))
|
||||
testApi(project(":js:js.serializer"))
|
||||
testApi(project(":js:js.dce"))
|
||||
@@ -106,59 +102,8 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
}
|
||||
}
|
||||
|
||||
enum class OsName { WINDOWS, MAC, LINUX, UNKNOWN }
|
||||
enum class OsArch { X86_32, X86_64, ARM64, UNKNOWN }
|
||||
data class OsType(val name: OsName, val arch: OsArch)
|
||||
abstract class MochaTestTask : NpmTask(), VerificationTask
|
||||
|
||||
val currentOsType = run {
|
||||
val gradleOs = OperatingSystem.current()
|
||||
val osName = when {
|
||||
gradleOs.isMacOsX -> OsName.MAC
|
||||
gradleOs.isWindows -> OsName.WINDOWS
|
||||
gradleOs.isLinux -> OsName.LINUX
|
||||
else -> OsName.UNKNOWN
|
||||
}
|
||||
|
||||
val osArch = when (providers.systemProperty("sun.arch.data.model").forUseAtConfigurationTime().get()) {
|
||||
"32" -> OsArch.X86_32
|
||||
"64" -> when (providers.systemProperty("os.arch").forUseAtConfigurationTime().get().toLowerCase()) {
|
||||
"aarch64" -> OsArch.ARM64
|
||||
else -> OsArch.X86_64
|
||||
}
|
||||
else -> OsArch.UNKNOWN
|
||||
}
|
||||
|
||||
OsType(osName, osArch)
|
||||
}
|
||||
|
||||
val jsShellDirectory = "https://archive.mozilla.org/pub/firefox/nightly/2023/01/2023-01-23-09-44-44-mozilla-central"
|
||||
val jsShellSuffix = when (currentOsType) {
|
||||
OsType(OsName.LINUX, OsArch.X86_32) -> "linux-i686"
|
||||
OsType(OsName.LINUX, OsArch.X86_64) -> "linux-x86_64"
|
||||
OsType(OsName.MAC, OsArch.X86_64),
|
||||
OsType(OsName.MAC, OsArch.ARM64) -> "mac"
|
||||
OsType(OsName.WINDOWS, OsArch.X86_32) -> "win32"
|
||||
OsType(OsName.WINDOWS, OsArch.X86_64) -> "win64"
|
||||
else -> error("unsupported os type $currentOsType")
|
||||
}
|
||||
val jsShellLocation = "$jsShellDirectory/jsshell-$jsShellSuffix.zip"
|
||||
|
||||
val downloadedTools = File(buildDir, "tools")
|
||||
|
||||
val downloadJsShell by task<Download> {
|
||||
src(jsShellLocation)
|
||||
dest(File(downloadedTools, "jsshell-$jsShellSuffix.zip"))
|
||||
overwrite(false)
|
||||
}
|
||||
|
||||
val unzipJsShell by task<Copy> {
|
||||
dependsOn(downloadJsShell)
|
||||
from(zipTree(downloadJsShell.get().dest))
|
||||
val unpackedDir = File(downloadedTools, "jsshell-$jsShellSuffix")
|
||||
into(unpackedDir)
|
||||
}
|
||||
|
||||
val testDataDir = project(":js:js.translator").projectDir.resolve("testData")
|
||||
val typescriptTestsDir = testDataDir.resolve("typescript-export")
|
||||
|
||||
@@ -262,12 +207,6 @@ fun Test.setupNodeJs() {
|
||||
)
|
||||
}
|
||||
|
||||
fun Test.setupSpiderMonkey() {
|
||||
dependsOn(unzipJsShell)
|
||||
val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath
|
||||
systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath)
|
||||
}
|
||||
|
||||
val d8Plugin = D8RootPlugin.apply(rootProject)
|
||||
d8Plugin.version = v8Version
|
||||
|
||||
@@ -318,7 +257,6 @@ fun Test.setUpJsBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean, firEnabled: B
|
||||
inputs.dir(rootDir.resolve("libraries/kotlin.test/js-ir/build/classes/kotlin/js/main"))
|
||||
}
|
||||
|
||||
exclude("org/jetbrains/kotlin/js/testOld/wasm/semantics/*")
|
||||
exclude("org/jetbrains/kotlin/js/testOld/api/*")
|
||||
|
||||
if (jsEnabled && !jsIrEnabled) {
|
||||
@@ -485,21 +423,6 @@ val runMocha by tasks.registering {
|
||||
finalizedBy(mochaTest)
|
||||
}
|
||||
|
||||
projectTest("wasmTest", true) {
|
||||
setupV8()
|
||||
setupSpiderMonkey()
|
||||
|
||||
include("org/jetbrains/kotlin/js/testOld/wasm/semantics/*")
|
||||
|
||||
dependsOn(":kotlin-stdlib-wasm:compileKotlinWasm")
|
||||
systemProperty("kotlin.wasm.stdlib.path", "libraries/stdlib/wasm/build/classes/kotlin/wasm/main")
|
||||
|
||||
dependsOn(":kotlin-test:kotlin-test-wasm:compileKotlinWasm")
|
||||
systemProperty("kotlin.wasm.kotlin.test.path", "libraries/kotlin.test/wasm/build/classes/kotlin/wasm/main")
|
||||
|
||||
setUpBoxTests()
|
||||
}
|
||||
|
||||
projectTest("invalidationTest", jUnitMode = JUnitMode.JUnit4) {
|
||||
setupV8()
|
||||
workingDir = rootDir
|
||||
|
||||
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.generators.tests
|
||||
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5
|
||||
import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.incremental.AbstractInvalidationTest
|
||||
import org.jetbrains.kotlin.incremental.AbstractJsIrES6InvalidationTest
|
||||
import org.jetbrains.kotlin.incremental.AbstractJsIrInvalidationTest
|
||||
import org.jetbrains.kotlin.js.test.*
|
||||
@@ -15,7 +14,6 @@ import org.jetbrains.kotlin.js.test.fir.*
|
||||
import org.jetbrains.kotlin.js.test.ir.*
|
||||
import org.jetbrains.kotlin.js.testOld.AbstractDceTest
|
||||
import org.jetbrains.kotlin.js.testOld.compatibility.binary.AbstractJsKlibBinaryCompatibilityTest
|
||||
import org.jetbrains.kotlin.js.testOld.wasm.semantics.*
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.test.runners.ir.AbstractFir2IrJsTextTest
|
||||
|
||||
@@ -33,24 +31,6 @@ fun main(args: Array<String>) {
|
||||
|
||||
generateTestGroupSuite(args) {
|
||||
testGroup("js/js.tests/tests-gen", "js/js.translator/testData", testRunnerMethodName = "runTest0") {
|
||||
testClass<AbstractJsTranslatorWasmTest> {
|
||||
model("box/main", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM)
|
||||
model("box/native/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM)
|
||||
model("box/esModules/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM,
|
||||
excludeDirs = listOf(
|
||||
// JsExport is not supported for classes
|
||||
"jsExport", "native", "export",
|
||||
// Multimodal infra is not supported. Also, we don't use ES modules for cross-module refs in Wasm
|
||||
"crossModuleRef", "crossModuleRefPerFile", "crossModuleRefPerModule"
|
||||
)
|
||||
)
|
||||
model("box/jsQualifier/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM)
|
||||
}
|
||||
|
||||
testClass<AbstractJsTranslatorUnitWasmTest> {
|
||||
model("box/kotlin.test/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM)
|
||||
}
|
||||
|
||||
testClass<AbstractDceTest> {
|
||||
model("dce/", pattern = "(.+)\\.js", targetBackend = TargetBackend.JS)
|
||||
}
|
||||
@@ -77,22 +57,6 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("js/js.tests/tests-gen", "compiler/testData", testRunnerMethodName = "runTest0") {
|
||||
testClass<AbstractIrCodegenBoxWasmTest> {
|
||||
model(
|
||||
"codegen/box", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM, excludeDirs = jvmOnlyBoxTests
|
||||
)
|
||||
}
|
||||
|
||||
testClass<AbstractIrCodegenBoxInlineWasmTest> {
|
||||
model("codegen/boxInline", targetBackend = TargetBackend.WASM)
|
||||
}
|
||||
|
||||
testClass<AbstractIrCodegenWasmJsInteropWasmTest> {
|
||||
model("codegen/boxWasmJsInterop", targetBackend = TargetBackend.WASM)
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("js/js.tests/tests-gen", "compiler/testData/binaryCompatibility", testRunnerMethodName = "runTest0") {
|
||||
testClass<AbstractJsKlibBinaryCompatibilityTest> {
|
||||
model("klibEvolution", targetBackend = TargetBackend.JS_IR)
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.js.engine.ScriptEngineV8
|
||||
import org.jetbrains.kotlin.js.engine.loadFiles
|
||||
import org.junit.Assert
|
||||
|
||||
internal const val TEST_DATA_DIR_PATH = "js/js.translator/testData/"
|
||||
private const val DIST_DIR_JS_PATH = "dist/js/"
|
||||
private const val ESM_EXTENSION = ".mjs"
|
||||
|
||||
@@ -172,7 +173,7 @@ object NashornJsTestChecker : AbstractNashornJsTestChecker() {
|
||||
}
|
||||
|
||||
override val preloadedScripts = listOf(
|
||||
BasicWasmBoxTest.TEST_DATA_DIR_PATH + "nashorn-polyfills.js",
|
||||
TEST_DATA_DIR_PATH + "nashorn-polyfills.js",
|
||||
DIST_DIR_JS_PATH + "kotlin.js",
|
||||
DIST_DIR_JS_PATH + "kotlin-test.js"
|
||||
)
|
||||
@@ -188,7 +189,7 @@ object NashornJsTestChecker : AbstractNashornJsTestChecker() {
|
||||
|
||||
object NashornIrJsTestChecker : AbstractNashornJsTestChecker() {
|
||||
override val preloadedScripts = listOf(
|
||||
BasicWasmBoxTest.TEST_DATA_DIR_PATH + "nashorn-polyfills.js",
|
||||
TEST_DATA_DIR_PATH + "nashorn-polyfills.js",
|
||||
"libraries/stdlib/js-v1/src/js/polyfills.js"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.js.backend.ast.*
|
||||
import org.jetbrains.kotlin.js.inline.clean.renameLabels
|
||||
import org.jetbrains.kotlin.js.inline.clean.resolveTemporaryNames
|
||||
import org.jetbrains.kotlin.js.parser.parse
|
||||
import org.jetbrains.kotlin.js.testOld.BasicWasmBoxTest
|
||||
import org.jetbrains.kotlin.js.testOld.TEST_DATA_DIR_PATH
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.fail
|
||||
import org.junit.Rule
|
||||
@@ -50,7 +50,7 @@ class NameResolutionTest {
|
||||
|
||||
private fun doTest() {
|
||||
val methodName = testName.methodName
|
||||
val baseName = "${BasicWasmBoxTest.TEST_DATA_DIR_PATH}/js-name-resolution/"
|
||||
val baseName = "${TEST_DATA_DIR_PATH}/js-name-resolution/"
|
||||
val originalName = "$baseName/$methodName.original.js"
|
||||
val expectedName = "$baseName/$methodName.expected.js"
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.js.backend.ast.*
|
||||
import org.jetbrains.kotlin.js.backend.ast.metadata.synthetic
|
||||
import org.jetbrains.kotlin.js.inline.clean.FunctionPostProcessor
|
||||
import org.jetbrains.kotlin.js.parser.parse
|
||||
import org.jetbrains.kotlin.js.testOld.BasicWasmBoxTest
|
||||
import org.jetbrains.kotlin.js.testOld.TEST_DATA_DIR_PATH
|
||||
import org.jetbrains.kotlin.js.testOld.createScriptEngine
|
||||
import org.jetbrains.kotlin.js.translate.utils.JsAstUtils
|
||||
import org.jetbrains.kotlin.js.util.TextOutputImpl
|
||||
@@ -29,7 +29,7 @@ abstract class BasicOptimizerTest(private var basePath: String) {
|
||||
|
||||
protected fun box() {
|
||||
val methodName = testName.methodName
|
||||
val baseName = "${BasicWasmBoxTest.TEST_DATA_DIR_PATH}/js-optimizer/$basePath"
|
||||
val baseName = "${TEST_DATA_DIR_PATH}/js-optimizer/$basePath"
|
||||
val unoptimizedName = "$baseName/$methodName.original.js"
|
||||
val optimizedName = "$baseName/$methodName.optimized.js"
|
||||
|
||||
|
||||
@@ -302,6 +302,7 @@ include ":kotlin-imports-dumper-compiler-plugin",
|
||||
":plugins:jvm-abi-gen-embeddable",
|
||||
":test-instrumenter",
|
||||
":wasm:wasm.ir",
|
||||
":wasm:wasm.tests",
|
||||
":repo:codebase-tests"
|
||||
|
||||
include ":kotlinx-atomicfu-compiler-plugin",
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
import org.jetbrains.kotlin.gradle.targets.js.d8.D8RootPlugin
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
import de.undercouch.gradle.tasks.download.Download
|
||||
import java.util.*
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
id("de.undercouch.download")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testApi(commonDependency("junit:junit"))
|
||||
testApi(projectTests(":compiler:tests-common"))
|
||||
testApi(intellijCore())
|
||||
}
|
||||
|
||||
val generationRoot = projectDir.resolve("tests-gen")
|
||||
|
||||
optInToExperimentalCompilerApi()
|
||||
|
||||
sourceSets {
|
||||
"main" { }
|
||||
"test" {
|
||||
projectDefault()
|
||||
this.java.srcDir(generationRoot.name)
|
||||
}
|
||||
}
|
||||
|
||||
val d8Plugin = D8RootPlugin.apply(rootProject)
|
||||
d8Plugin.version = v8Version
|
||||
|
||||
fun Test.setupV8() {
|
||||
dependsOn(d8Plugin.setupTaskProvider)
|
||||
val v8ExecutablePath = project.provider {
|
||||
d8Plugin.requireConfigured().executablePath.absolutePath
|
||||
}
|
||||
doFirst {
|
||||
systemProperty("javascript.engine.path.V8", v8ExecutablePath.get())
|
||||
}
|
||||
}
|
||||
|
||||
fun Test.setupWasmStdlib() {
|
||||
dependsOn(":kotlin-stdlib-wasm:compileKotlinWasm")
|
||||
systemProperty("kotlin.wasm.stdlib.path", "libraries/stdlib/wasm/build/classes/kotlin/wasm/main")
|
||||
dependsOn(":kotlin-test:kotlin-test-wasm:compileKotlinWasm")
|
||||
systemProperty("kotlin.wasm.kotlin.test.path", "libraries/kotlin.test/wasm/build/classes/kotlin/wasm/main")
|
||||
}
|
||||
|
||||
fun Test.setupGradlePropertiesForwarding() {
|
||||
val rootLocalProperties = Properties().apply {
|
||||
rootProject.file("local.properties").takeIf { it.isFile }?.inputStream()?.use {
|
||||
load(it)
|
||||
}
|
||||
}
|
||||
|
||||
val allProperties = properties + rootLocalProperties
|
||||
|
||||
val prefixForPropertiesToForward = "fd."
|
||||
for ((key, value) in allProperties) {
|
||||
if (key is String && key.startsWith(prefixForPropertiesToForward)) {
|
||||
systemProperty(key.substring(prefixForPropertiesToForward.length), value!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum class OsName { WINDOWS, MAC, LINUX, UNKNOWN }
|
||||
enum class OsArch { X86_32, X86_64, ARM64, UNKNOWN }
|
||||
data class OsType(val name: OsName, val arch: OsArch)
|
||||
|
||||
val currentOsType = run {
|
||||
val gradleOs = OperatingSystem.current()
|
||||
val osName = when {
|
||||
gradleOs.isMacOsX -> OsName.MAC
|
||||
gradleOs.isWindows -> OsName.WINDOWS
|
||||
gradleOs.isLinux -> OsName.LINUX
|
||||
else -> OsName.UNKNOWN
|
||||
}
|
||||
|
||||
val osArch = when (providers.systemProperty("sun.arch.data.model").forUseAtConfigurationTime().get()) {
|
||||
"32" -> OsArch.X86_32
|
||||
"64" -> when (providers.systemProperty("os.arch").forUseAtConfigurationTime().get().toLowerCase()) {
|
||||
"aarch64" -> OsArch.ARM64
|
||||
else -> OsArch.X86_64
|
||||
}
|
||||
else -> OsArch.UNKNOWN
|
||||
}
|
||||
|
||||
OsType(osName, osArch)
|
||||
}
|
||||
|
||||
val jsShellDirectory = "https://archive.mozilla.org/pub/firefox/nightly/2023/01/2023-01-23-09-44-44-mozilla-central"
|
||||
val jsShellSuffix = when (currentOsType) {
|
||||
OsType(OsName.LINUX, OsArch.X86_32) -> "linux-i686"
|
||||
OsType(OsName.LINUX, OsArch.X86_64) -> "linux-x86_64"
|
||||
OsType(OsName.MAC, OsArch.X86_64),
|
||||
OsType(OsName.MAC, OsArch.ARM64) -> "mac"
|
||||
OsType(OsName.WINDOWS, OsArch.X86_32) -> "win32"
|
||||
OsType(OsName.WINDOWS, OsArch.X86_64) -> "win64"
|
||||
else -> error("unsupported os type $currentOsType")
|
||||
}
|
||||
val jsShellLocation = "$jsShellDirectory/jsshell-$jsShellSuffix.zip"
|
||||
|
||||
val downloadedTools = File(buildDir, "tools")
|
||||
|
||||
val downloadJsShell by task<Download> {
|
||||
src(jsShellLocation)
|
||||
dest(File(downloadedTools, "jsshell-$jsShellSuffix.zip"))
|
||||
overwrite(false)
|
||||
}
|
||||
|
||||
val unzipJsShell by task<Copy> {
|
||||
dependsOn(downloadJsShell)
|
||||
from(zipTree(downloadJsShell.get().dest))
|
||||
val unpackedDir = File(downloadedTools, "jsshell-$jsShellSuffix")
|
||||
into(unpackedDir)
|
||||
}
|
||||
|
||||
fun Test.setupSpiderMonkey() {
|
||||
dependsOn(unzipJsShell)
|
||||
val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath
|
||||
systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath)
|
||||
}
|
||||
|
||||
testsJar {}
|
||||
|
||||
val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt") {
|
||||
dependsOn(":compiler:generateTestData")
|
||||
}
|
||||
|
||||
projectTest(parallel = true) {
|
||||
workingDir = rootDir
|
||||
setupV8()
|
||||
setupSpiderMonkey()
|
||||
setupWasmStdlib()
|
||||
setupGradlePropertiesForwarding()
|
||||
systemProperty("kotlin.wasm.test.root.out.dir", "$buildDir/")
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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 org.jetbrains.kotlin.generators.tests
|
||||
|
||||
import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.wasm.test.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
|
||||
val jvmOnlyBoxTests = listOf(
|
||||
"compileKotlinAgainstKotlin",
|
||||
)
|
||||
|
||||
generateTestGroupSuite(args) {
|
||||
val jsTranslatorTestPattern = "^([^_](.+))\\.kt$"
|
||||
testGroup("wasm/wasm.tests/tests-gen", "js/js.translator/testData", testRunnerMethodName = "runTest0") {
|
||||
testClass<AbstractJsTranslatorWasmTest> {
|
||||
model("box/main", pattern = jsTranslatorTestPattern, targetBackend = TargetBackend.WASM)
|
||||
model("box/native/", pattern = jsTranslatorTestPattern, targetBackend = TargetBackend.WASM)
|
||||
model("box/esModules/", pattern = jsTranslatorTestPattern, targetBackend = TargetBackend.WASM,
|
||||
excludeDirs = listOf(
|
||||
// JsExport is not supported for classes
|
||||
"jsExport", "native", "export",
|
||||
// Multimodal infra is not supported. Also, we don't use ES modules for cross-module refs in Wasm
|
||||
"crossModuleRef", "crossModuleRefPerFile", "crossModuleRefPerModule"
|
||||
)
|
||||
)
|
||||
model("box/jsQualifier/", pattern = jsTranslatorTestPattern, targetBackend = TargetBackend.WASM)
|
||||
}
|
||||
|
||||
testClass<AbstractJsTranslatorUnitWasmTest> {
|
||||
model("box/kotlin.test/", pattern = jsTranslatorTestPattern, targetBackend = TargetBackend.WASM)
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("wasm/wasm.tests/tests-gen", "compiler/testData", testRunnerMethodName = "runTest0") {
|
||||
testClass<AbstractIrCodegenBoxWasmTest> {
|
||||
model("codegen/box", targetBackend = TargetBackend.WASM, pattern = jsTranslatorTestPattern, excludeDirs = jvmOnlyBoxTests)
|
||||
}
|
||||
|
||||
testClass<AbstractIrCodegenBoxInlineWasmTest> {
|
||||
model("codegen/boxInline", targetBackend = TargetBackend.WASM)
|
||||
}
|
||||
|
||||
testClass<AbstractIrCodegenWasmJsInteropWasmTest> {
|
||||
model("codegen/boxWasmJsInterop", targetBackend = TargetBackend.WASM)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.testOld
|
||||
package org.jetbrains.kotlin.wasm.test
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vfs.StandardFileSystems
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
|
||||
import org.jetbrains.kotlin.js.config.JsConfig
|
||||
import org.jetbrains.kotlin.js.facade.TranslationUnit
|
||||
import org.jetbrains.kotlin.js.testOld.engines.WasmVM
|
||||
import org.jetbrains.kotlin.wasm.test.tools.WasmVM
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtNamedFunction
|
||||
@@ -42,7 +42,7 @@ abstract class BasicWasmBoxTest(
|
||||
private val startUnitTests: Boolean = false
|
||||
) : KotlinTestWithEnvironment() {
|
||||
|
||||
private val pathToRootOutputDir: String = System.getProperty("kotlin.js.test.root.out.dir") ?: error("'kotlin.js.test.root.out.dir' is not set")
|
||||
private val pathToRootOutputDir: String = System.getProperty("kotlin.wasm.test.root.out.dir") ?: error("'kotlin.wasm.test.root.out.dir' is not set")
|
||||
|
||||
private val testGroupOutputDirForCompilation = File(pathToRootOutputDir + "out/" + testGroupOutputDirPrefix)
|
||||
|
||||
@@ -358,7 +358,6 @@ abstract class BasicWasmBoxTest(
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TEST_DATA_DIR_PATH = "js/js.translator/testData/"
|
||||
const val TEST_MODULE = "main"
|
||||
private const val TEST_FUNCTION = "box"
|
||||
}
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 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 org.jetbrains.kotlin.js.testOld.wasm.semantics
|
||||
package org.jetbrains.kotlin.wasm.test
|
||||
|
||||
import org.jetbrains.kotlin.js.testOld.BasicWasmBoxTest
|
||||
import org.jetbrains.kotlin.wasm.test.BasicWasmBoxTest
|
||||
|
||||
abstract class AbstractIrCodegenBoxWasmTest : BasicWasmBoxTest(
|
||||
"compiler/testData/codegen/box/",
|
||||
@@ -23,12 +23,12 @@ abstract class AbstractIrCodegenWasmJsInteropWasmTest : BasicWasmBoxTest(
|
||||
)
|
||||
|
||||
abstract class AbstractJsTranslatorWasmTest : BasicWasmBoxTest(
|
||||
TEST_DATA_DIR_PATH + "box/",
|
||||
"js/js.translator/testData/box/",
|
||||
"js.translator/wasmBox"
|
||||
)
|
||||
|
||||
abstract class AbstractJsTranslatorUnitWasmTest : BasicWasmBoxTest(
|
||||
TEST_DATA_DIR_PATH + "box/",
|
||||
"js/js.translator/testData/box/",
|
||||
"js.translator/wasmBox",
|
||||
startUnitTests = true
|
||||
)
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.testOld.engines
|
||||
package org.jetbrains.kotlin.wasm.test.tools
|
||||
|
||||
import java.io.BufferedReader
|
||||
import java.io.File
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.testOld.wasm.semantics;
|
||||
package org.jetbrains.kotlin.wasm.test;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
@@ -16,7 +16,7 @@ import org.junit.runner.RunWith;
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/codegen/boxInline")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.testOld.wasm.semantics;
|
||||
package org.jetbrains.kotlin.wasm.test;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
@@ -17,7 +17,7 @@ import org.junit.runner.RunWith;
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/codegen/box")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.testOld.wasm.semantics;
|
||||
package org.jetbrains.kotlin.wasm.test;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
@@ -16,7 +16,7 @@ import org.junit.runner.RunWith;
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/codegen/boxWasmJsInterop")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.testOld.wasm.semantics;
|
||||
package org.jetbrains.kotlin.wasm.test;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
@@ -16,7 +16,7 @@ import org.junit.runner.RunWith;
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("js/js.translator/testData/box/kotlin.test")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.testOld.wasm.semantics;
|
||||
package org.jetbrains.kotlin.wasm.test;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
@@ -16,7 +16,7 @@ import org.junit.runner.RunWith;
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class JsTranslatorWasmTestGenerated extends AbstractJsTranslatorWasmTest {
|
||||
Reference in New Issue
Block a user