dumping ground for random patches and texts
 help / color / mirror / Atom feed
* [PATCH 1/5] tests: quiet uninitialized warnings on CentOS 7.x
@ 2023-12-15  0:08 Eric Wong
  2023-12-15  0:08 ` [PATCH 2/5] searchidx: quiet down old git patchid Eric Wong
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eric Wong @ 2023-12-15  0:08 UTC (permalink / raw)
  To: spew

Test::More distributed with Perl 5.16.3 on CentOS 7.x expects
the `$how_many' argument for `skip' and warns when its
uninitialized, so quiet that warning down.
---
 lib/PublicInbox/TestCommon.pm | 20 ++++++++++----------
 t/cmd_ipc.t                   |  4 ++--
 t/ds-poll.t                   |  2 +-
 t/httpd-corner.t              |  2 +-
 t/lei-convert.t               |  2 +-
 t/lei-daemon.t                |  2 +-
 t/lei-sigpipe.t               |  2 +-
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index 22c50675..b0f28e16 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -64,7 +64,7 @@ sub require_bsd (;$) {
 	return 1 if $ok;
 	return if defined(wantarray);
 	my $m = "$0 is BSD-only (\$^O=$^O)";
-	@_ ? skip($m) : plan(skip_all => $m);
+	@_ ? skip($m, 1) : plan(skip_all => $m);
 }
 
 sub xbail (@) { BAIL_OUT join(' ', map { ref() ? (explain($_)) : ($_) } @_) }
@@ -142,8 +142,7 @@ sub require_cmd ($;$) {
 	my $bin = $CACHE{$cmd} //= PublicInbox::Spawn::which($cmd);
 	return $bin if $bin;
 	return plan(skip_all => "$cmd missing from PATH for $0") if !$nr;
-	defined(wantarray) ? undef :
-		skip("$cmd missing, skipping $nr tests", $nr);
+	defined(wantarray) ? undef : skip("$cmd missing", $nr);
 }
 
 sub have_xapian_compact (;$) {
@@ -160,7 +159,7 @@ sub require_git ($;$) {
 	state $cur_ver = sprintf('%vd', $cur_vstr);
 	return plan skip_all => "git $req+ required, have $cur_ver" if !$nr;
 	defined(wantarray) ? undef :
-		skip("git $req+ required (have $cur_ver), skipping $nr tests")
+		skip("git $req+ required (have $cur_ver)", $nr)
 }
 
 sub require_git_http_backend (;$) {
@@ -189,12 +188,13 @@ my %IPv6_VERSION = (
 
 sub need_accept_filter ($) {
 	my ($af) = @_;
-	return if $^O eq 'netbsd'; # since NetBSD 5.0
+	return if $^O eq 'netbsd'; # since NetBSD 5.0, no kldstat needed
 	$^O =~ /\A(?:freebsd|dragonfly)\z/ or
-		skip 'SO_ACCEPTFILTER is FreeBSD/NetBSD/Dragonfly-only so far';
+		skip 'SO_ACCEPTFILTER is FreeBSD/NetBSD/Dragonfly-only so far',
+			1;
 	state $tried = {};
 	($tried->{$af} //= system("kldstat -m $af >/dev/null")) and
-		skip "$af not loaded: kldload $af";
+		skip "$af not loaded: kldload $af", 1;
 }
 
 sub require_mods {
@@ -1004,7 +1004,7 @@ sub cfg_new ($;@) {
 our $strace_cmd;
 sub strace (@) {
 	my ($for_daemon) = @_;
-	skip 'linux only test' if $^O ne 'linux';
+	skip 'linux only test', 1 if $^O ne 'linux';
 	if ($for_daemon) {
 		my $f = '/proc/sys/kernel/yama/ptrace_scope';
 		# TODO: we could fiddle with prctl in the daemon to make
@@ -1014,7 +1014,7 @@ sub strace (@) {
 			CORE::open($fh, '<', $f) ? readline($fh) : 0;
 		};
 		chomp $ps;
-		skip "strace unusable on daemons\n$f is `$ps' (!= 0)" if $ps;
+		skip "strace unusable on daemons\n$f is `$ps' (!= 0)", 1 if $ps;
 	}
 	require_cmd('strace', 1) or skip 'strace not available', 1;
 }
@@ -1029,7 +1029,7 @@ sub strace_inject (;$) {
 		eval("v$1");
 	};
 	$ver ge v4.16 or skip "$cmd too old for syscall injection (".
-				sprintf('v%vd', $ver). ' < v4.16)';
+				sprintf('v%vd', $ver). ' < v4.16)', 1;
 	$cmd
 }
 
diff --git a/t/cmd_ipc.t b/t/cmd_ipc.t
index ccf4ca31..08a4dcc3 100644
--- a/t/cmd_ipc.t
+++ b/t/cmd_ipc.t
@@ -146,9 +146,9 @@ SKIP: {
 	skip 'not Linux', 1 if $^O ne 'linux';
 	require_ok 'PublicInbox::Syscall';
 	$send = PublicInbox::Syscall->can('send_cmd4') or
-		skip 'send_cmd4 not defined for arch';
+		skip 'send_cmd4 not defined for arch', 1;
 	$recv = PublicInbox::Syscall->can('recv_cmd4') or
-		skip 'recv_cmd4 not defined for arch';
+		skip 'recv_cmd4 not defined for arch', 1;
 	$do_test->(SOCK_STREAM, 0, 'PP Linux stream');
 	$do_test->(SOCK_SEQPACKET, 0, 'PP Linux seqpacket');
 }
diff --git a/t/ds-poll.t b/t/ds-poll.t
index 321534bd..22dbc802 100644
--- a/t/ds-poll.t
+++ b/t/ds-poll.t
@@ -48,7 +48,7 @@ is(scalar @$events, 0, 'nothing ready after EPOLL_CTL_DEL');
 is($p->ep_add($r, EPOLLIN), 0, 're-add');
 SKIP: {
 	$cls =~ m!::(?:DSPoll|Select)\z! or
-		skip 'EBADF test for select|poll only';
+		skip 'EBADF test for select|poll only', 1;
 	my $old_fd = fileno($r);
 	close $r;
 	my @w;
diff --git a/t/httpd-corner.t b/t/httpd-corner.t
index 35c88600..7539573c 100644
--- a/t/httpd-corner.t
+++ b/t/httpd-corner.t
@@ -28,7 +28,7 @@ my @zmods = qw(PublicInbox::GzipFilter IO::Uncompress::Gunzip);
 # using socket activation:
 my ($defer_accept_val, $accf_arg, $TCP_DEFER_ACCEPT);
 SKIP: {
-	skip 'TCP_DEFER_ACCEPT is Linux-only' if $^O ne 'linux';
+	skip 'TCP_DEFER_ACCEPT is Linux-only', 1 if $^O ne 'linux';
 	$TCP_DEFER_ACCEPT = eval { Socket::TCP_DEFER_ACCEPT() } // 9;
 	setsockopt($sock, IPPROTO_TCP, $TCP_DEFER_ACCEPT, 5);
 	my $x = getsockopt($sock, IPPROTO_TCP, $TCP_DEFER_ACCEPT);
diff --git a/t/lei-convert.t b/t/lei-convert.t
index 6aff80bb..4670e47f 100644
--- a/t/lei-convert.t
+++ b/t/lei-convert.t
@@ -165,7 +165,7 @@ EOM
 			$ok = $x;
 			last;
 		}
-		skip 'pigz || gzip do not support --rsyncable' if !$ok;
+		skip 'pigz || gzip do not support --rsyncable', 1 if !$ok;
 		lei_ok qw(convert --rsyncable), "mboxrd:$d/qp.gz",
 			'-o', "mboxcl2:$d/qp2.gz";
 		undef $fh; # necessary to make IO::Uncompress::Gunzip happy
diff --git a/t/lei-daemon.t b/t/lei-daemon.t
index 2be967be..d97e494a 100644
--- a/t/lei-daemon.t
+++ b/t/lei-daemon.t
@@ -32,7 +32,7 @@ test_lei({ daemon_only => 1 }, sub {
 	SKIP: {
 		skip 'only testing open files on Linux', 1 if $^O ne 'linux';
 		my $d = "/proc/$pid/fd";
-		skip "no $d on Linux" unless -d $d;
+		skip "no $d on Linux", 1 unless -d $d;
 		my @before = sort(glob("$d/*"));
 		my $addr = pack_sockaddr_un($sock);
 		open my $null, '<', '/dev/null' or BAIL_OUT "/dev/null: $!";
diff --git a/t/lei-sigpipe.t b/t/lei-sigpipe.t
index 1aa700e9..72bc6c7d 100644
--- a/t/lei-sigpipe.t
+++ b/t/lei-sigpipe.t
@@ -11,7 +11,7 @@ use autodie qw(close open pipe seek sysread);
 use PublicInbox::IO qw(write_file);
 my $inboxdir = $ENV{GIANT_INBOX_DIR};
 SKIP: {
-	$inboxdir // skip 'GIANT_INBOX_DIR unset to test large results';
+	$inboxdir // skip 'GIANT_INBOX_DIR unset to test large results', 1;
 	require PublicInbox::Inbox;
 	my $ibx = PublicInbox::Inbox->new({
 		name => 'unconfigured-test',

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/5] searchidx: quiet down old git patchid
  2023-12-15  0:08 [PATCH 1/5] tests: quiet uninitialized warnings on CentOS 7.x Eric Wong
@ 2023-12-15  0:08 ` Eric Wong
  2023-12-15  0:08 ` [PATCH 3/5] cindex: --prune needs git 2.6+ Eric Wong
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2023-12-15  0:08 UTC (permalink / raw)
  To: spew

CentOS 7.x ships with git 1.8.5, so unless a CentOS 7.x user
enables 3rd-party repos[1], they'll be stuck with a version
of git without `--stable' (though I'm becoming skeptical of
indexing patchids at all).

[1] https://public-inbox.org/meta/20210421151308.yz5hzkgm75klunpe@nitro.local/
---
 lib/PublicInbox/SearchIdx.pm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 1ac8e33e..1cbf6d23 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -44,6 +44,7 @@ my $hex = '[a-f0-9]';
 my $OID = $hex .'{40,}';
 my @VMD_MAP = (kw => 'K', L => 'L'); # value order matters
 our $INDEXLEVELS = qr/\A(?:full|medium|basic)\z/;
+our $PATCHID_BROKEN;
 
 sub new {
 	my ($class, $ibx, $creat, $shard) = @_;
@@ -63,6 +64,7 @@ sub new {
 			die("Invalid indexlevel $ibx->{indexlevel}\n");
 		}
 	}
+	undef $PATCHID_BROKEN; # retry on new instances in case of upgrades
 	$ibx = PublicInbox::InboxWritable->new($ibx);
 	my $self = PublicInbox::Search->new($ibx);
 	bless $self, $class;
@@ -353,7 +355,8 @@ sub index_diff ($$$) {
 sub index_body_text {
 	my ($self, $doc, $sref) = @_;
 	my $rd;
-	if ($$sref =~ /^(?:diff|---|\+\+\+) /ms) { # start patch-id in parallel
+	# start patch-id in parallel
+	if ($$sref =~ /^(?:diff|---|\+\+\+) /ms && !$PATCHID_BROKEN) {
 		my $git = ($self->{ibx} // $self->{eidx} // $self)->git;
 		my $fh = PublicInbox::IO::write_file '+>:utf8', undef, $$sref;
 		$fh->flush or die "flush: $!";
@@ -386,7 +389,12 @@ sub index_body_text {
 	if (defined $rd) { # reap `git patch-id'
 		(readline($rd) // '') =~ /\A([a-f0-9]{40,})/ and
 			$doc->add_term('XDFID'.$1);
-		$rd->close or warn "W: git patch-id failed: \$?=$? (non-fatal)"
+		if (!$rd->close) {
+			my $c = 'git patch-id --stable';
+			$PATCHID_BROKEN = ($? >> 8) == 129;
+			$PATCHID_BROKEN ? warn("W: $c requires git v2.1.0+\n")
+				: warn("W: $c failed: \$?=$? (non-fatal)");
+		}
 	}
 }
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/5] cindex: --prune needs git 2.6+
  2023-12-15  0:08 [PATCH 1/5] tests: quiet uninitialized warnings on CentOS 7.x Eric Wong
  2023-12-15  0:08 ` [PATCH 2/5] searchidx: quiet down old git patchid Eric Wong
@ 2023-12-15  0:08 ` Eric Wong
  2023-12-15  0:08 ` [PATCH 4/5] git: quiet down `rev-parse --git-path' errors Eric Wong
  2023-12-15  0:08 ` [PATCH 5/5] t/pop3d-limit: use v1 inbox to test on ancient git Eric Wong
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2023-12-15  0:08 UTC (permalink / raw)
  To: spew

Older versions of git lack --batch-all-objects, and 2.6+ is
new enough already since v2, lei, etc all depend on it.
---
 lib/PublicInbox/CodeSearchIdx.pm | 2 ++
 t/cindex.t                       | 1 +
 2 files changed, 3 insertions(+)

diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index 5d420de2..570ff64f 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -1305,6 +1305,8 @@ sub cidx_run { # main entry point
 			my $v = $self->{-opt}->{"sort-$_"};
 			push @SORT, "--$_=$v" if defined $v;
 		}
+		($self->{-opt}->{prune} && $GIT_VER le v2.6) and
+			die "W: --prune requires git v2.6+\n";
 		init_join_prefork($self)
 	}
 	local @IDX_SHARDS = cidx_init($self); # forks workers
diff --git a/t/cindex.t b/t/cindex.t
index ab4cde7c..e5f26ec3 100644
--- a/t/cindex.t
+++ b/t/cindex.t
@@ -209,6 +209,7 @@ EOM
 
 SKIP: { # --prune
 	require_cmd($ENV{XAPIAN_DELVE} || 'xapian-delve', 1);
+	require_git v2.6, 1;
 	my $csrch = PublicInbox::CodeSearch->new("$tmp/ext");
 	is(scalar($csrch->mset('s:hi')->items), 1, 'got hit');
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/5] git: quiet down `rev-parse --git-path' errors
  2023-12-15  0:08 [PATCH 1/5] tests: quiet uninitialized warnings on CentOS 7.x Eric Wong
  2023-12-15  0:08 ` [PATCH 2/5] searchidx: quiet down old git patchid Eric Wong
  2023-12-15  0:08 ` [PATCH 3/5] cindex: --prune needs git 2.6+ Eric Wong
@ 2023-12-15  0:08 ` Eric Wong
  2023-12-15  0:08 ` [PATCH 5/5] t/pop3d-limit: use v1 inbox to test on ancient git Eric Wong
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2023-12-15  0:08 UTC (permalink / raw)
  To: spew

This fixes t/mda.t with git 1.8.5
---
 lib/PublicInbox/Git.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index 9c4d938e..6c4fcf93 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -107,7 +107,9 @@ sub git_path ($$) {
 			$d;
 		} else {
 			local $/ = "\n";
-			my $s = $self->qx(qw(rev-parse --git-path), $path);
+			my $rdr = { 2 => \my $err };
+			my $s = $self->qx([qw(rev-parse --git-path), $path],
+					undef, $rdr);
 			chomp $s;
 
 			# git prior to 2.5.0 did not understand --git-path

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 5/5] t/pop3d-limit: use v1 inbox to test on ancient git
  2023-12-15  0:08 [PATCH 1/5] tests: quiet uninitialized warnings on CentOS 7.x Eric Wong
                   ` (2 preceding siblings ...)
  2023-12-15  0:08 ` [PATCH 4/5] git: quiet down `rev-parse --git-path' errors Eric Wong
@ 2023-12-15  0:08 ` Eric Wong
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2023-12-15  0:08 UTC (permalink / raw)
  To: spew

We don't need v2 features nor scalability to test POP3 stuff.
---
 t/pop3d-limit.t | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/pop3d-limit.t b/t/pop3d-limit.t
index 79e320af..f52c8802 100644
--- a/t/pop3d-limit.t
+++ b/t/pop3d-limit.t
@@ -24,7 +24,7 @@ body $n
 EOM
 };
 
-my $ibx = create_inbox 'pop3d-limit', version => 2, -primary_address => $addr,
+my $ibx = create_inbox 'pop3d-limit', -primary_address => $addr,
 			indexlevel => 'basic', tmpdir => "$tmpdir/ibx", sub {
 	my ($im, $ibx) = @_;
 	$add_msg->($im, $_) for (1..3);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-15  0:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-15  0:08 [PATCH 1/5] tests: quiet uninitialized warnings on CentOS 7.x Eric Wong
2023-12-15  0:08 ` [PATCH 2/5] searchidx: quiet down old git patchid Eric Wong
2023-12-15  0:08 ` [PATCH 3/5] cindex: --prune needs git 2.6+ Eric Wong
2023-12-15  0:08 ` [PATCH 4/5] git: quiet down `rev-parse --git-path' errors Eric Wong
2023-12-15  0:08 ` [PATCH 5/5] t/pop3d-limit: use v1 inbox to test on ancient git Eric Wong

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