* [PATCH 0/4] test loading cleanups @ 2019-05-14 3:31 Eric Wong 2019-05-14 3:32 ` [PATCH 1/4] tests: remove unnecessary loading of ::DS and Socket Eric Wong ` (3 more replies) 0 siblings, 4 replies; 6+ messages in thread 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 [flat|nested] 6+ messages in thread
* [PATCH 1/4] tests: remove unnecessary loading of ::DS and Socket 2019-05-14 3:31 [PATCH 0/4] test loading cleanups Eric Wong @ 2019-05-14 3:32 ` Eric Wong 2019-05-14 3:32 ` [PATCH 2/4] t/config.t: remove Data::Dumper dependency Eric Wong ` (2 subsequent siblings) 3 siblings, 0 replies; 6+ messages in thread 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 [flat|nested] 6+ messages in thread
* [PATCH 2/4] t/config.t: remove Data::Dumper dependency 2019-05-14 3:31 [PATCH 0/4] test loading cleanups Eric Wong 2019-05-14 3:32 ` [PATCH 1/4] tests: remove unnecessary loading of ::DS and Socket Eric Wong @ 2019-05-14 3:32 ` 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 3 siblings, 0 replies; 6+ messages in thread From: Eric Wong @ 2019-05-14 3:32 UTC (permalink / raw) To: meta CentOS-7 needs the perl-Data-Dumper package, and the test is small enough to roll our own escaping, here. --- t/config.t | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/t/config.t b/t/config.t index ad738bd..f0c274b 100644 --- a/t/config.t +++ b/t/config.t @@ -127,10 +127,13 @@ my @invalid = ( ); -require Data::Dumper; +my %X = ("\0" => '\\0', "\b" => '\\b', "\f" => '\\f', "'" => "\\'"); +my $xre = join('|', keys %X); + for my $s (@invalid) { - my $d = Data::Dumper->new([$s])->Terse(1)->Indent(0)->Dump; - ok(!PublicInbox::Config::valid_inbox_name($s), "$d name rejected"); + my $d = $s; + $d =~ s/($xre)/$X{$1}/g; + ok(!PublicInbox::Config::valid_inbox_name($s), "`$d' name rejected"); } # obviously-valid examples @@ -146,8 +149,7 @@ my @valid = qw(a a@example a@example.com); # '!', '$', '=', '+' push @valid, qw[bang! ca$h less< more> 1% (parens) &more eql= +plus], '#hash'; for my $s (@valid) { - my $d = Data::Dumper->new([$s])->Terse(1)->Indent(0)->Dump; - ok(PublicInbox::Config::valid_inbox_name($s), "$d name accepted"); + ok(PublicInbox::Config::valid_inbox_name($s), "`$s' name accepted"); } { -- EW ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] t/nntp.t: skip if Data::Dumper is missing 2019-05-14 3:31 [PATCH 0/4] test loading cleanups Eric Wong 2019-05-14 3:32 ` [PATCH 1/4] tests: remove unnecessary loading of ::DS and Socket Eric Wong 2019-05-14 3:32 ` [PATCH 2/4] t/config.t: remove Data::Dumper dependency Eric Wong @ 2019-05-14 3:32 ` Eric Wong 2019-05-14 3:32 ` [PATCH 4/4] tests: get rid of unnecessary Cwd module use Eric Wong 3 siblings, 0 replies; 6+ messages in thread From: Eric Wong @ 2019-05-14 3:32 UTC (permalink / raw) To: meta We can revisit this, later; but Data::Dumper requires a separate package for CentOS-7 users, at least. --- t/nntp.t | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/t/nntp.t b/t/nntp.t index 47b1442..c4b9737 100644 --- a/t/nntp.t +++ b/t/nntp.t @@ -3,9 +3,8 @@ use strict; use warnings; use Test::More; -use Data::Dumper; -foreach my $mod (qw(DBD::SQLite Search::Xapian)) { +foreach my $mod (qw(DBD::SQLite Search::Xapian Data::Dumper)) { eval "require $mod"; plan skip_all => "$mod missing for nntp.t" if $@; } @@ -15,7 +14,7 @@ use_ok 'PublicInbox::Inbox'; { sub quote_str { - my (undef, $s) = split(/ = /, Dumper($_[0]), 2); + my (undef, $s) = split(/ = /, Data::Dumper::Dumper($_[0]), 2); $s =~ s/;\n//; $s; } -- EW ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] tests: get rid of unnecessary Cwd module use 2019-05-14 3:31 [PATCH 0/4] test loading cleanups Eric Wong ` (2 preceding siblings ...) 2019-05-14 3:32 ` [PATCH 3/4] t/nntp.t: skip if Data::Dumper is missing Eric Wong @ 2019-05-14 3:32 ` Eric Wong 2019-05-14 4:02 ` [PATCH v2 " Eric Wong 3 siblings, 1 reply; 6+ messages in thread From: Eric Wong @ 2019-05-14 3:32 UTC (permalink / raw) To: meta We only need it for tests that chdir, and maybe for ENV{PATH} portability (dash seems fine, not sure about others). --- t/admin.t | 1 - t/cgi.t | 1 - t/git.t | 5 ++--- t/httpd-corner.t | 3 +-- t/httpd-unix.t | 3 +-- t/httpd.t | 1 - t/mda.t | 2 +- t/nntpd.t | 1 - t/solver_git.t | 2 -- t/spamcheck_spamc.t | 1 - 10 files changed, 5 insertions(+), 15 deletions(-) diff --git a/t/admin.t b/t/admin.t index cc1e65d..b5a4383 100644 --- a/t/admin.t +++ b/t/admin.t @@ -4,7 +4,6 @@ use strict; use warnings; use Test::More; use File::Temp qw(tempdir); -# use Cwd qw(getcwd); use_ok 'PublicInbox::Admin', qw(resolve_repo_dir); my $tmpdir = tempdir('pi-admin.XXXXXX', TMPDIR => 1, CLEANUP => 1); my $git_dir = "$tmpdir/v1"; diff --git a/t/cgi.t b/t/cgi.t index aedd79e..b24bbc4 100644 --- a/t/cgi.t +++ b/t/cgi.t @@ -7,7 +7,6 @@ use warnings; use Test::More; use Email::MIME; use File::Temp qw/tempdir/; -use Cwd; eval { require IPC::Run }; plan skip_all => "missing IPC::Run for t/cgi.t" if $@; diff --git a/t/git.t b/t/git.t index 5b612b8..7edf82b 100644 --- a/t/git.t +++ b/t/git.t @@ -5,7 +5,6 @@ use warnings; use Test::More; use File::Temp qw/tempdir/; my $dir = tempdir('pi-git-XXXXXX', TMPDIR => 1, CLEANUP => 1); -use Cwd qw/getcwd/; use PublicInbox::Spawn qw(popen_rd); eval { require IPC::Run } or plan skip_all => 'IPC::Run missing'; @@ -15,7 +14,7 @@ use_ok 'PublicInbox::Git'; is(system(qw(git init -q --bare), $dir), 0, 'created git directory'); my $cmd = [ 'git', "--git-dir=$dir", 'fast-import', '--quiet' ]; - my $fi_data = getcwd().'/t/git.fast-import-data'; + my $fi_data = './t/git.fast-import-data'; ok(-r $fi_data, "fast-import data readable (or run test at top level)"); IPC::Run::run($cmd, '<', $fi_data); is($?, 0, 'fast-import succeeded'); @@ -68,7 +67,7 @@ if (1) { my $cmd = [ 'git', "--git-dir=$dir", qw(hash-object -w --stdin) ]; # need a big file, use the AGPL-3.0 :p - my $big_data = getcwd().'/COPYING'; + my $big_data = './COPYING'; ok(-r $big_data, 'COPYING readable'); my $size = -s $big_data; ok($size > 8192, 'file is big enough'); diff --git a/t/httpd-corner.t b/t/httpd-corner.t index bfa3920..7c21994 100644 --- a/t/httpd-corner.t +++ b/t/httpd-corner.t @@ -15,7 +15,6 @@ foreach my $mod (qw(Plack::Util Plack::Builder use Digest::SHA qw(sha1_hex); use File::Temp qw/tempdir/; -use Cwd qw/getcwd/; use IO::Socket; use IO::Socket::UNIX; use Fcntl qw(:seek); @@ -28,7 +27,7 @@ ok(defined mkfifo($fifo, 0777), 'created FIFO'); my $err = "$tmpdir/stderr.log"; my $out = "$tmpdir/stdout.log"; my $httpd = 'blib/script/public-inbox-httpd'; -my $psgi = getcwd()."/t/httpd-corner.psgi"; +my $psgi = "./t/httpd-corner.psgi"; my %opts = ( LocalAddr => '127.0.0.1', ReuseAddr => 1, diff --git a/t/httpd-unix.t b/t/httpd-unix.t index 2ef64df..758277c 100644 --- a/t/httpd-unix.t +++ b/t/httpd-unix.t @@ -12,11 +12,10 @@ foreach my $mod (qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status)) { use File::Temp qw/tempdir/; use IO::Socket::UNIX; -use Cwd qw/getcwd/; my $tmpdir = tempdir('httpd-unix-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $unix = "$tmpdir/unix.sock"; my $httpd = 'blib/script/public-inbox-httpd'; -my $psgi = getcwd() . '/t/httpd-corner.psgi'; +my $psgi = './t/httpd-corner.psgi'; my $out = "$tmpdir/out.log"; my $err = "$tmpdir/err.log"; diff --git a/t/httpd.t b/t/httpd.t index d55495f..c061031 100644 --- a/t/httpd.t +++ b/t/httpd.t @@ -9,7 +9,6 @@ foreach my $mod (qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status)) { plan skip_all => "$mod missing for httpd.t" if $@; } use File::Temp qw/tempdir/; -use Cwd qw/getcwd/; use IO::Socket::INET; require './t/common.perl'; diff --git a/t/mda.t b/t/mda.t index 5dbcec6..966600a 100644 --- a/t/mda.t +++ b/t/mda.t @@ -5,7 +5,7 @@ use warnings; use Test::More; use Email::MIME; use File::Temp qw/tempdir/; -use Cwd; +use Cwd qw(getcwd); use PublicInbox::MID qw(mid2path); eval { require IPC::Run }; plan skip_all => "missing IPC::Run for t/mda.t" if $@; diff --git a/t/nntpd.t b/t/nntpd.t index ec0a621..b8a84a0 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -9,7 +9,6 @@ foreach my $mod (qw(DBD::SQLite Search::Xapian)) { } require PublicInbox::SearchIdx; require PublicInbox::Msgmap; -use Cwd; use Email::Simple; use IO::Socket; use Socket qw(IPPROTO_TCP TCP_NODELAY); diff --git a/t/solver_git.t b/t/solver_git.t index 6f0ce77..5e0d132 100644 --- a/t/solver_git.t +++ b/t/solver_git.t @@ -4,7 +4,6 @@ use strict; use warnings; use Test::More; use File::Temp qw(tempdir); -use Cwd qw(abs_path); require './t/common.perl'; require_git(2.6); @@ -16,7 +15,6 @@ foreach my $mod (@mods) { } chomp(my $git_dir = `git rev-parse --git-dir 2>/dev/null`); plan skip_all => "$0 must be run from a git working tree" if $?; -$git_dir = abs_path($git_dir); use_ok "PublicInbox::$_" for (qw(Inbox V2Writable MIME Git SolverGit)); diff --git a/t/spamcheck_spamc.t b/t/spamcheck_spamc.t index 7016e8b..70de14b 100644 --- a/t/spamcheck_spamc.t +++ b/t/spamcheck_spamc.t @@ -3,7 +3,6 @@ use strict; use warnings; use Test::More; -use Cwd; use Email::Simple; use IO::File; use File::Temp qw/tempdir/; -- EW ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 4/4] tests: get rid of unnecessary Cwd module use 2019-05-14 3:32 ` [PATCH 4/4] tests: get rid of unnecessary Cwd module use Eric Wong @ 2019-05-14 4:02 ` Eric Wong 0 siblings, 0 replies; 6+ messages in thread From: Eric Wong @ 2019-05-14 4:02 UTC (permalink / raw) To: meta We only need it for tests that chdir, and maybe for ENV{PATH} portability (dash seems fine, not sure about others). v2: revert change to solver_git.t for FreeBSD 11.2 and document --- Interdiff: diff --git a/t/solver_git.t b/t/solver_git.t index 5e0d132..0b7d7c4 100644 --- a/t/solver_git.t +++ b/t/solver_git.t @@ -4,6 +4,7 @@ use strict; use warnings; use Test::More; use File::Temp qw(tempdir); +use Cwd qw(abs_path); require './t/common.perl'; require_git(2.6); @@ -16,6 +17,9 @@ foreach my $mod (@mods) { chomp(my $git_dir = `git rev-parse --git-dir 2>/dev/null`); plan skip_all => "$0 must be run from a git working tree" if $?; +# needed for alternates, and --absolute-git-dir is only in git 2.13+ +$git_dir = abs_path($git_dir); + use_ok "PublicInbox::$_" for (qw(Inbox V2Writable MIME Git SolverGit)); my $mainrepo = tempdir('pi-solver-XXXXXX', TMPDIR => 1, CLEANUP => 1); t/admin.t | 1 - t/cgi.t | 1 - t/git.t | 5 ++--- t/httpd-corner.t | 3 +-- t/httpd-unix.t | 3 +-- t/httpd.t | 1 - t/mda.t | 2 +- t/nntpd.t | 1 - t/solver_git.t | 2 ++ t/spamcheck_spamc.t | 1 - 10 files changed, 7 insertions(+), 13 deletions(-) diff --git a/t/admin.t b/t/admin.t index cc1e65d..b5a4383 100644 --- a/t/admin.t +++ b/t/admin.t @@ -4,7 +4,6 @@ use strict; use warnings; use Test::More; use File::Temp qw(tempdir); -# use Cwd qw(getcwd); use_ok 'PublicInbox::Admin', qw(resolve_repo_dir); my $tmpdir = tempdir('pi-admin.XXXXXX', TMPDIR => 1, CLEANUP => 1); my $git_dir = "$tmpdir/v1"; diff --git a/t/cgi.t b/t/cgi.t index aedd79e..b24bbc4 100644 --- a/t/cgi.t +++ b/t/cgi.t @@ -7,7 +7,6 @@ use warnings; use Test::More; use Email::MIME; use File::Temp qw/tempdir/; -use Cwd; eval { require IPC::Run }; plan skip_all => "missing IPC::Run for t/cgi.t" if $@; diff --git a/t/git.t b/t/git.t index 5b612b8..7edf82b 100644 --- a/t/git.t +++ b/t/git.t @@ -5,7 +5,6 @@ use warnings; use Test::More; use File::Temp qw/tempdir/; my $dir = tempdir('pi-git-XXXXXX', TMPDIR => 1, CLEANUP => 1); -use Cwd qw/getcwd/; use PublicInbox::Spawn qw(popen_rd); eval { require IPC::Run } or plan skip_all => 'IPC::Run missing'; @@ -15,7 +14,7 @@ use_ok 'PublicInbox::Git'; is(system(qw(git init -q --bare), $dir), 0, 'created git directory'); my $cmd = [ 'git', "--git-dir=$dir", 'fast-import', '--quiet' ]; - my $fi_data = getcwd().'/t/git.fast-import-data'; + my $fi_data = './t/git.fast-import-data'; ok(-r $fi_data, "fast-import data readable (or run test at top level)"); IPC::Run::run($cmd, '<', $fi_data); is($?, 0, 'fast-import succeeded'); @@ -68,7 +67,7 @@ if (1) { my $cmd = [ 'git', "--git-dir=$dir", qw(hash-object -w --stdin) ]; # need a big file, use the AGPL-3.0 :p - my $big_data = getcwd().'/COPYING'; + my $big_data = './COPYING'; ok(-r $big_data, 'COPYING readable'); my $size = -s $big_data; ok($size > 8192, 'file is big enough'); diff --git a/t/httpd-corner.t b/t/httpd-corner.t index bfa3920..7c21994 100644 --- a/t/httpd-corner.t +++ b/t/httpd-corner.t @@ -15,7 +15,6 @@ foreach my $mod (qw(Plack::Util Plack::Builder use Digest::SHA qw(sha1_hex); use File::Temp qw/tempdir/; -use Cwd qw/getcwd/; use IO::Socket; use IO::Socket::UNIX; use Fcntl qw(:seek); @@ -28,7 +27,7 @@ ok(defined mkfifo($fifo, 0777), 'created FIFO'); my $err = "$tmpdir/stderr.log"; my $out = "$tmpdir/stdout.log"; my $httpd = 'blib/script/public-inbox-httpd'; -my $psgi = getcwd()."/t/httpd-corner.psgi"; +my $psgi = "./t/httpd-corner.psgi"; my %opts = ( LocalAddr => '127.0.0.1', ReuseAddr => 1, diff --git a/t/httpd-unix.t b/t/httpd-unix.t index 2ef64df..758277c 100644 --- a/t/httpd-unix.t +++ b/t/httpd-unix.t @@ -12,11 +12,10 @@ foreach my $mod (qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status)) { use File::Temp qw/tempdir/; use IO::Socket::UNIX; -use Cwd qw/getcwd/; my $tmpdir = tempdir('httpd-unix-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $unix = "$tmpdir/unix.sock"; my $httpd = 'blib/script/public-inbox-httpd'; -my $psgi = getcwd() . '/t/httpd-corner.psgi'; +my $psgi = './t/httpd-corner.psgi'; my $out = "$tmpdir/out.log"; my $err = "$tmpdir/err.log"; diff --git a/t/httpd.t b/t/httpd.t index d55495f..c061031 100644 --- a/t/httpd.t +++ b/t/httpd.t @@ -9,7 +9,6 @@ foreach my $mod (qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status)) { plan skip_all => "$mod missing for httpd.t" if $@; } use File::Temp qw/tempdir/; -use Cwd qw/getcwd/; use IO::Socket::INET; require './t/common.perl'; diff --git a/t/mda.t b/t/mda.t index 5dbcec6..966600a 100644 --- a/t/mda.t +++ b/t/mda.t @@ -5,7 +5,7 @@ use warnings; use Test::More; use Email::MIME; use File::Temp qw/tempdir/; -use Cwd; +use Cwd qw(getcwd); use PublicInbox::MID qw(mid2path); eval { require IPC::Run }; plan skip_all => "missing IPC::Run for t/mda.t" if $@; diff --git a/t/nntpd.t b/t/nntpd.t index ec0a621..b8a84a0 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -9,7 +9,6 @@ foreach my $mod (qw(DBD::SQLite Search::Xapian)) { } require PublicInbox::SearchIdx; require PublicInbox::Msgmap; -use Cwd; use Email::Simple; use IO::Socket; use Socket qw(IPPROTO_TCP TCP_NODELAY); diff --git a/t/solver_git.t b/t/solver_git.t index 6f0ce77..0b7d7c4 100644 --- a/t/solver_git.t +++ b/t/solver_git.t @@ -16,6 +16,8 @@ foreach my $mod (@mods) { } chomp(my $git_dir = `git rev-parse --git-dir 2>/dev/null`); plan skip_all => "$0 must be run from a git working tree" if $?; + +# needed for alternates, and --absolute-git-dir is only in git 2.13+ $git_dir = abs_path($git_dir); use_ok "PublicInbox::$_" for (qw(Inbox V2Writable MIME Git SolverGit)); diff --git a/t/spamcheck_spamc.t b/t/spamcheck_spamc.t index 7016e8b..70de14b 100644 --- a/t/spamcheck_spamc.t +++ b/t/spamcheck_spamc.t @@ -3,7 +3,6 @@ use strict; use warnings; use Test::More; -use Cwd; use Email::Simple; use IO::File; use File::Temp qw/tempdir/; -- EW ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-05-14 4:02 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-05-14 3:31 [PATCH 0/4] test loading cleanups Eric Wong 2019-05-14 3:32 ` [PATCH 1/4] tests: remove unnecessary loading of ::DS and Socket Eric Wong 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
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).