diff options
author | Eric Wong <e@80x24.org> | 2023-09-08 00:49:20 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-09-08 10:38:39 +0000 |
commit | aa03dc3427e1b9a0c19b2fe0639ad5e53c37ac7a (patch) | |
tree | cfbfa5c57d21bb2f2b382bb9d7cbb21d0f18e398 /t/dir_idle.t | |
parent | d1e1605a4de96de2a5ba2c17b4bc183b83f57905 (diff) | |
download | public-inbox-aa03dc3427e1b9a0c19b2fe0639ad5e53c37ac7a.tar.gz |
KQNotify is now a subclass of FakeInotify since they're both faking a subset of inotify; and both require directory scanning via readdir() to detect new/deleted files. ctime is no longer used with per-file stat to detect new files with kevent. That proved too unreliable either due to low time resolution of the NetBSD/OpenBSD VFS and/or Time::HiRes::stat being constrained by floating point to represent `struct timespec', so instead we fuzz the time a bit if the ctime is recent and merely compare filenames off readdir. This fixes t/fake_inotify.t and t/kqnotify.t failures under NetBSD and also removes workarounds for OpenBSD in t/kqnotify.t. It also allows us to to remove delays in tests by being more aggressive in picking up new/deleted files in watch directories by adjusting the time to scan if the ctime is recent. This ought to may improve real-world reliability on all *BSDs regardless of whether IO::KQueue is installed.
Diffstat (limited to 't/dir_idle.t')
-rw-r--r-- | t/dir_idle.t | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/t/dir_idle.t b/t/dir_idle.t index 50e1dd27..9e66cc58 100644 --- a/t/dir_idle.t +++ b/t/dir_idle.t @@ -14,14 +14,12 @@ $di->add_watches(["$tmpdir/a", "$tmpdir/c"], 1); PublicInbox::DS->SetLoopTimeout(1000); my $end = 3 + now; local @PublicInbox::DS::post_loop_do = (sub { scalar(@x) == 0 && now < $end }); -tick(0.011); rmdir("$tmpdir/a/b") or xbail "rmdir $!"; PublicInbox::DS::event_loop(); -is(scalar(@x), 1, 'got an event') and +is(scalar(@x), 1, 'got an rmdir event') and is($x[0]->[0]->fullname, "$tmpdir/a/b", 'got expected fullname') and ok($x[0]->[0]->IN_DELETE, 'IN_DELETE set'); -tick(0.011); rmdir("$tmpdir/a") or xbail "rmdir $!"; @x = (); $end = 3 + now; @@ -30,7 +28,6 @@ is(scalar(@x), 1, 'got an event') and is($x[0]->[0]->fullname, "$tmpdir/a", 'got expected fullname') and ok($x[0]->[0]->IN_DELETE_SELF, 'IN_DELETE_SELF set'); -tick(0.011); rename("$tmpdir/c", "$tmpdir/j") or xbail "rmdir $!"; @x = (); $end = 3 + now; |