diff --git a/src/bin/thin_check.rs b/src/bin/thin_check.rs index 1c1ea27..2298ce9 100644 --- a/src/bin/thin_check.rs +++ b/src/bin/thin_check.rs @@ -25,14 +25,12 @@ fn main() { .arg( Arg::with_name("SB_ONLY") .help("Only check the superblock.") - .long("super-block-only") - .value_name("SB_ONLY"), + .long("super-block-only"), ) .arg( Arg::with_name("SKIP_MAPPINGS") .help("Don't check the mapping tree") - .long("skip-mappings") - .value_name("SKIP_MAPPINGS"), + .long("skip-mappings"), ) .arg( Arg::with_name("AUTO_REPAIR") @@ -47,7 +45,7 @@ fn main() { .arg( Arg::with_name("CLEAR_NEEDS_CHECK") .help("Clears the 'needs_check' flag in the superblock") - .long("clear-needs-check"), + .long("clear-needs-check-flag"), ) .arg( Arg::with_name("OVERRIDE_MAPPING_ROOT") diff --git a/tests/cache_check.rs b/tests/cache_check.rs index 3faddb5..8cf716c 100644 --- a/tests/cache_check.rs +++ b/tests/cache_check.rs @@ -42,7 +42,7 @@ fn accepts_help() -> Result<()> { #[test] fn missing_metadata() -> Result<()> { let stderr = run_fail(cache_check!())?; - assert!(stderr.contains("No input file provided")); + assert!(stderr.contains(msg::MISSING_INPUT_ARG)); Ok(()) } @@ -66,7 +66,7 @@ fn unreadable_metadata() -> Result<()> { let md = mk_valid_md(&mut td)?; cmd!("chmod", "-r", &md).run()?; let stderr = run_fail(cache_check!(&md))?; - assert!(stderr.contains("syscall 'open' failed: Permission denied")); + assert!(stderr.contains("Permission denied")); Ok(()) } diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 67debcc..f47347f 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -18,6 +18,22 @@ use test_dir::TestDir; //------------------------------------------ +#[cfg(not(feature = "rust_tests"))] +pub mod msg { + pub const FILE_NOT_FOUND: &str = "Couldn't stat file"; + pub const MISSING_INPUT_ARG: &str = "No input file provided"; + pub const MISSING_OUTPUT_ARG: &str = "No output file provided"; +} + +#[cfg(feature = "rust_tests")] +pub mod msg { + pub const FILE_NOT_FOUND: &str = "Couldn't find input file"; + pub const MISSING_INPUT_ARG: &str = "The following required arguments were not provided"; + pub const MISSING_OUTPUT_ARG: &str = "The following required arguments were not provided"; +} + +//------------------------------------------ + #[macro_export] macro_rules! path_to_cpp { ($name: literal) => { diff --git a/tests/thin_delta.rs b/tests/thin_delta.rs index acdee59..2d570de 100644 --- a/tests/thin_delta.rs +++ b/tests/thin_delta.rs @@ -65,6 +65,7 @@ fn snap2_unspecified() -> Result<()> { #[test] fn dev_unspecified() -> Result<()> { let stderr = run_fail(thin_delta!("--snap1", "45", "--snap2", "46"))?; - assert!(stderr.contains("No input device provided")); + // TODO: replace with msg::MISSING_INPUT_ARG once the rust version is ready + assert!(stderr.contains("No input file provided")); Ok(()) } diff --git a/tests/thin_repair.rs b/tests/thin_repair.rs index 74eef8e..e0b6529 100644 --- a/tests/thin_repair.rs +++ b/tests/thin_repair.rs @@ -53,6 +53,7 @@ fn missing_input_file() -> Result<()> { let md = mk_zeroed_md(&mut td)?; let stderr = run_fail(thin_repair!("-i", "no-such-file", "-o", &md))?; assert!(superblock_all_zeroes(&md)?); + // TODO: replace with msg::FILE_NOT_FOUND once the rust version is ready assert!(stderr.contains("Couldn't stat file")); Ok(()) } @@ -72,6 +73,7 @@ fn missing_output_file() -> Result<()> { let mut td = TestDir::new()?; let md = mk_valid_md(&mut td)?; let stderr = run_fail(thin_repair!("-i", &md))?; + // TODO: replace with msg::MISSING_OUTPUT_ARG once the rust version is ready assert!(stderr.contains("No output file provided.")); Ok(()) } diff --git a/tests/thin_restore.rs b/tests/thin_restore.rs index f1d82fa..b5aa434 100644 --- a/tests/thin_restore.rs +++ b/tests/thin_restore.rs @@ -44,7 +44,7 @@ fn no_input_file() -> Result<()> { let mut td = TestDir::new()?; let md = mk_zeroed_md(&mut td)?; let stderr = run_fail(thin_restore!("-o", &md))?; - assert!(stderr.contains("No input file provided.")); + assert!(stderr.contains(msg::MISSING_INPUT_ARG)); Ok(()) } @@ -54,7 +54,7 @@ fn missing_input_file() -> Result<()> { let md = mk_zeroed_md(&mut td)?; let stderr = run_fail(thin_restore!("-i", "no-such-file", "-o", &md))?; assert!(superblock_all_zeroes(&md)?); - assert!(stderr.contains("Couldn't stat file")); + assert!(stderr.contains(msg::FILE_NOT_FOUND)); Ok(()) } @@ -73,7 +73,7 @@ fn no_output_file() -> Result<()> { let mut td = TestDir::new()?; let xml = mk_valid_xml(&mut td)?; let stderr = run_fail(thin_restore!("-i", &xml))?; - assert!(stderr.contains("No output file provided.")); + assert!(stderr.contains(msg::MISSING_OUTPUT_ARG)); Ok(()) } diff --git a/thin-provisioning/thin_delta.cc b/thin-provisioning/thin_delta.cc index 56f97fa..71eeb3d 100644 --- a/thin-provisioning/thin_delta.cc +++ b/thin-provisioning/thin_delta.cc @@ -687,7 +687,7 @@ thin_delta_cmd::run(int argc, char **argv) } if (argc == optind) - die("No input device provided."); + die("No input file provided."); else fs.dev = argv[optind];