Skip to content
This repository was archived by the owner on Jul 12, 2024. It is now read-only.

test: Remove @JSExportTopLevel from test-suites functions #17

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

tanishiking
Copy link
Owner

Previously, the resulting Wasm module contained all the code for every test-suite package, which made debugging test results harder because
(1) the resulting Wasm module contained a lot of irrelevant code, and (2) if one of the test-suites was compiled to invalid Wasm code, all the tests would be affected, rendering all modules unable to instantiate.

This issue caused because each Scala.js package in the test-suites containing @JSExportTopLevel, which served as a root node for reachability analysis. Thus, all the code under test-suites remained alive after linking.

To address this, this commit removes all @JSExportTopLevel from the test-suites. Instead, we added a function call to the ModuleInitializer methods into the start function of Wasm
If a test fails, Wasm will execute unreachable, causing instantiation to fail and the test to fail accordingly.

Previously, the resulting Wasm module contained all the code for every test-suite package,
which made debugging test results harder because
(1) the resulting Wasm module contained a lot of irrelevant code, and
(2) if one of the test-suites was compiled to invalid Wasm code, all the tests would be affected, rendering all modules unable to instantiate.

This issue caused because each Scala.js package in the test-suites containing
`@JSExportTopLevel`, which served as a root node for reachability analysis.
Thus, all the code under test-suites remained alive after linking.

To address this, this commit removes all `@JSExportTopLevel` from the test-suites.
Instead, we added a function call to the `ModuleInitializer` methods into
the start function of Wasm
If a test fails, Wasm will execute unreachable, causing instantiation to fail and the test to fail accordingly.
TestSuite("testsuite.core.HijackedClassesDispatchTest"),
TestSuite("testsuite.core.HijackedClassesMonoTest"),
TestSuite("testsuite.core.HijackedClassesUpcastTest"),
TestSuite("testsuite.core.ToStringTest")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we can eliminate other objects even if they are in the same package (testsuite.core)

Copy link
Collaborator

@sjrd sjrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This is going to be much nicer to work with.

@sjrd sjrd merged commit 025fddc into main Mar 15, 2024
1 check passed
@sjrd sjrd deleted the test-start-function branch March 15, 2024 08:29
@sjrd sjrd mentioned this pull request Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants