diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2026-07-06 12:50:37 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2026-07-06 12:50:37 +0000 |
| commit | b70997c8c75adc3ab343c47d5ba7d01c9c774d9e (patch) | |
| tree | 3173f78799e428e49c9965bab72065ed26cfe547 /tests | |
| parent | 4805b88edb009e53c4fee159138d2cbe0c848da7 (diff) | |
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/sys/kern/inotify_test.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/sys/kern/inotify_test.c b/tests/sys/kern/inotify_test.c index d3799b12ce20..9d5265e71f95 100644 --- a/tests/sys/kern/inotify_test.c +++ b/tests/sys/kern/inotify_test.c @@ -54,6 +54,8 @@ ev2name(int event) return ("IN_MOVED_TO"); case IN_OPEN: return ("IN_OPEN"); + case IN_IGNORED: + return ("IN_IGNORED"); default: return (NULL); } @@ -832,6 +834,27 @@ ATF_TC_BODY(inotify_event_delete, tc) close_inotify(ifd); } +ATF_TC_WITHOUT_HEAD(inotify_event_delete_ignored); +ATF_TC_BODY(inotify_event_delete_ignored, tc) +{ + char path[PATH_MAX]; + int error, ifd, wd; + + ifd = inotify(IN_NONBLOCK); + + wd = watch_dir(ifd, IN_DELETE, path); + + /* + * IN_IGNORED should be generated when a watched directory is removed, + * even if the watch was not configured to raise IN_DELETE_SELF. + */ + error = rmdir(path); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd, 0, IN_IGNORED, NULL); + + close_inotify(ifd); +} + ATF_TC_WITHOUT_HEAD(inotify_event_move); ATF_TC_BODY(inotify_event_move, tc) { @@ -999,6 +1022,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, inotify_event_close_write); ATF_TP_ADD_TC(tp, inotify_event_create); ATF_TP_ADD_TC(tp, inotify_event_delete); + ATF_TP_ADD_TC(tp, inotify_event_delete_ignored); ATF_TP_ADD_TC(tp, inotify_event_move); ATF_TP_ADD_TC(tp, inotify_event_move_dir); ATF_TP_ADD_TC(tp, inotify_event_open); |
