From: Michael Albinus Date: Sat, 17 Sep 2022 13:11:00 +0000 (+0200) Subject: Fix recent filenotify-tests changes X-Git-Tag: emacs-29.0.90~1856^2~423 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5bf8f9cc0d2fb12071301f50f9b85640d240a1fc;p=emacs.git Fix recent filenotify-tests changes * lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch): Use "-P". * test/lisp/filenotify-tests.el (file-notify-test11-symlinks): Adapt test. --- diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 1c26e25e57e..2052fa5a732 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3814,7 +3814,7 @@ Fall back to normal file name handler if no Tramp handler exists." (concat "create,modify,move,moved_from,moved_to,move_self," "delete,delete_self,ignored")) ((memq 'attribute-change flags) "attrib,ignored")) - sequence `(,command "-mq" "-e" ,events ,localname) + sequence `(,command "-mPq" "-e" ,events ,localname) ;; Make events a list of symbols. events (mapcar diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index fef3ab80f9a..bdf0da7a736 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -1575,6 +1575,8 @@ the file watch." "Check that file notification do not follow symbolic links." :tags '(:expensive-test) (skip-unless (file-notify--test-local-enabled)) + ;; This test does not work for kqueue (yet). + (skip-unless (not (string-equal (file-notify--test-library) "kqueue"))) (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) file-notify--test-tmpfile1 (file-notify--test-make-temp-name)) @@ -1583,7 +1585,12 @@ the file watch." (unwind-protect (progn (write-region "any text" nil file-notify--test-tmpfile1 nil 'no-message) - (make-symbolic-link file-notify--test-tmpfile1 file-notify--test-tmpfile) + ;; Some systems, like MS Windows w/o sufficient privileges, do + ;; not allow creation of symbolic links. + (condition-case nil + (make-symbolic-link + file-notify--test-tmpfile1 file-notify--test-tmpfile) + (error (ert-skip "`make-symbolic-link' not supported"))) (should (setq file-notify--test-desc (file-notify--test-add-watch @@ -1616,8 +1623,21 @@ the file watch." (should-not file-notify--test-events) ;; Changing timestamp of the symlink shows the event. - (file-notify--test-with-actions '(attribute-changed) - (set-file-times file-notify--test-tmpfile '(0 0) 'nofollow)) + (file-notify--test-with-actions + (cond + ;; w32notify does not distinguish between `changed' and + ;; `attribute-changed'. + ((string-equal (file-notify--test-library) "w32notify") + '(changed)) + ;; GFam{File,Directory}Monitor, GKqueueFileMonitor and + ;; GPollFileMonitor do not report the `attribute-changed' + ;; event. + ((memq (file-notify--test-monitor) + '(GFamFileMonitor GFamDirectoryMonitor + GKqueueFileMonitor GPollFileMonitor)) + '()) + (t '(attribute-changed))) + (set-file-times file-notify--test-tmpfile '(0 0) 'nofollow)) ;; Deleting the target should not raise any event. (file-notify--test-with-actions nil @@ -1653,7 +1673,8 @@ the file watch." '(attribute-change change) #'file-notify--test-event-handler))) (should (file-notify-valid-p file-notify--test-desc)) - ;; None of the actions on a file in the symlinked directory will be reported. + ;; None of the actions on a file in the symlinked directory + ;; will be reported. (file-notify--test-with-actions nil (write-region "another text" nil tmpfile nil 'no-message) (write-region "another text" nil tmpfile1 nil 'no-message)