diff options
author | Eric Wong <e@80x24.org> | 2021-03-25 06:20:19 +0200 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-03-25 17:58:58 +0000 |
commit | 98008cde927c175f77360d2ec5b70dac66931e83 (patch) | |
tree | 97d954e99aaa1b580bb2f26ca188edbfb6eb38a1 /lib/PublicInbox/TestCommon.pm | |
parent | c4012d44fda18cc36cf8cc6d2799abe2d56887c7 (diff) | |
download | public-inbox-98008cde927c175f77360d2ec5b70dac66931e83.tar.gz |
We hide paths by default to reduce noise, but we want noise with loud errors.
Diffstat (limited to 'lib/PublicInbox/TestCommon.pm')
-rw-r--r-- | lib/PublicInbox/TestCommon.pm | 14 |
1 files 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; } |