Skip to content

Rust insta based tests - #210

Merged
jonathanpallant merged 8 commits into
rust-embedded:mainfrom
sriramster:rust_insta_based_tests
Aug 24, 2026
Merged

Rust insta based tests#210
jonathanpallant merged 8 commits into
rust-embedded:mainfrom
sriramster:rust_insta_based_tests

Conversation

@sriramster

@sriramster sriramster commented Jul 29, 2026

Copy link
Copy Markdown

This patch series introduces rust insta based testing framework. The insta framework documentation is available (https://docs.rs/insta/latest/insta/).

  • Patch introduces a new crate for testing named qemu-tests aarch32-tests
  • All the older reference folder are removed. And new snapshots are saved under qemu-tests/snapshots
  • Each test runs the binaries in qemu for all the defined targets, and compares the output with .snap files saved.
  • The .snap files needs to be bootstrapped for any new example added. Check justfile for more details on this.
  • The github workflow is updated to pickup these changes.
  • Older tests.sh code is remove as testing is handled by rust internally.

The PR address #138

@jonathanpallant jonathanpallant left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for these changes. I think the proposed solution is going to work well and I left you some thoughts.

Comment thread qemu-tests/tests/common/mod.rs Outdated
Comment thread qemu-tests/Cargo.toml Outdated
Comment thread .github/workflows/build.yml Outdated
Comment thread qemu-tests/tests/tests.rs Outdated
@sriramster

Copy link
Copy Markdown
Author

@jonathanpallant Please have a look when you've time. Hopefully I've address most of the comments in one way or the other.

@sriramster
sriramster force-pushed the rust_insta_based_tests branch from f299118 to 988e18e Compare August 5, 2026 05:03
@sriramster

Copy link
Copy Markdown
Author

@jonathanpallant would you please have a look at this?

@jonathanpallant

Copy link
Copy Markdown
Contributor

I'm on vacation at the moment

Sriram Raghunathan added 8 commits August 24, 2026 15:14
This patch series introduces the rust insta crate based testing upgrade.
The insta crate allows for snapshot comparison which is more powerful
than the current bash script based testing framework.

For documentation https://docs.rs/insta/latest/insta/

This patch introduces a new crate named qemu-tests.

* The qemu-tests has a mod named common, which lists the bins available
  in each of the examples
* Once bins are populated, we use rust's command execution from std, and
  call the `cargo run` with specific flags and --bin
* Before validating the test suite needs to be bootstrapped for the
  insta to load the snapshot for comparsion please refer to justfile for
  notes on how to initialize the test suite.

Signed-off-by: Sriram Raghunathan <sriram@hcoop.net>
… with insta crate

Signed-off-by: Sriram Raghunathan <sriram@hcoop.net>
…rkflow to use updated test-qemu

Signed-off-by: Sriram Raghunathan <sriram@hcoop.net>
Signed-off-by: Sriram Raghunathan <sriram@hcoop.net>
Signed-off-by: Sriram Raghunathan <sriram@hcoop.net>
Signed-off-by: Sriram Raghunathan <sriram@hcoop.net>
* Move back to older style target based invocation of tests.
* Allow user to run target specific insta tests.
* Adapt test framework accordingly.

Signed-off-by: Sriram Raghunathan <sriram@hcoop.net>
tests. And control the execution with libtest_mimic addressing the
review comments

Signed-off-by: Sriram Raghunathan <sriram@hcoop.net>
@jonathanpallant

Copy link
Copy Markdown
Contributor

Tried it out on the CLI, and it works great. I like that I can run cargo test -p aarch32-tests v8r and it runs all the Armv8-R tests.

@jonathanpallant
jonathanpallant added this pull request to the merge queue Aug 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Aug 24, 2026
@jonathanpallant
jonathanpallant added this pull request to the merge queue Aug 24, 2026
Merged via the queue into rust-embedded:main with commit ca2fb91 Aug 24, 2026
96 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants