summary refs log tree commit diff
path: root/qcow
diff options
context:
space:
mode:
authorDylan Reid <dgreid@chromium.org>2019-06-14 10:28:55 -0700
committerCommit Bot <commit-bot@chromium.org>2019-06-21 19:22:31 +0000
commitc9f254b1921335231b32550b5ae6b8416e1ca7aa (patch)
tree00177c82c378b80adecb96fe29d1a5ce5cd5c14b /qcow
parent0dfe1be88a3d1427f447bc21ddab54e539ffadc4 (diff)
downloadcrosvm-c9f254b1921335231b32550b5ae6b8416e1ca7aa.tar
crosvm-c9f254b1921335231b32550b5ae6b8416e1ca7aa.tar.gz
crosvm-c9f254b1921335231b32550b5ae6b8416e1ca7aa.tar.bz2
crosvm-c9f254b1921335231b32550b5ae6b8416e1ca7aa.tar.lz
crosvm-c9f254b1921335231b32550b5ae6b8416e1ca7aa.tar.xz
crosvm-c9f254b1921335231b32550b5ae6b8416e1ca7aa.tar.zst
crosvm-c9f254b1921335231b32550b5ae6b8416e1ca7aa.zip
qcow: Fix invalid_cluster_bits test
Start with a valid header so the invalid cluster bits field is tested in
isolation. Before this change the test would pass even if the cluster
bits check was removed from the code because the header was invalid for
other reasons.

BUG=none
TEST=this is a test

Change-Id: I5c09417ae3f974522652a50cb0fdc5dc0e10dd44
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1660889
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'qcow')
-rw-r--r--qcow/src/qcow.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/qcow/src/qcow.rs b/qcow/src/qcow.rs
index 4aeb7e3..4b781f4 100644
--- a/qcow/src/qcow.rs
+++ b/qcow/src/qcow.rs
@@ -1793,9 +1793,9 @@ mod tests {
 
     #[test]
     fn invalid_cluster_bits() {
-        let mut header = test_huge_header();
+        let mut header = valid_header();
         header[23] = 3;
-        with_basic_file(&test_huge_header(), |disk_file: File| {
+        with_basic_file(&header, |disk_file: File| {
             QcowFile::from(disk_file).expect_err("Failed to create file.");
         });
     }