]> git.eshelyaron.com Git - emacs.git/commitdiff
Enable auto-revert-tests to pass on Android
authorPo Lu <luangruo@yahoo.com>
Wed, 26 Feb 2025 02:33:30 +0000 (10:33 +0800)
committerEshel Yaron <me@eshelyaron.com>
Wed, 26 Feb 2025 09:41:35 +0000 (10:41 +0100)
* 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
test/lisp/autorevert-tests.el

index 042c329a37a332239fef2e87003c7651ccb2de46..b9fcec756cc2dbdc2011ff1d320f1de451215eee 100644 (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"
index d8115b444de98c65f1630436a2e31e6d2d0d42fd..4aab58a6f02a4af4faff17e45421ede0bba32a27 100644 (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.