risc0 icon indicating copy to clipboard operation
risc0 copied to clipboard

added the ability to test in guest environment

Open dymchenkko opened this issue 3 years ago • 0 comments

Added support to run tests in a guest environment.

These changes allow testing the guest environment with printing results to the console.

When the test_mode field is set to true in GuestOptions, in addition to build_guest_package() function, embed_methods_with_options() also runs the test_guest_package() function.

test_guest_package() - installs r0vm in target, runs tests, sets r0vm as a runner for tests and prints outputs.

Compromises made:

  • A custom test runner is needed as libtest currently requires fmax/sqrt/fmin functions
  • r0vm will always be the latest crates.io upstream, should ideally be parsing guest method Cargo.toml to find the right reference to it

See corresponding pull request in risc0-rust-starter: https://github.com/risc0/risc0-rust-starter/pull/16

NOTE: this is my first open source contribution pull request, be gentle but firm, will happily correct issues!

dymchenkko avatar Aug 30 '22 06:08 dymchenkko