aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2023-01-17 16:00:08 +0100
committerMichael Albinus2023-01-17 16:00:08 +0100
commit013ab7e2a83afa7fb577c356ae686439a2906f34 (patch)
treeae500e02b0f7269420cc607c6b8c7506fcd49fdd /test
parent96015c9c8cc1720e8ee7cd9cea4de48126dd9122 (diff)
downloademacs-013ab7e2a83afa7fb577c356ae686439a2906f34.tar.gz
emacs-013ab7e2a83afa7fb577c356ae686439a2906f34.zip
Complete implementation of `file-user-id'
* lisp/net/ange-ftp.el (ange-ftp-file-user-uid): New defun. Mark it as file name handler for `file-user-uid'. * lisp/net/tramp-archive.el (tramp-archive-handle-file-user-uid): Move up. Protect `file-user-id' call for older Emacs versions. * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): Remove 'file-user-uid'. * test/lisp/net/tramp-archive-tests.el (tramp-archive-test44-file-user-uid): New test. (tramp-archive-test48-auto-load) (tramp-archive-test48-delay-load): Rename. * test/lisp/net/tramp-tests.el (tramp-test44-file-user-uid): New test. (tramp--test-asynchronous-requests-timeout): Adapt docstring. (tramp-test45-asynchronous-requests) (tramp-test46-dired-compress-file) (tramp-test46-dired-compress-dir, tramp-test47-read-password) (tramp-test48-auto-load, tramp-test48-delay-load) (tramp-test48-recursive-load, tramp-test48-remote-load-path) (tramp-test49-unload): Rename.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/tramp-archive-tests.el15
-rw-r--r--test/lisp/net/tramp-tests.el67
2 files changed, 61 insertions, 21 deletions
diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el
index 59b7ed9cf7c..8fe1dbd8d0b 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -878,7 +878,18 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
878 (zerop (nth 1 fsi)) 878 (zerop (nth 1 fsi))
879 (zerop (nth 2 fsi)))))) 879 (zerop (nth 2 fsi))))))
880 880
881(ert-deftest tramp-archive-test47-auto-load () 881;; `file-user-uid' was introduced in Emacs 30.1.
882(ert-deftest tramp-archive-test44-file-user-uid ()
883 "Check that `file-user-uid' returns proper values."
884 (skip-unless tramp-archive-enabled)
885 (skip-unless (fboundp 'file-user-uid))
886
887 (let ((default-directory tramp-archive-test-archive))
888 ;; `file-user-uid' exists since Emacs 30.1. We don't want to see
889 ;; compiler warnings for older Emacsen.
890 (should (integerp (with-no-warnings (file-user-uid))))))
891
892(ert-deftest tramp-archive-test48-auto-load ()
882 "Check that `tramp-archive' autoloads properly." 893 "Check that `tramp-archive' autoloads properly."
883 :tags '(:expensive-test) 894 :tags '(:expensive-test)
884 (skip-unless tramp-archive-enabled) 895 (skip-unless tramp-archive-enabled)
@@ -923,7 +934,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
923 (format "(setq tramp-archive-enabled %s)" enabled)) 934 (format "(setq tramp-archive-enabled %s)" enabled))
924 (shell-quote-argument (format code file))))))))))) 935 (shell-quote-argument (format code file)))))))))))
925 936
926(ert-deftest tramp-archive-test47-delay-load () 937(ert-deftest tramp-archive-test48-delay-load ()
927 "Check that `tramp-archive' is loaded lazily, only when needed." 938 "Check that `tramp-archive' is loaded lazily, only when needed."
928 :tags '(:expensive-test) 939 :tags '(:expensive-test)
929 (skip-unless tramp-archive-enabled) 940 (skip-unless tramp-archive-enabled)
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 168933b6b46..0932a53f4b1 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -33,7 +33,7 @@
33;; remote host, set this environment variable to "/dev/null" or 33;; remote host, set this environment variable to "/dev/null" or
34;; whatever is appropriate on your system. 34;; whatever is appropriate on your system.
35 35
36;; For slow remote connections, `tramp-test44-asynchronous-requests' 36;; For slow remote connections, `tramp-test45-asynchronous-requests'
37;; might be too heavy. Setting $REMOTE_PARALLEL_PROCESSES to a proper 37;; might be too heavy. Setting $REMOTE_PARALLEL_PROCESSES to a proper
38;; value less than 10 could help. 38;; value less than 10 could help.
39 39
@@ -6297,7 +6297,7 @@ INPUT, if non-nil, is a string sent to the process."
6297 (skip-unless (and (fboundp 'file-locked-p) (fboundp 'make-lock-file-name))) 6297 (skip-unless (and (fboundp 'file-locked-p) (fboundp 'make-lock-file-name)))
6298 6298
6299 ;; `lock-file', `unlock-file', `file-locked-p' and 6299 ;; `lock-file', `unlock-file', `file-locked-p' and
6300 ;; `make-lock-file-name' exists since Emacs 28.1. We don't want to 6300 ;; `make-lock-file-name' exist since Emacs 28.1. We don't want to
6301 ;; see compiler warnings for older Emacsen. 6301 ;; see compiler warnings for older Emacsen.
6302 (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil))) 6302 (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
6303 (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) 6303 (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
@@ -7076,11 +7076,40 @@ This requires restrictions of file name syntax."
7076 (dotimes (i (length fsi)) 7076 (dotimes (i (length fsi))
7077 (should (natnump (or (nth i fsi) 0)))))) 7077 (should (natnump (or (nth i fsi) 0))))))
7078 7078
7079;; `tramp-test44-asynchronous-requests' could be blocked. So we set a 7079;; `file-user-uid' was introduced in Emacs 30.1.
7080(ert-deftest tramp-test44-file-user-uid ()
7081 "Check that `file-user-uid' and `tramp-get-remote-*' return proper values."
7082 (skip-unless (tramp--test-enabled))
7083
7084 (let ((default-directory ert-remote-temporary-file-directory))
7085 ;; `file-user-uid' exists since Emacs 30.1. We don't want to see
7086 ;; compiler warnings for older Emacsen.
7087 (when (fboundp 'file-user-uid)
7088 (should (integerp (with-no-warnings (file-user-uid)))))
7089
7090 (with-parsed-tramp-file-name default-directory nil
7091 (should (or (integerp (tramp-get-remote-uid v 'integer))
7092 (null (tramp-get-remote-uid v 'integer))))
7093 (should (or (stringp (tramp-get-remote-uid v 'string))
7094 (null (tramp-get-remote-uid v 'string))))
7095
7096 (should (or (integerp (tramp-get-remote-gid v 'integer))
7097 (null (tramp-get-remote-gid v 'integer))))
7098 (should (or (stringp (tramp-get-remote-gid v 'string))
7099 (null (tramp-get-remote-gid v 'string))))
7100
7101 (when-let ((groups (tramp-get-remote-groups v 'integer)))
7102 (should (consp groups))
7103 (dolist (group groups) (should (integerp group))))
7104 (when-let ((groups (tramp-get-remote-groups v 'string)))
7105 (should (consp groups))
7106 (dolist (group groups) (should (stringp group)))))))
7107
7108;; `tramp-test45-asynchronous-requests' could be blocked. So we set a
7080;; timeout of 300 seconds, and we send a SIGUSR1 signal after 300 7109;; timeout of 300 seconds, and we send a SIGUSR1 signal after 300
7081;; seconds. Similar check is performed in the timer function. 7110;; seconds. Similar check is performed in the timer function.
7082(defconst tramp--test-asynchronous-requests-timeout 300 7111(defconst tramp--test-asynchronous-requests-timeout 300
7083 "Timeout for `tramp-test44-asynchronous-requests'.") 7112 "Timeout for `tramp-test45-asynchronous-requests'.")
7084 7113
7085(defmacro tramp--test-with-proper-process-name-and-buffer (proc &rest body) 7114(defmacro tramp--test-with-proper-process-name-and-buffer (proc &rest body)
7086 "Set \"process-name\" and \"process-buffer\" connection properties. 7115 "Set \"process-name\" and \"process-buffer\" connection properties.
@@ -7116,7 +7145,7 @@ This is needed in timer functions as well as process filters and sentinels."
7116 (tramp-flush-connection-property v "process-buffer"))))) 7145 (tramp-flush-connection-property v "process-buffer")))))
7117 7146
7118;; This test is inspired by Bug#16928. 7147;; This test is inspired by Bug#16928.
7119(ert-deftest tramp-test44-asynchronous-requests () 7148(ert-deftest tramp-test45-asynchronous-requests ()
7120 "Check parallel asynchronous requests. 7149 "Check parallel asynchronous requests.
7121Such requests could arrive from timers, process filters and 7150Such requests could arrive from timers, process filters and
7122process sentinels. They shall not disturb each other." 7151process sentinels. They shall not disturb each other."
@@ -7283,7 +7312,7 @@ process sentinels. They shall not disturb each other."
7283 (unless (process-live-p proc) 7312 (unless (process-live-p proc)
7284 (setq buffers (delq buf buffers)))))) 7313 (setq buffers (delq buf buffers))))))
7285 7314
7286 ;; Checks. All process output shall exists in the 7315 ;; Checks. All process output shall exist in the
7287 ;; respective buffers. All created files shall be 7316 ;; respective buffers. All created files shall be
7288 ;; deleted. 7317 ;; deleted.
7289 (tramp--test-message "Check %s" (current-time-string)) 7318 (tramp--test-message "Check %s" (current-time-string))
@@ -7309,10 +7338,10 @@ process sentinels. They shall not disturb each other."
7309 (ignore-errors (cancel-timer timer)) 7338 (ignore-errors (cancel-timer timer))
7310 (ignore-errors (delete-directory tmp-name 'recursive)))))) 7339 (ignore-errors (delete-directory tmp-name 'recursive))))))
7311 7340
7312;; (tramp--test-deftest-direct-async-process tramp-test44-asynchronous-requests 7341;; (tramp--test-deftest-direct-async-process tramp-test45-asynchronous-requests
7313;; 'unstable) 7342;; 'unstable)
7314 7343
7315(ert-deftest tramp-test45-dired-compress-file () 7344(ert-deftest tramp-test46-dired-compress-file ()
7316 "Check that Tramp (un)compresses normal files." 7345 "Check that Tramp (un)compresses normal files."
7317 (skip-unless (tramp--test-enabled)) 7346 (skip-unless (tramp--test-enabled))
7318 (skip-unless (tramp--test-sh-p)) 7347 (skip-unless (tramp--test-sh-p))
@@ -7333,7 +7362,7 @@ process sentinels. They shall not disturb each other."
7333 (should (string= tmp-name (dired-get-filename))) 7362 (should (string= tmp-name (dired-get-filename)))
7334 (delete-file tmp-name))) 7363 (delete-file tmp-name)))
7335 7364
7336(ert-deftest tramp-test45-dired-compress-dir () 7365(ert-deftest tramp-test46-dired-compress-dir ()
7337 "Check that Tramp (un)compresses directories." 7366 "Check that Tramp (un)compresses directories."
7338 (skip-unless (tramp--test-enabled)) 7367 (skip-unless (tramp--test-enabled))
7339 (skip-unless (tramp--test-sh-p)) 7368 (skip-unless (tramp--test-sh-p))
@@ -7355,7 +7384,7 @@ process sentinels. They shall not disturb each other."
7355 (delete-directory tmp-name) 7384 (delete-directory tmp-name)
7356 (delete-file (concat tmp-name ".tar.gz")))) 7385 (delete-file (concat tmp-name ".tar.gz"))))
7357 7386
7358(ert-deftest tramp-test46-read-password () 7387(ert-deftest tramp-test47-read-password ()
7359 "Check Tramp password handling." 7388 "Check Tramp password handling."
7360 :tags '(:expensive-test) 7389 :tags '(:expensive-test)
7361 (skip-unless (tramp--test-enabled)) 7390 (skip-unless (tramp--test-enabled))
@@ -7415,7 +7444,7 @@ process sentinels. They shall not disturb each other."
7415 (should (file-exists-p ert-remote-temporary-file-directory))))))))) 7444 (should (file-exists-p ert-remote-temporary-file-directory)))))))))
7416 7445
7417;; This test is inspired by Bug#29163. 7446;; This test is inspired by Bug#29163.
7418(ert-deftest tramp-test47-auto-load () 7447(ert-deftest tramp-test48-auto-load ()
7419 "Check that Tramp autoloads properly." 7448 "Check that Tramp autoloads properly."
7420 ;; If we use another syntax but `default', Tramp is already loaded 7449 ;; If we use another syntax but `default', Tramp is already loaded
7421 ;; due to the `tramp-change-syntax' call. 7450 ;; due to the `tramp-change-syntax' call.
@@ -7440,7 +7469,7 @@ process sentinels. They shall not disturb each other."
7440 (mapconcat #'shell-quote-argument load-path " -L ") 7469 (mapconcat #'shell-quote-argument load-path " -L ")
7441 (shell-quote-argument code))))))) 7470 (shell-quote-argument code)))))))
7442 7471
7443(ert-deftest tramp-test47-delay-load () 7472(ert-deftest tramp-test48-delay-load ()
7444 "Check that Tramp is loaded lazily, only when needed." 7473 "Check that Tramp is loaded lazily, only when needed."
7445 ;; Tramp is neither loaded at Emacs startup, nor when completing a 7474 ;; Tramp is neither loaded at Emacs startup, nor when completing a
7446 ;; non-Tramp file name like "/foo". Completing a Tramp-alike file 7475 ;; non-Tramp file name like "/foo". Completing a Tramp-alike file
@@ -7470,7 +7499,7 @@ process sentinels. They shall not disturb each other."
7470 (mapconcat #'shell-quote-argument load-path " -L ") 7499 (mapconcat #'shell-quote-argument load-path " -L ")
7471 (shell-quote-argument (format code tm))))))))) 7500 (shell-quote-argument (format code tm)))))))))
7472 7501
7473(ert-deftest tramp-test47-recursive-load () 7502(ert-deftest tramp-test48-recursive-load ()
7474 "Check that Tramp does not fail due to recursive load." 7503 "Check that Tramp does not fail due to recursive load."
7475 (skip-unless (tramp--test-enabled)) 7504 (skip-unless (tramp--test-enabled))
7476 7505
@@ -7494,7 +7523,7 @@ process sentinels. They shall not disturb each other."
7494 (mapconcat #'shell-quote-argument load-path " -L ") 7523 (mapconcat #'shell-quote-argument load-path " -L ")
7495 (shell-quote-argument code)))))))) 7524 (shell-quote-argument code))))))))
7496 7525
7497(ert-deftest tramp-test47-remote-load-path () 7526(ert-deftest tramp-test48-remote-load-path ()
7498 "Check that Tramp autoloads its packages with remote `load-path'." 7527 "Check that Tramp autoloads its packages with remote `load-path'."
7499 ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el. 7528 ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el.
7500 ;; It shall still work, when a remote file name is in the 7529 ;; It shall still work, when a remote file name is in the
@@ -7519,7 +7548,7 @@ process sentinels. They shall not disturb each other."
7519 (mapconcat #'shell-quote-argument load-path " -L ") 7548 (mapconcat #'shell-quote-argument load-path " -L ")
7520 (shell-quote-argument code))))))) 7549 (shell-quote-argument code)))))))
7521 7550
7522(ert-deftest tramp-test48-unload () 7551(ert-deftest tramp-test49-unload ()
7523 "Check that Tramp and its subpackages unload completely. 7552 "Check that Tramp and its subpackages unload completely.
7524Since it unloads Tramp, it shall be the last test to run." 7553Since it unloads Tramp, it shall be the last test to run."
7525 :tags '(:expensive-test) 7554 :tags '(:expensive-test)
@@ -7620,19 +7649,19 @@ If INTERACTIVE is non-nil, the tests are run interactively."
7620;; * file-name-case-insensitive-p 7649;; * file-name-case-insensitive-p
7621;; * memory-info 7650;; * memory-info
7622;; * tramp-get-home-directory 7651;; * tramp-get-home-directory
7623;; * tramp-get-remote-gid
7624;; * tramp-get-remote-groups
7625;; * tramp-get-remote-uid
7626;; * tramp-set-file-uid-gid 7652;; * tramp-set-file-uid-gid
7627 7653
7628;; * Work on skipped tests. Make a comment, when it is impossible. 7654;; * Work on skipped tests. Make a comment, when it is impossible.
7629;; * Revisit expensive tests, once problems in `tramp-error' are solved. 7655;; * Revisit expensive tests, once problems in `tramp-error' are solved.
7630;; * Fix `tramp-test06-directory-file-name' for "ftp". 7656;; * Fix `tramp-test06-directory-file-name' for "ftp".
7657;; * Check, why a process filter t doesn't work in
7658;; `tramp-test29-start-file-process' and
7659;; `tramp-test30-make-process'.
7631;; * Implement `tramp-test31-interrupt-process' and 7660;; * Implement `tramp-test31-interrupt-process' and
7632;; `tramp-test31-signal-process' for "adb", "sshfs" and for direct 7661;; `tramp-test31-signal-process' for "adb", "sshfs" and for direct
7633;; async processes. Check, why they don't run stable. 7662;; async processes. Check, why they don't run stable.
7634;; * Check, why direct async processes do not work for 7663;; * Check, why direct async processes do not work for
7635;; `tramp-test44-asynchronous-requests'. 7664;; `tramp-test45-asynchronous-requests'.
7636 7665
7637(provide 'tramp-tests) 7666(provide 'tramp-tests)
7638 7667