From: Michael Albinus Date: Sun, 5 May 2019 10:20:44 +0000 (+0200) Subject: Adapt tests for recent file-notification changes in Tramp X-Git-Tag: emacs-27.0.90~2983 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f82e0e5b76da7f0374100628a5e439a0189b0255;p=emacs.git Adapt tests for recent file-notification changes in Tramp * lisp/net/tramp.el (tramp-file-notify-process-sentinel): Pacify byte compiler. * test/lisp/autorevert-tests.el (auto-revert-test02-auto-revert-deleted-file): * test/lisp/filenotify-tests.el (file-notify-test03-events) (file-notify-test05-file-validity) (file-notify-test09-watched-file-in-watched-dir): Adapt for remote files. --- diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index c1fe413e368..911fa912727 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3859,7 +3859,7 @@ of." "Call `file-notify-rm-watch'." (unless (process-live-p proc) (tramp-message proc 5 "Sentinel called: `%S' `%s'" proc event) - (file-notify-rm-watch proc))) + (tramp-compat-funcall 'file-notify-rm-watch proc))) ;;; Functions for establishing connection: diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index d98c11658fe..af9edac1bea 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -309,9 +309,7 @@ This expects `auto-revert--messages' to be bound by ;; polling. (should (string-match "any text" (buffer-string))) ;; With w32notify, the 'stopped' events are not sent. - ;; Same for remote file name handlers. Why? (or (eq file-notify--library 'w32notify) - (file-remote-p temporary-file-directory) (should-not auto-revert-notify-watch-descriptor)) ;; Once the file has been recreated, the buffer shall be diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index af2d0b33e08..b0273741bcb 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -682,17 +682,18 @@ delivered." (file-notify--test-library) "gvfs-monitor-dir.exe") '((deleted stopped) (created deleted stopped))) + ;; On emba, `deleted' and `stopped' events of the + ;; directory are not detected. +; ((getenv "EMACS_EMBA_CI") +; '(created changed deleted)) ;; There are two `deleted' events, for the file and for - ;; the directory. Except for cygwin and kqueue. And - ;; cygwin does not raise a `changed' event. + ;; the directory. Except for cygwin, kqueue and remote + ;; files. And cygwin does not raise a `changed' event. ((eq system-type 'cygwin) '(created deleted stopped)) - ((string-equal (file-notify--test-library) "kqueue") + ((or (string-equal (file-notify--test-library) "kqueue") + (file-remote-p temporary-file-directory)) '(created changed deleted stopped)) - ;; On emba, `deleted' and `stopped' events of the - ;; directory are not detected. - ((getenv "EMACS_EMBA_CI") - '(created changed deleted)) (t '(created changed deleted deleted stopped))) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) @@ -740,8 +741,11 @@ delivered." '(created changed created changed deleted stopped)) ;; On emba, `deleted' and `stopped' events of the ;; directory are not detected. - ((getenv "EMACS_EMBA_CI") - '(created changed created changed deleted deleted)) +; ((getenv "EMACS_EMBA_CI") +; '(created changed created changed deleted deleted)) + ;; Remote files return two `deleted' events. + ((file-remote-p temporary-file-directory) + '(created changed created changed deleted deleted stopped)) (t '(created changed created changed deleted deleted deleted stopped))) (write-region @@ -786,18 +790,19 @@ delivered." (file-notify--test-library) "gvfs-monitor-dir.exe") '((deleted stopped) (created deleted stopped))) + ;; On emba, `deleted' and `stopped' events of the + ;; directory are not detected. +; ((getenv "EMACS_EMBA_CI") +; '(created changed renamed deleted)) ;; There are two `deleted' events, for the file and for - ;; the directory. Except for cygwin and kqueue. And - ;; cygwin raises `created' and `deleted' events instead - ;; of a `renamed' event. + ;; the directory. Except for cygwin, kqueue and remote + ;; files. And cygwin raises `created' and `deleted' + ;; events instead of a `renamed' event. ((eq system-type 'cygwin) '(created created deleted deleted stopped)) - ((string-equal (file-notify--test-library) "kqueue") + ((or (string-equal (file-notify--test-library) "kqueue") + (file-remote-p temporary-file-directory)) '(created changed renamed deleted stopped)) - ;; On emba, `deleted' and `stopped' events of the - ;; directory are not detected. - ((getenv "EMACS_EMBA_CI") - '(created changed renamed deleted)) (t '(created changed renamed deleted deleted stopped))) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) @@ -1041,11 +1046,12 @@ delivered." '((deleted stopped) (created deleted stopped))) ;; There are two `deleted' events, for the file and for - ;; the directory. Except for cygwin and kqueue. And - ;; cygwin does not raise a `changed' event. + ;; the directory. Except for cygwin, kqueue and remote + ;; files. And cygwin does not raise a `changed' event. ((eq system-type 'cygwin) '(created deleted stopped)) - ((string-equal (file-notify--test-library) "kqueue") + ((or (string-equal (file-notify--test-library) "kqueue") + (file-remote-p temporary-file-directory)) '(created changed deleted stopped)) (t '(created changed deleted deleted stopped))) (write-region @@ -1261,7 +1267,8 @@ delivered." (file-notify--test-with-events (cond ;; On cygwin we only get the `changed' event. - ((eq system-type 'cygwin) '(changed)) + ((eq system-type 'cygwin) + '(changed)) (t '(renamed created changed))) ;; The file is renamed when creating a backup. It shall ;; still be watched. @@ -1402,11 +1409,15 @@ the file watch." (cond ;; w32notify does not raise `deleted' and `stopped' ;; events for the watched directory. - ((string-equal (file-notify--test-library) "w32notify") '()) + ((string-equal (file-notify--test-library) "w32notify") + '()) ;; On emba, `deleted' and `stopped' events of the ;; directory are not detected. - ((getenv "EMACS_EMBA_CI") - '()) +; ((getenv "EMACS_EMBA_CI") +; '()) + ;; Remote files send just one `stopped' event. + ((file-remote-p temporary-file-directory) + '(stopped)) (t '(deleted stopped)))))) (delete-directory file-notify--test-tmpfile 'recursive)) (unless (getenv "EMACS_EMBA_CI")