about summary refs log tree commit homepage
path: root/t/www_listing.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/www_listing.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/www_listing.t')
-rw-r--r--t/www_listing.t8
1 files changed, 3 insertions, 5 deletions
diff --git a/t/www_listing.t b/t/www_listing.t
index 61a059e5..9cde3575 100644
--- a/t/www_listing.t
+++ b/t/www_listing.t
@@ -64,15 +64,13 @@ sub tiny_test {
                 'epoch 1 in description');
 }
 
-my $pid;
-END { kill 'TERM', $pid if defined $pid };
+my $td;
 SKIP: {
         my $err = "$tmpdir/stderr.log";
         my $out = "$tmpdir/stdout.log";
         my $alt = "$tmpdir/alt.git";
         my $cfgfile = "$tmpdir/config";
         my $v2 = "$tmpdir/v2";
-        my $httpd = 'blib/script/public-inbox-httpd';
         my $sock = tcp_server();
         ok($sock, 'sock created');
         my ($host, $port) = ($sock->sockhost, $sock->sockport);
@@ -106,8 +104,8 @@ SKIP: {
 
         close $fh or die;
         my $env = { PI_CONFIG => $cfgfile };
-        my $cmd = [ $httpd, '-W0', "--stdout=$out", "--stderr=$err" ];
-        $pid = spawn_listener($env, $cmd, [$sock]);
+        my $cmd = [ '-httpd', '-W0', "--stdout=$out", "--stderr=$err" ];
+        $td = start_script($cmd, $env, { 3 => $sock });
         $sock = undef;
 
         tiny_test($host, $port);