[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)
|
||||
|
||||
Reference in New Issue
Block a user