From d45f003970925c0616f22e0257eda5d21f9ef996 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 26 Feb 2025 10:33:30 +0800 Subject: [PATCH] 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. (cherry picked from commit c5853892c58be8e1c543177967850dceb1f4bcbc) --- lisp/emacs-lisp/ert-x.el | 3 +++ test/lisp/autorevert-tests.el | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index 042c329a37a..b9fcec756cc 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -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" diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index d8115b444de..4aab58a6f02 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -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. -- 2.39.5