-# Copyright (C) 2015-2019 all contributors <meta@public-inbox.org>
+# Copyright (C) 2015-2020 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use warnings;
use Test::More;
-my @mods = qw(DBI DBD::SQLite Search::Xapian);
-foreach my $mod (@mods) {
- eval "require $mod";
- plan skip_all => "missing $mod for $0" if $@;
-};
+use PublicInbox::TestCommon;
+require_mods(qw(DBD::SQLite Search::Xapian));
require PublicInbox::SearchIdx;
require PublicInbox::Inbox;
-use File::Temp qw/tempdir/;
use Email::MIME;
-my $tmpdir = tempdir('pi-search-XXXXXX', TMPDIR => 1, CLEANUP => 1);
+my ($tmpdir, $for_destroy) = tmpdir();
my $git_dir = "$tmpdir/a.git";
my $ibx = PublicInbox::Inbox->new({ inboxdir => $git_dir });
my ($root_id, $last_id);
my $mset = $ro->query('t:list@example.com', {mset => 1});
is($mset->size, 6, 'searched To: successfully');
foreach my $m ($mset->items) {
- my $smsg = $ro->lookup_article($m->get_docid);
+ my $smsg = $ro->{over_ro}->get_art($m->get_docid);
like($smsg->to, qr/\blist\@example\.com\b/, 'to appears');
}
$mset = $ro->query('tc:list@example.com', {mset => 1});
is($mset->size, 6, 'searched To+Cc: successfully');
foreach my $m ($mset->items) {
- my $smsg = $ro->lookup_article($m->get_docid);
+ my $smsg = $ro->{over_ro}->get_art($m->get_docid);
my $tocc = join("\n", $smsg->to, $smsg->cc);
like($tocc, qr/\blist\@example\.com\b/, 'tocc appears');
}
my $mset = $ro->query($pfx . 'foo@example.com', { mset => 1 });
is($mset->items, 1, "searched $pfx successfully for Cc:");
foreach my $m ($mset->items) {
- my $smsg = $ro->lookup_article($m->get_docid);
+ my $smsg = $ro->{over_ro}->get_art($m->get_docid);
like($smsg->cc, qr/\bfoo\@example\.com\b/,
'cc appears');
}
}
$rw->unindex_blob($amsg);
$rw->commit_txn_lazy;
- is($ro->lookup_article($art->{num}), undef, 'gone from OVER DB') if defined($art);
+ SKIP: {
+ skip('$art not defined', 1) unless defined $art;
+ is($ro->{over_ro}->get_art($art->{num}), undef,
+ 'gone from OVER DB');
+ };
});
my $all_mask = 07777;
my $dir_mask = 02770;
-# FreeBSD does not allow non-root users to set S_ISGID, so
-# git doesn't set it, either (see DIR_HAS_BSD_GROUP_SEMANTICS in git.git)
-if ($^O =~ /freebsd/i) {
+# FreeBSD and apparently OpenBSD does not allow non-root users to set S_ISGID,
+# so git doesn't set it, either (see DIR_HAS_BSD_GROUP_SEMANTICS in git.git)
+if ($^O =~ /(?:free|open)bsd/i) {
$all_mask = 0777;
$dir_mask = 0770;
}