emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5bf8f9cc0d: Fix recent filenotify-tests changes


From: Michael Albinus
Subject: master 5bf8f9cc0d: Fix recent filenotify-tests changes
Date: Sat, 17 Sep 2022 09:11:10 -0400 (EDT)

branch: master
commit 5bf8f9cc0d2fb12071301f50f9b85640d240a1fc
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    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.
---
 lisp/net/tramp-sh.el          |  2 +-
 test/lisp/filenotify-tests.el | 29 +++++++++++++++++++++++++----
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 1c26e25e57..2052fa5a73 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 fef3ab80f9..bdf0da7a73 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]