about summary refs log tree commit
path: root/t/perf-nntpd.t
diff options
context:
space:
mode:
Diffstat (limited to 't/perf-nntpd.t')
-rw-r--r--t/perf-nntpd.t22
1 files changed, 9 insertions, 13 deletions
diff --git a/t/perf-nntpd.t b/t/perf-nntpd.t
index 7abf2249..c7d2eaff 100644
--- a/t/perf-nntpd.t
+++ b/t/perf-nntpd.t
@@ -10,18 +10,9 @@ use Net::NNTP;
 my $pi_dir = $ENV{GIANT_PI_DIR};
 plan skip_all => "GIANT_PI_DIR not defined for $0" unless $pi_dir;
 eval { require PublicInbox::Search };
-my ($host_port, $group, %opts, $s, $pid);
+my ($host_port, $group, %opts, $s, $td);
 require './t/common.perl';
 
-END {
-        if ($s) {
-                $s->print("QUIT\r\n");
-                $s->getline;
-                $s = undef;
-        }
-        kill 'TERM', $pid if defined $pid;
-};
-
 if (($ENV{NNTP_TEST_URL} || '') =~ m!\Anntp://([^/]+)/([^/]+)\z!) {
         ($host_port, $group) = ($1, $2);
         $host_port .= ":119" unless index($host_port, ':') > 0;
@@ -29,7 +20,6 @@ if (($ENV{NNTP_TEST_URL} || '') =~ m!\Anntp://([^/]+)/([^/]+)\z!) {
         $group = 'inbox.test.perf.nntpd';
         my $ibx = { inboxdir => $pi_dir, newsgroup => $group };
         $ibx = PublicInbox::Inbox->new($ibx);
-        my $nntpd = 'blib/script/public-inbox-nntpd';
         my $tmpdir = tempdir('perf-nntpd-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 
         my $pi_config = "$tmpdir/config";
@@ -46,8 +36,8 @@ if (($ENV{NNTP_TEST_URL} || '') =~ m!\Anntp://([^/]+)/([^/]+)\z!) {
 
         my $sock = tcp_server();
         ok($sock, 'sock created');
-        my $cmd = [ $nntpd, '-W0' ];
-        $pid = spawn_listener({ PI_CONFIG => $pi_config }, $cmd, [$sock]);
+        my $cmd = [ '-nntpd', '-W0' ];
+        $td = start_script($cmd, { PI_CONFIG => $pi_config }, { 3 => $sock });
         $host_port = $sock->sockhost . ':' . $sock->sockport;
 }
 %opts = (
@@ -110,6 +100,12 @@ $t = timeit(1, sub {
 });
 diag 'newnews took: ' . timestr($t) . " for $n";
 
+if ($s) {
+        $s->print("QUIT\r\n");
+        $s->getline;
+}
+
+
 done_testing();
 
 1;