From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id F3A591F8C8 for ; Sat, 25 Sep 2021 03:21:02 +0000 (UTC) Date: Sat, 25 Sep 2021 03:21:01 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 6/5] t/v2mirror: check dependencies for legacy test Message-ID: References: <20210924105645.8627-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210924105645.8627-1-e@80x24.org> List-Id: We still need Email::MIME to test against old revisions. We'll also depend on the revision just prior to the manifest.js.gz introduction to avoid loading Danga::Socket, since it was getting loaded even with `plackup'. Finally, we'll disable Inline::C usage with old Spawn.pm since our old code included alloca.h, which is not portable to FreeBSD. --- t/v2mirror.t | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/t/v2mirror.t b/t/v2mirror.t index a625646d..63d17ebf 100644 --- a/t/v2mirror.t +++ b/t/v2mirror.t @@ -315,23 +315,26 @@ if ('test read-only epoch dirs') { } my $err = ''; -my $v110 = xqx([qw(git rev-parse v1.1.0-pre1)], undef, { 2 => \$err }); +my $oldrev = '0b3e19584c90d958a723ac2d3dec3f84f5513688~1'; +# 3e0e596105198cfa (wwwlisting: allow hiding entries from manifest, 2019-06-09) +$oldrev = xqx([qw(git rev-parse), $oldrev], undef, { 2 => \$err }); SKIP: { skip("no detected public-inbox GIT_DIR ($err)", 1) if $?; + require_mods('Email::MIME', 1); # for legacy revision # using plackup to test old PublicInbox::WWW since -httpd from # back then relied on some packages we no longer depend on my $plackup = which('plackup') or skip('no plackup in path', 1); require PublicInbox::Lock; - chomp $v110; + chomp $oldrev; my ($base) = ($0 =~ m!\b([^/]+)\.[^\.]+\z!); - my $wt = "t/data-gen/$base.pre-manifest"; + my $wt = "t/data-gen/$base.pre-manifest-$oldrev"; my $lk = bless { lock_path => __FILE__ }, 'PublicInbox::Lock'; $lk->lock_acquire; my $psgi = "$wt/app.psgi"; if (!-f $psgi) { # checkout a pre-manifest.js.gz version my $t = File::Temp->new(TEMPLATE => 'g-XXXX', TMPDIR => 1); my $env = { GIT_INDEX_FILE => $t->filename }; - xsys([qw(git read-tree), $v110], $env) and xbail 'read-tree'; + xsys([qw(git read-tree), $oldrev], $env) and xbail 'read-tree'; xsys([qw(git checkout-index -a), "--prefix=$wt/"], $env) and xbail 'checkout-index'; my $f = "$wt/app.psgi.tmp.$$"; @@ -353,7 +356,8 @@ EOM $td->join('TERM'); open $rdr->{2}, '>>', "$tmpdir/plackup.err.log" or xbail "open: $!"; open $rdr->{1}, '>>&', $rdr->{2} or xbail "open: $!"; - $td = start_script($cmd, { PERL5LIB => 'lib' }, $rdr); + my $env = { PERL5LIB => 'lib', PERL_INLINE_DIRECTORY => undef }; + $td = start_script($cmd, $env, $rdr); # wait for plackup socket()+bind()+listen() my %opt = ( Proto => 'tcp', Type => Socket::SOCK_STREAM(), PeerAddr => "$host:$port" ); @@ -363,7 +367,7 @@ EOM } my $dst = "$tmpdir/scrape"; @cmd = (qw(-clone -q), "http://$host:$port/v2", $dst); - run_script(\@cmd, undef, { 2 => \(my $err = '') }); + run_script(\@cmd, undef, { 2 => \($err = '') }); is($?, 0, 'scraping clone on old PublicInbox::WWW') or diag $err; my @g_all = glob("$dst/git/*.git");