t/cmd_ipc.t | 3 +--
t/httpd-corner.t | 2 +-
t/httpd-unix.t | 8 ++++----
t/nntpd.t | 6 +++---
diff --git a/t/cmd_ipc.t b/t/cmd_ipc.t
index 75697a1539e3e8b2b80bb4d1cfa80d685e7d57d5..cd76d5e896d160a015e19a9f9e119bfa0ffaa188 100644
--- a/t/cmd_ipc.t
+++ b/t/cmd_ipc.t
@@ -10,7 +10,6 @@ pipe(my ($r, $w)) or BAIL_OUT;
my ($send, $recv);
require_ok 'PublicInbox::Spawn';
my $SOCK_SEQPACKET = eval { Socket::SOCK_SEQPACKET() } // undef;
-use Time::HiRes qw(usleep);
my $do_test = sub { SKIP: {
my ($type, $flag, $desc) = @_;
@@ -61,7 +60,7 @@ my $pid = fork // xbail "fork: $!";
if ($pid == 0) {
# need to loop since Perl signals are racy
# (the interpreter doesn't self-pipe)
- while (usleep(1000)) {
+ while (tick(0.01)) {
kill 'ALRM', $tgt;
}
}
diff --git a/t/httpd-corner.t b/t/httpd-corner.t
index e16e8dc87364db2de975b1edeefc49ed04a96db9..88820270d4f97100cd3f66f931529ccdee88e446 100644
--- a/t/httpd-corner.t
+++ b/t/httpd-corner.t
@@ -320,7 +320,7 @@ is($?, 0, 'no error');
$spawn_httpd->('-W0');
}
-sub delay { select(undef, undef, undef, shift || rand(0.02)) }
+sub delay { tick(shift || rand(0.02)) }
my $str = 'abcdefghijklmnopqrstuvwxyz';
my $len = length $str;
diff --git a/t/httpd-unix.t b/t/httpd-unix.t
index fe4a21616373a682d71020a6be26e7b10b6f76fe..e915ea2c66dd3c707c0690b5c148018e1cff7e8b 100644
--- a/t/httpd-unix.t
+++ b/t/httpd-unix.t
@@ -1,8 +1,8 @@
-# Copyright (C) 2016-2021 all contributors
+#!perl -w
+# Copyright (C) all contributors
# License: AGPL-3.0+
# Tests for binding Unix domain sockets
use strict;
-use warnings;
use Test::More;
use PublicInbox::TestCommon;
use Errno qw(EADDRINUSE);
@@ -36,7 +36,7 @@ $spawn_httpd->("-l$unix", '-W0');
my %o = (Peer => $unix, Type => SOCK_STREAM);
for (1..1000) {
last if -S $unix && IO::Socket::UNIX->new(%o);
- select undef, undef, undef, 0.02
+ tick(0.02);
}
ok(-S $unix, 'UNIX socket was bound by -httpd');
@@ -89,7 +89,7 @@ my $cond = shift;
my $end = time + 30;
do {
return if $cond->();
- select undef, undef, undef, 0.012;
+ tick(0.012);
} until (time > $end);
Carp::confess('condition failed');
}
diff --git a/t/nntpd.t b/t/nntpd.t
index 058bd796e8fb28979ac46b76d9dfb3a0b9c44f69..30233ce0c3b186ba8dd4d813183d8d81e874584a 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -358,7 +358,7 @@ rename($tmp, $f) or BAIL_OUT "rename($tmp, $f): $!";
}
ok(run_script([qw(-index -c -j0 --reindex), $ibx->{inboxdir}],
undef, $noerr), '-compacted');
- select(undef, undef, undef, $fast_idle ? 0.1 : 2.1);
+ tick($fast_idle ? 0.1 : 2.1);
$art = $n->article($ex->header('Message-ID'));
ok($art, 'new article retrieved after compact');
$lsof or skip 'lsof missing', 1;
@@ -372,9 +372,9 @@ SKIP: { test_watch($tmpdir, $host_port, $group) };
{
setsockopt($s, IPPROTO_TCP, TCP_NODELAY, 1);
syswrite($s, 'HDR List-id 1-');
- select(undef, undef, undef, 0.15);
+ tick(0.15);
ok($td->kill, 'killed nntpd');
- select(undef, undef, undef, 0.15);
+ tick(0.15);
syswrite($s, "\r\n");
$buf = '';
do {