From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] imap_searchqp: attempt to suppress error messages harder
Date: Mon, 25 Nov 2024 08:59:33 +0000 [thread overview]
Message-ID: <20241125085933.726538-1-e@80x24.org> (raw)
In addition to setting $::RD_ERRORS and $::RD_WARN to `undef'
for parsing the generated $prd object, we'll make those `undef'
on Parse::RecDescent object instantion, too, in an attempt to
reduce test failures.
Furthermore, add a note about the occasional test failure and
maybe somebody else can help us figure it out since it's been
sporadically failing for a while...
Followup-to: 31ca305f28d747a0 (t/imap_searchqp: hopefully fix test reliability, 2024-04-28)
Followup-to: fa8bce03925461ef (t/imap_searchqp.t: retry bad query test on failure, 2023-10-10)
---
lib/PublicInbox/IMAPsearchqp.pm | 8 +++++---
t/imap_searchqp.t | 7 ++++++-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/lib/PublicInbox/IMAPsearchqp.pm b/lib/PublicInbox/IMAPsearchqp.pm
index 0c37220c..d1a943e5 100644
--- a/lib/PublicInbox/IMAPsearchqp.pm
+++ b/lib/PublicInbox/IMAPsearchqp.pm
@@ -170,6 +170,9 @@ sub impossible {
$$sql .= ' AND num < 0';
}
+# XXX not sure suppessing RD_* is needed here, but t/imap_searchqp.t
+# sporadically fails
+local ($::RD_ERRORS, $::RD_WARN);
my $prd = Parse::RecDescent->new(<<'EOG');
<nocheck>
{ my $q = $PublicInbox::IMAPsearchqp::q; }
@@ -278,9 +281,8 @@ sub parse {
my ($imap, $query) = @_;
my $sql = '';
%$q = (sql => \$sql, imap => $imap); # imap = PublicInbox::IMAP obj
- # $::RD_TRACE = 1;
- local $::RD_ERRORS = undef;
- local $::RD_WARN = undef;
+ # XXX not always effective for t/imap_searchqp.t
+ local ($::RD_ERRORS, $::RD_WARN);
my $res = eval { $prd->search_key(uc($query)) };
return $@ if $@ && $@ =~ /\A(?:BAD|NO) /;
return 'BAD unexpected result' if !$res || $res != $q;
diff --git a/t/imap_searchqp.t b/t/imap_searchqp.t
index d7840dd0..95cdd201 100644
--- a/t/imap_searchqp.t
+++ b/t/imap_searchqp.t
@@ -39,7 +39,12 @@ like($q, qr/\ANO \[/, 'bad charset rejected');
open STDERR, '>&', $olderr;
seek $tmperr, 0, SEEK_SET;
read($tmperr, my $buf, -s $tmperr);
- is($buf, '', 'nothing spewed to STDERR on bad query');
+ is($buf, '', 'nothing spewed to STDERR on bad query') or warn <<'EOM';
+FIXME: this sometimes fails despite setting $::RD_ERRORS + $::RD_WARN to
+undef in PublicInbox::IMAPsearchqp::parse and I don't understand why.
+It usually suceeds. Let us know if you can help us understand this
+occasional failure at meta@public-inbox.org
+EOM
}
like($q, qr/\ABAD /, 'bad charset rejected');
reply other threads:[~2024-11-25 8:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20241125085933.726538-1-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).