MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / header_v2_with_backing

Function header_v2_with_backing

block/src/qcow/mod.rs:2520–2537  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2518
2519 #[test]
2520 fn header_v2_with_backing() {
2521 let header = QcowHeader::create_for_size_and_path(2, 0x10_0000, Some("/my/path/to/a/file"))
2522 .expect("Failed to create header.");
2523 let mut disk_file: RawFile = RawFile::new(TempFile::new().unwrap().into_file(), false);
2524 header
2525 .write_to(&mut disk_file)
2526 .expect("Failed to write header to shm.");
2527 disk_file.rewind().unwrap();
2528 let read_header = QcowHeader::new(&mut disk_file).expect("Failed to create header.");
2529 assert_eq!(
2530 header.backing_file.as_ref().map(|bf| bf.path.clone()),
2531 Some(String::from("/my/path/to/a/file"))
2532 );
2533 assert_eq!(
2534 read_header.backing_file.as_ref().map(|bf| &bf.path),
2535 header.backing_file.as_ref().map(|bf| &bf.path)
2536 );
2537 }
2538
2539 #[test]
2540 fn header_v3_with_backing() {

Callers

nothing calls this directly

Calls 2

newFunction · 0.85
write_toMethod · 0.45

Tested by

no test coverage detected