user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
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	[thread overview]
Message-ID: <20210528094521.26490-2-e@80x24.org> (raw)
In-Reply-To: <20210528094521.26490-1-e@80x24.org>

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" ],

  reply	other threads:[~2021-05-28  9:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28  9:45 [PATCH 0/3] lei: diagnostic and reliability fix Eric Wong
2021-05-28  9:45 ` Eric Wong [this message]
2021-05-28  9:45 ` [PATCH 2/3] lei: restore working directory in more places Eric Wong
2021-05-28  9:45 ` [PATCH 3/3] script/lei: drop leftover message about fallback Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210528094521.26490-2-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).