]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix recent filenotify-tests changes
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 17 Sep 2022 13:11:00 +0000 (15:11 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 17 Sep 2022 13:11:00 +0000 (15:11 +0200)
* 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
test/lisp/filenotify-tests.el

index 1c26e25e57e8deab0b3b198f226fbb20a209edd3..2052fa5a73258010e634a096703df5912534e1cd 100644 (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
index fef3ab80f9afab22575f02b1cc66e21031735022..bdf0da7a7364a7096aff5d08899dd820dd79ab83 100644 (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)