From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 9292F1F9E5 for ; Fri, 28 May 2021 09:45:21 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/3] t/lei-*: better diagnostics for occasional failures Date: Fri, 28 May 2021 09:45:19 +0000 Message-Id: <20210528094521.26490-2-e@80x24.org> In-Reply-To: <20210528094521.26490-1-e@80x24.org> References: <20210528094521.26490-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Some of these have been failing occasionally, not sure how, yet... --- t/lei-q-kw.t | 2 +- t/lei-q-remote-import.t | 6 +++--- t/lei-q-save.t | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/t/lei-q-kw.t b/t/lei-q-kw.t index 074c573d..528751b4 100644 --- a/t/lei-q-kw.t +++ b/t/lei-q-kw.t @@ -116,7 +116,7 @@ for my $sfx ('', '.gz') { } $res{$mid} = $eml; }); - is_deeply(\%res, $exp, '--augment worked'); + is_deeply(\%res, $exp, '--augment worked') or diag $lei_err; lei_ok(qw(q -o), "mboxrd:/dev/stdout", qw(m:qp@example.com)) or diag $lei_err; diff --git a/t/lei-q-remote-import.t b/t/lei-q-remote-import.t index 80067061..7db684d9 100644 --- a/t/lei-q-remote-import.t +++ b/t/lei-q-remote-import.t @@ -49,10 +49,10 @@ test_lei({ tmpdir => $tmpdir }, sub { open my $fh, '>', "$o.lock"; $cmd[-1] = 'm:qp@example.com'; - unlink $o or BAIL_OUT $!; + unlink $o or xbail("unlink $o $! cwd=".Cwd::getcwd()); lei_ok(@cmd, '--lock=none'); - ok(-f $o && -s _, '--lock=none respected'); - unlink $o or BAIL_OUT $!; + ok(-f $o && -s _, '--lock=none respected') or diag $lei_err; + unlink $o or xbail("unlink $o $! cwd=".Cwd::getcwd()); ok(!lei(@cmd, '--lock=dotlock,timeout=0.000001'), 'dotlock fails'); ok(-f $o && !-s _, 'nothing output on lock failure'); unlink "$o.lock" or BAIL_OUT $!; diff --git a/t/lei-q-save.t b/t/lei-q-save.t index aed38a51..bea65133 100644 --- a/t/lei-q-save.t +++ b/t/lei-q-save.t @@ -25,7 +25,8 @@ test_lei(sub { lei_ok [qw(import -q -F eml -)], undef, { 0 => \$in, %$lei_opt }; lei_ok qw(q -q --save z:0.. d:last.week..), '-o', "MAILDIR:$home/md/"; my %before = map { $_ => 1 } glob("$home/md/cur/*"); - is_deeply(eml_load((keys %before)[0]), $doc1, 'doc1 matches'); + my $f = (keys %before)[0] or xbail({before => \%before}); + is_deeply(eml_load($f), $doc1, 'doc1 matches'); lei_ok qw(ls-mail-sync); is($lei_out, "maildir:$home/md\n", 'canonicalized mail sync name'); @@ -45,7 +46,8 @@ test_lei(sub { my %after = map { $_ => 1 } glob("$home/md/{new,cur}/*"); is(delete $after{(keys(%before))[0]}, 1, 'original message kept'); is(scalar(keys %after), 1, 'one new message added'); - is_deeply(eml_load((keys %after)[0]), $doc2, 'doc2 matches'); + $f = (keys %after)[0] or xbail({after => \%after}); + is_deeply(eml_load($f), $doc2, 'doc2 matches'); # check stdin lei_ok [qw(q --save - -o), "mboxcl2:mbcl2" ],