summaryrefslogtreecommitdiff
path: root/test/lisp/autorevert-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/autorevert-tests.el')
-rw-r--r--test/lisp/autorevert-tests.el19
1 files changed, 16 insertions, 3 deletions
diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el
index 831c6f7b375..6e8219d238d 100644
--- a/test/lisp/autorevert-tests.el
+++ b/test/lisp/autorevert-tests.el
@@ -159,14 +159,18 @@ This expects `auto-revert--messages' to be bound by
(ert-deftest auto-revert-test02-auto-revert-deleted-file ()
"Check autorevert for a deleted file."
:tags '(:expensive-test)
+ ;; Repeated unpredictable failures, bug#32645.
+ ;; Unlikely to be hydra-specific?
+ (skip-unless (not (getenv "EMACS_HYDRA_CI")))
(let ((tmpfile (make-temp-file "auto-revert-test"))
- buf)
+ buf desc)
(unwind-protect
(progn
(write-region "any text" nil tmpfile nil 'no-message)
(setq buf (find-file-noselect tmpfile))
(with-current-buffer buf
+ (should-not auto-revert-notify-watch-descriptor)
(should (string-equal (buffer-string) "any text"))
;; `buffer-stale--default-function' checks for
;; `verify-visited-file-modtime'. We must ensure that
@@ -174,12 +178,16 @@ This expects `auto-revert--messages' to be bound by
(sleep-for 1)
(auto-revert-mode 1)
(should auto-revert-mode)
+ (setq desc auto-revert-notify-watch-descriptor)
;; Remove file while reverting. We simulate this by
;; modifying `before-revert-hook'.
(add-hook
'before-revert-hook
- (lambda () (delete-file buffer-file-name))
+ (lambda ()
+ ;; Temporarily.
+ (message "%s deleted" buffer-file-name)
+ (delete-file buffer-file-name))
nil t)
(ert-with-message-capture auto-revert--messages
@@ -192,7 +200,7 @@ This expects `auto-revert--messages' to be bound by
(should (string-match "any text" (buffer-string)))
;; With w32notify, the 'stopped' events are not sent.
(or (eq file-notify--library 'w32notify)
- (should-not auto-revert-use-notify))
+ (should-not auto-revert-notify-watch-descriptor))
;; Once the file has been recreated, the buffer shall be
;; reverted.
@@ -203,6 +211,11 @@ This expects `auto-revert--messages' to be bound by
(auto-revert--wait-for-revert buf))
;; Check, that the buffer has been reverted.
(should (string-match "another text" (buffer-string)))
+ ;; When file notification is used, it must be reenabled
+ ;; after recreation of the file. We cannot expect that
+ ;; the descriptor is the same, so we just check the
+ ;; existence.
+ (should (eq (null desc) (null auto-revert-notify-watch-descriptor)))
;; An empty file shall still be reverted.
(ert-with-message-capture auto-revert--messages