X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fhttpd-corner.t;h=4ed34934e500649470ba411629764afbe286f044;hb=d62d98b9a7f502da65673f0b83a6d06312c060d9;hp=551af2b21526c822e7f479186d668d4ed380be85;hpb=ad6f26f3b9f0e428020d05667987556f8fcbec2f;p=public-inbox.git diff --git a/t/httpd-corner.t b/t/httpd-corner.t index 551af2b2..4ed34934 100644 --- a/t/httpd-corner.t +++ b/t/httpd-corner.t @@ -7,19 +7,14 @@ use warnings; use Test::More; use Time::HiRes qw(gettimeofday tv_interval); use PublicInbox::Spawn qw(which spawn); - -foreach my $mod (qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status)) { - eval "require $mod"; - plan skip_all => "$mod missing for httpd-corner.t" if $@; -} - +use PublicInbox::TestCommon; +require_mods(qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status)); use Digest::SHA qw(sha1_hex); use IO::Socket; use IO::Socket::UNIX; use Fcntl qw(:seek); use Socket qw(IPPROTO_TCP TCP_NODELAY SOL_SOCKET); use POSIX qw(mkfifo); -require './t/common.perl'; my ($tmpdir, $for_destroy) = tmpdir(); my $fifo = "$tmpdir/fifo"; ok(defined mkfifo($fifo, 0777), 'created FIFO'); @@ -271,7 +266,7 @@ SKIP: { my $cmd = [qw(curl --tcp-nodelay --no-buffer -T- -HExpect: -sS), $url]; open my $cout, '+>', undef or die; open my $cerr, '>', undef or die; - my $rdr = { 0 => fileno($r), 1 => fileno($cout), 2 => fileno($cerr) }; + my $rdr = { 0 => $r, 1 => $cout, 2 => $cerr }; my $pid = spawn($cmd, undef, $rdr); close $r or die "close read pipe: $!"; foreach my $c ('a'..'z') { @@ -553,16 +548,16 @@ SKIP: { # filter out pipes inherited from the parent my @this = `lsof -p $$`; my $bad; - sub extract_inodes { + my $extract_inodes = sub { map {; my @f = split(' ', $_); my $inode = $f[-2]; $bad = $_ if $inode !~ /\A[0-9]+\z/; $inode => 1; } grep (/\bpipe\b/, @_); - } - my %child = extract_inodes(@lsof); - my %parent = extract_inodes(@this); + }; + my %child = $extract_inodes->(@lsof); + my %parent = $extract_inodes->(@this); skip("inode not in expected format: $bad", 1) if defined($bad); delete @child{(keys %parent)}; is_deeply([], [keys %child], 'no extra pipes with -W0');