X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FTestCommon.pm;h=abf4f3642b00c0fa57ef5163c8d2676cc6d35d53;hb=e95fbe90accedf079f3ddbd1df8e267e2fe90c2e;hp=333791b4cd5d9d5d858572866fdd343e572f1e66;hpb=1e7cc8849b56ec96a16fda97921e1612cedc01a3;p=public-inbox.git diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 333791b4..abf4f364 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -743,11 +743,14 @@ sub create_inbox ($$;@) { $ibx; } -sub test_httpd ($$;$) { - my ($env, $client, $skip) = @_; - for (qw(PI_CONFIG TMPDIR)) { - $env->{$_} or BAIL_OUT "$_ unset"; - } +sub test_httpd ($$;$$) { + my ($env, $client, $skip, $cb) = @_; + my ($tmpdir, $for_destroy); + $env->{TMPDIR} //= do { + ($tmpdir, $for_destroy) = tmpdir(); + $tmpdir; + }; + for (qw(PI_CONFIG)) { $env->{$_} or BAIL_OUT "$_ unset" } SKIP: { require_mods(qw(Plack::Test::ExternalServer LWP::UserAgent), $skip // 1); @@ -761,6 +764,7 @@ sub test_httpd ($$;$) { $ua->max_redirect(0); Plack::Test::ExternalServer::test_psgi(client => $client, ua => $ua); + $cb->() if $cb; $td->join('TERM'); open my $fh, '<', $err or BAIL_OUT $!; my $e = do { local $/; <$fh> };