use warnings;
use Test::More;
use PublicInbox::Spawn qw(which);
-use File::Temp qw/tempdir/;
-require './t/common.perl';
+use PublicInbox::TestCommon;
my @mods = qw(URI::Escape Plack::Builder Digest::SHA
IO::Compress::Gzip IO::Uncompress::Gunzip HTTP::Tiny);
foreach my $mod (@mods) {
use_ok 'PublicInbox::Git';
-my $tmpdir = tempdir('www_listing-tmp-XXXXXX', TMPDIR => 1, CLEANUP => 1);
+my ($tmpdir, $for_destroy) = tmpdir();
my $bare = PublicInbox::Git->new("$tmpdir/bare.git");
is(system(qw(git init -q --bare), $bare->{git_dir}), 0, 'git init --bare');
is(PublicInbox::WwwListing::fingerprint($bare), undef,
'got fingerprint with non-empty repo');
sub tiny_test {
- my ($host, $port) = @_;
+ my ($json, $host, $port) = @_;
my $http = HTTP::Tiny->new;
my $res = $http->get("http://$host:$port/manifest.js.gz");
is($res->{status}, 200, 'got manifest');
'epoch 1 in description');
}
-my $pid;
-END { kill 'TERM', $pid if defined $pid };
+my $td;
SKIP: {
my $err = "$tmpdir/stderr.log";
my $out = "$tmpdir/stdout.log";
my $alt = "$tmpdir/alt.git";
my $cfgfile = "$tmpdir/config";
my $v2 = "$tmpdir/v2";
- my $httpd = 'blib/script/public-inbox-httpd';
my $sock = tcp_server();
ok($sock, 'sock created');
my ($host, $port) = ($sock->sockhost, $sock->sockport);
close $fh or die;
my $env = { PI_CONFIG => $cfgfile };
- my $cmd = [ $httpd, "--stdout=$out", "--stderr=$err" ];
- $pid = spawn_listener($env, $cmd, [$sock]);
+ my $cmd = [ '-httpd', '-W0', "--stdout=$out", "--stderr=$err" ];
+ $td = start_script($cmd, $env, { 3 => $sock });
$sock = undef;
- tiny_test($host, $port);
+ tiny_test($json, $host, $port);
skip 'skipping grok-pull integration test', 2 if !which('grok-pull');