sourcefrog / cargo-mutants

:zombie: Inject bugs and see if your tests catch them!

Home Page:https://mutants.rs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash when running in workspaces

adamchalmers opened this issue · comments

Happening on MacOS on cargo-mutants 23.6.0

Steps to reproduce:

  1. Check out the repro repo: https://github.com/adamchalmers/mutants-bug.git
  2. cd into mutants-bug/something
  3. Run cargo mutants

Observation:

thread 'main' panicked at 'manifest_path is within source_root_path: StripPrefixError(())', /Users/adamchalmers/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-mutants-23.6.0/src/cargo.rs:85:18
stack backtrace:
   0: rust_begin_unwind
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/panicking.rs:67:14
   2: core::result::unwrap_failed
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/result.rs:1651:5
   3: <cargo_mutants::cargo::CargoTool as cargo_mutants::tool::Tool>::root_files
   4: cargo_mutants::visit::walk_tree
   5: cargo_mutants::lab::test_unmutated_then_all_mutants
   6: cargo_mutants::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

There was a testdata/tree/workspace with the right configuration, but the tests didn't cover invoking it from a subdirectory.

By the way, currently cargo-mutants will test the whole workspace, even when it's run from a subdirectory. (See https://mutants.rs/workspaces.html.) This behavior might not be the right choice and might change in future.