]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
tests: quiet uninitialized warnings on CentOS 7.x
authorEric Wong <e@80x24.org>
Fri, 15 Dec 2023 20:22:45 +0000 (15:22 -0500)
committerEric Wong <e@80x24.org>
Sat, 16 Dec 2023 10:06:29 +0000 (10:06 +0000)
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
t/cmd_ipc.t
t/ds-poll.t
t/httpd-corner.t
t/lei-convert.t
t/lei-daemon.t
t/lei-sigpipe.t

index 22c506752df167989ef20daaecb01ec832a18ef7..b0f28e16aad5f12da3c565624b71b9be7a332f7e 100644 (file)
@@ -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
 }
 
index ccf4ca312fb37c555f9e255440b63a41d57be365..08a4dcc37af9c75142c14a8023cb7bce3102788f 100644 (file)
@@ -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');
 }
index 321534bddbe2a9d3f4fc1933b8273fad9f4d6cc4..22dbc8027edd4fda39b7f2064f08fb187b063642 100644 (file)
@@ -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;
index 35c88600090bd9b941761b94ef11c81384e3c07c..7539573c9fb64472299e1885a0048f5d87894827 100644 (file)
@@ -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);
index 6aff80bbbc7a7a2fe8ba0d9dffe5320613b4d3f7..4670e47f67cf3783fe53e59b519d5b3e03502b81 100644 (file)
@@ -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
index 2be967be945de560737d34d4702430407fb677df..d97e494a6f1def87923bec0f22782a6c8bd2780a 100644 (file)
@@ -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: $!";
index 1aa700e93c1f2da0c8ef0dced5d08cb442a7d36c..72bc6c7de5040fb8948e7ce3989fe78cd104decc 100644 (file)
@@ -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',