about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-05-14 03:32:03 +0000
committerEric Wong <e@80x24.org>2019-05-14 04:00:10 +0000
commit2d51a2accd28465c915f91ab48c7e52a81d87a68 (patch)
tree06c8ca7d3d4cf015f5dc548438b859cd31cd29b9
parent1f4b022c38faba208528d0d5c993d569682b2a09 (diff)
downloadpublic-inbox-2d51a2accd28465c915f91ab48c7e52a81d87a68.tar.gz
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
-rw-r--r--t/admin.t1
-rw-r--r--t/cgi.t1
-rw-r--r--t/git.t5
-rw-r--r--t/httpd-corner.t3
-rw-r--r--t/httpd-unix.t3
-rw-r--r--t/httpd.t1
-rw-r--r--t/mda.t2
-rw-r--r--t/nntpd.t1
-rw-r--r--t/solver_git.t2
-rw-r--r--t/spamcheck_spamc.t1
10 files changed, 7 insertions, 13 deletions
diff --git a/t/admin.t b/t/admin.t
index cc1e65d1..b5a4383e 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 aedd79ef..b24bbc4a 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 5b612b8e..7edf82b4 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 bfa39205..7c219943 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 2ef64dfc..758277c9 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 d55495ff..c061031c 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 5dbcec63..966600a8 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 ec0a621c..b8a84a0c 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 6f0ce777..0b7d7c49 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 7016e8bf..70de14b6 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/;