From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 43A9D1F487 for ; Fri, 1 Dec 2023 02:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1701396426; bh=gkmso8cYWj9TTn/2rLOVZHB3oMi6OPg0HPauXiTiwoI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oMB5Ffj/74S0wKE0XIq/oxI0dwsHdn2kOMthiDuDUnvdlSDGqXn2vfXZVZCblYCp8 4b3sBP2dHwySEB49Fqz48uORkUQHaI0cVjnA3F6LQm5tBEWkMm9Uu4rB6tpM5a7Cmw imt7NxN3LEHrx8jKzWoTiw3PGTsYuWLzz2OZUwHI= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/4] tests: note kevent+tmpfs failures on DragonFly <= 6.4 Date: Fri, 1 Dec 2023 02:07:04 +0000 Message-ID: <20231201020705.2752562-4-e@80x24.org> In-Reply-To: <20231201020705.2752562-1-e@80x24.org> References: <20231201020705.2752562-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: I forgot to set TMPDIR=/path/to/non-tmpfs again. --- lib/PublicInbox/TestCommon.pm | 23 ++++++++++++++++++++++- t/dir_idle.t | 7 +++++-- t/kqnotify.t | 2 +- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 8e7eb950..f2914d09 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -24,7 +24,7 @@ BEGIN { @EXPORT = qw(tmpdir tcp_server tcp_connect require_git require_mods run_script start_script key2sub xsys xsys_e xqx eml_load tick have_xapian_compact json_utf8 setup_public_inboxes create_inbox - create_coderepo require_bsd + create_coderepo require_bsd kernel_version check_broken_tmpfs quit_waiter_pipe wait_for_eof tcp_host_port test_lei lei lei_ok $lei_out $lei_err $lei_opt test_httpd xbail require_cmd is_xdeeply tail_f @@ -37,6 +37,27 @@ BEGIN { push @EXPORT, @methods; } +sub kernel_version () { + state $version = do { + require POSIX; + my @u = POSIX::uname(); + if ($u[2] =~ /\A([0-9]+(?:\.[0-9]+)+)/) { + eval "v$1"; + } else { + local $" = "', `"; + diag "Unable to get kernel version from: `@u'"; + undef; + } + }; +} + +sub check_broken_tmpfs () { + return if $^O ne 'dragonfly' || kernel_version ge v6.5; + diag 'EVFILT_VNODE + tmpfs is broken on dragonfly <= 6.4 (have: '. + sprintf('%vd', kernel_version).')'; + 1; +} + sub require_bsd (;$) { state $ok = ($^O =~ m!\A(?:free|net|open)bsd\z! || $^O eq 'dragonfly'); diff --git a/t/dir_idle.t b/t/dir_idle.t index 14aad7a1..8d085d6e 100644 --- a/t/dir_idle.t +++ b/t/dir_idle.t @@ -16,10 +16,12 @@ my $end = 3 + now; local @PublicInbox::DS::post_loop_do = (sub { scalar(@x) == 0 && now < $end }); rmdir("$tmpdir/a/b") or xbail "rmdir $!"; PublicInbox::DS::event_loop(); -is(scalar(@x), 1, 'got an rmdir event') or xbail explain(\@x); -if (@x) { +if (is(scalar(@x), 1, 'got an rmdir event')) { is($x[0]->[0]->fullname, "$tmpdir/a/b", 'got expected fullname') and ok($x[0]->[0]->IN_DELETE, 'IN_DELETE set'); +} else { + check_broken_tmpfs; + xbail explain(\@x); } rmdir("$tmpdir/a") or xbail "rmdir $!"; @@ -30,6 +32,7 @@ if (is(scalar(@x), 1, 'got an event after rmdir')) { is($x[0]->[0]->fullname, "$tmpdir/a", 'got expected fullname') and ok($x[0]->[0]->IN_DELETE_SELF, 'IN_DELETE_SELF set'); } else { + check_broken_tmpfs; diag explain(\@x); } rename("$tmpdir/c", "$tmpdir/j") or xbail "rmdir $!"; diff --git a/t/kqnotify.t b/t/kqnotify.t index cf32b633..add477a4 100644 --- a/t/kqnotify.t +++ b/t/kqnotify.t @@ -62,6 +62,6 @@ is_xdeeply($hit, \@unlink, 'unlinked files match'); # this is unreliable on Dragonfly tmpfs (fixed post-6.4) rmdir "$tmpdir/new"; $hit = [ sort(map { $_->fullname } $kqn->read) ]; -is(scalar(@$hit), 1, 'detected self removal'); +is(scalar(@$hit), 1, 'detected self removal') or check_broken_tmpfs; done_testing;