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

Nobody has claimed this yet.

Assessment

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

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.

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:
name = "issue831"
patterns = ["*.masm"]
working_dir = "../../../"

[format.shtest]
  1. 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.

Dominant language
Rust
Stars
116
Forks
84
Avg merge
1d 1h
Merged PRs (30d)
21

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from 0xMiden/compiler

All issues in 0xMiden/compiler

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.