From aaa84aa35adbd80cdfd3d63e037af5f6e2a1fe7f Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Tue, 31 Aug 2021 10:04:48 +0800 Subject: [PATCH] [tests] Enable tests for rust thin_repair --- tests/common/target.rs | 2 +- tests/thin_repair.rs | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/common/target.rs b/tests/common/target.rs index 65885bc..79b742b 100644 --- a/tests/common/target.rs +++ b/tests/common/target.rs @@ -40,7 +40,7 @@ pub const THIN_DELTA: &str = path_to_cpp!("thin_delta"); // TODO: rust version pub const THIN_DUMP: &str = path_to!("thin_dump"); pub const THIN_METADATA_PACK: &str = path_to_rust!("thin_metadata_pack"); // rust-only pub const THIN_METADATA_UNPACK: &str = path_to_rust!("thin_metadata_unpack"); // rust-only -pub const THIN_REPAIR: &str = path_to_cpp!("thin_repair"); // TODO: rust version +pub const THIN_REPAIR: &str = path_to!("thin_repair"); pub const THIN_RESTORE: &str = path_to!("thin_restore"); pub const THIN_RMAP: &str = path_to_cpp!("thin_rmap"); // TODO: rust version pub const THIN_GENERATE_METADATA: &str = path_to_cpp!("thin_generate_metadata"); // cpp-only diff --git a/tests/thin_repair.rs b/tests/thin_repair.rs index eb3ac2d..da54a7a 100644 --- a/tests/thin_repair.rs +++ b/tests/thin_repair.rs @@ -46,7 +46,7 @@ impl<'a> Program<'a> for ThinRepair { } fn bad_option_hint(option: &str) -> String { - cpp_msg::bad_option_hint(option) + msg::bad_option_hint(option) } } @@ -56,27 +56,33 @@ impl<'a> InputProgram<'a> for ThinRepair { } fn file_not_found() -> &'a str { - cpp_msg::FILE_NOT_FOUND + msg::FILE_NOT_FOUND } fn missing_input_arg() -> &'a str { - cpp_msg::MISSING_INPUT_ARG + msg::MISSING_INPUT_ARG } + #[cfg(not(feature = "rust_tests"))] fn corrupted_input() -> &'a str { "The following field needs to be provided on the command line due to corruption in the superblock" } + + #[cfg(feature = "rust_tests")] + fn corrupted_input() -> &'a str { + "data block size needs to be provided due to corruption in the superblock" + } } impl<'a> OutputProgram<'a> for ThinRepair { fn missing_output_arg() -> &'a str { - cpp_msg::MISSING_OUTPUT_ARG + msg::MISSING_OUTPUT_ARG } } impl<'a> MetadataWriter<'a> for ThinRepair { fn file_not_found() -> &'a str { - cpp_msg::FILE_NOT_FOUND + msg::FILE_NOT_FOUND } }