From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/4] t/inbox_idle: delay for low-res FS w/o inotify||kqueue
Date: Mon, 11 Nov 2024 21:56:53 +0000 [thread overview]
Message-ID: <20241111215656.2411957-2-e@80x24.org> (raw)
In-Reply-To: <20241111215656.2411957-1-e@80x24.org>
On systems without inotify||kqueue, changes are unreliably
detected on filesystems with low-resolution timestamps. The
FakeInotify emulation can't detect changes properly in all
cases. While this remains a problem for real-world use cases,
systems w/o inotify or IO::KQueue are probably rare, so we'll
just change this test case to accomodate old FSes which lack
high resolution timestamps.
Keep in mind that mounting an old FS on a modern kernel doesn't
automatically give it high-resolution timestamps. I discovered
this problem because I still use an ancient ext3 FS created
decades ago on a modern kernel :x
---
t/inbox_idle.t | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/t/inbox_idle.t b/t/inbox_idle.t
index 0ccffab7..94f3845c 100644
--- a/t/inbox_idle.t
+++ b/t/inbox_idle.t
@@ -9,6 +9,11 @@ require PublicInbox::SearchIdx;
use_ok 'PublicInbox::InboxIdle';
my ($tmpdir, $for_destroy) = tmpdir();
+# for non-inotify|kqueue systems w/ low-res FS timestamps
+# This only makes the test work, but either high-res FS timestamps
+# or inotify or kqueue support needs to be added to your system.
+my $poll_delay = 1;
+
for my $V (1, 2) {
my $inboxdir = "$tmpdir/$V";
my $ibx = create_inbox "idle$V", tmpdir => $inboxdir, version => $V,
@@ -35,16 +40,21 @@ EOF
my $ii = PublicInbox::InboxIdle->new($pi_cfg);
ok($ii, 'InboxIdle created');
SKIP: {
- skip('inotify or kqueue missing', 1) unless $ii->{sock};
+ $ii->{sock} or skip
+'inotify or kqueue missing, expect real-world breakage on low-res FSes', 1;
ok(fileno($ii->{sock}) >= 0, 'fileno() gave valid FD');
+ $poll_delay = 0;
}
my $im = $ibx->importer(0);
ok($im->add(eml_load('t/utf8.eml')), "$V added");
+ tick $poll_delay if $poll_delay;
$im->done;
$ii->event_step;
- is(scalar @{$obj->{called}}, 1, 'called on unlock');
+ is(scalar @{$obj->{called}}, 1, 'called on unlock') or
+ diag explain($obj);
$pi_cfg->each_inbox(sub { shift->unsubscribe_unlock($ident) });
ok($im->add(eml_load('t/data/0001.patch')), "$V added #2");
+ tick $poll_delay if $poll_delay;
$im->done;
$ii->event_step;
is(scalar @{$obj->{called}}, 1, 'not called when unsubbed');
next prev parent reply other threads:[~2024-11-11 21:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-11 21:56 [PATCH 0/4] another round of small fixes Eric Wong
2024-11-11 21:56 ` Eric Wong [this message]
2024-11-11 21:56 ` [PATCH 2/4] t/spawn: increase timeout for slow systems Eric Wong
2024-11-11 21:56 ` [PATCH 3/4] import: avoid uninitialized comparison on failures Eric Wong
2024-11-11 21:56 ` [PATCH 4/4] view: avoid uninitialized var from diff query textarea Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241111215656.2411957-2-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).