Skip to content

Commit

Permalink
[move/tracing] Panic unit tests if tracing without being compiled wit…
Browse files Browse the repository at this point in the history
…h tracing support (#20253)

## Description 

Make sure that if the `--trace-execution` flag is passed that the binary
was compiled with the `tracing` feature flag set.

## Test plan 

CI

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
tzakian authored Nov 13, 2024
1 parent 60bdb62 commit 8117d83
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions external-crates/move/crates/move-unit-test/src/test_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ impl TestRunner {
native_function_table: Option<NativeFunctionTable>,
cost_table: Option<CostTable>,
) -> Result<Self> {
// If we want to trace the execution, check that the tracing compilation feature is
// enabled, otherwise we won't generate a trace.
move_vm_profiler::tracing_feature_disabled! {
if trace_location.is_some() {
return Err(anyhow::anyhow!(
"Tracing is enabled but the binary was not compiled with the `tracing` \
feature flag set. Rebuild binary with `--features tracing`"
));
}
};

let modules = tests.module_info.values().map(|info| &info.module);
let starting_storage_state =
setup_test_storage(modules, tests.bytecode_deps_modules.iter())?;
Expand Down

0 comments on commit 8117d83

Please sign in to comment.