aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2016-03-04 14:01:36 +0000
committerMichael Albinus2016-03-04 14:01:36 +0000
commit484967796755051c4045cdcc26b0d3d129cc72ad (patch)
treec2fc0747c640beb5f6056494728e775bf9c20883 /test
parentca4e30058eba0531f38fff75f14734acffab84ea (diff)
downloademacs-484967796755051c4045cdcc26b0d3d129cc72ad.tar.gz
emacs-484967796755051c4045cdcc26b0d3d129cc72ad.zip
Fix Bug#22814
* lisp/autorevert.el (global-auto-revert-mode): Do not set `auto-revert-use-notify' to nil. * etc/NEWS: Mention this. * etc/PROBLEMS: Remove problem Bug#22814. * src/kqueue.c: Include <sys/resource.h>. (Fkqueue_add_watch): Limit the number of used file descriptors. (Bug#22814) * test/lisp/filenotify-tests.el (file-notify--test-remote-enabled) (file-notify-test00-availability, file-notify-test01-add-watch) (file-notify-test02-events, file-notify-test06-many-events): Use #' read syntax for functions. (file-notify-test05-dir-validity) (file-notify-test06-many-events): Simplify directory creation. (file-notify-test09-sufficient-ressources): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/filenotify-tests.el86
1 files changed, 64 insertions, 22 deletions
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index 9f0c0ed0dc1..d3610f00080 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -140,7 +140,7 @@ being the result.")
140 (setq desc 140 (setq desc
141 (file-notify-add-watch 141 (file-notify-add-watch
142 file-notify-test-remote-temporary-file-directory 142 file-notify-test-remote-temporary-file-directory
143 '(change) 'ignore)))) 143 '(change) #'ignore))))
144 (setq file-notify--test-remote-enabled-checked (cons t desc)) 144 (setq file-notify--test-remote-enabled-checked (cons t desc))
145 (when desc (file-notify-rm-watch desc)))) 145 (when desc (file-notify-rm-watch desc))))
146 ;; Return result. 146 ;; Return result.
@@ -180,7 +180,7 @@ remote host, or nil."
180 (message "Library: `%s'" (file-notify--test-library)) 180 (message "Library: `%s'" (file-notify--test-library))
181 (should 181 (should
182 (setq file-notify--test-desc 182 (setq file-notify--test-desc
183 (file-notify-add-watch temporary-file-directory '(change) 'ignore))) 183 (file-notify-add-watch temporary-file-directory '(change) #'ignore)))
184 184
185 ;; Cleanup. 185 ;; Cleanup.
186 (file-notify--test-cleanup)) 186 (file-notify--test-cleanup))
@@ -199,23 +199,23 @@ remote host, or nil."
199 ;; Check, that different valid parameters are accepted. 199 ;; Check, that different valid parameters are accepted.
200 (should 200 (should
201 (setq file-notify--test-desc 201 (setq file-notify--test-desc
202 (file-notify-add-watch temporary-file-directory '(change) 'ignore))) 202 (file-notify-add-watch temporary-file-directory '(change) #'ignore)))
203 (file-notify-rm-watch file-notify--test-desc) 203 (file-notify-rm-watch file-notify--test-desc)
204 (should 204 (should
205 (setq file-notify--test-desc 205 (setq file-notify--test-desc
206 (file-notify-add-watch 206 (file-notify-add-watch
207 temporary-file-directory '(attribute-change) 'ignore))) 207 temporary-file-directory '(attribute-change) #'ignore)))
208 (file-notify-rm-watch file-notify--test-desc) 208 (file-notify-rm-watch file-notify--test-desc)
209 (should 209 (should
210 (setq file-notify--test-desc 210 (setq file-notify--test-desc
211 (file-notify-add-watch 211 (file-notify-add-watch
212 temporary-file-directory '(change attribute-change) 'ignore))) 212 temporary-file-directory '(change attribute-change) #'ignore)))
213 (file-notify-rm-watch file-notify--test-desc) 213 (file-notify-rm-watch file-notify--test-desc)
214 (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) 214 (write-region "any text" nil file-notify--test-tmpfile nil 'no-message)
215 (should 215 (should
216 (setq file-notify--test-desc 216 (setq file-notify--test-desc
217 (file-notify-add-watch 217 (file-notify-add-watch
218 file-notify--test-tmpfile '(change attribute-change) 'ignore))) 218 file-notify--test-tmpfile '(change attribute-change) #'ignore)))
219 (file-notify-rm-watch file-notify--test-desc) 219 (file-notify-rm-watch file-notify--test-desc)
220 (delete-file file-notify--test-tmpfile) 220 (delete-file file-notify--test-tmpfile)
221 221
@@ -238,7 +238,7 @@ remote host, or nil."
238 (should 238 (should
239 (equal (should-error 239 (equal (should-error
240 (file-notify-add-watch 240 (file-notify-add-watch
241 file-notify--test-tmpfile1 '(change attribute-change) 'ignore)) 241 file-notify--test-tmpfile1 '(change attribute-change) #'ignore))
242 `(file-notify-error 242 `(file-notify-error
243 "Directory does not exist" ,file-notify--test-tmpfile))) 243 "Directory does not exist" ,file-notify--test-tmpfile)))
244 244
@@ -361,7 +361,7 @@ longer than timeout seconds for the events to be delivered."
361 (setq file-notify--test-desc 361 (setq file-notify--test-desc
362 (file-notify-add-watch 362 (file-notify-add-watch
363 file-notify--test-tmpfile 363 file-notify--test-tmpfile
364 '(change) 'file-notify--test-event-handler))) 364 '(change) #'file-notify--test-event-handler)))
365 (file-notify--test-with-events 365 (file-notify--test-with-events
366 (cond 366 (cond
367 ;; cygwin recognizes only `deleted' and `stopped' events. 367 ;; cygwin recognizes only `deleted' and `stopped' events.
@@ -381,7 +381,7 @@ longer than timeout seconds for the events to be delivered."
381 (setq file-notify--test-desc 381 (setq file-notify--test-desc
382 (file-notify-add-watch 382 (file-notify-add-watch
383 file-notify--test-tmpfile 383 file-notify--test-tmpfile
384 '(change) 'file-notify--test-event-handler))) 384 '(change) #'file-notify--test-event-handler)))
385 (file-notify--test-with-events 385 (file-notify--test-with-events
386 (cond 386 (cond
387 ;; cygwin recognizes only `deleted' and `stopped' events. 387 ;; cygwin recognizes only `deleted' and `stopped' events.
@@ -414,7 +414,7 @@ longer than timeout seconds for the events to be delivered."
414 file-notify--test-desc 414 file-notify--test-desc
415 (file-notify-add-watch 415 (file-notify-add-watch
416 temporary-file-directory 416 temporary-file-directory
417 '(change) 'file-notify--test-event-handler))) 417 '(change) #'file-notify--test-event-handler)))
418 (file-notify--test-with-events 418 (file-notify--test-with-events
419 (cond 419 (cond
420 ;; w32notify does not raise `deleted' and `stopped' 420 ;; w32notify does not raise `deleted' and `stopped'
@@ -445,7 +445,7 @@ longer than timeout seconds for the events to be delivered."
445 file-notify--test-desc 445 file-notify--test-desc
446 (file-notify-add-watch 446 (file-notify-add-watch
447 temporary-file-directory 447 temporary-file-directory
448 '(change) 'file-notify--test-event-handler))) 448 '(change) #'file-notify--test-event-handler)))
449 (file-notify--test-with-events 449 (file-notify--test-with-events
450 (cond 450 (cond
451 ;; w32notify does not distinguish between `changed' and 451 ;; w32notify does not distinguish between `changed' and
@@ -487,7 +487,7 @@ longer than timeout seconds for the events to be delivered."
487 file-notify--test-desc 487 file-notify--test-desc
488 (file-notify-add-watch 488 (file-notify-add-watch
489 temporary-file-directory 489 temporary-file-directory
490 '(change) 'file-notify--test-event-handler))) 490 '(change) #'file-notify--test-event-handler)))
491 (file-notify--test-with-events 491 (file-notify--test-with-events
492 (cond 492 (cond
493 ;; w32notify does not raise `deleted' and `stopped' 493 ;; w32notify does not raise `deleted' and `stopped'
@@ -521,7 +521,7 @@ longer than timeout seconds for the events to be delivered."
521 (setq file-notify--test-desc 521 (setq file-notify--test-desc
522 (file-notify-add-watch 522 (file-notify-add-watch
523 file-notify--test-tmpfile 523 file-notify--test-tmpfile
524 '(attribute-change) 'file-notify--test-event-handler))) 524 '(attribute-change) #'file-notify--test-event-handler)))
525 (file-notify--test-with-events 525 (file-notify--test-with-events
526 (cond 526 (cond
527 ;; w32notify does not distinguish between `changed' and 527 ;; w32notify does not distinguish between `changed' and
@@ -743,9 +743,9 @@ longer than timeout seconds for the events to be delivered."
743 743
744 (unwind-protect 744 (unwind-protect
745 (progn 745 (progn
746 (setq file-notify--test-tmpfile 746 (should
747 (file-name-as-directory (file-notify--test-make-temp-name))) 747 (setq file-notify--test-tmpfile
748 (make-directory file-notify--test-tmpfile) 748 (make-temp-file "file-notify-test-parent" t)))
749 (should 749 (should
750 (setq file-notify--test-desc 750 (setq file-notify--test-desc
751 (file-notify-add-watch 751 (file-notify-add-watch
@@ -765,9 +765,9 @@ longer than timeout seconds for the events to be delivered."
765 765
766 (unwind-protect 766 (unwind-protect
767 (progn 767 (progn
768 (setq file-notify--test-tmpfile 768 (should
769 (file-name-as-directory (file-notify--test-make-temp-name))) 769 (setq file-notify--test-tmpfile
770 (make-directory file-notify--test-tmpfile) 770 (make-temp-file "file-notify-test-parent" t)))
771 (should 771 (should
772 (setq file-notify--test-desc 772 (setq file-notify--test-desc
773 (file-notify-add-watch 773 (file-notify-add-watch
@@ -795,13 +795,14 @@ longer than timeout seconds for the events to be delivered."
795 ;; Under cygwin events arrive in random order. Impossible to define a test. 795 ;; Under cygwin events arrive in random order. Impossible to define a test.
796 (skip-unless (not (eq system-type 'cygwin))) 796 (skip-unless (not (eq system-type 'cygwin)))
797 797
798 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) 798 (should
799 (make-directory file-notify--test-tmpfile) 799 (setq file-notify--test-tmpfile
800 (make-temp-file "file-notify-test-parent" t)))
800 (should 801 (should
801 (setq file-notify--test-desc 802 (setq file-notify--test-desc
802 (file-notify-add-watch 803 (file-notify-add-watch
803 file-notify--test-tmpfile 804 file-notify--test-tmpfile
804 '(change) 'file-notify--test-event-handler))) 805 '(change) #'file-notify--test-event-handler)))
805 (unwind-protect 806 (unwind-protect
806 (let ((n 1000) 807 (let ((n 1000)
807 source-file-list target-file-list 808 source-file-list target-file-list
@@ -1058,6 +1059,47 @@ the file watch."
1058(file-notify--deftest-remote file-notify-test08-watched-file-in-watched-dir 1059(file-notify--deftest-remote file-notify-test08-watched-file-in-watched-dir
1059 "Check `file-notify-test08-watched-file-in-watched-dir' for remote files.") 1060 "Check `file-notify-test08-watched-file-in-watched-dir' for remote files.")
1060 1061
1062(ert-deftest file-notify-test09-sufficient-ressources ()
1063 "Check that file notification does not use too many ressources."
1064 :tags '(:expensive-test)
1065 (skip-unless (file-notify--test-local-enabled))
1066 ;; This test is intended for kqueue only.
1067 (skip-unless (string-equal (file-notify--test-library) "kqueue"))
1068
1069 (should
1070 (setq file-notify--test-tmpfile
1071 (make-temp-file "file-notify-test-parent" t)))
1072 (unwind-protect
1073 (let ((temporary-file-directory file-notify--test-tmpfile)
1074 descs)
1075 (should-error
1076 (while t
1077 ;; We watch directories, because we want to reach the upper
1078 ;; limit. Watching a file might not be sufficient, because
1079 ;; most of the libraries implement this as watching the
1080 ;; upper directory.
1081 (setq file-notify--test-tmpfile1
1082 (make-temp-file "file-notify-test-parent" t)
1083 descs
1084 (cons
1085 (should
1086 (file-notify-add-watch
1087 file-notify--test-tmpfile1 '(change) #'ignore))
1088 descs)))
1089 :type 'file-notify-error)
1090 ;; Remove watches. If we don't do it prior removing
1091 ;; directories, Emacs crashes in batch mode.
1092 (dolist (desc descs)
1093 (file-notify-rm-watch desc))
1094 ;; Remove directories.
1095 (delete-directory file-notify--test-tmpfile 'recursive))
1096
1097 ;; Cleanup.
1098 (file-notify--test-cleanup)))
1099
1100(file-notify--deftest-remote file-notify-test09-sufficient-ressources
1101 "Check `file-notify-test09-sufficient-ressources' for remote files.")
1102
1061(defun file-notify-test-all (&optional interactive) 1103(defun file-notify-test-all (&optional interactive)
1062 "Run all tests for \\[file-notify]." 1104 "Run all tests for \\[file-notify]."
1063 (interactive "p") 1105 (interactive "p")