about summary refs log tree commit homepage
path: root/lib/PublicInbox/TestCommon.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-12-13 00:50:07 +0000
committerEric Wong <e@80x24.org>2023-12-13 09:01:47 +0000
commit68c2233c74cd47bd37fb554a4f4bf54667334ea3 (patch)
tree717e02adf2dc382e91dd764dc1d7273523cf5de5 /lib/PublicInbox/TestCommon.pm
parent1f70373f1fe951959eadf1f311152b0131d07303 (diff)
downloadpublic-inbox-68c2233c74cd47bd37fb554a4f4bf54667334ea3.tar.gz
Alpine Linux ships git-http-backend in the `git-daemon'
package separately from `git', so we must test for its
existence before attempting to test functionality which
depends on it.
Diffstat (limited to 'lib/PublicInbox/TestCommon.pm')
-rw-r--r--lib/PublicInbox/TestCommon.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index d587bf10..27a758e4 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -25,7 +25,7 @@ BEGIN {
                 run_script start_script key2sub xsys xsys_e xqx eml_load tick
                 have_xapian_compact json_utf8 setup_public_inboxes create_inbox
                 create_coderepo require_bsd kernel_version check_broken_tmpfs
-                quit_waiter_pipe wait_for_eof
+                quit_waiter_pipe wait_for_eof require_git_http_backend
                 tcp_host_port test_lei lei lei_ok $lei_out $lei_err $lei_opt
                 test_httpd xbail require_cmd is_xdeeply tail_f
                 ignore_inline_c_missing no_pollerfd no_coredump cfg_new
@@ -163,6 +163,23 @@ sub require_git ($;$) {
                 skip("git $req+ required (have $cur_ver), skipping $nr tests")
 }
 
+sub require_git_http_backend (;$) {
+        my ($nr) = @_;
+        state $ok = do {
+                require PublicInbox::Git;
+                my $git = PublicInbox::Git::check_git_exe() or plan
+                        skip_all => 'nothing in public-inbox works w/o git';
+                my $rdr = { 1 => \my $out, 2 => \my $err };
+                xsys([$git, qw(http-backend)], undef, $rdr);
+                $out =~ /^Status:/ism;
+        };
+        if (!$ok) {
+                my $msg = "`git http-backend' not available";
+                defined($nr) ? skip $msg, $nr : plan skip_all => $msg;
+        }
+        $ok;
+}
+
 my %IPv6_VERSION = (
         'Net::NNTP' => 3.00,
         'Mail::IMAPClient' => 3.40,