commit 2da7951fe085b2e837e606b4c051d276f32666b3
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Tue Mar 14 14:52:22 2017 +0100

    autotest: de-duplicate error reporting paths

 src/run-tests.pl | 62 +++++++++++++++---------------------------------
 1 file changed, 19 insertions(+), 43 deletions(-)

diff --git a/src/run-tests.pl b/src/run-tests.pl
index 0ef6ef8..4390173 100755
--- a/src/run-tests.pl
+++ b/src/run-tests.pl
@@ -616,24 +616,17 @@ sub test($$$@)
        &writecfg(@sfx);
 
        my ($xc, @ret) = runsync("-J");
-       if ($xc) {
+       if ($xc || ckchan("slave/.mbsyncstate.new", $tx)) {
                print "Input:\n";
                printchan($sx);
                print "Options:\n";
                print " [ ".join(", ", map('"'.qm($_).'"', @sfx))." ]\n";
-               print "Debug output:\n";
-               print @ret;
-               exit 1;
-       }
-       if (ckchan("slave/.mbsyncstate.new", $tx)) {
-               print "Input:\n";
-               printchan($sx);
-               print "Options:\n";
-               print " [ ".join(", ", map('"'.qm($_).'"', @sfx))." ]\n";
-               print "Expected result:\n";
-               printchan($tx);
-               print "Actual result:\n";
-               showchan("slave/.mbsyncstate.new");
+               if (!$xc) {
+                       print "Expected result:\n";
+                       printchan($tx);
+                       print "Actual result:\n";
+                       showchan("slave/.mbsyncstate.new");
+               }
                print "Debug output:\n";
                print @ret;
                exit 1;
@@ -644,52 +637,35 @@ sub test($$$@)
        my @nj = <FILE>;
        close FILE;
        ($xc, @ret) = runsync("-0 --no-expunge");
-       if ($xc) {
+       if ($xc || ckstate("slave/.mbsyncstate", @{ $$tx[2] })) {
                print "Journal replay failed.\n";
                print "Options:\n";
                print " [ ".join(", ", map('"'.qm($_).'"', @sfx))." ], [ 
\"-0\", \"--no-expunge\" ]\n";
                print "Old State:\n";
                printstate(@{ $$sx[2] });
                print "Journal:\n".join("", @nj)."\n";
-               print "Debug output:\n";
-               print @ret;
-               exit 1;
-       }
-       if (ckstate("slave/.mbsyncstate", @{ $$tx[2] })) {
-               print "Journal replay failed.\n";
-               print "Options:\n";
-               print " [ ".join(", ", map('"'.qm($_).'"', @sfx))." ], [ 
\"-0\", \"--no-expunge\" ]\n";
-               print "Old State:\n";
-               printstate(@{ $$sx[2] });
-               print "Journal:\n".join("", @nj)."\n";
-               print "Expected New State:\n";
-               printstate(@{ $$tx[2] });
-               print "New State:\n";
-               showstate("slave/.mbsyncstate");
+               if (!$xc) {
+                       print "Expected New State:\n";
+                       printstate(@{ $$tx[2] });
+                       print "New State:\n";
+                       showstate("slave/.mbsyncstate");
+               }
                print "Debug output:\n";
                print @ret;
                exit 1;
        }
 
        ($xc, @ret) = runsync("");
-       if ($xc) {
+       if ($xc || ckchan("slave/.mbsyncstate", $tx)) {
                print "Idempotence verification run failed.\n";
                print "Input == Expected result:\n";
                printchan($tx);
                print "Options:\n";
                print " [ ".join(", ", map('"'.qm($_).'"', @sfx))." ]\n";
-               print "Debug output:\n";
-               print @ret;
-               exit 1;
-       }
-       if (ckchan("slave/.mbsyncstate", $tx)) {
-               print "Idempotence verification run failed.\n";
-               print "Input == Expected result:\n";
-               printchan($tx);
-               print "Options:\n";
-               print " [ ".join(", ", map('"'.qm($_).'"', @sfx))." ]\n";
-               print "Actual result:\n";
-               showchan("slave/.mbsyncstate");
+               if (!$xc) {
+                       print "Actual result:\n";
+                       showchan("slave/.mbsyncstate");
+               }
                print "Debug output:\n";
                print @ret;
                exit 1;

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to