mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Rework filenotify-tests.el
* lisp/filenotify.el (file-notify--rm-descriptor): Use `insert-special-event'. * lisp/net/tramp-sh.el (tramp-bundle-read-file-names): Fix docstring. (tramp-sh-gio-monitor-process-filter): Extend error strings. * test/infra/Dockerfile.emba (emacs-base): Install python3. * test/lisp/filenotify-tests.el (auto-revert-buffer-list): Declare. (file-notify--test-rootdir): New defvar. Replace all uses of `temporary-file-directory' by it. (file-notify--test-cleanup): Set `auto-revert-buffer-list' to nil. (file-notify--test-monitor): Check also for `process-live-p'. Skip test, if the monitor cannot be determined. (file-notify--deftest-remote): Do not call `tramp-cleanup-connection', this is done in `file-notify--test-cleanup' already. (with-file-notify-test): New defmacro. Use it in (almost) all tests. (file-notify--test-make-temp-name): Do not create `file-notify--test-tmpdir'. (file-notify--test-event-handler): Use `directory-file-name '. (auto-revert-debug): Set it to nil. (file-notify-test<nn>-*): Rewrite, using `with-file-notify-test' and `ert-with-temp-file'. * test/lisp/net/tramp-tests.el (tramp-test46-file-notifications): Tag it :unstable.
This commit is contained in:
parent
6e64e0bd26
commit
76c17ac0f0
5 changed files with 1090 additions and 1243 deletions
|
|
@ -78,8 +78,8 @@ DESCRIPTOR should be an object returned by `file-notify-add-watch'.
|
|||
If it is registered in `file-notify-descriptors', a `stopped' event is sent."
|
||||
(when-let* ((watch (gethash descriptor file-notify-descriptors)))
|
||||
(unwind-protect
|
||||
;; Send `stopped' event.
|
||||
(file-notify-handle-event
|
||||
;; Insert `stopped' event.
|
||||
(insert-special-event
|
||||
(make-file-notify
|
||||
:-event `(,descriptor stopped
|
||||
,(file-notify--watch-absolute-filename watch))
|
||||
|
|
|
|||
|
|
@ -3619,8 +3619,9 @@ will be used."
|
|||
|
||||
(defun tramp-bundle-read-file-names (vec files)
|
||||
"Read file attributes of FILES and with one command fill the cache.
|
||||
FILES must be the local names only. The cache attributes to be
|
||||
filled are described in `tramp-bundle-read-file-names'."
|
||||
FILES must be the local names only. The cache attributes to be filled
|
||||
are \"file-exists-p\", \"file-readable-p\", \"file-directory-p\" and
|
||||
\"file-executable-p\"."
|
||||
(when files
|
||||
(tramp-maybe-send-script
|
||||
vec tramp-bundle-read-file-names "tramp_bundle_read_file_names")
|
||||
|
|
@ -3875,7 +3876,10 @@ Fall back to normal file name handler if no Tramp handler exists."
|
|||
(catch 'doesnt-work
|
||||
;; https://bugs.launchpad.net/bugs/1742946
|
||||
(when (string-match-p
|
||||
(rx (| "Monitoring not supported" "No locations given")) string)
|
||||
(rx (| "Monitoring not supported"
|
||||
"No locations given"
|
||||
"Unable to find default local file monitor type"))
|
||||
string)
|
||||
(delete-process proc)
|
||||
(throw 'doesnt-work nil))
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ FROM debian:bookworm as emacs-base
|
|||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \
|
||||
libc-dev gcc g++ make autoconf automake libncurses-dev gnutls-dev \
|
||||
libxml2-dev libdbus-1-dev libacl1-dev acl git man-db texinfo gdb \
|
||||
libxml2-dev libdbus-1-dev libacl1-dev acl git man-db texinfo gdb python3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
FROM emacs-base as emacs-inotify
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -8095,7 +8095,10 @@ process sentinels. They shall not disturb each other."
|
|||
;; selector "remote".
|
||||
(ert-deftest tramp-test46-file-notifications ()
|
||||
"Check that Tramp handles file notifications."
|
||||
:tags '(:unstable)
|
||||
(skip-unless (tramp--test-enabled))
|
||||
;; filenotify.el was reworked in Emacs 31.
|
||||
(skip-unless (tramp--test-emacs31-p))
|
||||
|
||||
(let* ((tmp-name (tramp--test-make-temp-name))
|
||||
;(file-notify-debug t)
|
||||
|
|
@ -8114,12 +8117,13 @@ process sentinels. They shall not disturb each other."
|
|||
(progn
|
||||
(tramp--test-message "%S" desc1)
|
||||
(should-not (file-exists-p tmp-name))
|
||||
(should (file-notify-valid-p desc1))
|
||||
(should (file-notify-valid-p desc2))
|
||||
|
||||
;; Create the file.
|
||||
;; Create the file. `file-notify-valid-p' requires that the
|
||||
;; watched file exists, so we cannot check it earlier for `desc1'.
|
||||
(write-region "foo" nil tmp-name)
|
||||
(should (file-exists-p tmp-name))
|
||||
(should (file-notify-valid-p desc1))
|
||||
;; Modify.
|
||||
(write-region "foo" nil tmp-name)
|
||||
(should (file-exists-p tmp-name))
|
||||
|
|
|
|||
Loading…
Reference in a new issue