about summary refs log tree commit homepage
path: root/t/v2writable.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-11-24 00:22:31 +0000
committerEric Wong <e@80x24.org>2019-11-24 21:46:49 +0000
commite05912ae3899a0f50a6baf3b6c1892789d24f6b1 (patch)
tree3b031d7478b78b77ae66eaa57360e21f2286f6c1 /t/v2writable.t
parent8576a48b2344905229737fde45498c80a1171ca5 (diff)
downloadpublic-inbox-e05912ae3899a0f50a6baf3b6c1892789d24f6b1.tar.gz
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.
Diffstat (limited to 't/v2writable.t')
-rw-r--r--t/v2writable.t8
1 files changed, 3 insertions, 5 deletions
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);