aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAnders Lindgren2015-10-28 12:13:18 +0100
committerAnders Lindgren2015-10-28 12:13:18 +0100
commite69f7770611d85e130806763a46db7e212bc952f (patch)
tree96bdd02003f21cea72a604d8f14a06ff99cd9744 /test
parent0392e241b844487261d4dfcccc9a442793e0a868 (diff)
parentcc587a3539612d250d222363b18d15258e33f82a (diff)
downloademacs-e69f7770611d85e130806763a46db7e212bc952f.tar.gz
emacs-e69f7770611d85e130806763a46db7e212bc952f.zip
Merge branch 'master' of /Volumes/HD2/build/emacs-git-ssh
Diffstat (limited to 'test')
-rw-r--r--test/automated/auto-revert-tests.el4
-rw-r--r--test/automated/file-notify-tests.el211
-rw-r--r--test/automated/simple-test.el1
3 files changed, 127 insertions, 89 deletions
diff --git a/test/automated/auto-revert-tests.el b/test/automated/auto-revert-tests.el
index 86184d613fc..7cabc5c3e66 100644
--- a/test/automated/auto-revert-tests.el
+++ b/test/automated/auto-revert-tests.el
@@ -136,8 +136,6 @@
136 buf) 136 buf)
137 (unwind-protect 137 (unwind-protect
138 (progn 138 (progn
139 (with-current-buffer (get-buffer-create "*Messages*")
140 (narrow-to-region (point-max) (point-max)))
141 (setq buf (dired-noselect temporary-file-directory)) 139 (setq buf (dired-noselect temporary-file-directory))
142 (with-current-buffer buf 140 (with-current-buffer buf
143 ;; `buffer-stale--default-function' checks for 141 ;; `buffer-stale--default-function' checks for
@@ -151,6 +149,8 @@
151 149
152 ;; Delete file. We wait for a second, in order to have 150 ;; Delete file. We wait for a second, in order to have
153 ;; another timestamp. 151 ;; another timestamp.
152 (with-current-buffer (get-buffer-create "*Messages*")
153 (narrow-to-region (point-max) (point-max)))
154 (sleep-for 1) 154 (sleep-for 1)
155 (delete-file tmpfile) 155 (delete-file tmpfile)
156 156
diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el
index 56b4f69597d..222bdc52928 100644
--- a/test/automated/file-notify-tests.el
+++ b/test/automated/file-notify-tests.el
@@ -61,6 +61,8 @@
61(defvar file-notify--test-results nil) 61(defvar file-notify--test-results nil)
62(defvar file-notify--test-event nil) 62(defvar file-notify--test-event nil)
63(defvar file-notify--test-events nil) 63(defvar file-notify--test-events nil)
64(defvar file-notify--test-expected-events nil)
65
64(defun file-notify--test-timeout () 66(defun file-notify--test-timeout ()
65 "Timeout to wait for arriving events, in seconds." 67 "Timeout to wait for arriving events, in seconds."
66 (if (file-remote-p temporary-file-directory) 6 3)) 68 (if (file-remote-p temporary-file-directory) 6 3))
@@ -71,12 +73,12 @@
71 73
72 (when (and file-notify--test-tmpfile 74 (when (and file-notify--test-tmpfile
73 (file-exists-p file-notify--test-tmpfile)) 75 (file-exists-p file-notify--test-tmpfile))
74 (if (directory-name-p file-notify--test-tmpfile) 76 (if (file-directory-p file-notify--test-tmpfile)
75 (delete-directory file-notify--test-tmpfile 'recursive) 77 (delete-directory file-notify--test-tmpfile 'recursive)
76 (delete-file file-notify--test-tmpfile))) 78 (delete-file file-notify--test-tmpfile)))
77 (when (and file-notify--test-tmpfile1 79 (when (and file-notify--test-tmpfile1
78 (file-exists-p file-notify--test-tmpfile1)) 80 (file-exists-p file-notify--test-tmpfile1))
79 (if (directory-name-p file-notify--test-tmpfile1) 81 (if (file-directory-p file-notify--test-tmpfile1)
80 (delete-directory file-notify--test-tmpfile1 'recursive) 82 (delete-directory file-notify--test-tmpfile1 'recursive)
81 (delete-file file-notify--test-tmpfile1))) 83 (delete-file file-notify--test-tmpfile1)))
82 (when (file-remote-p temporary-file-directory) 84 (when (file-remote-p temporary-file-directory)
@@ -87,7 +89,8 @@
87 file-notify--test-tmpfile1 nil 89 file-notify--test-tmpfile1 nil
88 file-notify--test-desc nil 90 file-notify--test-desc nil
89 file-notify--test-results nil 91 file-notify--test-results nil
90 file-notify--test-events nil) 92 file-notify--test-events nil
93 file-notify--test-expected-events nil)
91 (when file-notify--test-event 94 (when file-notify--test-event
92 (error "file-notify--test-event should not be set but bound dynamically"))) 95 (error "file-notify--test-event should not be set but bound dynamically")))
93 96
@@ -226,13 +229,16 @@ being the result.")
226 "Ert test function to be called by `file-notify--test-event-handler'. 229 "Ert test function to be called by `file-notify--test-event-handler'.
227We cannot pass arguments, so we assume that `file-notify--test-event' 230We cannot pass arguments, so we assume that `file-notify--test-event'
228is bound somewhere." 231is bound somewhere."
229 ;;(message "Event %S" file-notify--test-event)
230 ;; Check the descriptor. 232 ;; Check the descriptor.
231 (should (equal (car file-notify--test-event) file-notify--test-desc)) 233 (should (equal (car file-notify--test-event) file-notify--test-desc))
232 ;; Check the file name. 234 ;; Check the file name.
233 (should 235 (should
234 (string-equal (file-notify--event-file-name file-notify--test-event) 236 (or (string-equal (file-notify--event-file-name file-notify--test-event)
235 file-notify--test-tmpfile)) 237 file-notify--test-tmpfile)
238 (string-equal (directory-file-name
239 (file-name-directory
240 (file-notify--event-file-name file-notify--test-event)))
241 file-notify--test-tmpfile)))
236 ;; Check the second file name if exists. 242 ;; Check the second file name if exists.
237 (when (eq (nth 1 file-notify--test-event) 'renamed) 243 (when (eq (nth 1 file-notify--test-event) 'renamed)
238 (should 244 (should
@@ -247,10 +253,15 @@ and the event to `file-notify--test-events'."
247 (let* ((file-notify--test-event event) 253 (let* ((file-notify--test-event event)
248 (result 254 (result
249 (ert-run-test (make-ert-test :body 'file-notify--test-event-test)))) 255 (ert-run-test (make-ert-test :body 'file-notify--test-event-test))))
250 (setq file-notify--test-events 256 ;; Do not add temporary files, this would confuse the checks.
251 (append file-notify--test-events `(,file-notify--test-event)) 257 (unless (string-match
252 file-notify--test-results 258 (regexp-quote ".#")
253 (append file-notify--test-results `(,result))))) 259 (file-notify--event-file-name file-notify--test-event))
260 ;;(message "file-notify--test-event-handler %S" file-notify--test-event)
261 (setq file-notify--test-events
262 (append file-notify--test-events `(,file-notify--test-event))
263 file-notify--test-results
264 (append file-notify--test-results `(,result))))))
254 265
255(defun file-notify--test-make-temp-name () 266(defun file-notify--test-make-temp-name ()
256 "Create a temporary file name for test." 267 "Create a temporary file name for test."
@@ -270,6 +281,8 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
270 (declare (indent 2)) 281 (declare (indent 2))
271 (let ((outer (make-symbol "outer"))) 282 (let ((outer (make-symbol "outer")))
272 `(let ((,outer file-notify--test-events)) 283 `(let ((,outer file-notify--test-events))
284 (setq file-notify--test-expected-events
285 (append file-notify--test-expected-events ,events))
273 (let (file-notify--test-events) 286 (let (file-notify--test-events)
274 ,@body 287 ,@body
275 (file-notify--wait-for-events 288 (file-notify--wait-for-events
@@ -281,21 +294,47 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
281(ert-deftest file-notify-test02-events () 294(ert-deftest file-notify-test02-events ()
282 "Check file creation/change/removal notifications." 295 "Check file creation/change/removal notifications."
283 (skip-unless (file-notify--test-local-enabled)) 296 (skip-unless (file-notify--test-local-enabled))
297
298 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
299 file-notify--test-tmpfile1 (file-notify--test-make-temp-name))
300
284 (unwind-protect 301 (unwind-protect
285 (progn 302 (progn
286 ;; Check creation, change, and deletion. 303 ;; Check creation, change and deletion.
287 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) 304 (setq file-notify--test-desc
288 file-notify--test-tmpfile1 (file-notify--test-make-temp-name)
289 file-notify--test-desc
290 (file-notify-add-watch 305 (file-notify-add-watch
291 file-notify--test-tmpfile 306 file-notify--test-tmpfile
292 '(change) 'file-notify--test-event-handler)) 307 '(change) 'file-notify--test-event-handler))
293 (file-notify--test-with-events 308 (file-notify--test-with-events
294 (file-notify--test-timeout) '(created changed deleted stopped) 309 (file-notify--test-timeout) '(created changed deleted)
295 (write-region 310 (write-region
296 "any text" nil file-notify--test-tmpfile nil 'no-message) 311 "any text" nil file-notify--test-tmpfile nil 'no-message)
297 (delete-file file-notify--test-tmpfile)) 312 (delete-file file-notify--test-tmpfile))
298 (file-notify-rm-watch file-notify--test-desc) 313 ;; `file-notify-rm-watch' fires the `stopped' event. Suppress it.
314 (let (file-notify--test-events)
315 (file-notify-rm-watch file-notify--test-desc))
316
317 ;; Check creation, change and deletion. There must be a
318 ;; `stopped' event when deleting the directory. It doesn't
319 ;; work for w32notify.
320 (unless (eq file-notify--library 'w32notify)
321 (make-directory file-notify--test-tmpfile)
322 (setq file-notify--test-desc
323 (file-notify-add-watch
324 file-notify--test-tmpfile
325 '(change) 'file-notify--test-event-handler))
326 (file-notify--test-with-events
327 (file-notify--test-timeout)
328 ;; There are two `deleted' events, for the file and for
329 ;; the directory.
330 '(created changed deleted deleted stopped)
331 (write-region
332 "any text" nil (expand-file-name "foo" file-notify--test-tmpfile)
333 nil 'no-message)
334 (delete-directory file-notify--test-tmpfile 'recursive))
335 ;; `file-notify-rm-watch' fires the `stopped' event. Suppress it.
336 (let (file-notify--test-events)
337 (file-notify-rm-watch file-notify--test-desc)))
299 338
300 ;; Check copy. 339 ;; Check copy.
301 (setq file-notify--test-desc 340 (setq file-notify--test-desc
@@ -308,8 +347,8 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
308 ;; w32notify does not distinguish between `changed' and 347 ;; w32notify does not distinguish between `changed' and
309 ;; `attribute-changed'. 348 ;; `attribute-changed'.
310 (if (eq file-notify--library 'w32notify) 349 (if (eq file-notify--library 'w32notify)
311 '(created changed changed deleted stopped) 350 '(created changed changed deleted)
312 '(created changed deleted stopped)) 351 '(created changed deleted))
313 (write-region 352 (write-region
314 "any text" nil file-notify--test-tmpfile nil 'no-message) 353 "any text" nil file-notify--test-tmpfile nil 'no-message)
315 (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) 354 (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1)
@@ -319,7 +358,9 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
319 (set-file-times file-notify--test-tmpfile '(0 0)) 358 (set-file-times file-notify--test-tmpfile '(0 0))
320 (delete-file file-notify--test-tmpfile) 359 (delete-file file-notify--test-tmpfile)
321 (delete-file file-notify--test-tmpfile1)) 360 (delete-file file-notify--test-tmpfile1))
322 (file-notify-rm-watch file-notify--test-desc) 361 ;; `file-notify-rm-watch' fires the `stopped' event. Suppress it.
362 (let (file-notify--test-events)
363 (file-notify-rm-watch file-notify--test-desc))
323 364
324 ;; Check rename. 365 ;; Check rename.
325 (setq file-notify--test-desc 366 (setq file-notify--test-desc
@@ -328,13 +369,15 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
328 '(change) 'file-notify--test-event-handler)) 369 '(change) 'file-notify--test-event-handler))
329 (should file-notify--test-desc) 370 (should file-notify--test-desc)
330 (file-notify--test-with-events 371 (file-notify--test-with-events
331 (file-notify--test-timeout) '(created changed renamed stopped) 372 (file-notify--test-timeout) '(created changed renamed)
332 (write-region 373 (write-region
333 "any text" nil file-notify--test-tmpfile nil 'no-message) 374 "any text" nil file-notify--test-tmpfile nil 'no-message)
334 (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) 375 (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1)
335 ;; After the rename, we won't get events anymore. 376 ;; After the rename, we won't get events anymore.
336 (delete-file file-notify--test-tmpfile1)) 377 (delete-file file-notify--test-tmpfile1))
337 (file-notify-rm-watch file-notify--test-desc) 378 ;; `file-notify-rm-watch' fires the `stopped' event. Suppress it.
379 (let (file-notify--test-events)
380 (file-notify-rm-watch file-notify--test-desc))
338 381
339 ;; Check attribute change. It doesn't work for w32notify. 382 ;; Check attribute change. It doesn't work for w32notify.
340 (unless (eq file-notify--library 'w32notify) 383 (unless (eq file-notify--library 'w32notify)
@@ -359,29 +402,16 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
359 (set-file-times file-notify--test-tmpfile '(0 0)) 402 (set-file-times file-notify--test-tmpfile '(0 0))
360 (read-event nil nil 0.1) 403 (read-event nil nil 0.1)
361 (delete-file file-notify--test-tmpfile)) 404 (delete-file file-notify--test-tmpfile))
362 (file-notify-rm-watch file-notify--test-desc)) 405 ;; `file-notify-rm-watch' fires the `stopped' event. Suppress it.
406 (let (file-notify--test-events)
407 (file-notify-rm-watch file-notify--test-desc)))
363 408
364 ;; Check the global sequence again just to make sure that 409 ;; Check the global sequence again just to make sure that
365 ;; `file-notify--test-events' has been set correctly. 410 ;; `file-notify--test-events' has been set correctly.
366 (should (equal 411 (should (equal (mapcar #'cadr file-notify--test-events)
367 (mapcar #'cadr file-notify--test-events) 412 file-notify--test-expected-events))
368 (if (eq file-notify--library 'w32notify)
369 '(created changed deleted stopped
370 created changed changed deleted stopped
371 created changed renamed stopped)
372 (if (file-remote-p temporary-file-directory)
373 '(created changed deleted stopped
374 created changed deleted stopped
375 created changed renamed stopped
376 attribute-changed attribute-changed
377 attribute-changed stopped)
378 '(created changed deleted stopped
379 created changed deleted stopped
380 created changed renamed stopped
381 attribute-changed attribute-changed stopped)))))
382 (should file-notify--test-results) 413 (should file-notify--test-results)
383 (dolist (result file-notify--test-results) 414 (dolist (result file-notify--test-results)
384 ;;(message "%s" (ert-test-result-messages result))
385 (when (ert-test-failed-p result) 415 (when (ert-test-failed-p result)
386 (ert-fail 416 (ert-fail
387 (cadr (ert-test-result-with-condition-condition result)))))) 417 (cadr (ert-test-result-with-condition-condition result))))))
@@ -429,8 +459,10 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
429 (should auto-revert-use-notify) 459 (should auto-revert-use-notify)
430 (should auto-revert-notify-watch-descriptor) 460 (should auto-revert-notify-watch-descriptor)
431 461
432 ;; Modify file. We wait for a second, in order to 462 ;; Modify file. We wait for a second, in order to have
433 ;; have another timestamp. 463 ;; another timestamp.
464 (with-current-buffer (get-buffer-create "*Messages*")
465 (narrow-to-region (point-max) (point-max)))
434 (sleep-for 1) 466 (sleep-for 1)
435 (write-region 467 (write-region
436 "another text" nil file-notify--test-tmpfile nil 'no-message) 468 "another text" nil file-notify--test-tmpfile nil 'no-message)
@@ -442,9 +474,34 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
442 (string-match 474 (string-match
443 (format-message "Reverting buffer `%s'." (buffer-name buf)) 475 (format-message "Reverting buffer `%s'." (buffer-name buf))
444 (buffer-string)))) 476 (buffer-string))))
445 (should (string-match "another text" (buffer-string))))) 477 (should (string-match "another text" (buffer-string)))
478
479 ;; Stop file notification. Autorevert shall still work via polling.
480 (file-notify-rm-watch auto-revert-notify-watch-descriptor)
481 (file-notify--wait-for-events
482 timeout (null auto-revert-use-notify))
483 (should-not auto-revert-use-notify)
484 (should-not auto-revert-notify-watch-descriptor)
485
486 ;; Modify file. We wait for two seconds, in order to have
487 ;; another timestamp. One second seems to be too short.
488 (with-current-buffer (get-buffer-create "*Messages*")
489 (narrow-to-region (point-max) (point-max)))
490 (sleep-for 2)
491 (write-region
492 "foo bla" nil file-notify--test-tmpfile nil 'no-message)
493
494 ;; Check, that the buffer has been reverted.
495 (with-current-buffer (get-buffer-create "*Messages*")
496 (file-notify--wait-for-events
497 timeout
498 (string-match
499 (format-message "Reverting buffer `%s'." (buffer-name buf))
500 (buffer-string))))
501 (should (string-match "foo bla" (buffer-string)))))
446 502
447 ;; Cleanup. 503 ;; Cleanup.
504 (with-current-buffer "*Messages*" (widen))
448 (ignore-errors (kill-buffer buf)) 505 (ignore-errors (kill-buffer buf))
449 (file-notify--test-cleanup)))) 506 (file-notify--test-cleanup))))
450 507
@@ -463,41 +520,16 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
463 file-notify--test-tmpfile 520 file-notify--test-tmpfile
464 '(change) #'file-notify--test-event-handler)) 521 '(change) #'file-notify--test-event-handler))
465 (file-notify--test-with-events 522 (file-notify--test-with-events
466 (file-notify--test-timeout) '(created changed) 523 (file-notify--test-timeout) '(created changed deleted)
467 (should (file-notify-valid-p file-notify--test-desc)) 524 (should (file-notify-valid-p file-notify--test-desc))
468 (write-region 525 (write-region
469 "any text" nil file-notify--test-tmpfile nil 'no-message) 526 "any text" nil file-notify--test-tmpfile nil 'no-message)
470 (should (file-notify-valid-p file-notify--test-desc))) 527 (delete-file file-notify--test-tmpfile))
471 ;; After removing the watch, the descriptor must not be valid 528 ;; After deleting the file, the descriptor is still valid.
529 (should (file-notify-valid-p file-notify--test-desc))
530 ;; After removing the watch, the descriptor must not be valid
472 ;; anymore. 531 ;; anymore.
473 (file-notify-rm-watch file-notify--test-desc) 532 (file-notify-rm-watch file-notify--test-desc)
474 (file-notify--wait-for-events
475 (file-notify--test-timeout)
476 (not (file-notify-valid-p file-notify--test-desc)))
477 (should-not (file-notify-valid-p file-notify--test-desc)))
478
479 ;; Cleanup.
480 (file-notify--test-cleanup))
481
482 (unwind-protect
483 (progn
484 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
485 file-notify--test-desc
486 (file-notify-add-watch
487 file-notify--test-tmpfile
488 '(change) #'file-notify--test-event-handler))
489 (file-notify--test-with-events
490 (file-notify--test-timeout) '(created changed)
491 (should (file-notify-valid-p file-notify--test-desc))
492 (write-region
493 "any text" nil file-notify--test-tmpfile nil 'no-message)
494 (should (file-notify-valid-p file-notify--test-desc)))
495 ;; After deleting the file, the descriptor must not be valid
496 ;; anymore.
497 (delete-file file-notify--test-tmpfile)
498 (file-notify--wait-for-events
499 (file-notify--test-timeout)
500 (not (file-notify-valid-p file-notify--test-desc)))
501 (should-not (file-notify-valid-p file-notify--test-desc))) 533 (should-not (file-notify-valid-p file-notify--test-desc)))
502 534
503 ;; Cleanup. 535 ;; Cleanup.
@@ -506,26 +538,23 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
506 (unwind-protect 538 (unwind-protect
507 ;; The batch-mode operation of w32notify is fragile (there's no 539 ;; The batch-mode operation of w32notify is fragile (there's no
508 ;; input threads to send the message to). 540 ;; input threads to send the message to).
509 (unless (and noninteractive (eq file-notify--library 'w32notify)) 541 ;(unless (and noninteractive (eq file-notify--library 'w32notify))
510 (let ((temporary-file-directory (make-temp-file 542 (unless (eq file-notify--library 'w32notify)
511 "file-notify-test-parent" t))) 543 (let ((temporary-file-directory
544 (make-temp-file "file-notify-test-parent" t)))
512 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) 545 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
513 file-notify--test-desc 546 file-notify--test-desc
514 (file-notify-add-watch 547 (file-notify-add-watch
515 file-notify--test-tmpfile 548 file-notify--test-tmpfile
516 '(change) #'file-notify--test-event-handler)) 549 '(change) #'file-notify--test-event-handler))
517 (file-notify--test-with-events 550 (file-notify--test-with-events
518 (file-notify--test-timeout) '(created changed) 551 (file-notify--test-timeout) '(created changed deleted stopped)
519 (should (file-notify-valid-p file-notify--test-desc)) 552 (should (file-notify-valid-p file-notify--test-desc))
520 (write-region 553 (write-region
521 "any text" nil file-notify--test-tmpfile nil 'no-message) 554 "any text" nil file-notify--test-tmpfile nil 'no-message)
522 (should (file-notify-valid-p file-notify--test-desc))) 555 (delete-directory temporary-file-directory t))
523 ;; After deleting the parent, the descriptor must not be 556 ;; After deleting the parent directory, the descriptor must
524 ;; valid anymore. 557 ;; not be valid anymore.
525 (delete-directory temporary-file-directory t)
526 (file-notify--wait-for-events
527 (file-notify--test-timeout)
528 (not (file-notify-valid-p file-notify--test-desc)))
529 (should-not (file-notify-valid-p file-notify--test-desc)))) 558 (should-not (file-notify-valid-p file-notify--test-desc))))
530 559
531 ;; Cleanup. 560 ;; Cleanup.
@@ -540,8 +569,8 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
540 569
541 (unwind-protect 570 (unwind-protect
542 (progn 571 (progn
543 (setq file-notify--test-tmpfile (file-name-as-directory 572 (setq file-notify--test-tmpfile
544 (file-notify--test-make-temp-name))) 573 (file-name-as-directory (file-notify--test-make-temp-name)))
545 (make-directory file-notify--test-tmpfile) 574 (make-directory file-notify--test-tmpfile)
546 (setq file-notify--test-desc 575 (setq file-notify--test-desc
547 (file-notify-add-watch 576 (file-notify-add-watch
@@ -551,6 +580,9 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
551 ;; After removing the watch, the descriptor must not be valid 580 ;; After removing the watch, the descriptor must not be valid
552 ;; anymore. 581 ;; anymore.
553 (file-notify-rm-watch file-notify--test-desc) 582 (file-notify-rm-watch file-notify--test-desc)
583 (file-notify--wait-for-events
584 (file-notify--test-timeout)
585 (not (file-notify-valid-p file-notify--test-desc)))
554 (should-not (file-notify-valid-p file-notify--test-desc))) 586 (should-not (file-notify-valid-p file-notify--test-desc)))
555 587
556 ;; Cleanup. 588 ;; Cleanup.
@@ -560,8 +592,8 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
560 ;; The batch-mode operation of w32notify is fragile (there's no 592 ;; The batch-mode operation of w32notify is fragile (there's no
561 ;; input threads to send the message to). 593 ;; input threads to send the message to).
562 (unless (and noninteractive (eq file-notify--library 'w32notify)) 594 (unless (and noninteractive (eq file-notify--library 'w32notify))
563 (setq file-notify--test-tmpfile (file-name-as-directory 595 (setq file-notify--test-tmpfile
564 (file-notify--test-make-temp-name))) 596 (file-name-as-directory (file-notify--test-make-temp-name)))
565 (make-directory file-notify--test-tmpfile) 597 (make-directory file-notify--test-tmpfile)
566 (setq file-notify--test-desc 598 (setq file-notify--test-desc
567 (file-notify-add-watch 599 (file-notify-add-watch
@@ -589,5 +621,10 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
589 (ert-run-tests-interactively "^file-notify-") 621 (ert-run-tests-interactively "^file-notify-")
590 (ert-run-tests-batch "^file-notify-"))) 622 (ert-run-tests-batch "^file-notify-")))
591 623
624;; TODO:
625
626;; * It does not work yet for local gfilenotify and remote inotifywait.
627;; * For w32notify, no stopped events arrive when a directory is removed.
628
592(provide 'file-notify-tests) 629(provide 'file-notify-tests)
593;;; file-notify-tests.el ends here 630;;; file-notify-tests.el ends here
diff --git a/test/automated/simple-test.el b/test/automated/simple-test.el
index a9c4d67556e..8da575d5d97 100644
--- a/test/automated/simple-test.el
+++ b/test/automated/simple-test.el
@@ -26,6 +26,7 @@
26 (debug t)) 26 (debug t))
27 `(with-temp-buffer 27 `(with-temp-buffer
28 (emacs-lisp-mode) 28 (emacs-lisp-mode)
29 (setq indent-tabs-mode nil)
29 (insert "(a b") 30 (insert "(a b")
30 (save-excursion (insert " c d)")) 31 (save-excursion (insert " c d)"))
31 ,@body 32 ,@body