[Gradle, JS] Migrate JS cli tests to ir backend

This commit is contained in:
Ilya Goncharov
2023-07-05 07:10:06 +00:00
committed by Space Team
parent 38533977f0
commit 148d8c9246
85 changed files with 243 additions and 328 deletions
@@ -56,12 +56,12 @@ class LauncherScriptTest : TestCaseWithTmpdir() {
val stdout =
AbstractCliTest.getNormalizedCompilerOutput(
StringUtil.convertLineSeparators(process.inputStream.bufferedReader().use { it.readText() }),
null, testDataDirectory
null, testDataDirectory, tmpdir.absolutePath
)
val stderr =
AbstractCliTest.getNormalizedCompilerOutput(
StringUtil.convertLineSeparators(process.errorStream.bufferedReader().use { it.readText() }),
null, testDataDirectory
null, testDataDirectory, tmpdir.absolutePath
).replace("Picked up [_A-Z]+:.*\n".toRegex(), "")
.replace("The system cannot find the file specified", "No such file or directory") // win -> unix
process.waitFor(10, TimeUnit.SECONDS)
@@ -145,9 +145,14 @@ class LauncherScriptTest : TestCaseWithTmpdir() {
"kotlinc-js",
"$testDataDirectory/emptyMain.kt",
"-nowarn",
"-Xforce-deprecated-legacy-compiler-usage",
"-output",
File(tmpdir, "out.js").path,
"-libraries",
PathUtil.kotlinPathsForCompiler.jsStdLibJarPath.absolutePath,
"-Xir-produce-klib-dir",
"-Xir-only",
"-ir-output-dir",
tmpdir.path,
"-ir-output-name",
"out",
environment = mapOf("JAVA_HOME" to KtTestUtil.getJdk8Home().absolutePath)
)
}
@@ -65,7 +65,7 @@ abstract class JavaModulesIntegrationTest(private val jdkVersion: Int, private v
return { actual ->
KotlinTestUtils.assertEqualsToFile(
expectedFile,
getNormalizedCompilerOutput(actual, null, testDataPath)
getNormalizedCompilerOutput(actual, null, testDataPath, tmpdir.absolutePath)
.replace((System.getenv("JDK_11_0") ?: System.getenv("JDK_11")).replace("\\", "/"), "\$JDK11")
.replace((System.getenv("JDK_17_0") ?: System.getenv("JDK_17")).replace("\\", "/"), "\$JDK17")
)