[pve-devel] [PATCH qemu-server v3 4/4] t/cfg2cmd: ensure tests can pass again

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Dec 10 18:00:03 CET 2018


the change to use a real diff to check tests, with it's nicer output
for failing cases, failed to ensure that the test system knew if a
case passed - earlier done indirectly by 'is_deeply', thus add a
manual 'pass' call if the tes was OK.
Further, the firs test failing aborted everything, which isn't to
nice, normally it's much more convenient if all test get run and one
can view at the results of all of them. So put the diff in an eval
and fail/note the test manually.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 test/run_config2command_tests.pl | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/run_config2command_tests.pl b/test/run_config2command_tests.pl
index 0e37c17..160f872 100755
--- a/test/run_config2command_tests.pl
+++ b/test/run_config2command_tests.pl
@@ -190,7 +190,13 @@ sub do_test($) {
 
 	my $exp = join("\n", @$cmd_expected);
 	my $got = join("\n", @$cmd);
-	diff($exp, $got);
+	eval { diff($exp, $got) };
+	if (my $err = $@) {
+	    fail("$testname");
+	    note($err);
+	} else {
+	    pass("$testname");
+	}
     } else {
 	file_set_contents($cmd_fn, $cmdline);
     }
-- 
2.19.2





More information about the pve-devel mailing list