From fe61cc1099b23c9f5d5872aab9f6fc9d321702ee Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Wed, 22 May 2019 15:02:41 +0200 Subject: [PATCH] tests/pxar.rs: Make sure the correct pxar binary is run in the tests. If compiled in debug mode, the debug binary should be tested, in release mode the release binary has to be invoked. Signed-off-by: Christian Ebner --- tests/pxar.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/pxar.rs b/tests/pxar.rs index d440ee6e..8e66a4c9 100644 --- a/tests/pxar.rs +++ b/tests/pxar.rs @@ -7,24 +7,30 @@ fn pxar_create_and_extract() { let src_dir = "./tests/catar_data/test_xattrs_src/"; let dest_dir = "./tests/catar_data/test_xattrs_dest/"; - println!("run pxar create archive.pxar '{}'", src_dir); + let exec_path = if cfg!(debug_assertions) { + "./target/debug/pxar" + } else { + "./target/release/pxar" + }; - Command::new("./target/debug/pxar") + println!("run '{} create archive.pxar {}'", exec_path, src_dir); + + Command::new(exec_path) .arg("create") .arg("./tests/archive.pxar") .arg(src_dir) .status() .unwrap_or_else(|err| { - panic!("Failed to invoke './target/debug/pxar': {}", err) + panic!("Failed to invoke '{}': {}", exec_path, err) }); - Command::new("./target/debug/pxar") + Command::new(exec_path) .arg("extract") .arg("./tests/archive.pxar") .arg(dest_dir) .status() .unwrap_or_else(|err| { - panic!("Failed to invoke './target/debug/pxar': {}", err) + panic!("Failed to invoke '{}': {}", exec_path, err) }); /* Use rsync with --dry-run and --itemize-changes to compare