From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 38CC01FD79 for ; Mon, 15 Mar 2021 11:58:32 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 26/35] t/lei_xsearch: use create_inbox Date: Mon, 15 Mar 2021 12:58:17 +0100 Message-Id: <20210315115826.17591-27-e@80x24.org> In-Reply-To: <20210315115826.17591-1-e@80x24.org> References: <20210315115826.17591-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This ends up being significantly faster when confined to a slow TMPDIR. --- t/lei_xsearch.t | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/t/lei_xsearch.t b/t/lei_xsearch.t index a1ab3ec8..f626c790 100644 --- a/t/lei_xsearch.t +++ b/t/lei_xsearch.t @@ -6,7 +6,6 @@ use v5.10.1; use List::Util qw(shuffle max); use PublicInbox::TestCommon; use PublicInbox::Eml; -use PublicInbox::InboxWritable; require_mods(qw(DBD::SQLite Search::Xapian)); require PublicInbox::ExtSearchIdx; require_git 2.6; @@ -73,26 +72,12 @@ is($lxs->over, undef, '->over fails'); { $lxs = PublicInbox::LeiXSearch->new; - my $v2ibx = PublicInbox::InboxWritable->new({ - inboxdir => "$home/v2full", - name => 'v2full', - version => 2, - indexlevel => 'full', - -primary_address => 'v2full@example.com', - }, {}); - my $im = $v2ibx->importer(0); - $im->add(eml_load('t/plack-qp.eml')); - $im->done; - my $v1ibx = PublicInbox::InboxWritable->new({ - inboxdir => "$home/v1medium", - name => 'v1medium', - version => 1, - indexlevel => 'medium', - -primary_address => 'v1medium@example.com', - }, {}); - $im = $v1ibx->importer(0); - $im->add(eml_load('t/utf8.eml')); - $im->done; + my $v2ibx = create_inbox 'v2full', version => 2, sub { + $_[0]->add(eml_load('t/plack-qp.eml')); + }; + my $v1ibx = create_inbox 'v1medium', indexlevel => 'medium', sub { + $_[0]->add(eml_load('t/utf8.eml')); + }; $lxs->prepare_external($v1ibx); $lxs->prepare_external($v2ibx); for my $loc ($lxs->locals) {