From e05912ae3899a0f50a6baf3b6c1892789d24f6b1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 24 Nov 2019 00:22:31 +0000 Subject: t/common: start_script replaces spawn_listener We can shave several hundred milliseconds off tests which spawn daemons by preloading and avoiding startup time for common modules which are already loaded in the parent process. This also gives ENV{TAIL} support to all tests which support daemons which log to stdout/stderr. --- t/v2writable.t | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 't/v2writable.t') diff --git a/t/v2writable.t b/t/v2writable.t index 28420bb9..4bb6d733 100644 --- a/t/v2writable.t +++ b/t/v2writable.t @@ -163,12 +163,10 @@ EOF close $fh or die "close: $!\n"; my $sock = tcp_server(); ok($sock, 'sock created'); - my $pid; my $len; - END { kill 'TERM', $pid if defined $pid }; - my $nntpd = 'blib/script/public-inbox-nntpd'; - my $cmd = [ $nntpd, '-W0', "--stdout=$out", "--stderr=$err" ]; - $pid = spawn_listener({ PI_CONFIG => $pi_config }, $cmd, [ $sock ]); + my $cmd = [ '-nntpd', '-W0', "--stdout=$out", "--stderr=$err" ]; + my $env = { PI_CONFIG => $pi_config }; + my $td = start_script($cmd, $env, { 3 => $sock }); my $host_port = $sock->sockhost . ':' . $sock->sockport; my $n = Net::NNTP->new($host_port); $n->group($group); -- cgit v1.2.3-24-ge0c7