[WASM] Initial infrastructure

- New module ":compiler:backend.wasm"
    - Initial compiler infra (driver, phaser, context)
    - Subset of Wasm AST
    - Skeleton of IR -> Wasm AST
    - Wasm AST -> WAT transformer

- Testing infra

- SpiderMonkey jsshell tool
This commit is contained in:
Svyatoslav Kuzmich
2019-08-07 14:27:18 +03:00
parent 812083ee05
commit 6e6ffa12a6
106 changed files with 6418 additions and 584 deletions
+71 -6
View File
@@ -1,15 +1,18 @@
import com.moowork.gradle.node.NodeExtension
import com.moowork.gradle.node.npm.NpmTask
import de.undercouch.gradle.tasks.download.Download
import org.gradle.internal.os.OperatingSystem
plugins {
kotlin("jvm")
id("jps-compatible")
id("com.moowork.node").version("1.2.0")
id("de.undercouch.download")
}
node {
download = true
version = "10.16.2"
}
val antLauncherJar by configurations.creating
@@ -27,6 +30,7 @@ dependencies {
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "idea_rt", "util") }
testCompile(project(":compiler:backend.js"))
testCompile(project(":compiler:backend.wasm"))
testCompile(projectTests(":compiler:ir.serialization.js"))
testCompile(project(":js:js.translator"))
testCompile(project(":js:js.serializer"))
@@ -65,7 +69,7 @@ sourceSets {
}
fun Test.setUpBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) {
fun Test.setUpJsBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) {
dependsOn(":dist")
if (jsEnabled) dependsOn(testJsRuntime)
if (jsIrEnabled) {
@@ -74,14 +78,20 @@ fun Test.setUpBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) {
dependsOn(":compiler:ir.serialization.js:generateKotlinTestKLib")
}
exclude("org/jetbrains/kotlin/js/test/wasm/semantics/*")
if (jsEnabled && !jsIrEnabled) exclude("org/jetbrains/kotlin/js/test/ir/semantics/*")
if (!jsEnabled && jsIrEnabled) include("org/jetbrains/kotlin/js/test/ir/semantics/*")
jvmArgs("-da:jdk.nashorn.internal.runtime.RecompilableScriptFunctionData") // Disable assertion which fails due to a bug in nashorn (KT-23637)
workingDir = rootDir
if (findProperty("kotlin.compiler.js.ir.tests.skip")?.toString()?.toBoolean() == true) {
exclude("org/jetbrains/kotlin/js/test/ir/semantics/*")
}
setUpBoxTests()
}
fun Test.setUpBoxTests() {
workingDir = rootDir
doFirst {
systemProperty("kotlin.ant.classpath", antLauncherJar.asPath)
systemProperty("kotlin.ant.launcher.class", "org.apache.tools.ant.Main")
@@ -96,19 +106,19 @@ fun Test.setUpBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) {
}
projectTest(parallel = true) {
setUpBoxTests(jsEnabled = true, jsIrEnabled = true)
setUpJsBoxTests(jsEnabled = true, jsIrEnabled = true)
}
projectTest("jsTest", true) {
setUpBoxTests(jsEnabled = true, jsIrEnabled = false)
setUpJsBoxTests(jsEnabled = true, jsIrEnabled = false)
}
projectTest("jsIrTest", true) {
setUpBoxTests(jsEnabled = false, jsIrEnabled = true)
setUpJsBoxTests(jsEnabled = false, jsIrEnabled = true)
}
projectTest("quickTest", true) {
setUpBoxTests(jsEnabled = true, jsIrEnabled = false)
setUpJsBoxTests(jsEnabled = true, jsIrEnabled = false)
systemProperty("kotlin.js.skipMinificationTest", "true")
}
@@ -136,3 +146,58 @@ val runMocha by task<NpmTask> {
val check by tasks
check.dependsOn(this)
}
enum class OsName { WINDOWS, MAC, LINUX, UNKNOWN }
enum class OsArch { X86_32, X86_64, 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 (System.getProperty("sun.arch.data.model")) {
"32" -> OsArch.X86_32
"64" -> OsArch.X86_64
else -> OsArch.UNKNOWN
}
OsType(osName, osArch)
}
val jsShellDirectory = "https://archive.mozilla.org/pub/firefox/nightly/2019/08/2019-08-11-09-56-40-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) -> "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"))
}
val unzipJsShell by task<Copy> {
dependsOn(downloadJsShell)
from(zipTree(downloadJsShell.get().dest))
val unpackedDir = File(downloadedTools, "jsshell-$jsShellSuffix")
into(unpackedDir)
}
projectTest("wasmTest", true) {
dependsOn(unzipJsShell)
dependsOn(":compiler:ir.serialization.js:generateWasmRuntimeKLib")
include("org/jetbrains/kotlin/js/test/wasm/semantics/*")
val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath
systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath)
setUpBoxTests()
}
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.js.test.AbstractDceTest
import org.jetbrains.kotlin.js.test.AbstractJsLineNumberTest
import org.jetbrains.kotlin.js.test.ir.semantics.*
import org.jetbrains.kotlin.js.test.semantics.*
import org.jetbrains.kotlin.js.test.wasm.semantics.AbstractIrWasmBoxWasmTest
import org.jetbrains.kotlin.test.TargetBackend
fun main(args: Array<String>) {
@@ -42,6 +43,14 @@ fun main(args: Array<String>) {
testClass<AbstractJsLineNumberTest> {
model("lineNumbers/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.JS)
}
testClass<AbstractIrWasmBoxWasmTest> {
model("wasmBox", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM)
}
testClass<AbstractIrWasmBoxJsTest> {
model("wasmBox", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.JS_IR)
}
}
testGroup("js/js.tests/test", "compiler/testData", testRunnerMethodName = "runTest0") {
@@ -0,0 +1,194 @@
/*
* Copyright 2010-2019 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.test
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.vfs.StandardFileSystems
import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.PsiManager
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
import org.jetbrains.kotlin.backend.common.phaser.toPhaseMap
import org.jetbrains.kotlin.backend.wasm.compileWasm
import org.jetbrains.kotlin.backend.wasm.wasmPhases
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.ir.backend.js.loadKlib
import org.jetbrains.kotlin.js.config.JsConfig
import org.jetbrains.kotlin.js.facade.TranslationUnit
import org.jetbrains.kotlin.js.test.engines.SpiderMonkeyEngine
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtNamedFunction
import org.jetbrains.kotlin.psi.KtPsiFactory
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment
import java.io.Closeable
import java.io.File
private val wasmRuntimeKlib =
loadKlib("compiler/ir/serialization.js/build/wasmRuntime/klib")
abstract class BasicWasmBoxTest(
private val pathToTestDir: String,
testGroupOutputDirPrefix: String,
pathToRootOutputDir: String = TEST_DATA_DIR_PATH
) : KotlinTestWithEnvironment() {
private val testGroupOutputDirForCompilation = File(pathToRootOutputDir + "out/" + testGroupOutputDirPrefix)
private val spiderMonkey by lazy { SpiderMonkeyEngine() }
fun doTest(filePath: String) {
val file = File(filePath)
val outputDir = getOutputDir(file)
val fileContent = KotlinTestUtils.doLoadFile(file)
TestFileFactoryImpl().use { testFactory ->
val inputFiles: MutableList<TestFile> = KotlinTestUtils.createTestFiles(file.name, fileContent, testFactory, true, "")
val testPackage = testFactory.testPackage
val outputFileBase = outputDir.absolutePath + "/" + getTestName(true)
val outputWatFile = outputFileBase + ".wat"
val outputJsFile = outputFileBase + ".js"
val kotlinFiles = inputFiles.filter { it.fileName.endsWith(".kt") }
val psiFiles = createPsiFiles(kotlinFiles.map { File(it.fileName).canonicalPath }.sorted())
val config = createConfig()
translateFiles(
psiFiles.map(TranslationUnit::SourceFile),
File(outputWatFile),
File(outputJsFile),
config,
testPackage,
TEST_FUNCTION
)
spiderMonkey.runFile(outputJsFile)
}
}
private fun getOutputDir(file: File, testGroupOutputDir: File = testGroupOutputDirForCompilation): File {
val stopFile = File(pathToTestDir)
return generateSequence(file.parentFile) { it.parentFile }
.takeWhile { it != stopFile }
.map { it.name }
.toList().asReversed()
.fold(testGroupOutputDir, ::File)
}
private fun translateFiles(
units: List<TranslationUnit>,
outputWatFile: File,
outputJsFile: File,
config: JsConfig,
testPackage: String?,
testFunction: String
) {
val filesToCompile = units.map { (it as TranslationUnit.SourceFile).file }
val debugMode = false
val phaseConfig = if (debugMode) {
val allPhasesSet = wasmPhases.toPhaseMap().values.toSet()
val dumpOutputDir = File(outputWatFile.parent, outputWatFile.nameWithoutExtension + "-irdump")
println("\n ------ Dumping phases to file://$dumpOutputDir")
PhaseConfig(
wasmPhases,
dumpToDirectory = dumpOutputDir.path,
toDumpStateAfter = allPhasesSet,
toValidateStateAfter = allPhasesSet,
dumpOnlyFqName = null
)
} else {
PhaseConfig(wasmPhases)
}
val compilerResult = compileWasm(
project = config.project,
files = filesToCompile,
configuration = config.configuration,
phaseConfig = phaseConfig,
allDependencies = listOf(wasmRuntimeKlib),
friendDependencies = emptyList(),
exportedDeclarations = setOf(FqName.fromSegments(listOfNotNull(testPackage, testFunction)))
)
outputWatFile.write(compilerResult.wat)
val runtime = File("libraries/stdlib/wasm/runtime/runtime.js").readText()
val testRunner = """
const wat = read(String.raw`${outputWatFile.absoluteFile}`);
const wasmBinary = wasmTextToBinary(wat);
const wasmModule = new WebAssembly.Module(wasmBinary);
const wasmInstance = new WebAssembly.Instance(wasmModule, { runtime });
const actualResult = wasmInstance.exports.$testFunction();
if (actualResult !== "OK")
throw `Wrong box result '${'$'}{actualResult}'; Expected "OK"`;
""".trimIndent()
outputJsFile.write(runtime + "\n" + compilerResult.js + "\n" + testRunner)
}
private fun createPsiFile(fileName: String): KtFile {
val psiManager = PsiManager.getInstance(project)
val fileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL)
val file = fileSystem.findFileByPath(fileName) ?: error("File not found: $fileName")
return psiManager.findFile(file) as KtFile
}
private fun createPsiFiles(fileNames: List<String>): List<KtFile> = fileNames.map(this::createPsiFile)
private fun createConfig(): JsConfig {
val configuration = environment.configuration.copy()
configuration.put(CommonConfigurationKeys.MODULE_NAME, TEST_MODULE)
return JsConfig(project, configuration, null, null)
}
private inner class TestFileFactoryImpl : KotlinTestUtils.TestFileFactoryNoModules<TestFile>(), Closeable {
override fun create(fileName: String, text: String, directives: MutableMap<String, String>): TestFile {
val ktFile = KtPsiFactory(project).createFile(text)
val boxFunction = ktFile.declarations.find { it is KtNamedFunction && it.name == TEST_FUNCTION }
if (boxFunction != null) {
testPackage = ktFile.packageFqName.asString()
if (testPackage?.isEmpty() == true) {
testPackage = null
}
}
val temporaryFile = File(tmpDir, "WASM_TEST/$fileName")
KotlinTestUtils.mkdirs(temporaryFile.parentFile)
temporaryFile.writeText(text, Charsets.UTF_8)
return TestFile(temporaryFile.absolutePath)
}
var testPackage: String? = null
val tmpDir = KotlinTestUtils.tmpDir("wasm-tests")
override fun close() {
FileUtil.delete(tmpDir)
}
}
private class TestFile(val fileName: String)
override fun createEnvironment() =
KotlinCoreEnvironment.createForTests(testRootDisposable, CompilerConfiguration(), EnvironmentConfigFiles.JS_CONFIG_FILES)
companion object {
const val TEST_DATA_DIR_PATH = "js/js.translator/testData/"
const val TEST_MODULE = "WASM_TESTS"
private const val TEST_FUNCTION = "box"
}
}
private fun File.write(text: String) {
parentFile.mkdirs()
writeText(text)
}
@@ -0,0 +1,44 @@
/*
* Copyright 2010-2019 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.test.engines
import java.io.BufferedReader
import java.io.InputStreamReader
import kotlin.test.fail
class ExternalTool(val path: String) {
fun run(vararg arguments: String) {
val command = arrayOf(path, *arguments)
val process = ProcessBuilder(*command)
.redirectErrorStream(true)
.start()
val commandString = command.joinToString(" ") { escapeShellArgument(it) }
println(commandString)
// Print process output
val input = BufferedReader(InputStreamReader(process.inputStream))
while (true) println(input.readLine() ?: break)
val exitValue = process.waitFor()
if (exitValue != 0) {
fail("Command \"$commandString\" terminated with exit code $exitValue")
}
}
}
private fun escapeShellArgument(arg: String): String =
"'${arg.replace("'", "'\\''")}'"
class SpiderMonkeyEngine(
jsShellPath: String = System.getProperty("javascript.engine.path.SpiderMonkey")
) {
private val jsShell = ExternalTool(jsShellPath)
fun runFile(file: String) {
jsShell.run(file)
}
}
@@ -0,0 +1,548 @@
/*
* Copyright 2010-2019 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.test.ir.semantics;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
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.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("js/js.translator/testData/wasmBox")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class IrWasmBoxJsTestGenerated extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInWasmBox() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("basicTypes.kt")
public void testBasicTypes() throws Exception {
runTest("js/js.translator/testData/wasmBox/basicTypes.kt");
}
@TestMetadata("primitivesOperatos.kt")
public void testPrimitivesOperatos() throws Exception {
runTest("js/js.translator/testData/wasmBox/primitivesOperatos.kt");
}
@TestMetadata("js/js.translator/testData/wasmBox/number")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Number extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInNumber() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/number"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("assignmentIntOverflow.kt")
public void testAssignmentIntOverflow() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/assignmentIntOverflow.kt");
}
@TestMetadata("byteAndShortConversions.kt")
public void testByteAndShortConversions() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/byteAndShortConversions.kt");
}
@TestMetadata("conversionsWithTruncation.kt")
public void testConversionsWithTruncation() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/conversionsWithTruncation.kt");
}
@TestMetadata("conversionsWithoutTruncation.kt")
public void testConversionsWithoutTruncation() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/conversionsWithoutTruncation.kt");
}
@TestMetadata("division.kt")
public void testDivision() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/division.kt");
}
@TestMetadata("doubleConversions.kt")
public void testDoubleConversions() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/doubleConversions.kt");
}
@TestMetadata("hexadecimalConstant.kt")
public void testHexadecimalConstant() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/hexadecimalConstant.kt");
}
@TestMetadata("incDecOptimization.kt")
public void testIncDecOptimization() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/incDecOptimization.kt");
}
@TestMetadata("intConversions.kt")
public void testIntConversions() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/intConversions.kt");
}
@TestMetadata("intDivFloat.kt")
public void testIntDivFloat() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/intDivFloat.kt");
}
@TestMetadata("intIncDecOverflow.kt")
public void testIntIncDecOverflow() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/intIncDecOverflow.kt");
}
@TestMetadata("intOverflow.kt")
public void testIntOverflow() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/intOverflow.kt");
}
@TestMetadata("kt2342.kt")
public void testKt2342() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/kt2342.kt");
}
@TestMetadata("longBinaryOperations.kt")
public void testLongBinaryOperations() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/longBinaryOperations.kt");
}
@TestMetadata("longBitOperations.kt")
public void testLongBitOperations() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/longBitOperations.kt");
}
@TestMetadata("longCompareToIntrinsic.kt")
public void testLongCompareToIntrinsic() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/longCompareToIntrinsic.kt");
}
@TestMetadata("longEqualsIntrinsic.kt")
public void testLongEqualsIntrinsic() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/longEqualsIntrinsic.kt");
}
@TestMetadata("longHashCode.kt")
public void testLongHashCode() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/longHashCode.kt");
}
@TestMetadata("longUnaryOperations.kt")
public void testLongUnaryOperations() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/longUnaryOperations.kt");
}
@TestMetadata("mixedTypesOverflow.kt")
public void testMixedTypesOverflow() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/mixedTypesOverflow.kt");
}
@TestMetadata("numberCompareTo.kt")
public void testNumberCompareTo() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/numberCompareTo.kt");
}
@TestMetadata("numberConversions.kt")
public void testNumberConversions() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/numberConversions.kt");
}
@TestMetadata("numberEquals.kt")
public void testNumberEquals() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/numberEquals.kt");
}
@TestMetadata("numberIncDec.kt")
public void testNumberIncDec() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/numberIncDec.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class PassedCommonTests extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInPassedCommonTests() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/boxingOptimization")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BoxingOptimization extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInBoxingOptimization() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/boxingOptimization"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("explicitEqualsOnDouble.kt")
public void testExplicitEqualsOnDouble() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/boxingOptimization/explicitEqualsOnDouble.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/classes")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Classes extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/classes"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("kt2482.kt")
public void testKt2482() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/classes/kt2482.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/constants")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Constants extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInConstants() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/constants"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("float.kt")
public void testFloat() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/constants/float.kt");
}
@TestMetadata("long.kt")
public void testLong() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/constants/long.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ControlStructures extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInControlStructures() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("ifConst1.kt")
public void testIfConst1() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures/ifConst1.kt");
}
@TestMetadata("ifConst2.kt")
public void testIfConst2() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures/ifConst2.kt");
}
@TestMetadata("kt1899.kt")
public void testKt1899() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures/kt1899.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/extensionProperties")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ExtensionProperties extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInExtensionProperties() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/extensionProperties"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("topLevel.kt")
public void testTopLevel() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/extensionProperties/topLevel.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/functions")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Functions extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInFunctions() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/functions"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("kt2280.kt")
public void testKt2280() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/functions/kt2280.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/ieee754")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Ieee754 extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInIeee754() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/ieee754"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("lessDouble_properIeeeAndNewInference.kt")
public void testLessDouble_properIeeeAndNewInference() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ieee754/lessDouble_properIeeeAndNewInference.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/ir")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Ir extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInIr() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/ir"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ClosureConversion extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInClosureConversion() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("closureConversion1.kt")
public void testClosureConversion1() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion/closureConversion1.kt");
}
@TestMetadata("closureConversion3.kt")
public void testClosureConversion3() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion/closureConversion3.kt");
}
@TestMetadata("closureConversion4.kt")
public void testClosureConversion4() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion/closureConversion4.kt");
}
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/labels")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Labels extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInLabels() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/labels"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("propertyAccessor.kt")
public void testPropertyAccessor() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/labels/propertyAccessor.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class LazyCodegen extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInLazyCodegen() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen/optimizations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Optimizations extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInOptimizations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen/optimizations"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("negateConstantCompare.kt")
public void testNegateConstantCompare() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen/optimizations/negateConstantCompare.kt");
}
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class OperatorConventions extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInOperatorConventions() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("annotatedAssignment.kt")
public void testAnnotatedAssignment() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions/annotatedAssignment.kt");
}
@TestMetadata("infixFunctionOverBuiltinMember.kt")
public void testInfixFunctionOverBuiltinMember() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions/infixFunctionOverBuiltinMember.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class PrimitiveTypes extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInPrimitiveTypes() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("ea35963.kt")
public void testEa35963() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/ea35963.kt");
}
@TestMetadata("incrementByteCharShort.kt")
public void testIncrementByteCharShort() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/incrementByteCharShort.kt");
}
@TestMetadata("kt1634.kt")
public void testKt1634() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt1634.kt");
}
@TestMetadata("kt3078.kt")
public void testKt3078() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt3078.kt");
}
@TestMetadata("kt6590_identityEquals.kt")
public void testKt6590_identityEquals() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt6590_identityEquals.kt");
}
@TestMetadata("kt737.kt")
public void testKt737() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt737.kt");
}
@TestMetadata("kt828.kt")
public void testKt828() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt828.kt");
}
@TestMetadata("kt877.kt")
public void testKt877() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt877.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/publishedApi")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class PublishedApi extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInPublishedApi() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/publishedApi"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("topLevel.kt")
public void testTopLevel() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/publishedApi/topLevel.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/unaryOp")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class UnaryOp extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInUnaryOp() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/unaryOp"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("intrinsic.kt")
public void testIntrinsic() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/unaryOp/intrinsic.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/when")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class When extends AbstractIrWasmBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInWhen() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/when"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("noElseNoMatch.kt")
public void testNoElseNoMatch() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/when/noElseNoMatch.kt");
}
}
}
}
@@ -15,6 +15,11 @@ abstract class AbstractIrJsCodegenBoxTest : BasicIrBoxTest(
"codegen/irBox/"
)
abstract class AbstractIrWasmBoxJsTest : BasicIrBoxTest(
BasicBoxTest.TEST_DATA_DIR_PATH + "wasmBox/",
"irWasmBox/"
)
abstract class BorrowedIrInlineTest(relativePath: String) : BasicIrBoxTest(
"compiler/testData/codegen/boxInline/$relativePath",
"codegen/irBoxInline/$relativePath"
@@ -0,0 +1,553 @@
/*
* Copyright 2010-2019 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.test.wasm.semantics;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
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.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("js/js.translator/testData/wasmBox")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class IrWasmBoxWasmTestGenerated extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInWasmBox() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("basicTypes.kt")
public void testBasicTypes() throws Exception {
runTest("js/js.translator/testData/wasmBox/basicTypes.kt");
}
@TestMetadata("primitivesOperatos.kt")
public void testPrimitivesOperatos() throws Exception {
runTest("js/js.translator/testData/wasmBox/primitivesOperatos.kt");
}
@TestMetadata("js/js.translator/testData/wasmBox/number")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Number extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInNumber() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/number"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("assignmentIntOverflow.kt")
public void testAssignmentIntOverflow() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/assignmentIntOverflow.kt");
}
@TestMetadata("byteAndShortConversions.kt")
public void testByteAndShortConversions() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/byteAndShortConversions.kt");
}
@TestMetadata("conversionsWithTruncation.kt")
public void testConversionsWithTruncation() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/conversionsWithTruncation.kt");
}
@TestMetadata("conversionsWithoutTruncation.kt")
public void testConversionsWithoutTruncation() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/conversionsWithoutTruncation.kt");
}
@TestMetadata("division.kt")
public void testDivision() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/division.kt");
}
@TestMetadata("doubleConversions.kt")
public void testDoubleConversions() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/doubleConversions.kt");
}
@TestMetadata("hashCode.kt")
public void testHashCode() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/hashCode.kt");
}
@TestMetadata("hexadecimalConstant.kt")
public void testHexadecimalConstant() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/hexadecimalConstant.kt");
}
@TestMetadata("incDecOptimization.kt")
public void testIncDecOptimization() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/incDecOptimization.kt");
}
@TestMetadata("intConversions.kt")
public void testIntConversions() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/intConversions.kt");
}
@TestMetadata("intDivFloat.kt")
public void testIntDivFloat() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/intDivFloat.kt");
}
@TestMetadata("intIncDecOverflow.kt")
public void testIntIncDecOverflow() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/intIncDecOverflow.kt");
}
@TestMetadata("intOverflow.kt")
public void testIntOverflow() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/intOverflow.kt");
}
@TestMetadata("kt2342.kt")
public void testKt2342() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/kt2342.kt");
}
@TestMetadata("longBinaryOperations.kt")
public void testLongBinaryOperations() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/longBinaryOperations.kt");
}
@TestMetadata("longBitOperations.kt")
public void testLongBitOperations() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/longBitOperations.kt");
}
@TestMetadata("longCompareToIntrinsic.kt")
public void testLongCompareToIntrinsic() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/longCompareToIntrinsic.kt");
}
@TestMetadata("longEqualsIntrinsic.kt")
public void testLongEqualsIntrinsic() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/longEqualsIntrinsic.kt");
}
@TestMetadata("longHashCode.kt")
public void testLongHashCode() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/longHashCode.kt");
}
@TestMetadata("longUnaryOperations.kt")
public void testLongUnaryOperations() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/longUnaryOperations.kt");
}
@TestMetadata("mixedTypesOverflow.kt")
public void testMixedTypesOverflow() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/mixedTypesOverflow.kt");
}
@TestMetadata("numberCompareTo.kt")
public void testNumberCompareTo() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/numberCompareTo.kt");
}
@TestMetadata("numberConversions.kt")
public void testNumberConversions() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/numberConversions.kt");
}
@TestMetadata("numberEquals.kt")
public void testNumberEquals() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/numberEquals.kt");
}
@TestMetadata("numberIncDec.kt")
public void testNumberIncDec() throws Exception {
runTest("js/js.translator/testData/wasmBox/number/numberIncDec.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class PassedCommonTests extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInPassedCommonTests() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/boxingOptimization")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BoxingOptimization extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInBoxingOptimization() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/boxingOptimization"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("explicitEqualsOnDouble.kt")
public void testExplicitEqualsOnDouble() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/boxingOptimization/explicitEqualsOnDouble.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/classes")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Classes extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/classes"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("kt2482.kt")
public void testKt2482() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/classes/kt2482.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/constants")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Constants extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInConstants() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/constants"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("float.kt")
public void testFloat() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/constants/float.kt");
}
@TestMetadata("long.kt")
public void testLong() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/constants/long.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ControlStructures extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInControlStructures() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("ifConst1.kt")
public void testIfConst1() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures/ifConst1.kt");
}
@TestMetadata("ifConst2.kt")
public void testIfConst2() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures/ifConst2.kt");
}
@TestMetadata("kt1899.kt")
public void testKt1899() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures/kt1899.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/extensionProperties")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ExtensionProperties extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInExtensionProperties() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/extensionProperties"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("topLevel.kt")
public void testTopLevel() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/extensionProperties/topLevel.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/functions")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Functions extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInFunctions() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/functions"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("kt2280.kt")
public void testKt2280() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/functions/kt2280.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/ieee754")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Ieee754 extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInIeee754() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/ieee754"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("lessDouble_properIeeeAndNewInference.kt")
public void testLessDouble_properIeeeAndNewInference() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ieee754/lessDouble_properIeeeAndNewInference.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/ir")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Ir extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInIr() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/ir"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ClosureConversion extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInClosureConversion() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("closureConversion1.kt")
public void testClosureConversion1() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion/closureConversion1.kt");
}
@TestMetadata("closureConversion3.kt")
public void testClosureConversion3() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion/closureConversion3.kt");
}
@TestMetadata("closureConversion4.kt")
public void testClosureConversion4() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion/closureConversion4.kt");
}
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/labels")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Labels extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInLabels() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/labels"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("propertyAccessor.kt")
public void testPropertyAccessor() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/labels/propertyAccessor.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class LazyCodegen extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInLazyCodegen() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen/optimizations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Optimizations extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInOptimizations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen/optimizations"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("negateConstantCompare.kt")
public void testNegateConstantCompare() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen/optimizations/negateConstantCompare.kt");
}
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class OperatorConventions extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInOperatorConventions() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("annotatedAssignment.kt")
public void testAnnotatedAssignment() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions/annotatedAssignment.kt");
}
@TestMetadata("infixFunctionOverBuiltinMember.kt")
public void testInfixFunctionOverBuiltinMember() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions/infixFunctionOverBuiltinMember.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class PrimitiveTypes extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInPrimitiveTypes() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("ea35963.kt")
public void testEa35963() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/ea35963.kt");
}
@TestMetadata("incrementByteCharShort.kt")
public void testIncrementByteCharShort() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/incrementByteCharShort.kt");
}
@TestMetadata("kt1634.kt")
public void testKt1634() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt1634.kt");
}
@TestMetadata("kt3078.kt")
public void testKt3078() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt3078.kt");
}
@TestMetadata("kt6590_identityEquals.kt")
public void testKt6590_identityEquals() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt6590_identityEquals.kt");
}
@TestMetadata("kt737.kt")
public void testKt737() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt737.kt");
}
@TestMetadata("kt828.kt")
public void testKt828() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt828.kt");
}
@TestMetadata("kt877.kt")
public void testKt877() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt877.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/publishedApi")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class PublishedApi extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInPublishedApi() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/publishedApi"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("topLevel.kt")
public void testTopLevel() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/publishedApi/topLevel.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/unaryOp")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class UnaryOp extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInUnaryOp() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/unaryOp"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("intrinsic.kt")
public void testIntrinsic() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/unaryOp/intrinsic.kt");
}
}
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/when")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class When extends AbstractIrWasmBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInWhen() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/when"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
}
@TestMetadata("noElseNoMatch.kt")
public void testNoElseNoMatch() throws Exception {
runTest("js/js.translator/testData/wasmBox/passedCommonTests/when/noElseNoMatch.kt");
}
}
}
}
@@ -0,0 +1,16 @@
/*
* Copyright 2010-2019 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.test.wasm.semantics
import org.jetbrains.kotlin.js.test.BasicBoxTest
import org.jetbrains.kotlin.js.test.BasicWasmBoxTest
abstract class AbstractIrWasmBoxWasmTest : BasicWasmBoxTest(BasicBoxTest.TEST_DATA_DIR_PATH + "wasmBox", "wasmBox/")
abstract class AbstractIrCodegenBoxWasmTest : BasicWasmBoxTest(
"compiler/testData/codegen/box/",
"codegen/wasmBox/"
)