]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
t/lei-refresh-mail-sync: improve test reliability
authorEric Wong <e@80x24.org>
Tue, 28 Mar 2023 10:53:58 +0000 (10:53 +0000)
committerEric Wong <e@80x24.org>
Wed, 29 Mar 2023 04:36:48 +0000 (04:36 +0000)
Lack of signalfd/EVFILT_SIGNAL means we need to kill a
process repeatedly to ensure it wakes up.

t/lei-refresh-mail-sync.t

index 0498a0c428110271e2e0b1c3e36592b9f7ade5f1..8ccc68c62465ecec909c3bd6210af18916598188 100644 (file)
@@ -137,8 +137,12 @@ SKIP: {
        my $ar = PublicInbox::AutoReap->new($pid);
        ok(!(lei 'refresh-mail-sync', $url), 'URL fails on dead -imapd');
        ok(!(lei 'refresh-mail-sync', '--all'), '--all fails on dead -imapd');
-       $ar->kill for qw(avoid sig wake miss-no signalfd or EVFILT_SIG);
-       $ar->join('TERM');
+       {
+               local $SIG{CHLD} = sub { $ar->join('TERM'); undef $ar };
+               do {
+                       eval { $ar->kill and tick(0.01) }
+               } while (defined($ar));
+       }
 
        my $cmd = $srv->{imapd}->{cmd};
        my $s = $srv->{imapd}->{s};