[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/albinus 33e45e8: Work on filenotify-tests on emba
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] scratch/albinus 33e45e8: Work on filenotify-tests on emba |
Date: |
Sun, 6 Jan 2019 04:12:17 -0500 (EST) |
branch: scratch/albinus
commit 33e45e81f4d70a7cf799fb807e6b465de7479425
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Work on filenotify-tests on emba
* lisp/filenotify.el (file-notify-callback): Revert last change.
* test/lisp/filenotify-tests.el (file-notify-test05-file-validity):
Adapt test.
---
lisp/filenotify.el | 6 +--
test/lisp/filenotify-tests.el | 109 ++++++++++++++++++++++--------------------
2 files changed, 59 insertions(+), 56 deletions(-)
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index 55f92db..c05e065 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -255,10 +255,8 @@ EVENT is the cadr of the event in
`file-notify-handle-event'
;; Not, when a file is backed up.
(not (and (stringp file1) (backup-file-name-p file1)))
;; Watched file or directory is concerned.
- (or (string-equal
- file (file-notify--event-watched-file event))
- (file-in-directory-p
- file (file-notify--watch-directory watch)))))
+ (string-equal
+ file (file-notify--event-watched-file event))))
(file-notify-rm-watch desc)))))))
;; `kqueue', `gfilenotify' and `w32notify' return a unique descriptor
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index 3e99a9a..aac0fc3 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -1018,60 +1018,65 @@ delivered."
;; 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))
- ;; 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)
- (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))
+ ;; 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)
+ (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.")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] scratch/albinus 33e45e8: Work on filenotify-tests on emba,
Michael Albinus <=