KJS: fix wrongAbiVersion test after abi version was increased. Make it less fragile with the hack for JS tests.
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
||||
error: file 'compiler/testData/cli/js/wrongAbiVersionLib/wrongAbiLib.meta.js' was compiled with an incompatible version of Kotlin. Its ABI version is 0, expected ABI version is 4
|
||||
error: file 'compiler/testData/cli/js/wrongAbiVersionLib/wrongAbiLib.meta.js' was compiled with an incompatible version of Kotlin. Its ABI version is 0, expected version is $ABI_VERSION$
|
||||
COMPILATION_ERROR
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestCaseWithTmpdir;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
import org.jetbrains.kotlin.utils.KotlinJavascriptMetadataUtils;
|
||||
import org.jetbrains.kotlin.utils.PathUtil;
|
||||
import org.jetbrains.kotlin.utils.StringsKt;
|
||||
import org.junit.Assert;
|
||||
@@ -81,11 +82,11 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir {
|
||||
return normalizedOutputWithoutExitCode + exitCode;
|
||||
}
|
||||
|
||||
private void doTest(@NotNull String fileName, @NotNull CLICompiler<?> compiler) throws Exception {
|
||||
private void doTest(@NotNull String fileName, @NotNull CLICompiler<?> compiler, BinaryVersion version) throws Exception {
|
||||
System.setProperty("java.awt.headless", "true");
|
||||
Pair<String, ExitCode> outputAndExitCode = executeCompilerGrabOutput(compiler, readArgs(fileName, tmpdir.getPath()));
|
||||
String actual = getNormalizedCompilerOutput(
|
||||
outputAndExitCode.getFirst(), outputAndExitCode.getSecond(), new File(fileName).getParent(), JvmMetadataVersion.INSTANCE
|
||||
outputAndExitCode.getFirst(), outputAndExitCode.getSecond(), new File(fileName).getParent(), version
|
||||
);
|
||||
|
||||
File outFile = new File(fileName.replaceFirst("\\.args$", ".out"));
|
||||
@@ -151,11 +152,22 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir {
|
||||
}
|
||||
|
||||
protected void doJvmTest(@NotNull String fileName) throws Exception {
|
||||
doTest(fileName, new K2JVMCompiler());
|
||||
doTest(fileName, new K2JVMCompiler(), JvmMetadataVersion.INSTANCE);
|
||||
}
|
||||
|
||||
protected void doJsTest(@NotNull String fileName) throws Exception {
|
||||
doTest(fileName, new K2JSCompiler());
|
||||
doTest(fileName, new K2JSCompiler(), new BinaryVersion() {
|
||||
@Override
|
||||
public boolean isCompatible() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(KotlinJavascriptMetadataUtils.ABI_VERSION);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static String removePerfOutput(String output) {
|
||||
|
||||
@@ -144,7 +144,7 @@ public class LibrarySourcesConfig extends JsConfig {
|
||||
if (!metadata.isAbiVersionCompatible()) {
|
||||
report.invoke("File '" + path + "' was compiled with an incompatible version of Kotlin. " +
|
||||
"Its ABI version is " + metadata.getAbiVersion() +
|
||||
", expected ABI version is " + KotlinJavascriptMetadataUtils.ABI_VERSION);
|
||||
", expected version is " + KotlinJavascriptMetadataUtils.ABI_VERSION);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user