[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
@@ -111,7 +111,7 @@ val CompilerConfiguration.resolverLogger: Logger
override fun fatal(message: String): Nothing { override fun fatal(message: String): Nothing {
messageLogger.report(IrMessageLogger.Severity.ERROR, message, null) messageLogger.report(IrMessageLogger.Severity.ERROR, message, null)
kotlin.error("FATAL ERROR: $message") throw CompilationErrorException()
} }
} }
} }
+8 -4
View File
@@ -1,5 +1,9 @@
compiler/testData/integration/ant/js/simpleWithoutStdlibAndFolderAsAnotherLib/jslib-example/LibraryExample.kt compiler/testData/integration/ant/js/simpleWithoutStdlibAndFolderAsAnotherLib/jslib-example/LibraryExample.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-klib-dir
-meta-info -Xir-only
-output -ir-output-dir
$TEMP_DIR$/jslib-example.js $TEMP_DIR$
-ir-output-name
jslib-example
-libraries
$STDLIB_JS$
+1 -3
View File
@@ -1,3 +1 @@
// EXISTS: jslib-example.meta.js // EXISTS: default/manifest
// EXISTS: jslib-example.js
// EXISTS: jslib-example/library/sample/sample.kjsm
-44
View File
@@ -1,44 +0,0 @@
if (typeof kotlin === 'undefined') {
throw new Error("Error loading module 'LibraryExample'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'LibraryExample'.");
}
var LibraryExample = function (_, Kotlin) {
'use strict';
function pairAdd(p) {
return p.first + p.second | 0;
}
function pairMul(p) {
return Kotlin.imul(p.first, p.second);
}
function IntHolder(value) {
this.value = value;
}
IntHolder.$metadata$ = {
kind: Kotlin.Kind.CLASS,
simpleName: 'IntHolder',
interfaces: []
};
IntHolder.prototype.component1 = function () {
return this.value;
};
IntHolder.prototype.copy_za3lpa$ = function (value) {
return new IntHolder(value === void 0 ? this.value : value);
};
IntHolder.prototype.toString = function () {
return 'IntHolder(value=' + Kotlin.toString(this.value) + ')';
};
IntHolder.prototype.hashCode = function () {
var result = 0;
result = result * 31 + Kotlin.hashCode(this.value) | 0;
return result;
};
IntHolder.prototype.equals = function (other) {
return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && Kotlin.equals(this.value, other.value))));
};
var package$library = _.library || (_.library = {});
var package$sample = package$library.sample || (package$library.sample = {});
package$sample.pairAdd_1fzo63$ = pairAdd;
package$sample.pairMul_1fzo63$ = pairMul;
package$sample.IntHolder = IntHolder;
Kotlin.defineModule('LibraryExample', _);
return _;
}(typeof LibraryExample === 'undefined' ? {} : LibraryExample, kotlin);
@@ -1 +0,0 @@
// Kotlin.kotlin_module_metadata(1, "LibraryExample", "H4sIAAAAAAAAAJVW227TQBB1fF1Pb64LJTUgRBEgbiWkCIEESC19KJWQgIoPcJ1tsqmzG9ZO0v4Ar0h9QP2UfAGf0N+BcS5O0tRu6gfvaHdmzlzOjq2490FxFa94Rv4Nn0LXHsmnRHE9sMD49oOz2NVBdRTPPCNK11aSs4cwD+aRiEPGQWXChUQBdKI4hUQNffVcvIabqZol6WFIgxjUeuQ6I318Fxw1sVK7tjp0rtf9tg96K2ZhlvOXsJo6n6fHTSpZg/LYzzToBV3/2aLyBNQWy1J7BzdAE7IKWmczAK0iGqAFUeSuXowZ36qjJaZa19YS0yfgpCGZ0udVGmWh7MNGqgqBkAJT5TSazASA8VgyHrFgJvwNWBoP/bgm8yv9CBbSIJJEr1OSlgxnCakIRs90mkO3gQzbMX34AGCEmBXWxhi95gLRaPqSRYJn1vw5rKT6dkQRmgfZHXqBSacdakqBbYlZtvqFYMKE6ywnmAn3IwLkXaVeQayjmhRcRGB06EE1zG/wZY2L2tVZGvcebl00NWkbaTkTEycGRD0zqx4H+mrTHNgcq1AP3zhosbCSn/FTWJ4aOVnobyZSnMMGHwrZ8JEU+RjPwE0xCN5QKnn21NmC9asvej7ebw3+FMAK2YH0cXaZkd9ohhTszzzeFWGFylGZtvgJGG0/bFHQ8DhBbDQFR5BXoAeiidbIez+MwNoWIqQ+B0PENXRBan5U+yQqFEgs9pOpUwVzsFpNn8mtSgUKTdC/otzf+dIK3Y9jgZtJ4EUFdzSUNUdHOVnNwQqDdXGwLhcVb8e76yx5askou47jLbq6i3L/XSJdouCxm3Pcr/M6I79IUS2rJX2buKZjJBZ7tmMl6+5fbW/FISiqZYI8NfqbBdy0UTTLxJnz9GKhpO+ea2g03zs/L6C4gKKF4veBSwQ8JSpMDdpkdM7OygMpOhGVWYR5C2tjvhe4iNkhC/z+MMlFKSHKyNI4pHFQy7d4DIuTUyUrqERxmIAe0+PMOzXxSam3Mz8pd8BOGT199T9A8eLwQcbJCMk4y/Qp46AfmVsdIY+ovGbxWEivsFgDs/+fMh3/Dty79MdnbFzMkMbEJ8LnyIQeCzJK6g1U/wOSAB0W3QkAAA==");
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
<LibraryExample>:library.sample
+8
View File
@@ -0,0 +1,8 @@
abi_version=1.8.0
builtins_platform=JS
compiler_version=1.9.255-SNAPSHOT
depends=kotlin
metadata_version=1.4.1
serializedIrFileFingerprints=3vriludieft1x.1583499ndbss7
serializedKlibFingerprint=3f3efqjuxw1sw.xi1rrqn6iire
unique_name=LibraryExample
-4
View File
@@ -1,4 +0,0 @@
$TESTDATA_DIR$/inlineCycle.kt
-Xforce-deprecated-legacy-compiler-usage
-output
$TEMP_DIR$
-20
View File
@@ -1,20 +0,0 @@
inline fun a(l: () -> Unit) {
b(l)
//check that nested not recognized as cycle
c {
c {
}
}
}
inline fun b(p: () -> Unit) {
p()
a(p)
}
inline fun c(p: () -> Unit) {
p()
}
-7
View File
@@ -1,7 +0,0 @@
compiler/testData/cli/js/inlineCycle.kt:2:5: error: the 'b' invocation is a part of inline cycle
b(l)
^
compiler/testData/cli/js/inlineCycle.kt:15:5: error: the 'a' invocation is a part of inline cycle
a(p)
^
COMPILATION_ERROR
+8 -3
View File
@@ -1,6 +1,11 @@
$TESTDATA_DIR$/languageVersion.kt $TESTDATA_DIR$/languageVersion.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-klib-dir
-output -Xir-only
$TEMP_DIR$/out.js -ir-output-dir
$TEMP_DIR$
-ir-output-name
out
-language-version -language-version
1.4 1.4
-libraries
$STDLIB_JS$
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1,5 +1,5 @@
# jslib # jslib
Path to sources: `compiler/testData/cli/js/jslib` Path to sources: `compiler/testData/cli/js/lib`
`folderAsLib/LibraryExample.js`, `folderAsLib/LibraryExample.meta.js` and `LibraryExample.jar` should be updated after changing some files in source folder. `folderAsLib/LibraryExample.js`, `folderAsLib/LibraryExample.meta.js` and `LibraryExample.jar` should be updated after changing some files in source folder.
+7 -4
View File
@@ -1,6 +1,9 @@
$TESTDATA_DIR$/withLib.kt $TESTDATA_DIR$/withLib.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-klib-dir
-Xir-only
-libraries -libraries
not/existing/path $STDLIB_JS$:not/existing/path
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
+1 -1
View File
@@ -1,2 +1,2 @@
error: path 'not/existing/path' does not exist error: could not find "not/existing/path" in [$USER_DIR$]
COMPILATION_ERROR COMPILATION_ERROR
@@ -1,13 +0,0 @@
$TESTDATA_DIR$/separateModules/sepModule1.kt
-Xforce-deprecated-legacy-compiler-usage
-meta-info
-Xmetadata-only
-output
$TEMP_DIR$/m1/m1.js
---
$TESTDATA_DIR$/separateModules/sepModule2.kt
-Xforce-deprecated-legacy-compiler-usage
-libraries
$TEMP_DIR$/m1
-output
$TEMP_DIR$/m2/m2.js
@@ -1 +0,0 @@
OK
@@ -1,5 +0,0 @@
// EXISTS: m1/m1.meta.js
// ABSENT: m1/m1.js
// EXISTS: m1/m1/m1/m1.kjsm
// EXISTS: m2/m2.js
-12
View File
@@ -1,12 +0,0 @@
$TESTDATA_DIR$/separateModules/sepModule1.kt
-Xforce-deprecated-legacy-compiler-usage
-meta-info
-output
$TEMP_DIR$/m1/m.js
---
$TESTDATA_DIR$/separateModules/sepModule2.kt
-Xforce-deprecated-legacy-compiler-usage
-libraries
$TEMP_DIR$/m1
-output
$TEMP_DIR$/m2/m.js
-2
View File
@@ -1,2 +0,0 @@
warning: module "m" depends on module with the same name
OK
-1
View File
@@ -1 +0,0 @@
// NOT_CONTAINS: m2/m.js, foo(bar$lambda);
@@ -1,12 +0,0 @@
$TESTDATA_DIR$/separateModules/sepModule3.kt
-Xforce-deprecated-legacy-compiler-usage
-meta-info
-output
$TEMP_DIR$/m3/m.js
---
$TESTDATA_DIR$/separateModules/sepModule4.kt
-Xforce-deprecated-legacy-compiler-usage
-libraries
$TEMP_DIR$/m3
-output
$TEMP_DIR$/m4/m.js
@@ -1,2 +0,0 @@
warning: module "m" depends on module with the same name
OK
@@ -1 +0,0 @@
// NOT_CONTAINS: m4/m.js, foofaa();
+7 -4
View File
@@ -1,6 +1,9 @@
$TESTDATA_DIR$/withLib.kt $TESTDATA_DIR$/withLib.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-klib-dir
-Xir-only
-libraries -libraries
compiler/testData/integration/ant/js/simpleWithJsFileAsAnotherLib $STDLIB_JS$:compiler/testData/integration/ant/js/simpleWithJsFileAsAnotherLib
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
+1 -7
View File
@@ -1,8 +1,2 @@
warning: 'compiler/testData/integration/ant/js/simpleWithJsFileAsAnotherLib' is not a valid Kotlin Javascript library error: could not find "compiler/testData/integration/ant/js/simpleWithJsFileAsAnotherLib" in [$USER_DIR$]
compiler/testData/cli/js/withLib.kt:2:8: error: unresolved reference: library
import library.sample.*
^
compiler/testData/cli/js/withLib.kt:6:13: error: unresolved reference: pairAdd
val x = pairAdd(p)
^
COMPILATION_ERROR COMPILATION_ERROR
-4
View File
@@ -1,4 +0,0 @@
$TESTDATA_DIR$/simple2js.kt
-Xforce-deprecated-legacy-compiler-usage
-output
$TESTDATA_DIR$
-2
View File
@@ -1,2 +0,0 @@
error: cannot open output file '$TESTDATA_DIR$': is a directory
COMPILATION_ERROR
-1
View File
@@ -1 +0,0 @@
// ABSENT: out.js
@@ -1,6 +0,0 @@
$TESTDATA_DIR$/simple2js.kt
-Xforce-deprecated-legacy-compiler-usage
-output
$TEMP_DIR$/out.js
-output-postfix
not/existing/path
@@ -1,2 +0,0 @@
error: output postfix file 'not/existing/path' not found
COMPILATION_ERROR
@@ -1 +0,0 @@
// ABSENT: out.js
@@ -1,6 +0,0 @@
$TESTDATA_DIR$/simple2js.kt
-Xforce-deprecated-legacy-compiler-usage
-output
$TEMP_DIR$/out.js
-output-prefix
not/existing/path
-2
View File
@@ -1,2 +0,0 @@
error: output prefix file 'not/existing/path' not found
COMPILATION_ERROR
@@ -1 +0,0 @@
// ABSENT: out.js
+8 -3
View File
@@ -1,4 +1,9 @@
$TESTDATA_DIR$/reifiedIntersectionType.kt $TESTDATA_DIR$/reifiedIntersectionType.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-klib-dir
-output -Xir-only
$TEMP_DIR$/out.js -libraries
$STDLIB_JS$
-ir-output-dir
$TEMP_DIR$
-ir-output-name
out
@@ -1,6 +0,0 @@
package m1
inline fun foo(action: () -> Int): Int {
return action()
}
-13
View File
@@ -1,13 +0,0 @@
package m2
import m1.*
fun bar(): Int {
foo { return 100 }
return -99
}
fun box(): String {
if (bar() == 100) return "OK"
return "fail"
}
-10
View File
@@ -1,10 +0,0 @@
package m3
fun foofaa(): Unit { }
inline fun foo(action: () -> Int): Int {
foofaa()
return action()
}
-17
View File
@@ -1,17 +0,0 @@
package m4
import m3.*
inline fun foo(action: () -> Int): Int {
return action()
}
fun bar(): Int {
foo { return 100 }
return -99
}
fun box(): String {
if (bar() == 100) return "OK"
return "fail"
}
+8 -3
View File
@@ -1,4 +1,9 @@
$TESTDATA_DIR$/simple2js.kt $TESTDATA_DIR$/simple2js.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-klib-dir
-output -Xir-only
$TEMP_DIR$/out.js -libraries
$STDLIB_JS$
-ir-output-dir
$TEMP_DIR$
-ir-output-name
out
+1 -1
View File
@@ -1 +1 @@
// EXISTS: out.js // EXISTS: default/manifest
+8 -3
View File
@@ -1,7 +1,12 @@
$TESTDATA_DIR$/sourceMap.kt $TESTDATA_DIR$/sourceMap.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-js
-Xir-only
-libraries
$STDLIB_JS$
-source-map -source-map
-source-map-prefix -source-map-prefix
./ ./
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
+3
View File
@@ -1 +1,4 @@
info: produce executable: $TMP_DIR$
info: cache directory: null
info: executable production duration: [time]
OK OK
+8 -3
View File
@@ -1,7 +1,12 @@
$TESTDATA_DIR$/sourceMapCharEscape.kt $TESTDATA_DIR$/sourceMapCharEscape.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-js
-Xir-only
-libraries
$STDLIB_JS$
-source-map -source-map
-source-map-embed-sources -source-map-embed-sources
always always
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
+3
View File
@@ -1 +1,4 @@
info: produce executable: $TMP_DIR$
info: cache directory: null
info: executable production duration: [time]
OK OK
@@ -1,7 +1,12 @@
$TESTDATA_DIR$/sourceMapDuplicatePath/ $TESTDATA_DIR$/sourceMapDuplicatePath/
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-js
-Xir-only
-libraries
$STDLIB_JS$
-source-map -source-map
-source-map-base-dirs -source-map-base-dirs
$TESTDATA_DIR$/sourceMapDuplicatePath/foo:$TESTDATA_DIR$/sourceMapDuplicatePath/bar $TESTDATA_DIR$/sourceMapDuplicatePath/foo:$TESTDATA_DIR$/sourceMapDuplicatePath/bar
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
@@ -1,2 +1,4 @@
warning: there are files with same path 'lib.kt', relative to source roots: '$TESTDATA_DIR$/sourceMapDuplicatePath/foo/lib.kt' and '$TESTDATA_DIR$/sourceMapDuplicatePath/bar/lib.kt'. This will likely cause problems with debugger info: produce executable: $TMP_DIR$
info: cache directory: null
info: executable production duration: [time]
OK OK
+8 -3
View File
@@ -1,9 +1,14 @@
$TESTDATA_DIR$/sourceMap.kt $TESTDATA_DIR$/sourceMap.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-js
-Xir-only
-libraries
$STDLIB_JS$
-source-map -source-map
-source-map-prefix -source-map-prefix
./ ./
-source-map-embed-sources -source-map-embed-sources
always always
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
+3
View File
@@ -1 +1,4 @@
info: produce executable: $TMP_DIR$
info: cache directory: null
info: executable production duration: [time]
OK OK
+8 -3
View File
@@ -1,7 +1,12 @@
$TESTDATA_DIR$/sourceMap.kt $TESTDATA_DIR$/sourceMap.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-js
-Xir-only
-libraries
$STDLIB_JS$
-source-map -source-map
-source-map-prefix -source-map-prefix
/localhost/src/ /localhost/src/
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
+3
View File
@@ -1 +1,4 @@
info: produce executable: $TMP_DIR$
info: cache directory: null
info: executable production duration: [time]
OK OK
+15 -8
View File
@@ -1,14 +1,21 @@
$TESTDATA_DIR$/sourceMapRelativeRoot/lib/src/lib.kt $TESTDATA_DIR$/sourceMapRelativeRoot/lib/src/lib.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-klib-dir
-Xir-only
-libraries
$STDLIB_JS$
-source-map -source-map
-meta-info -ir-output-dir
-output $TESTDATA_DIR$/sourceMapRelativeRoot/lib/out
$TESTDATA_DIR$/sourceMapRelativeRoot/lib/out/lib.js -ir-output-name
lib
--- ---
$TESTDATA_DIR$/sourceMapRelativeRoot/main/src/main.kt $TESTDATA_DIR$/sourceMapRelativeRoot/main/src/main.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-js
-Xir-only
-libraries -libraries
$TESTDATA_DIR$/sourceMapRelativeRoot/lib/out/ $STDLIB_JS$:$TESTDATA_DIR$/sourceMapRelativeRoot/lib/out/
-source-map -source-map
-output -ir-output-dir
$TESTDATA_DIR$/sourceMapRelativeRoot/main/out/main.js $TESTDATA_DIR$/sourceMapRelativeRoot/main/out
-ir-output-name
main
+3
View File
@@ -1 +1,4 @@
info: produce executable: $TESTDATA_DIR$/sourceMapRelativeRoot/main/out
info: cache directory: null
info: executable production duration: [time]
OK OK
-2
View File
@@ -1,5 +1,3 @@
// EXISTS: $TESTDATA_DIR$/sourceMapRelativeRoot/lib/out/lib.js
// EXISTS: $TESTDATA_DIR$/sourceMapRelativeRoot/main/out/main.js // EXISTS: $TESTDATA_DIR$/sourceMapRelativeRoot/main/out/main.js
// CONTAINS: $TESTDATA_DIR$/sourceMapRelativeRoot/lib/out/lib.js.map, "../src/lib.kt"
// CONTAINS: $TESTDATA_DIR$/sourceMapRelativeRoot/main/out/main.js.map, "../src/main.kt" // CONTAINS: $TESTDATA_DIR$/sourceMapRelativeRoot/main/out/main.js.map, "../src/main.kt"
// CONTAINS: $TESTDATA_DIR$/sourceMapRelativeRoot/main/out/main.js.map, "../../lib/src/lib.kt" // CONTAINS: $TESTDATA_DIR$/sourceMapRelativeRoot/main/out/main.js.map, "../../lib/src/lib.kt"
+8 -3
View File
@@ -1,8 +1,13 @@
$TESTDATA_DIR$/sourceMapRoot/foo/file1.kt $TESTDATA_DIR$/sourceMapRoot/foo/file1.kt
$TESTDATA_DIR$/sourceMapRoot/bar/file2.kt $TESTDATA_DIR$/sourceMapRoot/bar/file2.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-js
-Xir-only
-libraries
$STDLIB_JS$
-source-map -source-map
-source-map-prefix -source-map-prefix
./ ./
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
+3
View File
@@ -1 +1,4 @@
info: produce executable: $TMP_DIR$
info: cache directory: null
info: executable production duration: [time]
OK OK
+8 -3
View File
@@ -1,8 +1,13 @@
$TESTDATA_DIR$/sourceMapRoot/foo/file1.kt $TESTDATA_DIR$/sourceMapRoot/foo/file1.kt
$TESTDATA_DIR$/sourceMapRoot/bar/file2.kt $TESTDATA_DIR$/sourceMapRoot/bar/file2.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-js
-Xir-only
-libraries
$STDLIB_JS$
-source-map -source-map
-source-map-base-dirs -source-map-base-dirs
$TESTDATA_DIR$/ $TESTDATA_DIR$/
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
+3
View File
@@ -1 +1,4 @@
info: produce executable: $TMP_DIR$
info: cache directory: null
info: executable production duration: [time]
OK OK
+9 -3
View File
@@ -2,9 +2,15 @@ $TESTDATA_DIR$/sourceMapRoot/foo/file1.kt
$TESTDATA_DIR$/sourceMapRoot/bar/file2.kt $TESTDATA_DIR$/sourceMapRoot/bar/file2.kt
$TESTDATA_DIR$/sourceMapRoot/bar/baz/file3.kt $TESTDATA_DIR$/sourceMapRoot/bar/baz/file3.kt
$TESTDATA_DIR$/sourceMapRoot/foo/baz/file4.kt $TESTDATA_DIR$/sourceMapRoot/foo/baz/file4.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-js
-Xir-only
-libraries
$STDLIB_JS$
-source-map -source-map
-source-map-base-dirs -source-map-base-dirs
$TESTDATA_DIR$/sourceMapRoot/foo $TESTDATA_DIR$/sourceMapRoot/foo
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
+3
View File
@@ -1 +1,4 @@
info: produce executable: $TMP_DIR$
info: cache directory: null
info: executable production duration: [time]
OK OK
+9 -3
View File
@@ -1,8 +1,14 @@
$TESTDATA_DIR$/sourceMapRoot/foo/file1.kt $TESTDATA_DIR$/sourceMapRoot/foo/file1.kt
$TESTDATA_DIR$/sourceMapRoot/bar/file2.kt $TESTDATA_DIR$/sourceMapRoot/bar/file2.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-js
-Xir-only
-libraries
$STDLIB_JS$
-source-map -source-map
-source-map-base-dirs -source-map-base-dirs
$TESTDATA_DIR$/foo:$TESTDATA_DIR$/bar $TESTDATA_DIR$/foo:$TESTDATA_DIR$/bar
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
+3
View File
@@ -1 +1,4 @@
info: produce executable: $TMP_DIR$
info: cache directory: null
info: executable production duration: [time]
OK OK
+8 -3
View File
@@ -1,5 +1,10 @@
$TESTDATA_DIR$/../warnings.kt $TESTDATA_DIR$/../warnings.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-klib-dir
-Xir-only
-libraries
$STDLIB_JS$
-nowarn -nowarn
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
+7 -4
View File
@@ -1,6 +1,9 @@
$TESTDATA_DIR$/withLib.kt $TESTDATA_DIR$/withLib.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-klib-dir
-Xir-only
-libraries -libraries
$TESTDATA_DIR$/folderAsLib $STDLIB_JS$:$TESTDATA_DIR$/folderAsLib
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
+1 -1
View File
@@ -1 +1 @@
// EXISTS: out.js // EXISTS: default/manifest
+7 -4
View File
@@ -1,6 +1,9 @@
$TESTDATA_DIR$/withLib.kt $TESTDATA_DIR$/withLib.kt
-Xforce-deprecated-legacy-compiler-usage -Xir-produce-klib-dir
-Xir-only
-libraries -libraries
$TESTDATA_DIR$/lib/LibraryExample.jar $STDLIB_JS$:$TESTDATA_DIR$/lib/LibraryExample.klib
-output -ir-output-dir
$TEMP_DIR$/out.js $TEMP_DIR$
-ir-output-name
out
+1 -1
View File
@@ -1 +1 @@
// EXISTS: out.js // EXISTS: default/manifest
@@ -84,13 +84,22 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir {
} }
@NotNull @NotNull
public static String getNormalizedCompilerOutput(@NotNull String pureOutput, @Nullable ExitCode exitCode, @NotNull String testDataDir) { public static String getNormalizedCompilerOutput(
@NotNull String pureOutput,
@Nullable ExitCode exitCode,
@NotNull String testDataDir,
@NotNull String tmpdir
) {
String testDataAbsoluteDir = new File(testDataDir).getAbsolutePath(); String testDataAbsoluteDir = new File(testDataDir).getAbsolutePath();
String tmpDirAbsoluteDir = new File(tmpdir).getAbsolutePath();
String normalizedOutputWithoutExitCode = StringUtil.convertLineSeparators(pureOutput) String normalizedOutputWithoutExitCode = StringUtil.convertLineSeparators(pureOutput)
.replace(testDataAbsoluteDir, TESTDATA_DIR) .replace(testDataAbsoluteDir, TESTDATA_DIR)
.replace(FileUtil.toSystemIndependentName(testDataAbsoluteDir), TESTDATA_DIR) .replace(FileUtil.toSystemIndependentName(testDataAbsoluteDir), TESTDATA_DIR)
.replace(PathUtil.getKotlinPathsForDistDirectory().getHomePath().getAbsolutePath(), "$PROJECT_DIR$") .replace(PathUtil.getKotlinPathsForDistDirectory().getHomePath().getAbsolutePath(), "$PROJECT_DIR$")
.replace(PathUtil.getKotlinPathsForDistDirectory().getHomePath().getParentFile().getAbsolutePath(), "$DIST_DIR$") .replace(PathUtil.getKotlinPathsForDistDirectory().getHomePath().getParentFile().getAbsolutePath(), "$DIST_DIR$")
.replace(org.jetbrains.kotlin.konan.file.File.Companion.getUserDir().getAbsolutePath(), "$USER_DIR$")
.replace(tmpDirAbsoluteDir, "$TMP_DIR$")
.replaceAll("info: executable production duration: \\d+ms", "info: executable production duration: [time]")
.replace("expected version is " + JvmMetadataVersion.INSTANCE, "expected version is $ABI_VERSION$") .replace("expected version is " + JvmMetadataVersion.INSTANCE, "expected version is $ABI_VERSION$")
.replace("expected version is " + JsMetadataVersion.INSTANCE, "expected version is $ABI_VERSION$") .replace("expected version is " + JsMetadataVersion.INSTANCE, "expected version is $ABI_VERSION$")
.replace("compiler version " + JvmMetadataVersion.INSTANCE, "compiler version $ABI_VERSION$") .replace("compiler version " + JvmMetadataVersion.INSTANCE, "compiler version $ABI_VERSION$")
@@ -115,7 +124,10 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir {
Pair<String, ExitCode> outputAndExitCode = executeCompilerGrabOutput(compiler, readArgs(fileName, tmpdir.getPath())); Pair<String, ExitCode> outputAndExitCode = executeCompilerGrabOutput(compiler, readArgs(fileName, tmpdir.getPath()));
String actual = getNormalizedCompilerOutput( String actual = getNormalizedCompilerOutput(
outputAndExitCode.getFirst(), outputAndExitCode.getSecond(), new File(fileName).getParent() outputAndExitCode.getFirst(),
outputAndExitCode.getSecond(),
new File(fileName).getParent(),
tmpdir.getAbsolutePath()
); );
File outFile = new File(fileName.replaceFirst("\\.args$", ".out")); File outFile = new File(fileName.replaceFirst("\\.args$", ".out"));
@@ -285,6 +297,9 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir {
).replace( ).replace(
"$JDK_17$", "$JDK_17$",
KtTestUtil.getJdk17Home().getPath() KtTestUtil.getJdk17Home().getPath()
).replace(
"$STDLIB_JS$",
PathUtil.getKotlinPathsForCompiler().getJsStdLibJarPath().getAbsolutePath()
); );
} }
@@ -132,7 +132,12 @@ abstract class AbstractKotlinCompilerIntegrationTest : TestCaseWithTmpdir() {
} }
protected fun normalizeOutput(output: Pair<String, ExitCode>): String { protected fun normalizeOutput(output: Pair<String, ExitCode>): String {
return AbstractCliTest.getNormalizedCompilerOutput(output.first, output.second, testDataDirectory.path).removeFirWarning() return AbstractCliTest.getNormalizedCompilerOutput(
output.first,
output.second,
testDataDirectory.path,
tmpdir.absolutePath
).removeFirWarning()
.replace(FileUtil.toSystemIndependentName(tmpdir.absolutePath), "\$TMP_DIR\$") .replace(FileUtil.toSystemIndependentName(tmpdir.absolutePath), "\$TMP_DIR\$")
} }
@@ -1318,11 +1318,6 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/js/firMppWithKlib.args"); runTest("compiler/testData/cli/js/firMppWithKlib.args");
} }
@TestMetadata("inlineCycle.args")
public void testInlineCycle() throws Exception {
runTest("compiler/testData/cli/js/inlineCycle.args");
}
@TestMetadata("jsExtraHelp.args") @TestMetadata("jsExtraHelp.args")
public void testJsExtraHelp() throws Exception { public void testJsExtraHelp() throws Exception {
runTest("compiler/testData/cli/js/jsExtraHelp.args"); runTest("compiler/testData/cli/js/jsExtraHelp.args");
@@ -1358,21 +1353,6 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/js/libraryDirNotFound.args"); runTest("compiler/testData/cli/js/libraryDirNotFound.args");
} }
@TestMetadata("moduleWithMetadataOnlyDependency.args")
public void testModuleWithMetadataOnlyDependency() throws Exception {
runTest("compiler/testData/cli/js/moduleWithMetadataOnlyDependency.args");
}
@TestMetadata("modulesWithSameNames.args")
public void testModulesWithSameNames() throws Exception {
runTest("compiler/testData/cli/js/modulesWithSameNames.args");
}
@TestMetadata("modulesWithSameNamesAndFunc.args")
public void testModulesWithSameNamesAndFunc() throws Exception {
runTest("compiler/testData/cli/js/modulesWithSameNamesAndFunc.args");
}
@TestMetadata("nonExistingKotlinHome.args") @TestMetadata("nonExistingKotlinHome.args")
public void testNonExistingKotlinHome() throws Exception { public void testNonExistingKotlinHome() throws Exception {
runTest("compiler/testData/cli/js/nonExistingKotlinHome.args"); runTest("compiler/testData/cli/js/nonExistingKotlinHome.args");
@@ -1388,21 +1368,6 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/js/notValidLibraryDir.args"); runTest("compiler/testData/cli/js/notValidLibraryDir.args");
} }
@TestMetadata("outputIsDirectory.args")
public void testOutputIsDirectory() throws Exception {
runTest("compiler/testData/cli/js/outputIsDirectory.args");
}
@TestMetadata("outputPostfixFileNotFound.args")
public void testOutputPostfixFileNotFound() throws Exception {
runTest("compiler/testData/cli/js/outputPostfixFileNotFound.args");
}
@TestMetadata("outputPrefixFileNotFound.args")
public void testOutputPrefixFileNotFound() throws Exception {
runTest("compiler/testData/cli/js/outputPrefixFileNotFound.args");
}
@TestMetadata("perFileWithValidModuleKind.args") @TestMetadata("perFileWithValidModuleKind.args")
public void testPerFileWithValidModuleKind() throws Exception { public void testPerFileWithValidModuleKind() throws Exception {
runTest("compiler/testData/cli/js/perFileWithValidModuleKind.args"); runTest("compiler/testData/cli/js/perFileWithValidModuleKind.args");
@@ -56,12 +56,12 @@ class LauncherScriptTest : TestCaseWithTmpdir() {
val stdout = val stdout =
AbstractCliTest.getNormalizedCompilerOutput( AbstractCliTest.getNormalizedCompilerOutput(
StringUtil.convertLineSeparators(process.inputStream.bufferedReader().use { it.readText() }), StringUtil.convertLineSeparators(process.inputStream.bufferedReader().use { it.readText() }),
null, testDataDirectory null, testDataDirectory, tmpdir.absolutePath
) )
val stderr = val stderr =
AbstractCliTest.getNormalizedCompilerOutput( AbstractCliTest.getNormalizedCompilerOutput(
StringUtil.convertLineSeparators(process.errorStream.bufferedReader().use { it.readText() }), StringUtil.convertLineSeparators(process.errorStream.bufferedReader().use { it.readText() }),
null, testDataDirectory null, testDataDirectory, tmpdir.absolutePath
).replace("Picked up [_A-Z]+:.*\n".toRegex(), "") ).replace("Picked up [_A-Z]+:.*\n".toRegex(), "")
.replace("The system cannot find the file specified", "No such file or directory") // win -> unix .replace("The system cannot find the file specified", "No such file or directory") // win -> unix
process.waitFor(10, TimeUnit.SECONDS) process.waitFor(10, TimeUnit.SECONDS)
@@ -145,9 +145,14 @@ class LauncherScriptTest : TestCaseWithTmpdir() {
"kotlinc-js", "kotlinc-js",
"$testDataDirectory/emptyMain.kt", "$testDataDirectory/emptyMain.kt",
"-nowarn", "-nowarn",
"-Xforce-deprecated-legacy-compiler-usage", "-libraries",
"-output", PathUtil.kotlinPathsForCompiler.jsStdLibJarPath.absolutePath,
File(tmpdir, "out.js").path, "-Xir-produce-klib-dir",
"-Xir-only",
"-ir-output-dir",
tmpdir.path,
"-ir-output-name",
"out",
environment = mapOf("JAVA_HOME" to KtTestUtil.getJdk8Home().absolutePath) environment = mapOf("JAVA_HOME" to KtTestUtil.getJdk8Home().absolutePath)
) )
} }
@@ -65,7 +65,7 @@ abstract class JavaModulesIntegrationTest(private val jdkVersion: Int, private v
return { actual -> return { actual ->
KotlinTestUtils.assertEqualsToFile( KotlinTestUtils.assertEqualsToFile(
expectedFile, 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_11_0") ?: System.getenv("JDK_11")).replace("\\", "/"), "\$JDK11")
.replace((System.getenv("JDK_17_0") ?: System.getenv("JDK_17")).replace("\\", "/"), "\$JDK17") .replace((System.getenv("JDK_17_0") ?: System.getenv("JDK_17")).replace("\\", "/"), "\$JDK17")
) )
@@ -88,10 +88,12 @@ class CompilerOutputTest : AbstractNativeSimpleTest() {
} }
private fun normalizeOutput(output: String, exitCode: ExitCode): String { private fun normalizeOutput(output: String, exitCode: ExitCode): String {
val dir = "compiler/testData/compileKotlinAgainstCustomBinaries/"
return AbstractCliTest.getNormalizedCompilerOutput( return AbstractCliTest.getNormalizedCompilerOutput(
output, output,
exitCode, exitCode,
"compiler/testData/compileKotlinAgainstCustomBinaries/" dir,
dir
) )
} }
} }
@@ -64,7 +64,7 @@ class ImportsDumperTest : TestCaseWithTmpdir() {
) )
) )
return getNormalizedCompilerOutput(output, exitCode, testDataDir.path) return getNormalizedCompilerOutput(output, exitCode, testDataDir.path, tmpDir.absolutePath)
} }
} }