]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/httpd: use run_script for -init
authorEric Wong <e@80x24.org>
Fri, 15 Nov 2019 09:50:53 +0000 (09:50 +0000)
committerEric Wong <e@80x24.org>
Sat, 16 Nov 2019 11:05:23 +0000 (11:05 +0000)
This only gives a small ~10% speedup, since -httpd still
needs execve, but any speedup is welcome.

t/httpd.t

index 15984a78e6d37901e0112d01de4dd8b10e27ce70..e7527ed64f2ae6815ccc87e2aec8bae5fb219621 100644 (file)
--- a/t/httpd.t
+++ b/t/httpd.t
@@ -22,7 +22,6 @@ my $group = 'test-httpd';
 my $addr = $group . '@example.com';
 my $cfgpfx = "publicinbox.$group";
 my $httpd = 'blib/script/public-inbox-httpd';
-my $init = 'blib/script/public-inbox-init';
 my $sock = tcp_server();
 my $pid;
 use_ok 'PublicInbox::Git';
@@ -31,8 +30,8 @@ use_ok 'Email::MIME';
 END { kill 'TERM', $pid if defined $pid };
 {
        local $ENV{HOME} = $home;
-       ok(!system($init, $group, $maindir, 'http://example.com/', $addr),
-               'init ran properly');
+       my $cmd = [ '-init', $group, $maindir, 'http://example.com/', $addr ];
+       ok(run_script($cmd), 'init ran properly');
 
        # ensure successful message delivery
        {
@@ -53,7 +52,7 @@ EOF
                $im->done($mime);
        }
        ok($sock, 'sock created');
-       my $cmd = [ $httpd, '-W0', "--stdout=$out", "--stderr=$err" ];
+       $cmd = [ $httpd, '-W0', "--stdout=$out", "--stderr=$err" ];
        $pid = spawn_listener(undef, $cmd, [$sock]);
        my $host = $sock->sockhost;
        my $port = $sock->sockport;