X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fsearch.t;h=3213ac2a9051a8b7c2b6f929ac2db08c78296646;hb=95bdac7f09c69036efed537a4d03d5bdd2ae4eb6;hp=a728d79f77aa725355f9eaa8da4f1d9fc269adaa;hpb=845d45f8b1c33a4b5fb559101ca53238b4dfc1aa;p=public-inbox.git diff --git a/t/search.t b/t/search.t index a728d79f..3213ac2a 100644 --- a/t/search.t +++ b/t/search.t @@ -1,20 +1,16 @@ -# Copyright (C) 2015-2019 all contributors +# Copyright (C) 2015-2020 all contributors # License: AGPL-3.0+ 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({ mainrepo => $git_dir }); +my $ibx = PublicInbox::Inbox->new({ inboxdir => $git_dir }); my ($root_id, $last_id); is(0, system(qw(git init --shared -q --bare), $git_dir), "git init (main)") @@ -323,14 +319,14 @@ $ibx->with_umask(sub { 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'); } @@ -339,7 +335,7 @@ $ibx->with_umask(sub { 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'); } @@ -436,15 +432,19 @@ $ibx->with_umask(sub { } $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; }