Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(vm): Run multivm tests with shadowing #3137

Merged
merged 6 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/lib/multivm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ If you want to add unit tests for the VM wrapper, consider the following:
- Whenever possible, make tests reusable; declare test logic in the [`testonly`](src/versions/testonly/mod.rs) module,
and then instantiate tests using this logic for the supported VM versions. If necessary, extend the tested VM trait so
that test logic can be defined in a generic way. See the `testonly` module docs for more detailed guidelines.
- If you define a generic test, don't forget to add its instantiations for all supported VMs (`vm_latest`, `vm_fast` and
`shadow`). `shadow` tests allow checking VM divergences for free!
- Do not use an RNG where it can be avoided (e.g., for test contract addresses).
- Avoid using zero / default values in cases they can be treated specially by the tested code.
2 changes: 2 additions & 0 deletions core/lib/multivm/src/versions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#[cfg(test)]
mod shadow;
mod shared;
#[cfg(test)]
mod testonly;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ use crate::{
vm_latest::HistoryEnabled,
};

mod tests;

type ReferenceVm<S = InMemoryStorage> = vm_latest::Vm<StorageView<S>, HistoryEnabled>;
type ShadowedFastVm<S = InMemoryStorage> = crate::vm_instance::ShadowedFastVm<S>;

Expand Down
Loading
Loading