We no longer depend on it for the core code, and tests
are optional for users. Hopefully this makes this
easier-to-install.
- Email::MIME libemail-mime-perl
- Email::MIME::ContentType libemail-mime-contenttype-perl
- Encode::MIME::Header perl
- Email::MIME libemail-mime-perl
- Email::MIME::ContentType libemail-mime-contenttype-perl
- Encode::MIME::Header perl
- - IPC::Run libipc-run-perl
'Email::MIME::ContentType' => 0,
'Email::Simple' => 0,
'Encode::MIME::Header' => 0,
'Email::MIME::ContentType' => 0,
'Email::Simple' => 0,
'Encode::MIME::Header' => 0,
'Mail::Thread' => '2.5', # 2.5+ needed for Email::Simple compat
'Plack' => 0,
'URI::Escape' => 0,
'Mail::Thread' => '2.5', # 2.5+ needed for Email::Simple compat
'Plack' => 0,
'URI::Escape' => 0,
use Email::MIME;
use File::Temp qw/tempdir/;
use Cwd;
use Email::MIME;
use File::Temp qw/tempdir/;
use Cwd;
+eval { require IPC::Run };
+plan skip_all => "missing IPC::Run for t/cgi.t" if $@;
use constant CGI => "blib/script/public-inbox.cgi";
my $index = "blib/script/public-inbox-index";
use constant CGI => "blib/script/public-inbox.cgi";
my $index = "blib/script/public-inbox-index";
sub run_with_env {
my ($env, @args) = @_;
my $init = sub { foreach my $k (keys %$env) { $ENV{$k} = $env->{$k} } };
sub run_with_env {
my ($env, @args) = @_;
my $init = sub { foreach my $k (keys %$env) { $ENV{$k} = $env->{$k} } };
- run(@args, init => $init);
+ IPC::Run::run(@args, init => $init);
use Email::MIME;
use File::Temp qw/tempdir/;
use Cwd;
use Email::MIME;
use File::Temp qw/tempdir/;
use Cwd;
use PublicInbox::MID qw(mid2path);
use PublicInbox::MID qw(mid2path);
+eval { require IPC::Run };
+plan skip_all => "missing IPC::Run for t/mda.t" if $@;
my $mda = "blib/script/public-inbox-mda";
my $learn = "blib/script/public-inbox-learn";
my $mda = "blib/script/public-inbox-mda";
my $learn = "blib/script/public-inbox-learn";
# ensure successful message delivery
{
local $ENV{PATH} = $main_path;
# ensure successful message delivery
{
local $ENV{PATH} = $main_path;
+ IPC::Run::run([$mda], \$in);
my $rev = `git --git-dir=$maindir rev-list HEAD`;
like($rev, qr/\A[a-f0-9]{40}/, "good revision committed");
chomp $rev;
my $rev = `git --git-dir=$maindir rev-list HEAD`;
like($rev, qr/\A[a-f0-9]{40}/, "good revision committed");
chomp $rev;
my @prev = <$faildir/new/*>;
is(scalar @prev, 0 , "nothing in PI_EMERGENCY before");
local $ENV{PATH} = $fail_path;
my @prev = <$faildir/new/*>;
is(scalar @prev, 0 , "nothing in PI_EMERGENCY before");
local $ENV{PATH} = $fail_path;
+ IPC::Run::run([$mda], \$in);
my @revs = `git --git-dir=$maindir rev-list HEAD`;
is(scalar @revs, 1, "bad revision not committed");
my @new = <$faildir/new/*>;
my @revs = `git --git-dir=$maindir rev-list HEAD`;
is(scalar @revs, 1, "bad revision not committed");
my @new = <$faildir/new/*>;
{
# deliver the spam message, first
{
# deliver the spam message, first
+ IPC::Run::run([$mda], \$in);
my $path = mid2path($mid);
my $msg = `git --git-dir=$maindir cat-file blob HEAD:$path`;
like($msg, qr/\Q$mid\E/, "message delivered");
my $path = mid2path($mid);
my $msg = `git --git-dir=$maindir cat-file blob HEAD:$path`;
like($msg, qr/\Q$mid\E/, "message delivered");
# now train it
local $ENV{GIT_AUTHOR_EMAIL} = 'trainer@example.com';
local $ENV{GIT_COMMITTER_EMAIL} = 'trainer@example.com';
# now train it
local $ENV{GIT_AUTHOR_EMAIL} = 'trainer@example.com';
local $ENV{GIT_COMMITTER_EMAIL} = 'trainer@example.com';
- run([$learn, "spam"], \$msg);
+ IPC::Run::run([$learn, "spam"], \$msg);
is($?, 0, "no failure from learning spam");
is($?, 0, "no failure from learning spam");
- run([$learn, "spam"], \$msg);
+ IPC::Run::run([$learn, "spam"], \$msg);
is($?, 0, "no failure from learning spam idempotently");
}
}
is($?, 0, "no failure from learning spam idempotently");
}
}
local $ENV{GIT_AUTHOR_EMAIL} = 'trainer@example.com';
local $ENV{GIT_COMMITTER_EMAIL} = 'trainer@example.com';
local $ENV{GIT_AUTHOR_EMAIL} = 'trainer@example.com';
local $ENV{GIT_COMMITTER_EMAIL} = 'trainer@example.com';
- run([$learn, "ham"], \$in);
+ IPC::Run::run([$learn, "ham"], \$in);
is($?, 0, "learned ham without failure");
my $path = mid2path($mid);
my $msg = `git --git-dir=$maindir cat-file blob HEAD:$path`;
like($msg, qr/\Q$mid\E/, "ham message delivered");
is($?, 0, "learned ham without failure");
my $path = mid2path($mid);
my $msg = `git --git-dir=$maindir cat-file blob HEAD:$path`;
like($msg, qr/\Q$mid\E/, "ham message delivered");
- run([$learn, "ham"], \$in);
+ IPC::Run::run([$learn, "ham"], \$in);
is($?, 0, "learned ham idempotently ");
# ensure trained email is filtered, too
is($?, 0, "learned ham idempotently ");
# ensure trained email is filtered, too
{
$in = $mime->as_string;
{
$in = $mime->as_string;
- run([$learn, "ham"], \$in);
+ IPC::Run::run([$learn, "ham"], \$in);
is($?, 0, "learned ham without failure");
my $path = mid2path($mid);
$msg = `git --git-dir=$maindir cat-file blob HEAD:$path`;
is($?, 0, "learned ham without failure");
my $path = mid2path($mid);
$msg = `git --git-dir=$maindir cat-file blob HEAD:$path`;
unlink @f if @f;
my ($out, $err) = ("", "");
local $ENV{PATH} = $main_path;
unlink @f if @f;
my ($out, $err) = ("", "");
local $ENV{PATH} = $main_path;
- run([$mda], \$in, \$out, \$err);
+ IPC::Run::run([$mda], \$in, \$out, \$err);
my $rev = `git --git-dir=$maindir rev-list HEAD`;
chomp $rev;
is($rev, $good_rev, "bad revision not commited ($msg)");
my $rev = `git --git-dir=$maindir rev-list HEAD`;
chomp $rev;
is($rev, $good_rev, "bad revision not commited ($msg)");