[cache_restore (rust)] Fix errors in tests

- Move error messages to stderr (fixes unwritable_output_file,
  input_file_not_found, and missing_input_option)
- Validate XML structures implicitly (fixes corrupted_input_data)
- Check output file size (fixes tiny_output_file)
- Allow restoring XML without the hints (for creating test fixtures)
- Provide XML error context
- Remove unused option
This commit is contained in:
Ming-Hung Tsai
2021-09-01 15:20:13 +08:00
parent 59e44667a9
commit 4ed2348b36
3 changed files with 114 additions and 45 deletions
+6 -8
View File
@@ -22,13 +22,6 @@ fn main() {
.long("async-io")
.hidden(true),
)
.arg(
Arg::with_name("OVERRIDE_MAPPING_ROOT")
.help("Specify a mapping root to use")
.long("override-mapping-root")
.value_name("OVERRIDE_MAPPING_ROOT")
.takes_value(true),
)
.arg(
Arg::with_name("QUIET")
.help("Suppress output messages, return only exit code.")
@@ -62,6 +55,11 @@ fn main() {
exit(1);
}
if let Err(e) = file_utils::check_output_file_requirements(output_file) {
eprintln!("{}", e);
exit(1);
}
let report;
if matches.is_present("QUIET") {
@@ -80,7 +78,7 @@ fn main() {
};
if let Err(reason) = restore(opts) {
println!("{}", reason);
eprintln!("{}", reason);
process::exit(1);
}
}