aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2015-11-06 07:33:50 +0100
committerMichael Albinus2015-11-06 07:33:50 +0100
commitf353f53b648784a6c6a4a23fbb575b9ac53d3ba6 (patch)
tree88838b7973e4177f8607a5923605ff1c13ccdb66 /test
parent267e0e80e1ad8c33c10ccaff77169a7aa759c163 (diff)
downloademacs-f353f53b648784a6c6a4a23fbb575b9ac53d3ba6.tar.gz
emacs-f353f53b648784a6c6a4a23fbb575b9ac53d3ba6.zip
Skip some file notification tests for cygwin
* test/automated/file-notify-tests.el (file-notify--test-with-events): Remove argument TIMEOUT. Adapt all callees. (file-notify-test02-events, file-notify-test04-file-validity): Skip for cygwin. (Bug#21804)
Diffstat (limited to 'test')
-rw-r--r--test/automated/file-notify-tests.el29
1 files changed, 14 insertions, 15 deletions
diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el
index 964dc4a07b1..67e929a6477 100644
--- a/test/automated/file-notify-tests.el
+++ b/test/automated/file-notify-tests.el
@@ -275,10 +275,10 @@ TIMEOUT is the maximum time to wait for, in seconds."
275 (while (null ,until) 275 (while (null ,until)
276 (read-event nil nil 0.1)))) 276 (read-event nil nil 0.1))))
277 277
278(defmacro file-notify--test-with-events (timeout events &rest body) 278(defmacro file-notify--test-with-events (events &rest body)
279 "Run BODY collecting events and then compare with EVENTS. 279 "Run BODY collecting events and then compare with EVENTS.
280Don't wait longer than TIMEOUT seconds for the events to be delivered." 280Don't wait longer than timeout seconds for the events to be delivered."
281 (declare (indent 2)) 281 (declare (indent 1))
282 (let ((outer (make-symbol "outer"))) 282 (let ((outer (make-symbol "outer")))
283 `(let ((,outer file-notify--test-events)) 283 `(let ((,outer file-notify--test-events))
284 (setq file-notify--test-expected-events 284 (setq file-notify--test-expected-events
@@ -286,7 +286,8 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
286 (let (file-notify--test-events) 286 (let (file-notify--test-events)
287 ,@body 287 ,@body
288 (file-notify--wait-for-events 288 (file-notify--wait-for-events
289 ,timeout (= (length ,events) (length file-notify--test-events))) 289 (file-notify--test-timeout)
290 (= (length ,events) (length file-notify--test-events)))
290 (should (equal ,events (mapcar #'cadr file-notify--test-events))) 291 (should (equal ,events (mapcar #'cadr file-notify--test-events)))
291 (setq ,outer (append ,outer file-notify--test-events))) 292 (setq ,outer (append ,outer file-notify--test-events)))
292 (setq file-notify--test-events ,outer)))) 293 (setq file-notify--test-events ,outer))))
@@ -294,6 +295,8 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
294(ert-deftest file-notify-test02-events () 295(ert-deftest file-notify-test02-events ()
295 "Check file creation/change/removal notifications." 296 "Check file creation/change/removal notifications."
296 (skip-unless (file-notify--test-local-enabled)) 297 (skip-unless (file-notify--test-local-enabled))
298 ;; Under cygwin there are so bad timings that it doesn't make sense to test.
299 (skip-unless (not (eq system-type 'cygwin)))
297 300
298 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) 301 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
299 file-notify--test-tmpfile1 (file-notify--test-make-temp-name)) 302 file-notify--test-tmpfile1 (file-notify--test-make-temp-name))
@@ -305,8 +308,7 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
305 (file-notify-add-watch 308 (file-notify-add-watch
306 file-notify--test-tmpfile 309 file-notify--test-tmpfile
307 '(change) 'file-notify--test-event-handler)) 310 '(change) 'file-notify--test-event-handler))
308 (file-notify--test-with-events 311 (file-notify--test-with-events '(created changed deleted)
309 (file-notify--test-timeout) '(created changed deleted)
310 (write-region 312 (write-region
311 "any text" nil file-notify--test-tmpfile nil 'no-message) 313 "any text" nil file-notify--test-tmpfile nil 'no-message)
312 (delete-file file-notify--test-tmpfile)) 314 (delete-file file-notify--test-tmpfile))
@@ -324,7 +326,6 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
324 file-notify--test-tmpfile 326 file-notify--test-tmpfile
325 '(change) 'file-notify--test-event-handler)) 327 '(change) 'file-notify--test-event-handler))
326 (file-notify--test-with-events 328 (file-notify--test-with-events
327 (file-notify--test-timeout)
328 ;; There are two `deleted' events, for the file and for 329 ;; There are two `deleted' events, for the file and for
329 ;; the directory. 330 ;; the directory.
330 '(created changed deleted deleted stopped) 331 '(created changed deleted deleted stopped)
@@ -343,7 +344,6 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
343 '(change) 'file-notify--test-event-handler)) 344 '(change) 'file-notify--test-event-handler))
344 (should file-notify--test-desc) 345 (should file-notify--test-desc)
345 (file-notify--test-with-events 346 (file-notify--test-with-events
346 (file-notify--test-timeout)
347 ;; w32notify does not distinguish between `changed' and 347 ;; w32notify does not distinguish between `changed' and
348 ;; `attribute-changed'. 348 ;; `attribute-changed'.
349 (if (eq file-notify--library 'w32notify) 349 (if (eq file-notify--library 'w32notify)
@@ -368,8 +368,7 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
368 file-notify--test-tmpfile 368 file-notify--test-tmpfile
369 '(change) 'file-notify--test-event-handler)) 369 '(change) 'file-notify--test-event-handler))
370 (should file-notify--test-desc) 370 (should file-notify--test-desc)
371 (file-notify--test-with-events 371 (file-notify--test-with-events '(created changed renamed)
372 (file-notify--test-timeout) '(created changed renamed)
373 (write-region 372 (write-region
374 "any text" nil file-notify--test-tmpfile nil 'no-message) 373 "any text" nil file-notify--test-tmpfile nil 'no-message)
375 (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) 374 (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1)
@@ -386,7 +385,6 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
386 file-notify--test-tmpfile 385 file-notify--test-tmpfile
387 '(attribute-change) 'file-notify--test-event-handler)) 386 '(attribute-change) 'file-notify--test-event-handler))
388 (file-notify--test-with-events 387 (file-notify--test-with-events
389 (file-notify--test-timeout)
390 (if (file-remote-p temporary-file-directory) 388 (if (file-remote-p temporary-file-directory)
391 ;; In the remote case, `write-region' raises also an 389 ;; In the remote case, `write-region' raises also an
392 ;; `attribute-changed' event. 390 ;; `attribute-changed' event.
@@ -511,6 +509,8 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
511(ert-deftest file-notify-test04-file-validity () 509(ert-deftest file-notify-test04-file-validity ()
512 "Check `file-notify-valid-p' for files." 510 "Check `file-notify-valid-p' for files."
513 (skip-unless (file-notify--test-local-enabled)) 511 (skip-unless (file-notify--test-local-enabled))
512 ;; Under cygwin there are so bad timings that it doesn't make sense to test.
513 (skip-unless (not (eq system-type 'cygwin)))
514 514
515 (unwind-protect 515 (unwind-protect
516 (progn 516 (progn
@@ -519,8 +519,7 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
519 (file-notify-add-watch 519 (file-notify-add-watch
520 file-notify--test-tmpfile 520 file-notify--test-tmpfile
521 '(change) #'file-notify--test-event-handler)) 521 '(change) #'file-notify--test-event-handler))
522 (file-notify--test-with-events 522 (file-notify--test-with-events '(created changed deleted)
523 (file-notify--test-timeout) '(created changed deleted)
524 (should (file-notify-valid-p file-notify--test-desc)) 523 (should (file-notify-valid-p file-notify--test-desc))
525 (write-region 524 (write-region
526 "any text" nil file-notify--test-tmpfile nil 'no-message) 525 "any text" nil file-notify--test-tmpfile nil 'no-message)
@@ -547,8 +546,7 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
547 (file-notify-add-watch 546 (file-notify-add-watch
548 file-notify--test-tmpfile 547 file-notify--test-tmpfile
549 '(change) #'file-notify--test-event-handler)) 548 '(change) #'file-notify--test-event-handler))
550 (file-notify--test-with-events 549 (file-notify--test-with-events '(created changed deleted stopped)
551 (file-notify--test-timeout) '(created changed deleted stopped)
552 (should (file-notify-valid-p file-notify--test-desc)) 550 (should (file-notify-valid-p file-notify--test-desc))
553 (write-region 551 (write-region
554 "any text" nil file-notify--test-tmpfile nil 'no-message) 552 "any text" nil file-notify--test-tmpfile nil 'no-message)
@@ -624,6 +622,7 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
624;; TODO: 622;; TODO:
625 623
626;; * For w32notify, no stopped events arrive when a directory is removed. 624;; * For w32notify, no stopped events arrive when a directory is removed.
625;; * Try to handle arriving events under cygwin reliably.
627 626
628(provide 'file-notify-tests) 627(provide 'file-notify-tests)
629;;; file-notify-tests.el ends here 628;;; file-notify-tests.el ends here