]>
git.proxmox.com Git - proxmox-backup.git/blob - tests/catar.rs
3 use std
::process
::Command
;
4 use proxmox_backup
::pxar
::*;
6 fn run_test(dir_name
: &str) -> Result
<(), Error
> {
8 println
!("run pxar test {}", dir_name
);
10 Command
::new("casync")
12 .arg("test-casync.catar")
15 .expect("failed to execute casync");
17 let writer
= std
::fs
::OpenOptions
::new()
21 .open("test-proxmox.catar")?
;
22 let writer
= pxar
::encoder
::sync
::StandardWriter
::new(writer
);
24 let dir
= nix
::dir
::Dir
::open(
25 dir_name
, nix
::fcntl
::OFlag
::O_NOFOLLOW
,
26 nix
::sys
::stat
::Mode
::empty())?
;
42 .arg("test-casync.catar")
43 .arg("test-proxmox.catar")
45 .expect("test failed - archives are different");
50 fn run_all_tests() -> Result
<(), Error
> {
52 run_test("tests/catar_data/test_file")?
;
54 run_test("tests/catar_data/test_symlink")?
;
56 run_test("tests/catar_data/test_subdir")?
;
58 run_test("tests/catar_data/test_goodbye_sort_order")?
;
60 run_test("tests/catar_data/test_files_and_subdirs")?
;
68 if let Err(err
) = run_all_tests() {
69 eprintln
!("Error: {}", err
);
70 std
::process
::exit(1);