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,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF 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 16C001F520 for ; Fri, 30 Sep 2022 09:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1664529701; bh=FIGz6917Ul+cbLkNJ1FsPEtOSuDL5sjr+tASuNRsS/0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mz86dtwaALIHfx/dfWbFnDmwlA92+u2SpkU2vd+96vp0K1dyyHKjyhE0+N547Uvhd lEL/x7BTgtu3CwnUzCCLcg+Vx5ag1n5UZibwVU8h3SO4nNIVtUTeTUvEjTe2f1rIdr VA/pWZt1iAX1WSRIReARg5JoU6o03qHXGrr8uo04= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/4] t/lei-up: improve diagnostics for this test Date: Fri, 30 Sep 2022 09:21:38 +0000 Message-Id: <20220930092140.3894047-3-e@80x24.org> In-Reply-To: <20220930092140.3894047-1-e@80x24.org> References: <20220930092140.3894047-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: I'm getting occasional failures for this test on CentOS 7.x (but not on FreeBSD nor Debian 10/11). I'm not why, yet, so just improve diagnostics for now. --- t/lei-up.t | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/t/lei-up.t b/t/lei-up.t index 022ebc05..baed6507 100644 --- a/t/lei-up.t +++ b/t/lei-up.t @@ -5,39 +5,50 @@ use strict; use v5.10.1; use PublicInbox::TestCommon; use IO::Uncompress::Gunzip qw(gunzip $GunzipError); test_lei(sub { my ($ro_home, $cfg_path) = setup_public_inboxes; - my $s = eml_load('t/plack-qp.eml')->as_string; + my $home = $ENV{HOME}; + my $qp = eml_load('t/plack-qp.eml'); + my $s = $qp->as_string; lei_ok [qw(import -q -F eml -)], undef, { 0 => \$s, %$lei_opt }; - lei_ok qw(q z:0.. -f mboxcl2 -o), "$ENV{HOME}/a.mbox.gz"; - lei_ok qw(q z:0.. -f mboxcl2 -o), "$ENV{HOME}/b.mbox.gz"; - lei_ok qw(q z:0.. -f mboxcl2 -o), "$ENV{HOME}/a"; - lei_ok qw(q z:0.. -f mboxcl2 -o), "$ENV{HOME}/b"; + lei_ok qw(q z:0.. -f mboxcl2 -o), "$home/a.mbox.gz"; + lei_ok qw(q z:0.. -f mboxcl2 -o), "$home/b.mbox.gz"; + lei_ok qw(q z:0.. -f mboxcl2 -o), "$home/a"; + lei_ok qw(q z:0.. -f mboxcl2 -o), "$home/b"; + my $uc; + for my $x (qw(a b)) { + gunzip("$home/$x.mbox.gz" => \$uc, MultiStream => 1) or + xbail "gunzip $GunzipError"; + ok(index($uc, $qp->body_raw) >= 0, + "original mail in $x.mbox.gz"); + open my $fh, '<', "$home/$x" or xbail $!; + $uc = do { local $/; <$fh> } // xbail $!; + ok(index($uc, $qp->body_raw) >= 0, + "original mail in uncompressed $x"); + } lei_ok qw(ls-search); $s = eml_load('t/utf8.eml')->as_string; lei_ok [qw(import -q -F eml -)], undef, { 0 => \$s, %$lei_opt }; lei_ok qw(up --all=local); - open my $fh, '<', "$ENV{HOME}/a.mbox.gz" or xbail "open: $!"; - my $gz = do { local $/; <$fh> }; - my $uc; - gunzip(\$gz => \$uc, MultiStream => 1) or xbail "gunzip $GunzipError"; - open $fh, '<', "$ENV{HOME}/a" or xbail "open: $!"; + gunzip("$home/a.mbox.gz" => \$uc, MultiStream => 1) or + xbail "gunzip $GunzipError"; + + open my $fh, '<', "$home/a" or xbail "open: $!"; my $exp = do { local $/; <$fh> }; is($uc, $exp, 'compressed and uncompressed match (a.gz)'); like($exp, qr/testmessage\@example.com/, '2nd message added'); - open $fh, '<', "$ENV{HOME}/b.mbox.gz" or xbail "open: $!"; - $gz = do { local $/; <$fh> }; undef $uc; - gunzip(\$gz => \$uc, MultiStream => 1) or xbail "gunzip $GunzipError"; + gunzip("$home/b.mbox.gz" => \$uc, MultiStream => 1) or + xbail "gunzip $GunzipError"; is($uc, $exp, 'compressed and uncompressed match (b.gz)'); - open $fh, '<', "$ENV{HOME}/b" or xbail "open: $!"; + open $fh, '<', "$home/b" or xbail "open: $!"; $uc = do { local $/; <$fh> }; is($uc, $exp, 'uncompressed both match'); - lei_ok [ qw(up -q), "$ENV{HOME}/b", "--mua=touch $ENV{HOME}/c" ], + lei_ok [ qw(up -q), "$home/b", "--mua=touch $home/c" ], undef, { run_mode => 0 }; - ok(-f "$ENV{HOME}/c", '--mua works with single output'); + ok(-f "$home/c", '--mua works with single output'); }); done_testing;