]> git.proxmox.com Git - qemu-server.git/commitdiff
test: print more info when OVF parsing fails
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 23 Apr 2020 10:46:46 +0000 (12:46 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 27 Apr 2020 11:08:58 +0000 (13:08 +0200)
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>
test/run_ovf_tests.pl

index b9e48256d3a2cc83f16bd1bb0e58cc1dd99f68fa..74c53bc758f987b197afa171011741138d362d56 100755 (executable)
@@ -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";