* [PATCH 0/4] test loading cleanups
@ 2019-05-14 3:31 7% Eric Wong
2019-05-14 3:32 5% ` [PATCH 1/4] tests: remove unnecessary loading of ::DS and Socket Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-05-14 3:31 UTC (permalink / raw)
To: meta
We definitely don't need to check for ::DS usability anymore
now that we've bundled and forked Danga::Socket.
I also noticed Data::Dumper is a separate package on CentOS-7;
but it's a dependency of Test::Simple, already. We were also
overusing Cwd::getcwd in some areas... and may still be...
Anyways, this saves a few milliseconds here and there and
tests are now slightly faster on my slow laptop, "make check"
goes from 51s to 49s :>
Eric Wong (4):
tests: remove unnecessary loading of ::DS and Socket
t/config.t: remove Data::Dumper dependency
t/nntp.t: skip if Data::Dumper is missing
tests: get rid of unnecessary Cwd module use
t/admin.t | 1 -
t/cgi.t | 1 -
t/config.t | 12 +++++++-----
t/git-http-backend.t | 10 ++++------
t/git.t | 5 ++---
t/httpd-corner.t | 9 ++++-----
t/httpd-unix.t | 6 ++----
t/httpd.t | 7 ++-----
t/mda.t | 2 +-
t/nntp.t | 5 ++---
t/nntpd.t | 5 ++---
t/solver_git.t | 2 --
t/spamcheck_spamc.t | 1 -
t/v2mirror.t | 2 +-
t/v2writable.t | 7 ++-----
15 files changed, 29 insertions(+), 46 deletions(-)
--
EW
^ permalink raw reply [relevance 7%]
* [PATCH 1/4] tests: remove unnecessary loading of ::DS and Socket
2019-05-14 3:31 7% [PATCH 0/4] test loading cleanups Eric Wong
@ 2019-05-14 3:32 5% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-05-14 3:32 UTC (permalink / raw)
To: meta
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
^ permalink raw reply related [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-05-14 3:31 7% [PATCH 0/4] test loading cleanups Eric Wong
2019-05-14 3:32 5% ` [PATCH 1/4] tests: remove unnecessary loading of ::DS and Socket Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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).