Skip to content

Commit

Permalink
Fix problem with missing "Cargo.lock" when in workspace subproject
Browse files Browse the repository at this point in the history
When invoking "cargo test" from workspace subproject
the Cargo.lock will be in parent project root_dir instead of $CARGO_MANIFEST_DIR
  • Loading branch information
budziq committed Jul 31, 2017
1 parent a31c0f2 commit f1be38e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/skeptic/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,15 @@ pub mod rt {
fn get_rlib_dependencies<P: AsRef<Path>>(root_dir: P, target_dir: P) -> Result<Vec<Fingerprint>> {
let root_dir = root_dir.as_ref();
let target_dir = target_dir.as_ref();
let lock = CargoLock::from_path(root_dir.join("Cargo.lock"))?;
let lock = CargoLock::from_path(root_dir.join("Cargo.lock")).or_else(
|_| {
// could not find Cargo.lock in $CARGO_MAINFEST_DIR
// try relative to target_dir
let mut root_dir = PathBuf::from(target_dir);
root_dir.pop();
root_dir.pop();
CargoLock::from_path(root_dir.join("Cargo.lock"))
})?;
let fingerprint_dir = target_dir.join(".fingerprint/");

let set = lock.collect::<HashSet<_>>();
Expand Down

0 comments on commit f1be38e

Please sign in to comment.