(ert-deftest file-notify-test03-events ()
"Check file creation/change/removal notifications."
- :tags (if (getenv "EMACS_EMBA_CI") '(:unstable))
(skip-unless (file-notify--test-local-enabled))
(unwind-protect
'(created deleted stopped))
((string-equal (file-notify--test-library) "kqueue")
'(created changed deleted stopped))
+ ;; inotify on emba does not detect `deleted' and
+ ;; `stopped' events of the directory.
+ ((and (string-equal (file-notify--test-library) "inotify")
+ (getenv "EMACS_EMBA_CI"))
+ '(created changed deleted))
(t '(created changed deleted deleted stopped)))
(write-region
"any text" nil file-notify--test-tmpfile nil 'no-message)
'(created created changed changed deleted stopped))
((string-equal (file-notify--test-library) "kqueue")
'(created changed created changed deleted stopped))
+ ;; inotify on emba does not detect `deleted' and
+ ;; `stopped' events of the directory.
+ ((and (string-equal (file-notify--test-library) "inotify")
+ (getenv "EMACS_EMBA_CI"))
+ '(created changed created changed deleted deleted))
(t '(created changed created changed
deleted deleted deleted stopped)))
(write-region
'(created created deleted deleted stopped))
((string-equal (file-notify--test-library) "kqueue")
'(created changed renamed deleted stopped))
+ ;; inotify on emba does not detect `deleted' and
+ ;; `stopped' events of the directory.
+ ((and (string-equal (file-notify--test-library) "inotify")
+ (getenv "EMACS_EMBA_CI"))
+ '(created changed renamed deleted))
(t '(created changed renamed deleted deleted stopped)))
(write-region
"any text" nil file-notify--test-tmpfile nil 'no-message)
(ert-deftest file-notify-test05-file-validity ()
"Check `file-notify-valid-p' for files."
- :tags (if (getenv "EMACS_EMBA_CI") '(:unstable))
(skip-unless (file-notify--test-local-enabled))
(unwind-protect
;; Cleanup.
(file-notify--test-cleanup))
- (unwind-protect
- (let ((file-notify--test-tmpdir
- (make-temp-file "file-notify-test-parent" t)))
- (should
- (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
- file-notify--test-desc
- (file-notify-add-watch
- file-notify--test-tmpdir
- '(change) #'file-notify--test-event-handler)))
- (should (file-notify-valid-p file-notify--test-desc))
- (file-notify--test-with-events
- (cond
- ;; w32notify does not raise `deleted' and `stopped' events
- ;; for the watched directory.
- ((string-equal (file-notify--test-library) "w32notify")
- '(created changed deleted))
- ;; gvfs-monitor-dir on cygwin does not detect the `created'
- ;; event reliably.
- ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe")
- '((deleted stopped)
- (created deleted stopped)))
- ;; There are two `deleted' events, for the file and for the
- ;; directory. Except for cygwin and kqueue. And cygwin
- ;; does not raise a `changed' event.
- ((eq system-type 'cygwin)
- '(created deleted stopped))
- ((string-equal (file-notify--test-library) "kqueue")
- '(created changed deleted stopped))
- (t '(created changed deleted deleted stopped)))
- (write-region
- "any text" nil file-notify--test-tmpfile nil 'no-message)
- (file-notify--test-read-event)
- (delete-directory file-notify--test-tmpdir 'recursive))
- ;; After deleting the parent directory, the descriptor must
- ;; not be valid anymore.
- (should-not (file-notify-valid-p file-notify--test-desc))
- ;; w32notify doesn't generate `stopped' events when the parent
- ;; directory is deleted, which doesn't provide a chance for
- ;; filenotify.el to remove the descriptor from the internal
- ;; hash table it maintains. So we must remove the descriptor
- ;; manually.
- (if (string-equal (file-notify--test-library) "w32notify")
- (file-notify--rm-descriptor file-notify--test-desc))
+ ;; inotify on emba does not detect `deleted' and
+ ;; `stopped' events of the directory.
+ (unless (and (string-equal (file-notify--test-library) "inotify")
+ (getenv "EMACS_EMBA_CI"))
+ (unwind-protect
+ (let ((file-notify--test-tmpdir
+ (make-temp-file "file-notify-test-parent" t)))
+ (should
+ (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
+ file-notify--test-desc
+ (file-notify-add-watch
+ file-notify--test-tmpdir
+ '(change) #'file-notify--test-event-handler)))
+ (should (file-notify-valid-p file-notify--test-desc))
+ (file-notify--test-with-events
+ (cond
+ ;; w32notify does not raise `deleted' and `stopped'
+ ;; events for the watched directory.
+ ((string-equal (file-notify--test-library) "w32notify")
+ '(created changed deleted))
+ ;; gvfs-monitor-dir on cygwin does not detect the
+ ;; `created' event reliably.
+ ((string-equal
+ (file-notify--test-library) "gvfs-monitor-dir.exe")
+ '((deleted stopped)
+ (created deleted stopped)))
+ ;; There are two `deleted' events, for the file and for
+ ;; the directory. Except for cygwin and kqueue. And
+ ;; cygwin does not raise a `changed' event.
+ ((eq system-type 'cygwin)
+ '(created deleted stopped))
+ ((string-equal (file-notify--test-library) "kqueue")
+ '(created changed deleted stopped))
+ (t '(created changed deleted deleted stopped)))
+ (write-region
+ "any text" nil file-notify--test-tmpfile nil 'no-message)
+ (file-notify--test-read-event)
+ (delete-directory file-notify--test-tmpdir 'recursive))
+ ;; After deleting the parent directory, the descriptor must
+ ;; not be valid anymore.
+ (should-not (file-notify-valid-p file-notify--test-desc))
+ ;; w32notify doesn't generate `stopped' events when the
+ ;; parent directory is deleted, which doesn't provide a
+ ;; chance for filenotify.el to remove the descriptor from
+ ;; the internal hash table it maintains. So we must remove
+ ;; the descriptor manually.
+ (if (string-equal (file-notify--test-library) "w32notify")
+ (file-notify--rm-descriptor file-notify--test-desc))
- ;; The environment shall be cleaned up.
- (file-notify--test-cleanup-p))
+ ;; The environment shall be cleaned up.
+ (file-notify--test-cleanup-p))
- ;; Cleanup.
- (file-notify--test-cleanup)))
+ ;; Cleanup.
+ (file-notify--test-cleanup))))
(file-notify--deftest-remote file-notify-test05-file-validity
"Check `file-notify-valid-p' via file notification for remote files.")
(ert-deftest file-notify-test06-dir-validity ()
"Check `file-notify-valid-p' for directories."
- :tags (if (getenv "EMACS_EMBA_CI") '(:unstable))
(skip-unless (file-notify--test-local-enabled))
(unwind-protect
;; Cleanup.
(file-notify--test-cleanup))
- (unwind-protect
- (progn
- (should
- (setq file-notify--test-tmpfile
- (make-temp-file "file-notify-test-parent" t)))
- (should
- (setq file-notify--test-desc
- (file-notify-add-watch
- file-notify--test-tmpfile '(change) #'ignore)))
- (should (file-notify-valid-p file-notify--test-desc))
- ;; After deleting the directory, the descriptor must not be
- ;; valid anymore.
- (delete-directory file-notify--test-tmpfile 'recursive)
- (file-notify--wait-for-events
- (file-notify--test-timeout)
- (not (file-notify-valid-p file-notify--test-desc)))
- (should-not (file-notify-valid-p file-notify--test-desc))
- (if (string-equal (file-notify--test-library) "w32notify")
- (file-notify--rm-descriptor file-notify--test-desc))
+ ;; inotify on emba does not detect `deleted' and
+ ;; `stopped' events of the directory.
+ (unless (and (string-equal (file-notify--test-library) "inotify")
+ (getenv "EMACS_EMBA_CI"))
+ (unwind-protect
+ (progn
+ (should
+ (setq file-notify--test-tmpfile
+ (make-temp-file "file-notify-test-parent" t)))
+ (should
+ (setq file-notify--test-desc
+ (file-notify-add-watch
+ file-notify--test-tmpfile '(change) #'ignore)))
+ (should (file-notify-valid-p file-notify--test-desc))
+ ;; After deleting the directory, the descriptor must not be
+ ;; valid anymore.
+ (delete-directory file-notify--test-tmpfile 'recursive)
+ (file-notify--wait-for-events
+ (file-notify--test-timeout)
+ (not (file-notify-valid-p file-notify--test-desc)))
+ (should-not (file-notify-valid-p file-notify--test-desc))
+ (if (string-equal (file-notify--test-library) "w32notify")
+ (file-notify--rm-descriptor file-notify--test-desc))
- ;; The environment shall be cleaned up.
- (file-notify--test-cleanup-p))
+ ;; The environment shall be cleaned up.
+ (file-notify--test-cleanup-p))
- ;; Cleanup.
- (file-notify--test-cleanup)))
+ ;; Cleanup.
+ (file-notify--test-cleanup))))
(file-notify--deftest-remote file-notify-test06-dir-validity
"Check `file-notify-valid-p' via file notification for remote directories.")
(ert-deftest file-notify-test07-many-events ()
"Check that events are not dropped."
- :tags (if (getenv "EMACS_EMBA_CI")
- '(:expensive-test :unstable) '(:expensive-test))
+ :tags '(:expensive-test)
(skip-unless (file-notify--test-local-enabled))
(should
(file-notify--test-read-event)
(delete-file file)))
(delete-directory file-notify--test-tmpfile)
- (if (string-equal (file-notify--test-library) "w32notify")
+ (if (or (string-equal (file-notify--test-library) "w32notify")
+ (and (string-equal (file-notify--test-library) "inotify")
+ (getenv "EMACS_EMBA_CI")))
(file-notify--rm-descriptor file-notify--test-desc))
;; The environment shall be cleaned up.
test caters for the situation in bug#22736 where the callback for
the directory received events for the file with the descriptor of
the file watch."
- :tags (if (getenv "EMACS_EMBA_CI")
- '(:expensive-test :unstable) '(:expensive-test))
+ :tags '(:expensive-test)
(skip-unless (file-notify--test-local-enabled))
;; A directory to be watched.
;; w32notify does not raise `deleted' and `stopped'
;; events for the watched directory.
((string-equal (file-notify--test-library) "w32notify") '())
+ ;; inotify on emba does not detect `deleted' and
+ ;; `stopped' events of the directory.
+ ((and (string-equal (file-notify--test-library) "inotify")
+ (getenv "EMACS_EMBA_CI"))
+ '())
(t '(deleted stopped))))))
(delete-directory file-notify--test-tmpfile 'recursive))
- (should-not (file-notify-valid-p file-notify--test-desc1))
- (should-not (file-notify-valid-p file-notify--test-desc2))
- (when (string-equal (file-notify--test-library) "w32notify")
+ (unless (and (string-equal (file-notify--test-library) "inotify")
+ (getenv "EMACS_EMBA_CI"))
+ (should-not (file-notify-valid-p file-notify--test-desc1))
+ (should-not (file-notify-valid-p file-notify--test-desc2)))
+ (when (or (string-equal (file-notify--test-library) "w32notify")
+ (and (string-equal (file-notify--test-library) "inotify")
+ (getenv "EMACS_EMBA_CI")))
(file-notify--rm-descriptor file-notify--test-desc1)
(file-notify--rm-descriptor file-notify--test-desc2))