mirror of
git://git.proxmox.com/git/pxar.git
synced 2024-12-22 21:33:50 +03:00
tests: cleanup warnings
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
650070b0e6
commit
1feb04d7b8
@ -8,7 +8,7 @@ use pxar::decoder::sync as decoder;
|
||||
use pxar::decoder::SeqRead;
|
||||
use pxar::encoder::sync as encoder;
|
||||
use pxar::encoder::{LinkOffset, SeqWrite};
|
||||
use pxar::format::{self, mode, Device};
|
||||
use pxar::format::{mode, Device};
|
||||
use pxar::EntryKind as PxarEntryKind;
|
||||
use pxar::Metadata;
|
||||
|
||||
@ -179,8 +179,6 @@ impl Entry {
|
||||
self.no_hardlink()?;
|
||||
let _: () = encoder.add_socket(&self.metadata, &self.name)?;
|
||||
}
|
||||
|
||||
other => bail!("TODO: encode_entry for {:?}", other),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@ -239,6 +237,14 @@ impl Entry {
|
||||
format_err!("failed to get contents for file entry: {:?}", item.path())
|
||||
})?
|
||||
.read_to_end(&mut data)?;
|
||||
if data.len() as u64 != *size {
|
||||
bail!(
|
||||
"file {:?} was advertised to be of size {} but we read {} bytes",
|
||||
item.path(),
|
||||
size,
|
||||
data.len(),
|
||||
);
|
||||
}
|
||||
contents.push(make_entry()?.entry(EntryKind::File(data)));
|
||||
}
|
||||
PxarEntryKind::Directory => {
|
||||
@ -270,7 +276,6 @@ impl Entry {
|
||||
PxarEntryKind::Socket => {
|
||||
contents.push(make_entry()?.entry(EntryKind::Socket));
|
||||
}
|
||||
other => todo!("decode for kind {:?}", other),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,9 @@ fn test1() {
|
||||
let mut encoder =
|
||||
encoder::Encoder::from_std(&mut file, &test_fs.metadata).expect("failed to create encoder");
|
||||
encode_directory(&mut encoder, &test_fs).expect("failed to encode test file system");
|
||||
encoder.finish();
|
||||
encoder
|
||||
.finish()
|
||||
.expect("failed to finish encoding the pxar archive");
|
||||
|
||||
assert!(!file.is_empty(), "encoder did not write any data");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user