test: print more info when OVF parsing fails

When one of the ovf tests fails to parse at all, we just get the
'die' message of the failing component, but not which file actually
failed to parse.

To get better output, convert the parsing also to a test and ok() and
fail() respectively and then printing the error.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-04-23 12:46:46 +02:00 committed by Thomas Lamprecht
parent 4fb85adc65
commit 31bf5a0f2b

View File

@ -12,8 +12,22 @@ use Data::Dumper;
my $test_manifests = join ('/', $Bin, 'ovf_manifests');
my $win2008 = PVE::QemuServer::OVF::parse_ovf("$test_manifests/Win_2008_R2_two-disks.ovf");
my $win10 = PVE::QemuServer::OVF::parse_ovf("$test_manifests/Win10-Liz.ovf");
print "parsing ovfs\n";
my $win2008 = eval { PVE::QemuServer::OVF::parse_ovf("$test_manifests/Win_2008_R2_two-disks.ovf") };
if (my $err = $@) {
fail('parse win2008');
warn("error: $err\n");
} else {
ok('parse win2008');
}
my $win10 = eval { PVE::QemuServer::OVF::parse_ovf("$test_manifests/Win10-Liz.ovf") };
if (my $err = $@) {
fail('parse win10');
warn("error: $err\n");
} else {
ok('parse win10');
}
print "testing disks\n";