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 7FA2C1FC0B for ; Wed, 24 Mar 2021 09:23:36 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 7/9] v2writable: cleanup SQLite handles on --xapian-only Date: Wed, 24 Mar 2021 14:23:33 +0500 Message-Id: <20210324092335.12345-8-e@80x24.org> In-Reply-To: <20210324092335.12345-1-e@80x24.org> References: <20210324092335.12345-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: I'm not sure exactly why this is needed with run_script localizing %SIG and everything else, but explictly cleaning up seems to fix the occasional test failures I see. Followup-to: 4c6c853494b49368 ("tests: show lsof output on deleted-file-check failures") --- lib/PublicInbox/V2Writable.pm | 1 + t/v2reindex.t | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 03590850..4130a472 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -1323,6 +1323,7 @@ sub xapian_only { } } $self->git->cat_async_wait; + $self->{ibx}->cleanup; $self->done; } diff --git a/t/v2reindex.t b/t/v2reindex.t index 1145e31b..e9f2b73b 100644 --- a/t/v2reindex.t +++ b/t/v2reindex.t @@ -549,5 +549,13 @@ my $env = { PI_CONFIG => '/dev/null' }; ok(run_script([qw(-index --reindex --xapian-only), $inboxdir], $env, $rdr), '--xapian-only works'); is($err, '', 'no errors from --xapian-only'); - +undef $for_destroy; +SKIP: { + use PublicInbox::Spawn qw(which); + skip 'only testing lsof(8) output on Linux', 1 if $^O ne 'linux'; + my $lsof = which('lsof') or skip 'no lsof in PATH', 1; + my $rdr = { 2 => \(my $null_err) }; + my @d = grep(m!/xap[0-9]+/!, xqx([$lsof, '-p', $$], undef, $rdr)); + is_deeply(\@d, [], 'no deleted index files') or diag explain(\@d); +} done_testing();