diff options
| -rw-r--r-- | src/gfilenotify.c | 23 | ||||
| -rw-r--r-- | src/inotify.c | 2 | ||||
| -rw-r--r-- | src/kqueue.c | 2 | ||||
| -rw-r--r-- | src/w32notify.c | 2 | ||||
| -rw-r--r-- | test/lisp/filenotify-tests.el | 103 |
5 files changed, 87 insertions, 45 deletions
diff --git a/src/gfilenotify.c b/src/gfilenotify.c index 30d0753f7e7..1ad989a0d95 100644 --- a/src/gfilenotify.c +++ b/src/gfilenotify.c | |||
| @@ -258,7 +258,7 @@ WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */) | |||
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | DEFUN ("gfile-valid-p", Fgfile_valid_p, Sgfile_valid_p, 1, 1, 0, | 260 | DEFUN ("gfile-valid-p", Fgfile_valid_p, Sgfile_valid_p, 1, 1, 0, |
| 261 | doc: /* "Check a watch specified by its WATCH-DESCRIPTOR. | 261 | doc: /* Check a watch specified by its WATCH-DESCRIPTOR. |
| 262 | 262 | ||
| 263 | WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. | 263 | WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. |
| 264 | 264 | ||
| @@ -278,6 +278,26 @@ invalid. */) | |||
| 278 | } | 278 | } |
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | DEFUN ("gfile-monitor-name", Fgfile_monitor_name, Sgfile_monitor_name, 1, 1, 0, | ||
| 282 | doc: /* Return the internal monitor name for WATCH-DESCRIPTOR. | ||
| 283 | |||
| 284 | The result is a string, either "GInotifyFileMonitor", | ||
| 285 | "GKqueueFileMonitor", or "GPollFileMonitor". | ||
| 286 | |||
| 287 | WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. | ||
| 288 | If WATCH-DESCRIPTOR is not valid, nil is returned. */) | ||
| 289 | (Lisp_Object watch_descriptor) | ||
| 290 | { | ||
| 291 | if (NILP (Fgfile_valid_p (watch_descriptor))) | ||
| 292 | return Qnil; | ||
| 293 | else | ||
| 294 | { | ||
| 295 | Lisp_Object watch_object = Fassoc (watch_descriptor, watch_list); | ||
| 296 | GFileMonitor *monitor = XINTPTR (watch_descriptor); | ||
| 297 | return build_string (G_OBJECT_TYPE_NAME (monitor)); | ||
| 298 | } | ||
| 299 | } | ||
| 300 | |||
| 281 | 301 | ||
| 282 | void | 302 | void |
| 283 | globals_of_gfilenotify (void) | 303 | globals_of_gfilenotify (void) |
| @@ -294,6 +314,7 @@ syms_of_gfilenotify (void) | |||
| 294 | defsubr (&Sgfile_add_watch); | 314 | defsubr (&Sgfile_add_watch); |
| 295 | defsubr (&Sgfile_rm_watch); | 315 | defsubr (&Sgfile_rm_watch); |
| 296 | defsubr (&Sgfile_valid_p); | 316 | defsubr (&Sgfile_valid_p); |
| 317 | defsubr (&Sgfile_monitor_name); | ||
| 297 | 318 | ||
| 298 | /* Filter objects. */ | 319 | /* Filter objects. */ |
| 299 | DEFSYM (Qchange, "change"); | 320 | DEFSYM (Qchange, "change"); |
diff --git a/src/inotify.c b/src/inotify.c index 38c8df5a29a..cacc6dca147 100644 --- a/src/inotify.c +++ b/src/inotify.c | |||
| @@ -364,7 +364,7 @@ See inotify_rm_watch(2) for more information. | |||
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | DEFUN ("inotify-valid-p", Finotify_valid_p, Sinotify_valid_p, 1, 1, 0, | 366 | DEFUN ("inotify-valid-p", Finotify_valid_p, Sinotify_valid_p, 1, 1, 0, |
| 367 | doc: /* "Check a watch specified by its WATCH-DESCRIPTOR. | 367 | doc: /* Check a watch specified by its WATCH-DESCRIPTOR. |
| 368 | 368 | ||
| 369 | WATCH-DESCRIPTOR should be an object returned by `inotify-add-watch'. | 369 | WATCH-DESCRIPTOR should be an object returned by `inotify-add-watch'. |
| 370 | 370 | ||
diff --git a/src/kqueue.c b/src/kqueue.c index d1d0a612044..8ebd132fdc3 100644 --- a/src/kqueue.c +++ b/src/kqueue.c | |||
| @@ -491,7 +491,7 @@ WATCH-DESCRIPTOR should be an object returned by `kqueue-add-watch'. */) | |||
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | DEFUN ("kqueue-valid-p", Fkqueue_valid_p, Skqueue_valid_p, 1, 1, 0, | 493 | DEFUN ("kqueue-valid-p", Fkqueue_valid_p, Skqueue_valid_p, 1, 1, 0, |
| 494 | doc: /* "Check a watch specified by its WATCH-DESCRIPTOR. | 494 | doc: /* Check a watch specified by its WATCH-DESCRIPTOR. |
| 495 | 495 | ||
| 496 | WATCH-DESCRIPTOR should be an object returned by `kqueue-add-watch'. | 496 | WATCH-DESCRIPTOR should be an object returned by `kqueue-add-watch'. |
| 497 | 497 | ||
diff --git a/src/w32notify.c b/src/w32notify.c index 32a03f70a66..e23e2b8740c 100644 --- a/src/w32notify.c +++ b/src/w32notify.c | |||
| @@ -670,7 +670,7 @@ w32_get_watch_object (void *desc) | |||
| 670 | } | 670 | } |
| 671 | 671 | ||
| 672 | DEFUN ("w32notify-valid-p", Fw32notify_valid_p, Sw32notify_valid_p, 1, 1, 0, | 672 | DEFUN ("w32notify-valid-p", Fw32notify_valid_p, Sw32notify_valid_p, 1, 1, 0, |
| 673 | doc: /* "Check a watch specified by its WATCH-DESCRIPTOR for validity. | 673 | doc: /* Check a watch specified by its WATCH-DESCRIPTOR for validity. |
| 674 | 674 | ||
| 675 | WATCH-DESCRIPTOR should be an object returned by `w32notify-add-watch'. | 675 | WATCH-DESCRIPTOR should be an object returned by `w32notify-add-watch'. |
| 676 | 676 | ||
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 1ed764fb976..e2bcc6b0f7e 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el | |||
| @@ -64,16 +64,22 @@ | |||
| 64 | (defvar file-notify--test-event nil) | 64 | (defvar file-notify--test-event nil) |
| 65 | (defvar file-notify--test-events nil) | 65 | (defvar file-notify--test-events nil) |
| 66 | 66 | ||
| 67 | (defconst file-notify--test-read-event-timeout | 67 | (defun file-notify--test-read-event () |
| 68 | (cond | 68 | "Read one event. |
| 69 | ;; Some events take several seconds to arrive on cygwin. | 69 | There are different timeouts for local and remote file notification libraries." |
| 70 | ((eq system-type 'cygwin) 7) | 70 | (read-event |
| 71 | (t 0.01)) | 71 | nil nil |
| 72 | "Timeout for `read-event' calls. | 72 | (cond |
| 73 | It is different for local and remote file notification libraries.") | 73 | ;; gio/gpollfilemonitor.c declares POLL_TIME_SECS 5. So we must |
| 74 | ;; wait at least this time. | ||
| 75 | ((and (string-equal (file-notify--test-library) "gfilenotify") | ||
| 76 | (string-equal (file-notify--test-monitor) "GPollFileMonitor")) | ||
| 77 | 7) | ||
| 78 | ((file-remote-p temporary-file-directory) 0.1) | ||
| 79 | (t 0.01)))) | ||
| 74 | 80 | ||
| 75 | (defun file-notify--test-timeout () | 81 | (defun file-notify--test-timeout () |
| 76 | "Timeout to wait for arriving events, in seconds." | 82 | "Timeout to wait for arriving a bunch of events, in seconds." |
| 77 | (cond | 83 | (cond |
| 78 | ((file-remote-p temporary-file-directory) 6) | 84 | ((file-remote-p temporary-file-directory) 6) |
| 79 | ((string-equal (file-notify--test-library) "w32notify") 4) | 85 | ((string-equal (file-notify--test-library) "w32notify") 4) |
| @@ -85,7 +91,7 @@ It is different for local and remote file notification libraries.") | |||
| 85 | TIMEOUT is the maximum time to wait for, in seconds." | 91 | TIMEOUT is the maximum time to wait for, in seconds." |
| 86 | `(with-timeout (,timeout (ignore)) | 92 | `(with-timeout (,timeout (ignore)) |
| 87 | (while (null ,until) | 93 | (while (null ,until) |
| 88 | (read-event nil nil file-notify--test-read-event-timeout)))) | 94 | (file-notify--test-read-event)))) |
| 89 | 95 | ||
| 90 | (defun file-notify--test-no-descriptors () | 96 | (defun file-notify--test-no-descriptors () |
| 91 | "Check that `file-notify-descriptors' is an empty hash table. | 97 | "Check that `file-notify-descriptors' is an empty hash table. |
| @@ -197,6 +203,15 @@ remote host, or nil." | |||
| 197 | "<[[:digit:]]+>\\'" "" | 203 | "<[[:digit:]]+>\\'" "" |
| 198 | (process-name (cdr file-notify--test-remote-enabled-checked)))))) | 204 | (process-name (cdr file-notify--test-remote-enabled-checked)))))) |
| 199 | 205 | ||
| 206 | (defun file-notify--test-monitor () | ||
| 207 | "The used monitor for the test, as a string. | ||
| 208 | This returns only for the local case and gfilenotify; otherwise it is nil. | ||
| 209 | `file-notify--test-desc' must be a valid watch descriptor." | ||
| 210 | (and file-notify--test-desc | ||
| 211 | (null (file-remote-p temporary-file-directory)) | ||
| 212 | (functionp 'gfile-monitor-name) | ||
| 213 | (gfile-monitor-name file-notify--test-desc))) | ||
| 214 | |||
| 200 | (defmacro file-notify--deftest-remote (test docstring) | 215 | (defmacro file-notify--deftest-remote (test docstring) |
| 201 | "Define ert `TEST-remote' for remote files." | 216 | "Define ert `TEST-remote' for remote files." |
| 202 | (declare (indent 1)) | 217 | (declare (indent 1)) |
| @@ -205,7 +220,6 @@ remote host, or nil." | |||
| 205 | :tags '(:expensive-test) | 220 | :tags '(:expensive-test) |
| 206 | (let* ((temporary-file-directory | 221 | (let* ((temporary-file-directory |
| 207 | file-notify-test-remote-temporary-file-directory) | 222 | file-notify-test-remote-temporary-file-directory) |
| 208 | (file-notify--test-read-event-timeout 0.1) | ||
| 209 | (ert-test (ert-get-test ',test))) | 223 | (ert-test (ert-get-test ',test))) |
| 210 | (skip-unless (file-notify--test-remote-enabled)) | 224 | (skip-unless (file-notify--test-remote-enabled)) |
| 211 | (tramp-cleanup-connection | 225 | (tramp-cleanup-connection |
| @@ -224,6 +238,8 @@ remote host, or nil." | |||
| 224 | (setq file-notify--test-desc | 238 | (setq file-notify--test-desc |
| 225 | (file-notify-add-watch | 239 | (file-notify-add-watch |
| 226 | temporary-file-directory '(change) #'ignore))) | 240 | temporary-file-directory '(change) #'ignore))) |
| 241 | (when (file-notify--test-monitor) | ||
| 242 | (message "Monitor: `%s'" (file-notify--test-monitor))) | ||
| 227 | (file-notify-rm-watch file-notify--test-desc) | 243 | (file-notify-rm-watch file-notify--test-desc) |
| 228 | 244 | ||
| 229 | ;; The environment shall be cleaned up. | 245 | ;; The environment shall be cleaned up. |
| @@ -387,15 +403,12 @@ delivered." | |||
| 387 | events))) | 403 | events))) |
| 388 | create-lockfiles) | 404 | create-lockfiles) |
| 389 | ;; Flush pending events. | 405 | ;; Flush pending events. |
| 406 | (file-notify--test-read-event) | ||
| 390 | (file-notify--wait-for-events | 407 | (file-notify--wait-for-events |
| 391 | (file-notify--test-timeout) | 408 | (file-notify--test-timeout) |
| 392 | (not (input-pending-p))) | 409 | (not (input-pending-p))) |
| 393 | (setq file-notify--test-events nil | 410 | (setq file-notify--test-events nil |
| 394 | file-notify--test-results nil) | 411 | file-notify--test-results nil) |
| 395 | ;; cygwin needs a delay between setting a watch and beginning | ||
| 396 | ;; file activity, or else the first event is not sent. | ||
| 397 | (if (eq system-type 'cygwin) | ||
| 398 | (sleep-for 1)) | ||
| 399 | ,@body | 412 | ,@body |
| 400 | (file-notify--wait-for-events | 413 | (file-notify--wait-for-events |
| 401 | ;; More events need more time. Use some fudge factor. | 414 | ;; More events need more time. Use some fudge factor. |
| @@ -434,7 +447,7 @@ delivered." | |||
| 434 | (t '(created changed deleted stopped))) | 447 | (t '(created changed deleted stopped))) |
| 435 | (write-region | 448 | (write-region |
| 436 | "another text" nil file-notify--test-tmpfile nil 'no-message) | 449 | "another text" nil file-notify--test-tmpfile nil 'no-message) |
| 437 | (read-event nil nil file-notify--test-read-event-timeout) | 450 | (file-notify--test-read-event) |
| 438 | (delete-file file-notify--test-tmpfile)) | 451 | (delete-file file-notify--test-tmpfile)) |
| 439 | (file-notify-rm-watch file-notify--test-desc)) | 452 | (file-notify-rm-watch file-notify--test-desc)) |
| 440 | 453 | ||
| @@ -452,7 +465,7 @@ delivered." | |||
| 452 | (changed changed deleted stopped)) | 465 | (changed changed deleted stopped)) |
| 453 | (write-region | 466 | (write-region |
| 454 | "another text" nil file-notify--test-tmpfile nil 'no-message) | 467 | "another text" nil file-notify--test-tmpfile nil 'no-message) |
| 455 | (read-event nil nil file-notify--test-read-event-timeout) | 468 | (file-notify--test-read-event) |
| 456 | (delete-file file-notify--test-tmpfile)) | 469 | (delete-file file-notify--test-tmpfile)) |
| 457 | (file-notify-rm-watch file-notify--test-desc) | 470 | (file-notify-rm-watch file-notify--test-desc) |
| 458 | 471 | ||
| @@ -483,7 +496,7 @@ delivered." | |||
| 483 | (t '(created changed deleted deleted stopped))) | 496 | (t '(created changed deleted deleted stopped))) |
| 484 | (write-region | 497 | (write-region |
| 485 | "any text" nil file-notify--test-tmpfile nil 'no-message) | 498 | "any text" nil file-notify--test-tmpfile nil 'no-message) |
| 486 | (read-event nil nil file-notify--test-read-event-timeout) | 499 | (file-notify--test-read-event) |
| 487 | (delete-directory temporary-file-directory 'recursive)) | 500 | (delete-directory temporary-file-directory 'recursive)) |
| 488 | (file-notify-rm-watch file-notify--test-desc)) | 501 | (file-notify-rm-watch file-notify--test-desc)) |
| 489 | 502 | ||
| @@ -516,14 +529,14 @@ delivered." | |||
| 516 | deleted deleted deleted stopped))) | 529 | deleted deleted deleted stopped))) |
| 517 | (write-region | 530 | (write-region |
| 518 | "any text" nil file-notify--test-tmpfile nil 'no-message) | 531 | "any text" nil file-notify--test-tmpfile nil 'no-message) |
| 519 | (read-event nil nil file-notify--test-read-event-timeout) | 532 | (file-notify--test-read-event) |
| 520 | (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) | 533 | (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) |
| 521 | ;; The next two events shall not be visible. | 534 | ;; The next two events shall not be visible. |
| 522 | (read-event nil nil file-notify--test-read-event-timeout) | 535 | (file-notify--test-read-event) |
| 523 | (set-file-modes file-notify--test-tmpfile 000) | 536 | (set-file-modes file-notify--test-tmpfile 000) |
| 524 | (read-event nil nil file-notify--test-read-event-timeout) | 537 | (file-notify--test-read-event) |
| 525 | (set-file-times file-notify--test-tmpfile '(0 0)) | 538 | (set-file-times file-notify--test-tmpfile '(0 0)) |
| 526 | (read-event nil nil file-notify--test-read-event-timeout) | 539 | (file-notify--test-read-event) |
| 527 | (delete-directory temporary-file-directory 'recursive)) | 540 | (delete-directory temporary-file-directory 'recursive)) |
| 528 | (file-notify-rm-watch file-notify--test-desc)) | 541 | (file-notify-rm-watch file-notify--test-desc)) |
| 529 | 542 | ||
| @@ -554,15 +567,16 @@ delivered." | |||
| 554 | (t '(created changed renamed deleted deleted stopped))) | 567 | (t '(created changed renamed deleted deleted stopped))) |
| 555 | (write-region | 568 | (write-region |
| 556 | "any text" nil file-notify--test-tmpfile nil 'no-message) | 569 | "any text" nil file-notify--test-tmpfile nil 'no-message) |
| 557 | (read-event nil nil file-notify--test-read-event-timeout) | 570 | (file-notify--test-read-event) |
| 558 | (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) | 571 | (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) |
| 559 | ;; After the rename, we won't get events anymore. | 572 | ;; After the rename, we won't get events anymore. |
| 560 | (read-event nil nil file-notify--test-read-event-timeout) | 573 | (file-notify--test-read-event) |
| 561 | (delete-directory temporary-file-directory 'recursive)) | 574 | (delete-directory temporary-file-directory 'recursive)) |
| 562 | (file-notify-rm-watch file-notify--test-desc)) | 575 | (file-notify-rm-watch file-notify--test-desc)) |
| 563 | 576 | ||
| 564 | ;; Check attribute change. Does not work for cygwin. | 577 | ;; Check attribute change. Does not work for cygwin. |
| 565 | (unless (eq system-type 'cygwin) | 578 | (unless (and (eq system-type 'cygwin) |
| 579 | (not (file-remote-p temporary-file-directory))) | ||
| 566 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) | 580 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) |
| 567 | (write-region | 581 | (write-region |
| 568 | "any text" nil file-notify--test-tmpfile nil 'no-message) | 582 | "any text" nil file-notify--test-tmpfile nil 'no-message) |
| @@ -588,11 +602,11 @@ delivered." | |||
| 588 | (t '(attribute-changed attribute-changed))) | 602 | (t '(attribute-changed attribute-changed))) |
| 589 | (write-region | 603 | (write-region |
| 590 | "any text" nil file-notify--test-tmpfile nil 'no-message) | 604 | "any text" nil file-notify--test-tmpfile nil 'no-message) |
| 591 | (read-event nil nil file-notify--test-read-event-timeout) | 605 | (file-notify--test-read-event) |
| 592 | (set-file-modes file-notify--test-tmpfile 000) | 606 | (set-file-modes file-notify--test-tmpfile 000) |
| 593 | (read-event nil nil file-notify--test-read-event-timeout) | 607 | (file-notify--test-read-event) |
| 594 | (set-file-times file-notify--test-tmpfile '(0 0)) | 608 | (set-file-times file-notify--test-tmpfile '(0 0)) |
| 595 | (read-event nil nil file-notify--test-read-event-timeout) | 609 | (file-notify--test-read-event) |
| 596 | (delete-file file-notify--test-tmpfile)) | 610 | (delete-file file-notify--test-tmpfile)) |
| 597 | (file-notify-rm-watch file-notify--test-desc)) | 611 | (file-notify-rm-watch file-notify--test-desc)) |
| 598 | 612 | ||
| @@ -736,7 +750,7 @@ delivered." | |||
| 736 | (changed changed deleted stopped)) | 750 | (changed changed deleted stopped)) |
| 737 | (write-region | 751 | (write-region |
| 738 | "another text" nil file-notify--test-tmpfile nil 'no-message) | 752 | "another text" nil file-notify--test-tmpfile nil 'no-message) |
| 739 | (read-event nil nil file-notify--test-read-event-timeout) | 753 | (file-notify--test-read-event) |
| 740 | (delete-file file-notify--test-tmpfile)) | 754 | (delete-file file-notify--test-tmpfile)) |
| 741 | ;; After deleting the file, the descriptor is not valid anymore. | 755 | ;; After deleting the file, the descriptor is not valid anymore. |
| 742 | (should-not (file-notify-valid-p file-notify--test-desc)) | 756 | (should-not (file-notify-valid-p file-notify--test-desc)) |
| @@ -774,7 +788,7 @@ delivered." | |||
| 774 | (t '(created changed deleted deleted stopped))) | 788 | (t '(created changed deleted deleted stopped))) |
| 775 | (write-region | 789 | (write-region |
| 776 | "any text" nil file-notify--test-tmpfile nil 'no-message) | 790 | "any text" nil file-notify--test-tmpfile nil 'no-message) |
| 777 | (read-event nil nil file-notify--test-read-event-timeout) | 791 | (file-notify--test-read-event) |
| 778 | (delete-directory temporary-file-directory t)) | 792 | (delete-directory temporary-file-directory t)) |
| 779 | ;; After deleting the parent directory, the descriptor must | 793 | ;; After deleting the parent directory, the descriptor must |
| 780 | ;; not be valid anymore. | 794 | ;; not be valid anymore. |
| @@ -876,9 +890,9 @@ delivered." | |||
| 876 | (let ((source-file-list source-file-list) | 890 | (let ((source-file-list source-file-list) |
| 877 | (target-file-list target-file-list)) | 891 | (target-file-list target-file-list)) |
| 878 | (while (and source-file-list target-file-list) | 892 | (while (and source-file-list target-file-list) |
| 879 | (read-event nil nil file-notify--test-read-event-timeout) | 893 | (file-notify--test-read-event) |
| 880 | (write-region "" nil (pop source-file-list) nil 'no-message) | 894 | (write-region "" nil (pop source-file-list) nil 'no-message) |
| 881 | (read-event nil nil file-notify--test-read-event-timeout) | 895 | (file-notify--test-read-event) |
| 882 | (write-region "" nil (pop target-file-list) nil 'no-message)))) | 896 | (write-region "" nil (pop target-file-list) nil 'no-message)))) |
| 883 | (file-notify--test-with-events | 897 | (file-notify--test-with-events |
| 884 | (cond | 898 | (cond |
| @@ -890,19 +904,19 @@ delivered." | |||
| 890 | ;; cygwin fires `changed' and `deleted' events, sometimes | 904 | ;; cygwin fires `changed' and `deleted' events, sometimes |
| 891 | ;; in random order. | 905 | ;; in random order. |
| 892 | ((eq system-type 'cygwin) | 906 | ((eq system-type 'cygwin) |
| 893 | (let ((r '(:random))) | 907 | (let (r) |
| 894 | (dotimes (_i n r) | 908 | (dotimes (_i n (cons :random r)) |
| 895 | (setq r (append r '(changed deleted)))))) | 909 | (setq r (append '(changed deleted) r))))) |
| 896 | (t (make-list n 'renamed))) | 910 | (t (make-list n 'renamed))) |
| 897 | (let ((source-file-list source-file-list) | 911 | (let ((source-file-list source-file-list) |
| 898 | (target-file-list target-file-list)) | 912 | (target-file-list target-file-list)) |
| 899 | (while (and source-file-list target-file-list) | 913 | (while (and source-file-list target-file-list) |
| 900 | (read-event nil nil file-notify--test-read-event-timeout) | 914 | (file-notify--test-read-event) |
| 901 | (rename-file (pop source-file-list) (pop target-file-list) t)))) | 915 | (rename-file (pop source-file-list) (pop target-file-list) t)))) |
| 902 | (file-notify--test-with-events (make-list n 'deleted) | 916 | (file-notify--test-with-events (make-list n 'deleted) |
| 903 | (dolist (file target-file-list) | 917 | (dolist (file target-file-list) |
| 904 | (read-event nil nil file-notify--test-read-event-timeout) | 918 | (file-notify--test-read-event) |
| 905 | (delete-file file) file-notify--test-read-event-timeout)) | 919 | (delete-file file))) |
| 906 | (delete-directory file-notify--test-tmpfile) | 920 | (delete-directory file-notify--test-tmpfile) |
| 907 | 921 | ||
| 908 | ;; The environment shall be cleaned up. | 922 | ;; The environment shall be cleaned up. |
| @@ -1040,6 +1054,12 @@ the file watch." | |||
| 1040 | (file-notify--test-with-events | 1054 | (file-notify--test-with-events |
| 1041 | ;; There could be one or two `changed' events. | 1055 | ;; There could be one or two `changed' events. |
| 1042 | (list | 1056 | (list |
| 1057 | ;; cygwin. | ||
| 1058 | (append | ||
| 1059 | '(:random) | ||
| 1060 | (make-list (/ n 2) 'changed) | ||
| 1061 | (make-list (/ n 2) 'created) | ||
| 1062 | (make-list (/ n 2) 'changed)) | ||
| 1043 | (append | 1063 | (append |
| 1044 | '(:random) | 1064 | '(:random) |
| 1045 | ;; Directory monitor and file monitor. | 1065 | ;; Directory monitor and file monitor. |
| @@ -1059,7 +1079,7 @@ the file watch." | |||
| 1059 | (make-list (/ n 2) 'created) | 1079 | (make-list (/ n 2) 'created) |
| 1060 | (make-list (/ n 2) 'changed))) | 1080 | (make-list (/ n 2) 'changed))) |
| 1061 | (dotimes (i n) | 1081 | (dotimes (i n) |
| 1062 | (read-event nil nil file-notify--test-read-event-timeout) | 1082 | (file-notify--test-read-event) |
| 1063 | (if (zerop (mod i 2)) | 1083 | (if (zerop (mod i 2)) |
| 1064 | (write-region | 1084 | (write-region |
| 1065 | "any text" nil file-notify--test-tmpfile1 t 'no-message) | 1085 | "any text" nil file-notify--test-tmpfile1 t 'no-message) |
| @@ -1081,9 +1101,10 @@ the file watch." | |||
| 1081 | ;; Now we delete the directory. | 1101 | ;; Now we delete the directory. |
| 1082 | (file-notify--test-with-events | 1102 | (file-notify--test-with-events |
| 1083 | (cond | 1103 | (cond |
| 1084 | ;; In kqueue, just one `deleted' event for the directory | 1104 | ;; In kqueue and for cygwin, just one `deleted' event for |
| 1085 | ;; is received. | 1105 | ;; the directory is received. |
| 1086 | ((string-equal (file-notify--test-library) "kqueue") | 1106 | ((or (eq system-type 'cygwin) |
| 1107 | (string-equal (file-notify--test-library) "kqueue")) | ||
| 1087 | '(deleted stopped)) | 1108 | '(deleted stopped)) |
| 1088 | (t (append | 1109 | (t (append |
| 1089 | ;; The directory monitor raises a `deleted' event for | 1110 | ;; The directory monitor raises a `deleted' event for |