diff options
author | Eric Wong <e@80x24.org> | 2019-11-15 09:50:52 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-11-16 11:05:23 +0000 |
commit | 30f1f693acd184797f3ad20ed6bedef6ee58f567 (patch) | |
tree | fc200b0f251948740dd7853e06c1e892a0d16695 /t | |
parent | 1d409006c6932c2be45dafd826242654cda23c6c (diff) | |
download | public-inbox-30f1f693acd184797f3ad20ed6bedef6ee58f567.tar.gz |
While this didn't use IPC::Run, having to reload several Perl modules and scripts is slow and inefficient, so roughly double the speed of this test.
Diffstat (limited to 't')
-rw-r--r-- | t/convert-compact.t | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/t/convert-compact.t b/t/convert-compact.t index dbccfbad..0661ed14 100644 --- a/t/convert-compact.t +++ b/t/convert-compact.t @@ -62,22 +62,20 @@ foreach (@xdir) { 'sharedRepository respected on file after convert'); } -local $ENV{PATH} = "blib/script:$ENV{PATH}"; local $ENV{PI_CONFIG} = '/dev/null'; -open my $err, '>>', "$tmpdir/err.log" or die "open: err.log $!\n"; -open my $out, '>>', "$tmpdir/out.log" or die "open: out.log $!\n"; -my $rdr = { 1 => fileno($out), 2 => fileno($err) }; +my ($out, $err) = ('', ''); +my $rdr = { 1 => \$out, 2 => \$err }; -my $cmd = [ 'public-inbox-compact', $ibx->{inboxdir} ]; -ok(PublicInbox::Import::run_die($cmd, undef, $rdr), 'v1 compact works'); +my $cmd = [ '-compact', $ibx->{inboxdir} ]; +ok(run_script($cmd, undef, $rdr), 'v1 compact works'); @xdir = glob("$ibx->{inboxdir}/public-inbox/xap*"); is(scalar(@xdir), 1, 'got one xapian directory after compact'); is(((stat($xdir[0]))[2]) & 07777, 0755, 'sharedRepository respected on v1 compact'); -$cmd = [ 'public-inbox-convert', $ibx->{inboxdir}, "$tmpdir/v2" ]; -ok(PublicInbox::Import::run_die($cmd, undef, $rdr), 'convert works'); +$cmd = [ '-convert', $ibx->{inboxdir}, "$tmpdir/v2" ]; +ok(run_script($cmd, undef, $rdr), 'convert works'); @xdir = glob("$tmpdir/v2/xap*/*"); foreach (@xdir) { my @st = stat($_); @@ -85,9 +83,9 @@ foreach (@xdir) { 'sharedRepository respected after convert'); } -$cmd = [ 'public-inbox-compact', "$tmpdir/v2" ]; +$cmd = [ '-compact', "$tmpdir/v2" ]; my $env = { NPROC => 2 }; -ok(PublicInbox::Import::run_die($cmd, $env, $rdr), 'v2 compact works'); +ok(run_script($cmd, $env, $rdr), 'v2 compact works'); $ibx->{inboxdir} = "$tmpdir/v2"; $ibx->{version} = 2; |