From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/4] tests: remove unnecessary loading of ::DS and Socket
Date: Tue, 14 May 2019 03:32:00 +0000 [thread overview]
Message-ID: <20190514033203.6160-2-e@80x24.org> (raw)
In-Reply-To: <20190514033203.6160-1-e@80x24.org>
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 b616e82..5ac0a4a 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 49c5d1f..bfa3920 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 627adfa..2ef64df 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 45cbcbf..d55495f 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 c39a05f..47b1442 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 ecfd74f..ec0a621 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 eaf9e61..441e36d 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 7511015..5f34d12 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 = (
--
EW
next prev parent reply other threads:[~2019-05-14 3:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 3:31 [PATCH 0/4] test loading cleanups Eric Wong
2019-05-14 3:32 ` Eric Wong [this message]
2019-05-14 3:32 ` [PATCH 2/4] t/config.t: remove Data::Dumper dependency Eric Wong
2019-05-14 3:32 ` [PATCH 3/4] t/nntp.t: skip if Data::Dumper is missing Eric Wong
2019-05-14 3:32 ` [PATCH 4/4] tests: get rid of unnecessary Cwd module use Eric Wong
2019-05-14 4:02 ` [PATCH v2 " Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190514033203.6160-2-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).