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.
This commit is contained in:
Michael Albinus 2022-09-17 15:11:00 +02:00
parent 84801d468a
commit 5bf8f9cc0d
2 changed files with 26 additions and 5 deletions

View file

@ -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

View file

@ -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)