[go: nahoru, domu]

Skip to content

Commit

Permalink
Improve error handling in example to not make CI fail
Browse files Browse the repository at this point in the history
  • Loading branch information
nicokoch committed Apr 2, 2019
1 parent 7b8bef9 commit b7cd9ff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ rust:
- nightly
cache: cargo
script:
- rustup target list | grep '(default)' | awk '{print $1}'
- cargo build --verbose --all
- cargo test --verbose --all
- cargo run --example compare
- RUST_BACKTRACE=1 cargo run --example compare
os:
- linux
- osx
Expand Down
11 changes: 9 additions & 2 deletions examples/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ fn main() {
let mut base_file = fs::File::create("base.txt").unwrap();
let mut src = io::repeat(65).take(100 * 1024 * 1024); // 100 MB
io::copy(&mut src, &mut base_file).unwrap();

let before_reflink = Instant::now();
reflink::reflink("base.txt", "reflinked.txt").unwrap();
match reflink::reflink("base.txt", "reflinked.txt") {
Ok(()) => {},
Err(e) => {
println!("Error during reflinking:\n{:?}", e);
fs::remove_file("base.txt").unwrap();
return;
}
};
println!("Time to reflink: {:?}", Instant::now() - before_reflink);

let before_copy = Instant::now();
Expand Down

0 comments on commit b7cd9ff

Please sign in to comment.