[Wasm] add simple tests to track the size of wasm and mjs files
This commit is contained in:
+10
@@ -49056,6 +49056,16 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Size {
|
||||
@Test
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+10
@@ -49056,6 +49056,16 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Size {
|
||||
@Test
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// TARGET_BACKEND: WASM
|
||||
|
||||
// WASM_DCE_EXPECTED_OUTPUT_SIZE: wasm 146_294
|
||||
// WASM_DCE_EXPECTED_OUTPUT_SIZE: mjs 8_247
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
@JsExport
|
||||
fun add(a: Int, b: Int) = a + b
|
||||
|
||||
// FILE: entry.mjs
|
||||
import k from "./index.mjs"
|
||||
|
||||
const r = k.add(2, 3);
|
||||
if (r != 5) throw Error("Wrong result: " + r);
|
||||
@@ -0,0 +1,9 @@
|
||||
// TARGET_BACKEND: WASM
|
||||
|
||||
// WASM_DCE_EXPECTED_OUTPUT_SIZE: wasm 146_626
|
||||
// WASM_DCE_EXPECTED_OUTPUT_SIZE: mjs 8_188
|
||||
|
||||
fun box(): String {
|
||||
println("Hello, World!")
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// TARGET_BACKEND: WASM
|
||||
|
||||
// WASM_DCE_EXPECTED_OUTPUT_SIZE: wasm 149_186
|
||||
// WASM_DCE_EXPECTED_OUTPUT_SIZE: mjs 8_686
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
import kotlinx.browser.document
|
||||
import kotlinx.dom.appendText
|
||||
|
||||
@JsExport
|
||||
fun test() {
|
||||
document.body?.appendText("Hello, World!")
|
||||
}
|
||||
|
||||
// FILE: entry.mjs
|
||||
import k from "./index.mjs"
|
||||
|
||||
const r = typeof k.test;
|
||||
if (r != "function") throw Error("Wrong result: " + r);
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// TARGET_BACKEND: WASM
|
||||
|
||||
// WASM_DCE_EXPECTED_OUTPUT_SIZE: wasm 146_345
|
||||
// WASM_DCE_EXPECTED_OUTPUT_SIZE: mjs 8_119
|
||||
|
||||
fun box() = "OK"
|
||||
+10
@@ -46566,6 +46566,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Size {
|
||||
@Test
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+10
@@ -49056,6 +49056,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Size {
|
||||
@Test
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+10
@@ -49056,6 +49056,16 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Size {
|
||||
@Test
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+13
@@ -37694,6 +37694,19 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Size extends AbstractLightAnalysisModeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+10
@@ -34598,6 +34598,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Size {
|
||||
@Test
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+10
@@ -34910,6 +34910,16 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Size {
|
||||
@Test
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+10
@@ -34910,6 +34910,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Size {
|
||||
@Test
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+10
@@ -34910,6 +34910,16 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Size {
|
||||
@Test
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+14
@@ -38972,6 +38972,20 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("codegenK2")
|
||||
@Tag("firCodegen")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@FirPipeline()
|
||||
public class Size {
|
||||
@Test
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+16
@@ -39932,6 +39932,22 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("codegenK2")
|
||||
@Tag("firCodegen")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@FirPipeline()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class Size {
|
||||
@Test
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+13
@@ -38492,6 +38492,19 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("codegen")
|
||||
@Tag("k1Codegen")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
public class Size {
|
||||
@Test
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+15
@@ -39452,6 +39452,21 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("codegen")
|
||||
@Tag("k1Codegen")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class Size {
|
||||
@Test
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Generated
+33
@@ -31189,6 +31189,39 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/size")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Size extends AbstractIrCodegenBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("add.kt")
|
||||
public void testAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/size/add.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSize() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/size"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("helloWorld.kt")
|
||||
public void testHelloWorld() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/size/helloWorld.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("helloWorldDOM.kt")
|
||||
public void testHelloWorldDOM() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/size/helloWorldDOM.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ok.kt")
|
||||
public void testOk() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/size/ok.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/smap")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user