use warnings;
use Test::More;
use PublicInbox::TestCommon;
+use PublicInbox::Spawn qw(which);
require_mods(qw(DBD::SQLite));
-require PublicInbox::SearchIdx;
-require PublicInbox::Msgmap;
require PublicInbox::InboxWritable;
-use Email::Simple;
+use PublicInbox::MIME;
use IO::Socket;
use Socket qw(IPPROTO_TCP TCP_NODELAY);
use Net::NNTP;
my @cmd = ('-init', $group, $inboxdir, 'http://example.com/', $addr);
push @cmd, "-V$version", '-Lbasic';
ok(run_script(\@cmd), 'init OK');
- is(system(qw(git config), "--file=$home/.public-inbox/config",
+ is(xsys(qw(git config), "--file=$home/.public-inbox/config",
"publicinbox.$group.newsgroup", $group),
0, 'enabled newsgroup');
my $len;
# ensure successful message delivery
{
- my $mime = Email::MIME->new(<<EOF);
+ my $mime = PublicInbox::MIME->new(<<EOF);
To: =?utf-8?Q?El=C3=A9anor?= <you\@example.com>
From: =?utf-8?Q?El=C3=A9anor?= <me\@example.com>
Cc: $addr
$im->add($mime);
$im->done;
if ($version == 1) {
- my $s = PublicInbox::SearchIdx->new($ibx, 1);
- $s->index_sync;
+ ok(run_script(['-index', $ibx->{inboxdir}]),
+ 'indexed v1');
}
}
$im->add($for_leafnode);
$im->done;
if ($version == 1) {
- my $s = PublicInbox::SearchIdx->new($ibx, 1);
- $s->index_sync;
+ ok(run_script(['-index', $ibx->{inboxdir}]),
+ 'indexed v1');
}
my $hdr = $n->head("<$long_hdr>");
my $expect = qr/\AMessage-ID: /i . qr/\Q<$long_hdr>\E/;
if ($INC{'Search/Xapian.pm'} && ($ENV{TEST_RUN_MODE}//2)) {
skip 'Search/Xapian.pm pre-loaded (by t/run.perl?)', 1;
}
- my @of = `lsof -p $td->{pid} 2>/dev/null`;
+ my $lsof = which('lsof') or skip 'lsof missing', 1;
+ my $rdr = { 2 => \(my $null) };
+ my @of = xqx([$lsof, '-p', $td->{pid}], undef, $rdr);
skip('lsof broken', 1) if (!scalar(@of) || $?);
my @xap = grep m!Search/Xapian!, @of;
is_deeply(\@xap, [], 'Xapian not loaded in nntpd');
$n = $s = undef;
$td->join;
- my $eout = eval {
- local $/;
+ is($?, 0, 'no error in exited process');
+ my $eout = do {
open my $fh, '<', $err or die "open $err failed: $!";
+ local $/;
<$fh>;
};
- is($?, 0, 'no error in exited process');
unlike($eout, qr/wide/i, 'no Wide character warnings');
}