about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-12-28 04:23:00 +0000
committerEric Wong <e@80x24.org>2023-12-29 16:56:08 +0000
commitcf977e706b07e80f394570a393eb2169b9b9a1a7 (patch)
treecaa1a8a4cad1ec89e59658fc088a3b5054dbf58a /t
parent84874a852c80e3d4eb96af14c017b37424cdf840 (diff)
downloadpublic-inbox-cf977e706b07e80f394570a393eb2169b9b9a1a7.tar.gz
This is a step towards improving the out-of-the-box experience
in achieving notifications without XS, extra downloads, and .so
loading + runtime mmap overhead.

This also fixes loongarch support of all Linux syscalls due to
a bad regexp :x

All the reachable Linux architectures listed at
<https://portal.cfarm.net/machines/list/> should be supported.
At the moment, there appears to be no reachable sparc* Linux
machines available to cfarm users.

Fixes: b0e5093aa3572a86 (syscall: add support for riscv64, 2022-08-11)
Diffstat (limited to 't')
-rw-r--r--t/imapd.t2
-rw-r--r--t/inotify3.t17
-rw-r--r--t/lei-auto-watch.t4
-rw-r--r--t/lei-watch.t4
-rw-r--r--t/nntpd.t2
-rw-r--r--t/watch_maildir.t2
6 files changed, 24 insertions, 7 deletions
diff --git a/t/imapd.t b/t/imapd.t
index 9606291e..549b8766 100644
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -250,7 +250,7 @@ SKIP: {
 
 ok($mic->logout, 'logout works');
 
-my $have_inotify = eval { require Linux::Inotify2; 1 };
+my $have_inotify = eval { require PublicInbox::Inotify; 1 };
 
 for my $ibx (@ibx) {
         my $name = $ibx->{name};
diff --git a/t/inotify3.t b/t/inotify3.t
new file mode 100644
index 00000000..c25c0f42
--- /dev/null
+++ b/t/inotify3.t
@@ -0,0 +1,17 @@
+#!perl -w
+# Copyright (C) all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+use v5.12; use PublicInbox::TestCommon;
+plan skip_all => 'inotify is Linux-only' if $^O ne 'linux';
+use_ok 'PublicInbox::Inotify3';
+my $in = PublicInbox::Inotify3->new;
+my $tmpdir = tmpdir;
+my $w = $in->watch("$tmpdir", PublicInbox::Inotify3::IN_ALL_EVENTS());
+$in->blocking(0);
+is_xdeeply [ $in->read ], [], 'non-blocking has no events, yet';
+undef $tmpdir;
+my @list = $in->read;
+ok scalar(@list), 'got events';
+ok $w->cancel, 'watch canceled';
+
+done_testing;
diff --git a/t/lei-auto-watch.t b/t/lei-auto-watch.t
index f871188d..1e190316 100644
--- a/t/lei-auto-watch.t
+++ b/t/lei-auto-watch.t
@@ -4,10 +4,10 @@
 use strict; use v5.10.1; use PublicInbox::TestCommon;
 use File::Basename qw(basename);
 plan skip_all => "TEST_FLAKY not enabled for $0" if !$ENV{TEST_FLAKY};
-my $have_fast_inotify = eval { require Linux::Inotify2 } ||
+my $have_fast_inotify = eval { require PublicInbox::Inotify } ||
         eval { require IO::KQueue };
 $have_fast_inotify or
-        diag("$0 IO::KQueue or Linux::Inotify2 missing, test will be slow");
+        diag("$0 IO::KQueue or inotify missing, test will be slow");
 
 test_lei(sub {
         my ($ro_home, $cfg_path) = setup_public_inboxes;
diff --git a/t/lei-watch.t b/t/lei-watch.t
index 24d9f5c8..7b357ee0 100644
--- a/t/lei-watch.t
+++ b/t/lei-watch.t
@@ -5,11 +5,11 @@ use strict; use v5.10.1; use PublicInbox::TestCommon;
 use File::Path qw(make_path remove_tree);
 plan skip_all => "TEST_FLAKY not enabled for $0" if !$ENV{TEST_FLAKY};
 require_mods('lei');
-my $have_fast_inotify = eval { require Linux::Inotify2 } ||
+my $have_fast_inotify = eval { require PublicInbox::Inotify } ||
         eval { require IO::KQueue };
 
 $have_fast_inotify or
-        diag("$0 IO::KQueue or Linux::Inotify2 missing, test will be slow");
+        diag("$0 IO::KQueue or inotify missing, test will be slow");
 
 my ($ro_home, $cfg_path) = setup_public_inboxes;
 test_lei(sub {
diff --git a/t/nntpd.t b/t/nntpd.t
index 0f3ef596..7052cb6a 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -14,7 +14,7 @@ use PublicInbox::DS;
 my $version = $ENV{PI_TEST_VERSION} || 1;
 require_git('2.6') if $version == 2;
 use_ok 'PublicInbox::Msgmap';
-my $fast_idle = eval { require Linux::Inotify2; 1 } //
+my $fast_idle = eval { require PublicInbox::Inotify; 1 } //
                 eval { require IO::KQueue; 1 };
 
 my ($tmpdir, $for_destroy) = tmpdir();
diff --git a/t/watch_maildir.t b/t/watch_maildir.t
index 07ebeef6..d7f01b1a 100644
--- a/t/watch_maildir.t
+++ b/t/watch_maildir.t
@@ -182,7 +182,7 @@ EOM
 
         # wait for -watch to setup inotify watches
         my $sleep = 1;
-        if (eval { require Linux::Inotify2 } && -d "/proc/$wm->{pid}/fd") {
+        if (eval { require PublicInbox::Inotify } && -d "/proc/$wm->{pid}/fd") {
                 my $end = time + 2;
                 my (@ino, @ino_info);
                 do {