[thin_shrink] Get test framework built

This verifies data has been moved to the correct place.
This commit is contained in:
Joe Thornber
2020-06-29 10:49:40 +01:00
parent d03dac8f75
commit 3618da3a12
8 changed files with 172 additions and 52 deletions

View File

@@ -2,6 +2,7 @@ extern crate clap;
extern crate thinp;
use clap::{App, Arg};
use std::path::Path;
use std::process::exit;
use thinp::file_utils;
@@ -53,18 +54,20 @@ fn main() {
let matches = parser.get_matches();
// FIXME: check these look like xml
let input_file = matches.value_of("INPUT").unwrap();
let output_file = matches.value_of("OUTPUT").unwrap();
let input_file = Path::new(matches.value_of("INPUT").unwrap());
let output_file = Path::new(matches.value_of("OUTPUT").unwrap());
let size = matches.value_of("SIZE").unwrap().parse::<u64>().unwrap();
let data_file = matches.value_of("DATA").unwrap();
let data_file = Path::new(matches.value_of("DATA").unwrap());
let do_copy = !matches.is_present("NOCOPY");
if !file_utils::file_exists(input_file) {
eprintln!("Couldn't find input file '{}'.", &input_file);
eprintln!("Couldn't find input file '{}'.", input_file.display());
exit(1);
}
if let Err(reason) = thinp::shrink::toplevel::shrink(&input_file, &output_file, &data_file, size, do_copy) {
if let Err(reason) =
thinp::shrink::toplevel::shrink(&input_file, &output_file, &data_file, size, do_copy)
{
println!("Application error: {}\n", reason);
exit(1);
}