0xMiden / 0xMiden/compiler

Convert `rust_sdk_invalid_stack_offset_movup_16_issue_831` test to lit test

Open Beginner friendly
#875 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
115
Forks
84
Avg merge
1d 8h
Merged PRs (30d)
15

Description

From https://github.com/0xMiden/compiler/pull/869#discussion_r2687339717:

> This is a good example of something we should use `lit` for. If you move this reproducer crate to `tests/lit/issue831`, and in that directory add two files:
>
> 1. `lit.suite.toml`:
>
> ```toml
> name = "issue831"
> patterns = ["*.masm"]
> working_dir = "../../../"
>
> [format.shtest]
> ```
>
> 2. `test.masm`:
>
> ```
> ;; RUN: cargo miden build --release --manifest-path %S/test-project/Cargo.toml --emit=masm=- 2>&1 | filecheck %s

This would run globally installed cargo-miden. So probably `bin/cargo-miden build ...`.

>
> ;; CHECK-NOT: invalid stack offset for movup: 16 is out of range
> ;; CHECK: proc {{.*}}create_swapp_note{{.*}}
> ```
>
> This test will fail if the output of `cargo miden build` contains the error message, and succeeds so long as we observe the expected procedure definition in the emitted MASM (that part may need to be tweaked, I just threw that in as an example). The `CHECK:` directive here just acts as a positive test to avoid false positives due to compilation failing for a reason other than the one related to issue 831.

The `create_swapp_note` is inlined so there is no need to check the MASM. Also I'd like it to fail on **any** error and not only on the "invalid stack offset ..." error. So the only check is that the build succeeds.

Contributor guide

Open the contributing guide

Research direction

The issue is about converting an existing test to a lit test. Look at the existing test `rust_sdk_invalid_stack_offset_movup_16_issue_831` to understand its purpose. Then, follow the instructions in the issue body: create a directory `tests/lit/issue831` with `lit.suite.toml` and `test.masm` files. The test should run `bin/cargo-miden build` and succeed without any error output. Check the project's existing lit tests for examples of structure and syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.