RHEL8 has dropped support for qcow1 format images, so skip the tests
related to creating/cloning qcow1 images (based on the output of
qemu-img -help).
Signed-off-by: Laine Stump <laine(a)laine.org>
---
scripts/storage/100-create-vol-dir.t | 22 ++++++++-----
scripts/storage/200-clone-vol-dir.t | 48 ++++++++++++++++------------
2 files changed, 41 insertions(+), 29 deletions(-)
diff --git a/scripts/storage/100-create-vol-dir.t b/scripts/storage/100-create-vol-dir.t
index 952012c..6262d69 100644
--- a/scripts/storage/100-create-vol-dir.t
+++ b/scripts/storage/100-create-vol-dir.t
@@ -99,18 +99,24 @@ lives_ok(sub { $vol->delete(0) }, "deleted volume");
-ok_volume(sub { $vol = $pool->create_volume($volqcow1xml) }, "create qcow
volume");
+SKIP: {
+ if (`qemu-img -help` !~ "^Supported formats: .* qcow ") {
+ skip "qcow1 format not supported", 4;
+ }
-$path = xpath($vol, "string(/volume/target/path)");
-$st = stat($path);
+ ok_volume(sub { $vol = $pool->create_volume($volqcow1xml) }, "create qcow
volume");
-ok($st, "path $path exists");
+ $path = xpath($vol, "string(/volume/target/path)");
+ $st = stat($path);
-# Don't know exactly how large a qcow1 empty file is, but it
-# should be quite small :-)
-ok($st->size < 1024*1024, "basic qcow1 header is allocated");
+ ok($st, "path $path exists");
-lives_ok(sub { $vol->delete(0) }, "deleted volume");
+ # Don't know exactly how large a qcow1 empty file is, but it
+ # should be quite small :-)
+ ok($st->size < 1024*1024, "basic qcow1 header is allocated");
+
+ lives_ok(sub { $vol->delete(0) }, "deleted volume");
+}
diff --git a/scripts/storage/200-clone-vol-dir.t b/scripts/storage/200-clone-vol-dir.t
index cc0daba..787564f 100644
--- a/scripts/storage/200-clone-vol-dir.t
+++ b/scripts/storage/200-clone-vol-dir.t
@@ -106,39 +106,45 @@ diag "Now testing cloning of various formats";
my @formats = qw(raw qcow qcow2 vmdk vpc);
foreach my $format (@formats) {
- diag "Cloning source volume to $format format";
- my $volclonexml = $tck->generic_volume("tck$format", $format,
((1024*1024*50)+4096))->as_xml;
+ SKIP: {
+ if (($format eq "qcow") and (`qemu-img -help` !~ "^Supported
formats: .* qcow ")) {
+ skip "qcow1 format not supported", 9;
+ }
- my $clone;
- ok_volume(sub { $clone = $pool->clone_volume($volclonexml, $vol) }, "clone to
$format volume");
+ diag "Cloning source volume to $format format";
+ my $volclonexml = $tck->generic_volume("tck$format", $format,
((1024*1024*50)+4096))->as_xml;
- $path = xpath($clone, "string(/volume/target/path)");
- $st = stat($path);
- ok($st, "path $path exists");
- ok($st->size >= ((1024*1024*50)+4096), "size is at least 50M");
+ my $clone;
+ ok_volume(sub { $clone = $pool->clone_volume($volclonexml, $vol) },
"clone to $format volume");
+ $path = xpath($clone, "string(/volume/target/path)");
+ $st = stat($path);
+ ok($st, "path $path exists");
+ ok($st->size >= ((1024*1024*50)+4096), "size is at least 50M");
- diag "Cloning cloned volume back to raw format";
- my $voldstxml = $tck->generic_volume("tckdst", "raw",
((1024*1024*50)+4096))->as_xml;
- my $result;
- ok_volume(sub { $result = $pool->clone_volume($voldstxml, $clone) }, "clone
back to raw volume");
+ diag "Cloning cloned volume back to raw format";
+ my $voldstxml = $tck->generic_volume("tckdst", "raw",
((1024*1024*50)+4096))->as_xml;
+ my $result;
+ ok_volume(sub { $result = $pool->clone_volume($voldstxml, $clone) },
"clone back to raw volume");
- $path = xpath($result, "string(/volume/target/path)");
- $st = stat($path);
- ok($st, "path $path exists");
+ $path = xpath($result, "string(/volume/target/path)");
- is($st->size, ((1024*1024*50)+4096), "size is 50M");
+ $st = stat($path);
+ ok($st, "path $path exists");
- diag "Comparing data between source & result volume";
+ is($st->size, ((1024*1024*50)+4096), "size is 50M");
- my $dstdigest = &digest($path);
+ diag "Comparing data between source & result volume";
- is($srcdigest, $dstdigest, "digests match");
+ my $dstdigest = &digest($path);
- lives_ok(sub { $clone->delete(0) }, "deleted clone volume");
- lives_ok(sub { $result->delete(0) }, "deleted result volume");
+ is($srcdigest, $dstdigest, "digests match");
+
+ lives_ok(sub { $clone->delete(0) }, "deleted clone volume");
+ lives_ok(sub { $result->delete(0) }, "deleted result volume");
+ }
}
--
2.20.1