From 46835d34029c92a2da886e5d0c17ec83cf86a209 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 14 May 2019 03:32:00 +0000 Subject: [PATCH] tests: remove unnecessary loading of ::DS and Socket PublicInbox::DS works for every platform we we care about, nowadays; so checking for it is a waste of time. Cleanup a few POSIX and Socket imports while we're in the area. --- t/git-http-backend.t | 10 ++++------ t/httpd-corner.t | 6 +++--- t/httpd-unix.t | 3 +-- t/httpd.t | 6 ++---- t/nntp.t | 2 +- t/nntpd.t | 4 ++-- t/v2mirror.t | 2 +- t/v2writable.t | 7 ++----- 8 files changed, 16 insertions(+), 24 deletions(-) diff --git a/t/git-http-backend.t b/t/git-http-backend.t index b616e822..5ac0a4a5 100644 --- a/t/git-http-backend.t +++ b/t/git-http-backend.t @@ -4,21 +4,19 @@ use strict; use warnings; use Test::More; use File::Temp qw/tempdir/; -use IO::Socket; -use Socket qw(SO_KEEPALIVE IPPROTO_TCP TCP_NODELAY); -use POSIX qw(dup2 setsid); -use Cwd qw(getcwd); +use IO::Socket::INET; +use POSIX qw(setsid); my $git_dir = $ENV{GIANT_GIT_DIR}; plan 'skip_all' => 'GIANT_GIT_DIR not defined' unless $git_dir; -foreach my $mod (qw(PublicInbox::DS BSD::Resource +foreach my $mod (qw(BSD::Resource Plack::Util Plack::Builder HTTP::Date HTTP::Status Net::HTTP)) { eval "require $mod"; plan skip_all => "$mod missing for git-http-backend.t" if $@; } require './t/common.perl'; -my $psgi = getcwd()."/t/git-http-backend.psgi"; +my $psgi = "./t/git-http-backend.psgi"; my $tmpdir = tempdir('pi-git-http-backend-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $err = "$tmpdir/stderr.log"; my $out = "$tmpdir/stdout.log"; diff --git a/t/httpd-corner.t b/t/httpd-corner.t index 49c5d1fe..bfa39205 100644 --- a/t/httpd-corner.t +++ b/t/httpd-corner.t @@ -7,7 +7,7 @@ use warnings; use Test::More; use Time::HiRes qw(gettimeofday tv_interval); -foreach my $mod (qw(Plack::Util Plack::Builder PublicInbox::DS +foreach my $mod (qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status IPC::Run)) { eval "require $mod"; plan skip_all => "$mod missing for httpd-corner.t" if $@; @@ -19,8 +19,8 @@ use Cwd qw/getcwd/; use IO::Socket; use IO::Socket::UNIX; use Fcntl qw(:seek); -use Socket qw(SO_KEEPALIVE IPPROTO_TCP TCP_NODELAY); -use POSIX qw(mkfifo :sys_wait_h); +use Socket qw(IPPROTO_TCP TCP_NODELAY); +use POSIX qw(mkfifo); require './t/common.perl'; my $tmpdir = tempdir('httpd-corner-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $fifo = "$tmpdir/fifo"; diff --git a/t/httpd-unix.t b/t/httpd-unix.t index 627adfaf..2ef64dfc 100644 --- a/t/httpd-unix.t +++ b/t/httpd-unix.t @@ -5,8 +5,7 @@ use strict; use warnings; use Test::More; -foreach my $mod (qw(Plack::Util Plack::Builder PublicInbox::DS - HTTP::Date HTTP::Status)) { +foreach my $mod (qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status)) { eval "require $mod"; plan skip_all => "$mod missing for httpd-unix.t" if $@; } diff --git a/t/httpd.t b/t/httpd.t index 45cbcbfd..d55495ff 100644 --- a/t/httpd.t +++ b/t/httpd.t @@ -4,15 +4,13 @@ use strict; use warnings; use Test::More; -foreach my $mod (qw(Plack::Util Plack::Builder PublicInbox::DS - HTTP::Date HTTP::Status)) { +foreach my $mod (qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status)) { eval "require $mod"; plan skip_all => "$mod missing for httpd.t" if $@; } use File::Temp qw/tempdir/; use Cwd qw/getcwd/; -use IO::Socket; -use Socket qw(SO_KEEPALIVE IPPROTO_TCP TCP_NODELAY); +use IO::Socket::INET; require './t/common.perl'; # FIXME: too much setup diff --git a/t/nntp.t b/t/nntp.t index c39a05fa..47b14422 100644 --- a/t/nntp.t +++ b/t/nntp.t @@ -5,7 +5,7 @@ use warnings; use Test::More; use Data::Dumper; -foreach my $mod (qw(DBD::SQLite Search::Xapian PublicInbox::DS)) { +foreach my $mod (qw(DBD::SQLite Search::Xapian)) { eval "require $mod"; plan skip_all => "$mod missing for nntp.t" if $@; } diff --git a/t/nntpd.t b/t/nntpd.t index ecfd74f7..ec0a621c 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -3,7 +3,7 @@ use strict; use warnings; use Test::More; -foreach my $mod (qw(DBD::SQLite Search::Xapian PublicInbox::DS)) { +foreach my $mod (qw(DBD::SQLite Search::Xapian)) { eval "require $mod"; plan skip_all => "$mod missing for nntpd.t" if $@; } @@ -12,7 +12,7 @@ require PublicInbox::Msgmap; use Cwd; use Email::Simple; use IO::Socket; -use Socket qw(SO_KEEPALIVE IPPROTO_TCP TCP_NODELAY); +use Socket qw(IPPROTO_TCP TCP_NODELAY); use File::Temp qw/tempdir/; use Net::NNTP; use Sys::Hostname; diff --git a/t/v2mirror.t b/t/v2mirror.t index eaf9e61d..441e36d7 100644 --- a/t/v2mirror.t +++ b/t/v2mirror.t @@ -7,7 +7,7 @@ require './t/common.perl'; require_git(2.6); # Integration tests for HTTP cloning + mirroring -foreach my $mod (qw(Plack::Util Plack::Builder PublicInbox::DS +foreach my $mod (qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status Search::Xapian DBD::SQLite IPC::Run)) { eval "require $mod"; diff --git a/t/v2writable.t b/t/v2writable.t index 75110155..5f34d127 100644 --- a/t/v2writable.t +++ b/t/v2writable.t @@ -127,12 +127,9 @@ if ('ensure git configs are correct') { 'same document') if ($mset1->size); } -SKIP: { +{ use Net::NNTP; - use IO::Socket; - use Socket qw(SO_KEEPALIVE IPPROTO_TCP TCP_NODELAY); - eval { require PublicInbox::DS }; - skip "PublicInbox::DS missing $@", 2 if $@; + use IO::Socket::INET; my $err = "$mainrepo/stderr.log"; my $out = "$mainrepo/stdout.log"; my %opts = ( -- 2.44.0