]> git.eshelyaron.com Git - emacs.git/commitdiff
Solve timimg issues in file-notify-tests.el
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 17 Oct 2015 09:20:05 +0000 (11:20 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 17 Oct 2015 09:20:05 +0000 (11:20 +0200)
* test/automated/file-notify-tests.el (file-notify-test02-events):
Rectify `attribute-change' tests.  There are timing issues with
gfilenotify.

test/automated/file-notify-tests.el

index c943d91c2d0fd5842c30de301cf047983e6345c6..17636486153e6353b1ea3ba72688dae4f12dd5b4 100644 (file)
@@ -325,12 +325,24 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
                  file-notify--test-tmpfile
                  '(attribute-change) 'file-notify--test-event-handler))
           (file-notify--test-with-events
-              (file-notify--test-timeout) '(attribute-changed attribute-changed)
+              (file-notify--test-timeout) '(attribute-changed)
+            (write-region
+             "any text" nil file-notify--test-tmpfile nil 'no-message)
+            (set-file-modes file-notify--test-tmpfile 000)
+            (delete-file file-notify--test-tmpfile))
+          (file-notify-rm-watch file-notify--test-desc)
+
+          ;; With gfilenotify, there are timing issues with attribute
+          ;; changes in a short time period.  So we apply 2 tests.
+          (setq file-notify--test-desc
+                (file-notify-add-watch
+                 file-notify--test-tmpfile
+                 '(attribute-change) 'file-notify--test-event-handler))
+          (file-notify--test-with-events
+              (file-notify--test-timeout) '(attribute-changed)
             (write-region
              "any text" nil file-notify--test-tmpfile nil 'no-message)
             (set-file-modes file-notify--test-tmpfile 000)
-            (read-event nil nil 0.1) ; In order to distinguish the events.
-            (set-file-times file-notify--test-tmpfile '(0 0))
             (delete-file file-notify--test-tmpfile))
           (file-notify-rm-watch file-notify--test-desc))