]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/mda_filter_rubylang: drop IPC::Run dependency
authorEric Wong <e@80x24.org>
Fri, 15 Nov 2019 09:50:49 +0000 (09:50 +0000)
committerEric Wong <e@80x24.org>
Sat, 16 Nov 2019 11:05:23 +0000 (11:05 +0000)
This test runs more than twice as fast, now.

t/mda_filter_rubylang.t

index f7d872c9c8d351fa115fde92b8429b9ca824bba0..e971b440def780213a1d83ba505bb616f6cdd944 100644 (file)
@@ -8,7 +8,7 @@ use PublicInbox::MIME;
 use PublicInbox::Config;
 require './t/common.perl';
 require_git(2.6);
-my @mods = qw(DBD::SQLite Search::Xapian IPC::Run);
+my @mods = qw(DBD::SQLite Search::Xapian);
 foreach my $mod (@mods) {
        eval "require $mod";
        plan skip_all => "$mod missing for mda_filter_rubylang.t" if $@;
@@ -19,7 +19,6 @@ my $tmpdir = tempdir('mda-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 my $pi_config = "$tmpdir/pi_config";
 local $ENV{PI_CONFIG} = $pi_config;
 local $ENV{PI_EMERGENCY} = "$tmpdir/emergency";
-my $mda = 'blib/script/public-inbox-mda';
 my @cfg = ('git', 'config', "--file=$pi_config");
 is(system(@cfg, 'publicinboxmda.spamcheck', 'none'), 0);
 
@@ -29,17 +28,17 @@ for my $v (qw(V1 V2)) {
        my $cfgpfx = "publicinbox.$v";
        my $inboxdir = "$tmpdir/$v";
        my $addr = "test-$v\@example.com";
-       my @cmd = ('blib/script/public-inbox-init', "-$v", $v, $inboxdir,
-               "http://example.com/$v", $addr);
-       is(system(@cmd), 0, 'public-inbox init OK');
-       is(system('blib/script/public-inbox-index', $inboxdir), 0);
+       my $cmd = [ '-init', "-$v", $v, $inboxdir,
+               "http://example.com/$v", $addr ];
+       ok(run_script($cmd), 'public-inbox-init');
+       ok(run_script(['-index', $inboxdir]), 'public-inbox-index');
        is(system(@cfg, "$cfgpfx.filter", 'PublicInbox::Filter::RubyLang'), 0);
        is(system(@cfg, "$cfgpfx.altid",
                'serial:alerts:file=msgmap.sqlite3'), 0);
 
        for my $i (1..2) {
-               local $ENV{ORIGINAL_RECIPIENT} = $addr;
-               my $msg = <<EOF;
+               my $env = { ORIGINAL_RECIPIENT => $addr };
+               my $opt = { 0 => \(<<EOF) };
 From: user\@example.com
 To: $addr
 Subject: blah $i
@@ -49,7 +48,7 @@ Date: Sat, 05 Jan 2019 04:19:17 +0000
 
 something
 EOF
-               ok(IPC::Run::run([$mda], \"$msg"), 'message delivered');
+               ok(run_script(['-mda'], $env, $opt), 'message delivered');
        }
        my $config = PublicInbox::Config->new;
        my $ibx = $config->lookup_name($v);