How to get bytecode fixtures, run regression tests, and update fixtures.
Regression tests use Sui Move .mv files under tests/bytecode/. These are not committed (they are large and gitignored). To obtain them:
-
Clone and build Sui
See tests/bytecode/README.md for exact commands: clone MystenLabs/sui, runsui move buildincrates/sui-framework, then copy.mvfiles from the build output into:tests/bytecode/move_stdlib/tests/bytecode/sui_framework/
-
If you skip this
If no.mvfiles are present, integration tests that depend on bytecode are skipped and still pass. Socargo testand CI succeed without any fixtures.
From the repo root:
cargo testThis runs all workspace tests, including the decompiler integration tests in crates/sui-decompiler/tests/decompiler_regression.rs:
- decompile_bytecode_fixtures: for each
.mvundertests/bytecode/, loads the module, decompiles, and checks that the output is non-empty and contains"module"or"address". Skipped if no.mvfiles. - decompile_then_sui_move_build: decompiles all
.mvfixtures to Move 2024, writes a temporary package withMove.toml(edition ="2024") and all modules under[addresses]std ="0x1", sui ="0x2", then runssui move build. Skipped if there are no.mvfiles or ifsuiis not in PATH; otherwise the test asserts that the build succeeds.
To run only the regression tests:
cargo test -p sui-decompiler decompile_bytecode_fixtures
cargo test -p sui-decompiler decompile_then_sui_move_buildTo run the full “decompile → sui move build” regression locally or in CI:
-
Prepare bytecode
From a local Sui repo, build the framework and copy.mvfiles as described in tests/bytecode/README.md. Use your Sui clone path (e.g./Users/mac/work/sui/sui) in thecporrsynccommands. -
Install Sui CLI
The build step requiressuion your PATH (e.g.cargo install --path /path/to/sui suior install from docs.sui.io). -
Run tests
From the desui repo root:cargo test -p sui-decompiler decompile_then_sui_move_buildIf no
.mvfiles exist undertests/bytecode/orsuiis not in PATH, the test is skipped and passes. -
CI (optional)
In GitHub Actions you can enable the bytecode regression by setting the SUI_PATH environment variable (e.g. as a repository variable) to the path of a Sui checkout. The workflow will then copy bytecode fromSUI_PATHintotests/bytecode/before running tests. The existing job does not require SUI_PATH; without it, only unit tests and the decompile-only integration test run (or the build test is skipped). To have the build regression actually run in CI,suimust also be available on PATH in that job (e.g. build Sui and add it to PATH in a prior step when SUI_PATH is set).
No absolute paths are hardcoded in the test code; the bytecode root is derived from CARGO_MANIFEST_DIR relative to the crate.
-
Bytecode (
.mv)
Re-run the steps intests/bytecode/README.mdto refresh from a newer Sui revision. Replace or add files intests/bytecode/move_stdlib/andtests/bytecode/sui_framework/. -
Move package for
sui move build
The minimal package undertests/fixtures/is used to verify decompiled output. To update:- Edit
tests/fixtures/Move.toml(e.g. bump Sui dependencyrev). - Add or replace
.movefiles intests/fixtures/sources/with decompiled or stub code. - Run
sui move buildfromtests/fixtures/to confirm it still builds. See tests/fixtures/README.md.
- Edit