From 406931bc45d1260cd4ea68ac26e1729e1649f8f8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 2 Apr 2020 20:39:07 +0200 Subject: [PATCH] autotest: use symbolic message subjects ... instead of numbers. otherwise there is too much confusion with UIDs. --- src/run-tests.pl | 73 +++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/src/run-tests.pl b/src/run-tests.pl index 8253399..3fd15b4 100755 --- a/src/run-tests.pl +++ b/src/run-tests.pl @@ -41,12 +41,15 @@ sub test($$$@); # master/slave: [ maxuid, { seq, uid, flags }... ] # state: [ MaxPulledUid, MaxExpiredMasterUid, MaxPushedUid, { muid, suid, flags }... ] +use enum qw(:=1 A..Z); +sub mn($) { chr(64 + shift) } + # generic syncing tests my @x01 = ( [ 9, - 1, 1, "F", 2, 2, "", 3, 3, "FS", 4, 4, "", 5, 5, "T", 6, 6, "F", 7, 7, "FT", 9, 9, "" ], + A, 1, "F", B, 2, "", C, 3, "FS", D, 4, "", E, 5, "T", F, 6, "F", G, 7, "FT", I, 9, "" ], [ 9, - 1, 1, "", 2, 2, "F", 3, 3, "F", 4, 4, "", 5, 5, "", 7, 7, "", 8, 8, "", 10, 9, "" ], + A, 1, "", B, 2, "F", C, 3, "F", D, 4, "", E, 5, "", G, 7, "", H, 8, "", J, 9, "" ], [ 8, 0, 0, 1, 1, "", 2, 2, "", 3, 3, "", 4, 4, "", 5, 5, "", 6, 6, "", 7, 7, "", 8, 8, "" ], ); @@ -55,9 +58,9 @@ my @O01 = ("", "", ""); #show("01", "01", "01"); my @X01 = ( [ 10, - 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 5, 5, "T", 6, 6, "FT", 7, 7, "FT", 9, 9, "", 10, 10, "" ], + A, 1, "F", B, 2, "F", C, 3, "FS", D, 4, "", E, 5, "T", F, 6, "FT", G, 7, "FT", I, 9, "", J, 10, "" ], [ 10, - 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 5, 5, "T", 7, 7, "FT", 8, 8, "T", 10, 9, "", 9, 10, "" ], + A, 1, "F", B, 2, "F", C, 3, "FS", D, 4, "", E, 5, "T", G, 7, "FT", H, 8, "T", J, 9, "", I, 10, "" ], [ 9, 0, 9, 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 5, 5, "T", 6, 0, "", 7, 7, "FT", 0, 8, "", 10, 9, "", 9, 10, "" ], ); @@ -67,9 +70,9 @@ my @O02 = ("", "", "Expunge Both\n"); #show("01", "02", "02"); my @X02 = ( [ 10, - 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 9, 9, "", 10, 10, "" ], + A, 1, "F", B, 2, "F", C, 3, "FS", D, 4, "", I, 9, "", J, 10, "" ], [ 10, - 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 10, 9, "", 9, 10, "" ], + A, 1, "F", B, 2, "F", C, 3, "FS", D, 4, "", J, 9, "", I, 10, "" ], [ 9, 0, 9, 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 10, 9, "", 9, 10, "" ], ); @@ -79,9 +82,9 @@ my @O03 = ("", "", "Expunge Slave\n"); #show("01", "03", "03"); my @X03 = ( [ 10, - 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 5, 5, "T", 6, 6, "FT", 7, 7, "FT", 9, 9, "", 10, 10, "" ], + A, 1, "F", B, 2, "F", C, 3, "FS", D, 4, "", E, 5, "T", F, 6, "FT", G, 7, "FT", I, 9, "", J, 10, "" ], [ 10, - 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 10, 9, "", 9, 10, "" ], + A, 1, "F", B, 2, "F", C, 3, "FS", D, 4, "", J, 9, "", I, 10, "" ], [ 9, 0, 9, 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 5, 0, "T", 6, 0, "", 7, 0, "T", 10, 9, "", 9, 10, "" ], ); @@ -91,9 +94,9 @@ my @O04 = ("", "", "Sync Pull\n"); #show("01", "04", "04"); my @X04 = ( [ 9, - 1, 1, "F", 2, 2, "", 3, 3, "FS", 4, 4, "", 5, 5, "T", 6, 6, "F", 7, 7, "FT", 9, 9, "" ], + A, 1, "F", B, 2, "", C, 3, "FS", D, 4, "", E, 5, "T", F, 6, "F", G, 7, "FT", I, 9, "" ], [ 10, - 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 5, 5, "T", 7, 7, "FT", 8, 8, "T", 10, 9, "", 9, 10, "" ], + A, 1, "F", B, 2, "F", C, 3, "FS", D, 4, "", E, 5, "T", G, 7, "FT", H, 8, "T", J, 9, "", I, 10, "" ], [ 9, 0, 0, 1, 1, "F", 2, 2, "", 3, 3, "FS", 4, 4, "", 5, 5, "T", 6, 6, "", 7, 7, "FT", 0, 8, "", 9, 10, "" ], ); @@ -103,9 +106,9 @@ my @O05 = ("", "", "Sync Flags\n"); #show("01", "05", "05"); my @X05 = ( [ 9, - 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 5, 5, "T", 6, 6, "F", 7, 7, "FT", 9, 9, "" ], + A, 1, "F", B, 2, "F", C, 3, "FS", D, 4, "", E, 5, "T", F, 6, "F", G, 7, "FT", I, 9, "" ], [ 9, - 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 5, 5, "T", 7, 7, "FT", 8, 8, "", 10, 9, "" ], + A, 1, "F", B, 2, "F", C, 3, "FS", D, 4, "", E, 5, "T", G, 7, "FT", H, 8, "", J, 9, "" ], [ 8, 0, 0, 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 5, 5, "T", 6, 6, "", 7, 7, "FT", 8, 8, "" ], ); @@ -115,9 +118,9 @@ my @O06 = ("", "", "Sync Delete\n"); #show("01", "06", "06"); my @X06 = ( [ 9, - 1, 1, "F", 2, 2, "", 3, 3, "FS", 4, 4, "", 5, 5, "T", 6, 6, "FT", 7, 7, "FT", 9, 9, "" ], + A, 1, "F", B, 2, "", C, 3, "FS", D, 4, "", E, 5, "T", F, 6, "FT", G, 7, "FT", I, 9, "" ], [ 9, - 1, 1, "", 2, 2, "F", 3, 3, "F", 4, 4, "", 5, 5, "", 7, 7, "", 8, 8, "T", 10, 9, "" ], + A, 1, "", B, 2, "F", C, 3, "F", D, 4, "", E, 5, "", G, 7, "", H, 8, "T", J, 9, "" ], [ 8, 0, 0, 1, 1, "", 2, 2, "", 3, 3, "", 4, 4, "", 5, 5, "", 6, 0, "", 7, 7, "", 0, 8, "" ], ); @@ -127,9 +130,9 @@ my @O07 = ("", "", "Sync New\n"); #show("01", "07", "07"); my @X07 = ( [ 10, - 1, 1, "F", 2, 2, "", 3, 3, "FS", 4, 4, "", 5, 5, "T", 6, 6, "F", 7, 7, "FT", 9, 9, "", 10, 10, "" ], + A, 1, "F", B, 2, "", C, 3, "FS", D, 4, "", E, 5, "T", F, 6, "F", G, 7, "FT", I, 9, "", J, 10, "" ], [ 10, - 1, 1, "", 2, 2, "F", 3, 3, "F", 4, 4, "", 5, 5, "", 7, 7, "", 8, 8, "", 10, 9, "", 9, 10, "" ], + A, 1, "", B, 2, "F", C, 3, "F", D, 4, "", E, 5, "", G, 7, "", H, 8, "", J, 9, "", I, 10, "" ], [ 9, 0, 9, 1, 1, "", 2, 2, "", 3, 3, "", 4, 4, "", 5, 5, "", 6, 6, "", 7, 7, "", 8, 8, "", 10, 9, "", 9, 10, "" ], ); @@ -139,9 +142,9 @@ my @O08 = ("", "", "Sync PushFlags PullDelete\n"); #show("01", "08", "08"); my @X08 = ( [ 9, - 1, 1, "F", 2, 2, "F", 3, 3, "FS", 4, 4, "", 5, 5, "T", 6, 6, "F", 7, 7, "FT", 9, 9, "" ], + A, 1, "F", B, 2, "F", C, 3, "FS", D, 4, "", E, 5, "T", F, 6, "F", G, 7, "FT", I, 9, "" ], [ 9, - 1, 1, "", 2, 2, "F", 3, 3, "F", 4, 4, "", 5, 5, "", 7, 7, "", 8, 8, "T", 10, 9, "" ], + A, 1, "", B, 2, "F", C, 3, "F", D, 4, "", E, 5, "", G, 7, "", H, 8, "T", J, 9, "" ], [ 8, 0, 0, 1, 1, "", 2, 2, "F", 3, 3, "F", 4, 4, "", 5, 5, "", 6, 6, "", 7, 7, "", 0, 8, "" ], ); @@ -151,9 +154,9 @@ test("push flags + pull deletions", \@x01, \@X08, @O08); my @x10 = ( [ 2, - 1, 1, "", 2, 2, "*" ], + A, 1, "", B, 2, "*" ], [ 1, - 3, 1, "*" ], + C, 1, "*" ], [ 0, 0, 0, ], ); @@ -162,9 +165,9 @@ my @O11 = ("MaxSize 1k\n", "MaxSize 1k\n", ""); #show("10", "11", "11"); my @X11 = ( [ 2, - 1, 1, "", 2, 2, "*" ], + A, 1, "", B, 2, "*" ], [ 2, - 3, 1, "*", 1, 2, "" ], + C, 1, "*", A, 2, "" ], [ 2, 0, 1, 0, 1, "^", 1, 2, "", 2, 0, "^" ], ); @@ -174,9 +177,9 @@ my @O22 = ("", "MaxSize 1k\n", ""); #show("11", "22", "22"); my @X22 = ( [ 3, - 1, 1, "", 2, 2, "*", 3, 3, "*" ], + A, 1, "", B, 2, "*", C, 3, "*" ], [ 2, - 3, 1, "*", 1, 2, "" ], + C, 1, "*", A, 2, "" ], [ 2, 0, 1, 3, 1, "", 1, 2, "", 2, 0, "^" ], ); @@ -186,7 +189,7 @@ test("slave max size", \@X11, \@X22, @O22); my @x30 = ( [ 6, - 1, 1, "F", 2, 2, "", 3, 3, "S", 4, 4, "", 5, 5, "S", 6, 6, "" ], + A, 1, "F", B, 2, "", C, 3, "S", D, 4, "", E, 5, "S", F, 6, "" ], [ 0, ], [ 0, 0, 0, @@ -197,9 +200,9 @@ my @O31 = ("", "", "MaxMessages 3\n"); #show("30", "31", "31"); my @X31 = ( [ 6, - 1, 1, "F", 2, 2, "", 3, 3, "S", 4, 4, "", 5, 5, "S", 6, 6, "" ], + A, 1, "F", B, 2, "", C, 3, "S", D, 4, "", E, 5, "S", F, 6, "" ], [ 5, - 1, 1, "F", 2, 2, "", 4, 3, "", 5, 4, "S", 6, 5, "" ], + A, 1, "F", B, 2, "", D, 3, "", E, 4, "S", F, 5, "" ], [ 6, 3, 0, 1, 1, "F", 2, 2, "", 4, 3, "", 5, 4, "S", 6, 5, "" ], ); @@ -209,9 +212,9 @@ my @O32 = ("", "", "MaxMessages 3\nExpireUnread yes\n"); #show("30", "32", "32"); my @X32 = ( [ 6, - 1, 1, "F", 2, 2, "", 3, 3, "S", 4, 4, "", 5, 5, "S", 6, 6, "" ], + A, 1, "F", B, 2, "", C, 3, "S", D, 4, "", E, 5, "S", F, 6, "" ], [ 4, - 1, 1, "F", 4, 2, "", 5, 3, "S", 6, 4, "" ], + A, 1, "F", D, 2, "", E, 3, "S", F, 4, "" ], [ 6, 3, 0, 1, 1, "F", 4, 2, "", 5, 3, "S", 6, 4, "" ], ); @@ -219,9 +222,9 @@ test("max messages vs. unread", \@x30, \@X32, @O32); my @x50 = ( [ 6, - 1, 1, "FS", 2, 2, "FS", 3, 3, "S", 4, 4, "", 5, 5, "", 6, 6, "" ], + A, 1, "FS", B, 2, "FS", C, 3, "S", D, 4, "", E, 5, "", F, 6, "" ], [ 6, - 1, 1, "S", 2, 2, "ST", 4, 4, "", 5, 5, "", 6, 6, "" ], + A, 1, "S", B, 2, "ST", D, 4, "", E, 5, "", F, 6, "" ], [ 6, 3, 0, 1, 1, "FS", 2, 2, "~S", 3, 3, "~S", 4, 4, "", 5, 5, "", 6, 6, "" ], ); @@ -230,9 +233,9 @@ my @O51 = ("", "", "MaxMessages 3\nExpunge Both\n"); #show("50", "51", "51"); my @X51 = ( [ 6, - 1, 1, "S", 2, 2, "FS", 3, 3, "S", 4, 4, "", 5, 5, "", 6, 6, "" ], + A, 1, "S", B, 2, "FS", C, 3, "S", D, 4, "", E, 5, "", F, 6, "" ], [ 6, - 2, 2, "FS", 4, 4, "", 5, 5, "", 6, 6, "" ], + B, 2, "FS", D, 4, "", E, 5, "", F, 6, "" ], [ 6, 3, 0, 2, 2, "FS", 4, 4, "", 5, 5, "", 6, 6, "" ], ); @@ -453,7 +456,7 @@ sub mkbox($$@) my ($num, $uid, $flg) = (shift @ms, shift @ms, shift @ms); my $big = $flg =~ s/\*//; open(FILE, ">", $bn."/".($flg =~ /S/ ? "cur" : "new")."/0.1_".$num.".local,U=".$uid.":2,".$flg) or - die "Cannot create message $num in mailbox $bn.\n"; + die "Cannot create message ".mn($num)." in mailbox $bn.\n"; print FILE "From: foo\nTo: bar\nDate: Thu, 1 Jan 1970 00:00:00 +0000\nSubject: $num\n\n".(("A"x50)."\n")x($big*30); close FILE; } @@ -587,7 +590,7 @@ sub printbox($$@) } else { print ", "; } - print shift(@ms).", ".shift(@ms).", \"".shift(@ms)."\""; + print mn(shift(@ms)).", ".shift(@ms).", \"".shift(@ms)."\""; } print " ],\n"; }