diff options
Diffstat (limited to 't/lei-mirror.t')
-rw-r--r-- | t/lei-mirror.t | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/t/lei-mirror.t b/t/lei-mirror.t index 32a5b039..76041b73 100644 --- a/t/lei-mirror.t +++ b/t/lei-mirror.t @@ -1,10 +1,12 @@ #!perl -w -# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org> +# Copyright (C) all contributors <meta@public-inbox.org> # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> -use strict; use v5.10.1; use PublicInbox::TestCommon; +use v5.12; use PublicInbox::TestCommon; use PublicInbox::Inbox; require_mods(qw(-httpd lei DBD::SQLite)); require_cmd('curl'); +require_git_http_backend; +use PublicInbox::Spawn qw(which); require PublicInbox::Msgmap; my $sock = tcp_server(); my ($tmpdir, $for_destroy) = tmpdir(); @@ -22,9 +24,16 @@ test_lei({ tmpdir => $tmpdir }, sub { lei_ok('add-external', $t1, '--mirror', "$http/t1/", \'--mirror v1'); my $mm_dup = "$t1/public-inbox/msgmap.sqlite3"; ok(-f $mm_dup, 't1-mirror indexed'); - is(PublicInbox::Inbox::try_cat("$t1/description"), + is(PublicInbox::IO::try_cat("$t1/description"), "mirror of $http/t1/\n", 'description set'); ok(-f "$t1/Makefile", 'convenience Makefile added (v1)'); + SKIP: { + my $make = require_cmd('make', 1); + delete local @ENV{qw(MFLAGS MAKEFLAGS MAKELEVEL)}; + is(xsys([$make, 'help'], undef, { -C => $t1, 1 => \(my $help) }), + 0, "$make handled Makefile without errors"); + isnt($help, '', 'make help worked'); + } ok(-f "$t1/inbox.config.example", 'inbox.config.example downloaded'); is((stat(_))[9], $created{v1}, 'inbox.config.example mtime is ->created_at'); @@ -43,7 +52,7 @@ test_lei({ tmpdir => $tmpdir }, sub { ok(-f $mm_dup, 't2-mirror indexed'); ok(-f "$t2/description", 't2 description'); ok(-f "$t2/Makefile", 'convenience Makefile added (v2)'); - is(PublicInbox::Inbox::try_cat("$t2/description"), + is(PublicInbox::IO::try_cat("$t2/description"), "mirror of $http/t2/\n", 'description set'); $tb = PublicInbox::Msgmap->new_file($mm_dup)->created_at; is($tb, $created{v2}, 'created_at matched in v2 mirror'); @@ -199,14 +208,14 @@ $td->join; my $exp = "mirror of https://example.com/src/\n"; my $f = "$tmpdir/description"; PublicInbox::LeiMirror::set_description($mrr); - is(PublicInbox::Inbox::try_cat($f), $exp, 'description set on ENOENT'); + is(PublicInbox::IO::try_cat($f), $exp, 'description set on ENOENT'); my $fh; (open($fh, '>', $f) and close($fh)) or xbail $!; PublicInbox::LeiMirror::set_description($mrr); - is(PublicInbox::Inbox::try_cat($f), $exp, 'description set on empty'); + is(PublicInbox::IO::try_cat($f), $exp, 'description set on empty'); (open($fh, '>', $f) and print $fh "x\n" and close($fh)) or xbail $!; - is(PublicInbox::Inbox::try_cat($f), "x\n", + is(PublicInbox::IO::try_cat($f), "x\n", 'description preserved if non-default'); } |