From 573d0b6bfcf36454c73d14978669300a5494f45b Mon Sep 17 00:00:00 2001 From: giwaov Date: Mon, 6 Apr 2026 20:42:37 +0100 Subject: [PATCH] test: convert issue 831 regression test to lit test Move the ust_sdk_invalid_stack_offset_movup_16_issue_831 integration test to a lit test suite under ests/lit/swapp/. - Add codegen_succeeds.masm to verify compilation produces no errors - Add issue831.masm to specifically check for the movup.16 stack offset regression - Move the test fixture project to ests/lit/swapp/test-project/ - Remove the old integration test function from ust_sdk/mod.rs Closes #875 --- .../src/rust_masm_tests/rust_sdk/mod.rs | 18 ------------------ tests/lit/swapp/codegen_succeeds.masm | 8 ++++++++ tests/lit/swapp/issue831.masm | 8 ++++++++ tests/lit/swapp/lit.suite.toml | 5 +++++ .../swapp/test-project}/.cargo/config.toml | 0 .../swapp/test-project}/.gitignore | 0 .../swapp/test-project}/Cargo.toml | 0 .../swapp/test-project}/src/lib.rs | 0 8 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 tests/lit/swapp/codegen_succeeds.masm create mode 100644 tests/lit/swapp/issue831.masm create mode 100644 tests/lit/swapp/lit.suite.toml rename tests/{rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup => lit/swapp/test-project}/.cargo/config.toml (100%) rename tests/{rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup => lit/swapp/test-project}/.gitignore (100%) rename tests/{rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup => lit/swapp/test-project}/Cargo.toml (100%) rename tests/{rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup => lit/swapp/test-project}/src/lib.rs (100%) diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs index b3b5440bc..277b612da 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs @@ -99,24 +99,6 @@ impl Note { test.compile_package(); } -/// Regression test for https://github.com/0xMiden/compiler/issues/831 -/// -/// Previously, compilation could panic during MASM codegen with: -/// `invalid stack offset for movup: 16 is out of range`. -#[test] -fn rust_sdk_invalid_stack_offset_movup_16_issue_831() { - let config = WasmTranslationConfig::default(); - let mut test = CompilerTest::rust_source_cargo_miden( - "../rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup", - config, - [], - ); - - // Ensure the crate compiles all the way to a package. This previously triggered the #831 - // panic in MASM codegen. - let package = test.compile_package(); -} - #[test] fn rust_sdk_cross_ctx_account_and_note() { let config = WasmTranslationConfig::default(); diff --git a/tests/lit/swapp/codegen_succeeds.masm b/tests/lit/swapp/codegen_succeeds.masm new file mode 100644 index 000000000..0385809c1 --- /dev/null +++ b/tests/lit/swapp/codegen_succeeds.masm @@ -0,0 +1,8 @@ +;; Regression test for https://github.com/0xMiden/compiler/issues/831 +;; +;; Previously, compilation could panic during MASM codegen with: +;; `invalid stack offset for movup: 16 is out of range`. +;; +;; RUN: env CARGO_TARGET_DIR=%target_dir/lit/swapp cargo miden build --release --manifest-path %S/test-project/Cargo.toml 2>&1 | filecheck %s + +;; CHECK-NOT: error diff --git a/tests/lit/swapp/issue831.masm b/tests/lit/swapp/issue831.masm new file mode 100644 index 000000000..fc8ff8bbb --- /dev/null +++ b/tests/lit/swapp/issue831.masm @@ -0,0 +1,8 @@ +;; Regression test for https://github.com/0xMiden/compiler/issues/831 +;; +;; Verifies that compilation does not panic with: +;; `invalid stack offset for movup: 16 is out of range` +;; +;; RUN: env CARGO_TARGET_DIR=%target_dir/lit/swapp cargo miden build --release --manifest-path %S/test-project/Cargo.toml 2>&1 | filecheck %s + +;; CHECK-NOT: invalid stack offset for movup: 16 is out of range diff --git a/tests/lit/swapp/lit.suite.toml b/tests/lit/swapp/lit.suite.toml new file mode 100644 index 000000000..982d54d59 --- /dev/null +++ b/tests/lit/swapp/lit.suite.toml @@ -0,0 +1,5 @@ +name = "swapp" +patterns = ["*.masm"] +working_dir = "../../../" + +[format.shtest] diff --git a/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/.cargo/config.toml b/tests/lit/swapp/test-project/.cargo/config.toml similarity index 100% rename from tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/.cargo/config.toml rename to tests/lit/swapp/test-project/.cargo/config.toml diff --git a/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/.gitignore b/tests/lit/swapp/test-project/.gitignore similarity index 100% rename from tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/.gitignore rename to tests/lit/swapp/test-project/.gitignore diff --git a/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/Cargo.toml b/tests/lit/swapp/test-project/Cargo.toml similarity index 100% rename from tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/Cargo.toml rename to tests/lit/swapp/test-project/Cargo.toml diff --git a/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/src/lib.rs b/tests/lit/swapp/test-project/src/lib.rs similarity index 100% rename from tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/src/lib.rs rename to tests/lit/swapp/test-project/src/lib.rs