]> Sergey Matveev's repositories - public-inbox.git/commitdiff
test_common: lazy-require AutoReap
authorEric Wong <e@80x24.org>
Tue, 19 Oct 2021 09:33:36 +0000 (09:33 +0000)
committerEric Wong <e@80x24.org>
Tue, 19 Oct 2021 17:29:14 +0000 (17:29 +0000)
This might speed up non-daemon-using tests.

lib/PublicInbox/TestCommon.pm

index 835779996d5644b56071c29fe775337a1d307fb0..fb0d5a4e6ededaabcff6f78385b6e927fdac95bb 100644 (file)
@@ -6,7 +6,6 @@ package PublicInbox::TestCommon;
 use strict;
 use parent qw(Exporter);
 use v5.10.1;
-use PublicInbox::AutoReap;
 use Fcntl qw(FD_CLOEXEC F_SETFD F_GETFD :seek);
 use POSIX qw(dup2);
 use IO::Socket::INET;
@@ -430,6 +429,7 @@ sub tail_f (@) {
        require PublicInbox::Spawn;
        my $pid = PublicInbox::Spawn::spawn($cmd, undef, { 1 => 2 });
        wait_for_tail($pid, scalar @_);
+       require PublicInbox::AutoReap;
        PublicInbox::AutoReap->new($pid, \&wait_for_tail);
 }
 
@@ -493,6 +493,7 @@ sub start_script {
                        die "FAIL: ",join(' ', $key, @argv), ": $!\n";
                }
        }
+       require PublicInbox::AutoReap;
        my $td = PublicInbox::AutoReap->new($pid);
        $td->{-extra} = $tail;
        $td;