commit fe3d19b7ebcaff5629ec236d01da1bf8262ad472
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Mon Nov 4 09:54:39 2013 +0100

    verify idempotence of all sync operations

 src/run-tests.pl |   43 +++++++++++++++++++++++++++++++++----------
 1 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/src/run-tests.pl b/src/run-tests.pl
index 7210cb3..7f1ec8b 100755
--- a/src/run-tests.pl
+++ b/src/run-tests.pl
@@ -156,8 +156,6 @@ my @X11 = (
 );
 test("max size", \@x10, \@X11, @O11);
 
-test("max size verification", \@X11, \@X11, @O11);
-
 my @O22 = ("", "MaxSize 1k\n", "");
 #show("11", "22", "22");
 my @X22 = (
@@ -193,8 +191,6 @@ my @X31 = (
 );
 test("max messages", \@x30, \@X31, @O31);
 
-test("max messages verification", \@X31, \@X31, @O31);
-
 my @x50 = (
  [ 6,
    1, 1, "FS", 2, 2, "FS", 3, 3, "S", 4, 4, "", 5, 5, "", 6, 6, "" ],
@@ -552,11 +548,11 @@ sub ckstate($@)
        return 0;
 }
 
-# \@chan_state
-sub ckchan($)
+# $statefile, \@chan_state
+sub ckchan($$)
 {
-       my ($cs) = @_;
-       my $rslt = ckstate("slave/.mbsyncstate.new", @{ $$cs[2] });
+       my ($F, $cs) = @_;
+       my $rslt = ckstate($F, @{ $$cs[2] });
        $rslt |= &ckbox("master", @{ $$cs[0] });
        $rslt |= &ckbox("slave", @{ $$cs[1] });
        return $rslt;
@@ -617,6 +613,7 @@ sub test($$$@)
        print "Testing: ".$ttl." ...\n";
        mkchan($$sx[0], $$sx[1], @{ $$sx[2] });
        &writecfg(@sfx);
+
        my ($xc, @ret) = runsync("-J");
        if ($xc) {
                print "Input:\n";
@@ -629,7 +626,7 @@ sub test($$$@)
                print @ret;
                exit 1;
        }
-       if (ckchan($tx)) {
+       if (ckchan("slave/.mbsyncstate.new", $tx)) {
                print "Input:\n";
                printchan($sx);
                print "Options:\n";
@@ -642,12 +639,12 @@ sub test($$$@)
                print @ret;
                exit 1;
        }
+
        open(FILE, "<", "slave/.mbsyncstate.journal") or
                die "Cannot read journal.\n";
        my @nj = <FILE>;
        close FILE;
        ($xc, @ret) = runsync("-0 --no-expunge");
-       killcfg();
        if ($xc) {
                print "Journal replay failed.\n";
                print "Input == Expected result:\n";
@@ -673,6 +670,32 @@ sub test($$$@)
                print @ret;
                exit 1;
        }
+
+       ($xc, @ret) = runsync("");
+       if ($xc) {
+               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");
+               print "Debug output:\n";
+               print @ret;
+               exit 1;
+       }
+
+       killcfg();
        rmtree "slave";
        rmtree "master";
 }

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to