Enable auto-revert-tests to pass on Android

* lisp/emacs-lisp/ert-x.el
(ert-remote-temporary-file-directory): Define to null-device on
Android.

* test/lisp/autorevert-tests.el
(auto-revert-test02-auto-revert-deleted-file): Provide for
situations where the watch descriptor is recreated by the
polling timer after a file notification is received.
This commit is contained in:
Po Lu 2025-02-26 10:33:30 +08:00
parent 928dc34e05
commit c5853892c5
2 changed files with 12 additions and 1 deletions

View file

@ -392,6 +392,9 @@ The same keyword arguments are supported as in
(cond
((getenv "REMOTE_TEMPORARY_FILE_DIRECTORY"))
((eq system-type 'windows-nt) null-device)
;; Android's built-in shell is far too dysfunctional to support
;; Tramp.
((eq system-type 'android) null-device)
(t (add-to-list
'tramp-methods
'("mock"

View file

@ -295,6 +295,7 @@ This expects `auto-revert--messages' to be bound by
(ert-with-message-capture auto-revert--messages
(auto-revert-tests--write-file "another text" tmpfile (pop times))
(should (eq desc auto-revert-notify-watch-descriptor))
(auto-revert--wait-for-revert buf))
;; Check, that the buffer hasn't been reverted. File
;; notification should be disabled, falling back to
@ -304,7 +305,14 @@ This expects `auto-revert--messages' to be bound by
(or (eq file-notify--library 'w32notify)
(getenv "EMACS_EMBA_CI")
(should-not
(file-notify-valid-p auto-revert-notify-watch-descriptor)))
;; The auto-revert timer is wont to establish a new
;; watch soon after the previous descriptor is
;; destroyed, which not unnaturally interferes with
;; our testing for its destruction, since descriptor
;; IDs are reused. Therefore, test the identity of
;; the previous descriptor, not just its validity.
(and (eq desc auto-revert-notify-watch-descriptor)
(file-notify-valid-p auto-revert-notify-watch-descriptor))))
;; Once the file has been recreated, the buffer shall be
;; reverted.