user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 0/4] fixes noticed while diagnosing t/lei-up.t
@ 2022-09-30  9:21  7% Eric Wong
  2022-09-30  9:21  7% ` [PATCH 1/4] tests: favor 3 argument `open' with interopolation Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2022-09-30  9:21 UTC (permalink / raw)
  To: meta

I'm still trying to figure out why OverIdx->adj_counter (via
next_tid) in the LeiSavedSearch dedupe check occasionally fails
under CentOS 7.x (but not other systems).

Meanwhile, some improvements noticed along the way.
The underlying problem remains...

Disabling WAL didn't help t/lei-up.t on CentOS 7.x, so the
obvious newish feature we use is unlikely the culprit...

Eric Wong (4):
  tests: favor 3 argument `open' with interopolation
  t/lei-up: improve diagnostics for this test
  lei_to_mail: propagate errors to script/lei
  t/altid_v2: improve test style

 lib/PublicInbox/LeiToMail.pm | 34 ++++++++++++++++------------
 t/altid_v2.t                 | 10 ++++-----
 t/hl_mod.t                   |  4 ++--
 t/lei-up.t                   | 43 ++++++++++++++++++++++--------------
 t/lei_to_mail.t              | 10 ++++-----
 5 files changed, 59 insertions(+), 42 deletions(-)

^ permalink raw reply	[relevance 7%]

* [PATCH 1/4] tests: favor 3 argument `open' with interopolation
  2022-09-30  9:21  7% [PATCH 0/4] fixes noticed while diagnosing t/lei-up.t Eric Wong
@ 2022-09-30  9:21  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2022-09-30  9:21 UTC (permalink / raw)
  To: meta

It makes code easier to review, and is more robust in case some
weirdos actually start their path names with '<' or '>' :P
---
 t/hl_mod.t      |  4 ++--
 t/lei-up.t      |  8 ++++----
 t/lei_to_mail.t | 10 +++++-----
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/t/hl_mod.t b/t/hl_mod.t
index a88f6c03..6ddbb778 100644
--- a/t/hl_mod.t
+++ b/t/hl_mod.t
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# Copyright (C) 2019-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict; use v5.10.1; use PublicInbox::TestCommon; use IO::Handle; # ->autoflush
 use Fcntl qw(:seek);
@@ -11,7 +11,7 @@ is($hls->_shebang2lang(\"#!/usr/bin/perl -w\n"), 'perl', 'perl shebang OK');
 is($hls->{-ext2lang}->{'pm'}, 'perl', '.pm suffix OK');
 is($hls->{-ext2lang}->{'pl'}, 'perl', '.pl suffix OK');
 like($hls->_path2lang('Makefile'), qr/\Amake/, 'Makefile OK');
-my $str = do { local $/; open(my $fh, __FILE__); <$fh> };
+my $str = do { local $/; open(my $fh, '<', __FILE__); <$fh> };
 my $orig = $str;
 
 {
diff --git a/t/lei-up.t b/t/lei-up.t
index fc369156..022ebc05 100644
--- a/t/lei-up.t
+++ b/t/lei-up.t
@@ -15,23 +15,23 @@ test_lei(sub {
 	$s = eml_load('t/utf8.eml')->as_string;
 	lei_ok [qw(import -q -F eml -)], undef, { 0 => \$s, %$lei_opt };
 	lei_ok qw(up --all=local);
-	open my $fh, "$ENV{HOME}/a.mbox.gz" or xbail "open: $!";
+	open my $fh, '<', "$ENV{HOME}/a.mbox.gz" or xbail "open: $!";
 	my $gz = do { local $/; <$fh> };
 	my $uc;
 	gunzip(\$gz => \$uc, MultiStream => 1) or xbail "gunzip $GunzipError";
-	open $fh, "$ENV{HOME}/a" or xbail "open: $!";
+	open $fh, '<', "$ENV{HOME}/a" or xbail "open: $!";
 
 	my $exp = do { local $/; <$fh> };
 	is($uc, $exp, 'compressed and uncompressed match (a.gz)');
 	like($exp, qr/testmessage\@example.com/, '2nd message added');
-	open $fh, "$ENV{HOME}/b.mbox.gz" or xbail "open: $!";
+	open $fh, '<', "$ENV{HOME}/b.mbox.gz" or xbail "open: $!";
 
 	$gz = do { local $/; <$fh> };
 	undef $uc;
 	gunzip(\$gz => \$uc, MultiStream => 1) or xbail "gunzip $GunzipError";
 	is($uc, $exp, 'compressed and uncompressed match (b.gz)');
 
-	open $fh, "$ENV{HOME}/b" or xbail "open: $!";
+	open $fh, '<', "$ENV{HOME}/b" or xbail "open: $!";
 	$uc = do { local $/; <$fh> };
 	is($uc, $exp, 'uncompressed both match');
 
diff --git a/t/lei_to_mail.t b/t/lei_to_mail.t
index e8958c64..d692751c 100644
--- a/t/lei_to_mail.t
+++ b/t/lei_to_mail.t
@@ -1,5 +1,5 @@
 #!perl -w
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use v5.10.1;
@@ -260,7 +260,7 @@ SKIP: { # FIFO support
 
 	my @f;
 	$mdr->maildir_each_file($md, sub { push @f, shift });
-	open my $fh, $f[0] or BAIL_OUT $!;
+	open my $fh, '<', $f[0] or BAIL_OUT $!;
 	is(do { local $/; <$fh> }, $buf, 'wrote to Maildir');
 
 	$wcb = $wcb_get->('maildir', $md);
@@ -271,7 +271,7 @@ SKIP: { # FIFO support
 	$mdr->maildir_each_file($md, sub { push @x, shift });
 	is(scalar(@x), 1, 'wrote one new file');
 	ok(!-f $f[0], 'old file clobbered');
-	open $fh, $x[0] or BAIL_OUT $!;
+	open $fh, '<', $x[0] or BAIL_OUT $!;
 	is(do { local $/; <$fh> }, $buf."\nx\n", 'wrote new file to Maildir');
 
 	local $lei->{opt}->{augment} = 1;
@@ -283,9 +283,9 @@ SKIP: { # FIFO support
 	is(scalar grep(/\A\Q$x[0]\E\z/, @f), 1, 'old file still there');
 	my @new = grep(!/\A\Q$x[0]\E\z/, @f);
 	is(scalar @new, 1, '1 new file written (b4dc0ffee skipped)');
-	open $fh, $x[0] or BAIL_OUT $!;
+	open $fh, '<', $x[0] or BAIL_OUT $!;
 	is(do { local $/; <$fh> }, $buf."\nx\n", 'old file untouched');
-	open $fh, $new[0] or BAIL_OUT $!;
+	open $fh, '<', $new[0] or BAIL_OUT $!;
 	is(do { local $/; <$fh> }, $buf."\ny\n", 'new file written');
 }
 

^ permalink raw reply related	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2022-09-30  9:21  7% [PATCH 0/4] fixes noticed while diagnosing t/lei-up.t Eric Wong
2022-09-30  9:21  7% ` [PATCH 1/4] tests: favor 3 argument `open' with interopolation Eric Wong

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).