about summary refs log tree commit homepage
path: root/t/mda_filter_rubylang.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-11-15 09:50:49 +0000
committerEric Wong <e@80x24.org>2019-11-16 11:05:23 +0000
commit6e87113aa054e00a1e0976eea10322ca12ace4cb (patch)
tree3c3c540b507338be13470100121783b73a61037f /t/mda_filter_rubylang.t
parent2508b31ae64719d826c6c99f16a7b91376671fa5 (diff)
downloadpublic-inbox-6e87113aa054e00a1e0976eea10322ca12ace4cb.tar.gz
This test runs more than twice as fast, now.
Diffstat (limited to 't/mda_filter_rubylang.t')
-rw-r--r--t/mda_filter_rubylang.t17
1 files changed, 8 insertions, 9 deletions
diff --git a/t/mda_filter_rubylang.t b/t/mda_filter_rubylang.t
index f7d872c9..e971b440 100644
--- a/t/mda_filter_rubylang.t
+++ b/t/mda_filter_rubylang.t
@@ -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);