[tests] Enable tests for rust thin_repair

This commit is contained in:
Ming-Hung Tsai 2021-08-31 10:04:48 +08:00
parent ea8dcb54d0
commit aaa84aa35a
2 changed files with 12 additions and 6 deletions

View File

@ -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_DUMP: &str = path_to!("thin_dump");
pub const THIN_METADATA_PACK: &str = path_to_rust!("thin_metadata_pack"); // rust-only 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_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_RESTORE: &str = path_to!("thin_restore");
pub const THIN_RMAP: &str = path_to_cpp!("thin_rmap"); // TODO: rust version 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 pub const THIN_GENERATE_METADATA: &str = path_to_cpp!("thin_generate_metadata"); // cpp-only

View File

@ -46,7 +46,7 @@ impl<'a> Program<'a> for ThinRepair {
} }
fn bad_option_hint(option: &str) -> String { 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 { fn file_not_found() -> &'a str {
cpp_msg::FILE_NOT_FOUND msg::FILE_NOT_FOUND
} }
fn missing_input_arg() -> &'a str { 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 { fn corrupted_input() -> &'a str {
"The following field needs to be provided on the command line due to corruption in the superblock" "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 { impl<'a> OutputProgram<'a> for ThinRepair {
fn missing_output_arg() -> &'a str { fn missing_output_arg() -> &'a str {
cpp_msg::MISSING_OUTPUT_ARG msg::MISSING_OUTPUT_ARG
} }
} }
impl<'a> MetadataWriter<'a> for ThinRepair { impl<'a> MetadataWriter<'a> for ThinRepair {
fn file_not_found() -> &'a str { fn file_not_found() -> &'a str {
cpp_msg::FILE_NOT_FOUND msg::FILE_NOT_FOUND
} }
} }