]>
git.proxmox.com Git - proxmox-backup.git/blob - tests/catar.rs
1 use std
::process
::Command
;
5 use pbs_client
::pxar
::*;
7 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(
26 nix
::fcntl
::OFlag
::O_NOFOLLOW
,
27 nix
::sys
::stat
::Mode
::empty(),
30 let options
= PxarCreateOptions
{
31 entries_max
: ENCODER_MAX_ENTRIES
,
32 ..PxarCreateOptions
::default()
35 let rt
= tokio
::runtime
::Runtime
::new().unwrap();
36 rt
.block_on(create_archive(
47 .arg("test-casync.catar")
48 .arg("test-proxmox.catar")
50 .expect("test failed - archives are different");
55 fn run_all_tests() -> Result
<(), Error
> {
56 run_test("tests/catar_data/test_file")?
;
58 run_test("tests/catar_data/test_symlink")?
;
60 run_test("tests/catar_data/test_subdir")?
;
62 run_test("tests/catar_data/test_goodbye_sort_order")?
;
64 run_test("tests/catar_data/test_files_and_subdirs")?
;
72 if let Err(err
) = run_all_tests() {
73 eprintln
!("Error: {}", err
);
74 std
::process
::exit(1);