From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 03/10] test_common: TEST_LEI_ERR_LOUD does not hide path names
Date: Thu, 25 Mar 2021 06:20:19 +0200 [thread overview]
Message-ID: <20210325042026.11270-4-e@80x24.org> (raw)
In-Reply-To: <20210325042026.11270-1-e@80x24.org>
We hide paths by default to reduce noise, but we want
noise with loud errors.
---
lib/PublicInbox/TestCommon.pm | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index e127970e..ffff5902 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -11,6 +11,7 @@ use POSIX qw(dup2);
use IO::Socket::INET;
use File::Spec;
our @EXPORT;
+my $lei_loud = $ENV{TEST_LEI_ERR_LOUD};
BEGIN {
@EXPORT = qw(tmpdir tcp_server tcp_connect require_git require_mods
run_script start_script key2sub xsys xsys_e xqx eml_load tick
@@ -463,21 +464,24 @@ sub lei (@) {
$lei_err =~ m!\bArgument .*? isn't numeric in !) {
fail "lei_err=$lei_err";
} else {
- state $loud = $ENV{TEST_LEI_ERR_LOUD};
- diag "lei_err=$lei_err" if $loud;
+ diag "lei_err=$lei_err" if $lei_loud;
}
}
$res;
};
sub lei_ok (@) {
+ state $PWD = $ENV{PWD} // Cwd::getcwd();
my $msg = ref($_[-1]) eq 'SCALAR' ? pop(@_) : undef;
my $tmpdir = quotemeta(File::Spec->tmpdir);
# filter out anything that looks like a path name for consistent logs
my @msg = ref($_[0]) eq 'ARRAY' ? @{$_[0]} : @_;
- for (@msg) {
- s!\A([a-z0-9]+://)[^/]+/!$1\$HOST_PORT/! ||
- s!$tmpdir\b/(?:[^/]+/)?!\$TMPDIR/!;
+ if (!$lei_loud) {
+ for (@msg) {
+ s!\A([a-z0-9]+://)[^/]+/!$1\$HOST_PORT/!;
+ s!$tmpdir\b/(?:[^/]+/)?!\$TMPDIR/!g;
+ s!\Q$PWD\E\b!\$PWD!g;
+ }
}
ok(lei(@_), "lei @msg". ($msg ? " ($$msg)" : '')) or diag $lei_err;
}
next prev parent reply other threads:[~2021-03-25 4:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-25 4:20 [PATCH 00/10] lei testing improvements Eric Wong
2021-03-25 4:20 ` [PATCH 01/10] test_common: cleanup inbox objects after use Eric Wong
2021-03-25 4:20 ` [PATCH 02/10] lei: janky $PATH2CFG garbage collection Eric Wong
2021-03-25 4:20 ` Eric Wong [this message]
2021-03-25 4:20 ` [PATCH 04/10] lei add-external: do not initialize writable store Eric Wong
2021-03-25 4:20 ` [PATCH 05/10] lei_mirror: don't show success on failure Eric Wong
2021-03-25 4:20 ` [PATCH 06/10] t/*: drop unnecessary v1-specific index calls Eric Wong
2021-03-25 4:20 ` [PATCH 07/10] tests: "check-run" uses persistent lei daemon Eric Wong
2021-03-25 4:20 ` [PATCH 08/10] lei import: force store, improve test diagnostics Eric Wong
2021-03-25 4:20 ` [PATCH 09/10] t/cmd_ipc: workaround signal handling raciness Eric Wong
2021-03-25 4:20 ` [PATCH 10/10] t/lei: add more diagnostics for failures 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=20210325042026.11270-4-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.
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).