diff options
| author | Michael Albinus | 2024-02-20 12:52:40 +0100 |
|---|---|---|
| committer | Michael Albinus | 2024-02-20 12:52:40 +0100 |
| commit | 4e9993cada32a866a75b458092de0028db2f5f41 (patch) | |
| tree | 8687fe6e6cf17747b3076b4fe2c7bf22dc38a0c1 /test | |
| parent | a1cbc4d810bc1b525fa46b23249b414c1ad6b031 (diff) | |
| download | emacs-4e9993cada32a866a75b458092de0028db2f5f41.tar.gz emacs-4e9993cada32a866a75b458092de0028db2f5f41.zip | |
Add Tramp methods dockercp and podmancp
* doc/misc/tramp.texi (External methods): Add dockercp and podmancp.
* etc/NEWS: Add Tramp methods "dockercp" and "podmancp".
* lisp/net/tramp.el (tramp-handle-make-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-handle-process-file)
(tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-send-command): Adapt
`tramp-expand-args' calls.
* lisp/net/tramp-container.el (tramp-dockercp-method)
(tramp-podmancp-method): New defconst.
(tramp-methods) <dockercp, podmancp>: Add new methods.
(tramp-container--completion-function): Adapt docstring. Use it
for "dockercp" and "podmancp" completion.
* lisp/net/tramp.el (tramp-get-remote-tmpdir):
* lisp/net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-maybe-open-connection): Use a default
value with `tramp-get-method-parameter'.
* lisp/net/tramp-sh.el (tramp-methods) <nc>: Add `tramp-copy-file-name'.
(tramp-default-copy-file-name): New defconst.
(tramp-make-copy-file-name): Rename from
`tramp-make-copy-program-file-name'. Use method parameter
`tramp-copy-file-name'. (Bug#69085)
(tramp-do-copy-or-rename-file-out-of-band): Adapt callees.
* lisp/net/tramp.el (tramp-methods): Adapt docstring.
(tramp-get-method-parameter, tramp-expand-args): New optional
argument DEFAULT.
* test/lisp/net/tramp-tests.el (tramp--test-container-p): Adapt.
(tramp--test-container-oob-p): New defun.
(tramp-test17-dired-with-wildcards, tramp-test35-remote-path)
(tramp-test41-special-characters): Use it.
(tramp--test-set-ert-test-documentation): Use `split-string'.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 85 |
1 files changed, 50 insertions, 35 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 623e0860a01..cdd2a1efdb2 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -3493,6 +3493,8 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 3493 | (skip-unless (not (tramp--test-rsync-p))) | 3493 | (skip-unless (not (tramp--test-rsync-p))) |
| 3494 | ;; Wildcards are not supported in tramp-crypt.el. | 3494 | ;; Wildcards are not supported in tramp-crypt.el. |
| 3495 | (skip-unless (not (tramp--test-crypt-p))) | 3495 | (skip-unless (not (tramp--test-crypt-p))) |
| 3496 | ;; Wildcards are not supported with "docker cp ..." or "podman cp ...". | ||
| 3497 | (skip-unless (not (tramp--test-container-oob-p))) | ||
| 3496 | 3498 | ||
| 3497 | (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil))) | 3499 | (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil))) |
| 3498 | (let* ((tmp-name1 | 3500 | (let* ((tmp-name1 |
| @@ -3819,7 +3821,7 @@ This tests also `access-file', `file-readable-p', | |||
| 3819 | "Set the documentation string for a derived test. | 3821 | "Set the documentation string for a derived test. |
| 3820 | The test is derived from TEST and COMMAND." | 3822 | The test is derived from TEST and COMMAND." |
| 3821 | (let ((test-doc | 3823 | (let ((test-doc |
| 3822 | (string-split (ert-test-documentation (get test 'ert--test)) "\n"))) | 3824 | (split-string (ert-test-documentation (get test 'ert--test)) "\n"))) |
| 3823 | ;; The first line must be extended. | 3825 | ;; The first line must be extended. |
| 3824 | (setcar | 3826 | (setcar |
| 3825 | test-doc (format "%s Use the \"%s\" command." (car test-doc) command)) | 3827 | test-doc (format "%s Use the \"%s\" command." (car test-doc) command)) |
| @@ -6379,33 +6381,35 @@ INPUT, if non-nil, is a string sent to the process." | |||
| 6379 | (setq tramp-remote-path orig-tramp-remote-path) | 6381 | (setq tramp-remote-path orig-tramp-remote-path) |
| 6380 | 6382 | ||
| 6381 | ;; We make a super long `tramp-remote-path'. | 6383 | ;; We make a super long `tramp-remote-path'. |
| 6382 | (make-directory tmp-name) | 6384 | (unless (tramp--test-container-oob-p) |
| 6383 | (should (file-directory-p tmp-name)) | 6385 | (make-directory tmp-name) |
| 6384 | (while (tramp-compat-length< (string-join orig-exec-path ":") 5000) | 6386 | (should (file-directory-p tmp-name)) |
| 6385 | (let ((dir (make-temp-file (file-name-as-directory tmp-name) 'dir))) | 6387 | (while (tramp-compat-length< (string-join orig-exec-path ":") 5000) |
| 6386 | (should (file-directory-p dir)) | 6388 | (let ((dir (make-temp-file |
| 6387 | (setq tramp-remote-path | 6389 | (file-name-as-directory tmp-name) 'dir))) |
| 6388 | (append | 6390 | (should (file-directory-p dir)) |
| 6389 | tramp-remote-path `(,(file-remote-p dir 'localname))) | 6391 | (setq tramp-remote-path |
| 6390 | orig-exec-path | 6392 | (append |
| 6391 | (append | 6393 | tramp-remote-path `(,(file-remote-p dir 'localname))) |
| 6392 | (butlast orig-exec-path) | 6394 | orig-exec-path |
| 6393 | `(,(file-remote-p dir 'localname)) | 6395 | (append |
| 6394 | (last orig-exec-path))))) | 6396 | (butlast orig-exec-path) |
| 6395 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) | 6397 | `(,(file-remote-p dir 'localname)) |
| 6396 | (should (equal (exec-path) orig-exec-path)) | 6398 | (last orig-exec-path))))) |
| 6397 | ;; Ignore trailing newline. | 6399 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) |
| 6398 | (setq path (substring (shell-command-to-string "echo $PATH") nil -1)) | 6400 | (should (equal (exec-path) orig-exec-path)) |
| 6399 | ;; The shell doesn't handle such long strings. | 6401 | ;; Ignore trailing newline. |
| 6400 | (unless (tramp-compat-length> | 6402 | (setq path (substring (shell-command-to-string "echo $PATH") nil -1)) |
| 6401 | path | 6403 | ;; The shell doesn't handle such long strings. |
| 6402 | (tramp-get-connection-property | 6404 | (unless (tramp-compat-length> |
| 6403 | tramp-test-vec "pipe-buf" 4096)) | 6405 | path |
| 6404 | ;; The last element of `exec-path' is `exec-directory'. | 6406 | (tramp-get-connection-property |
| 6405 | (should | 6407 | tramp-test-vec "pipe-buf" 4096)) |
| 6406 | (string-equal path (string-join (butlast orig-exec-path) ":")))) | 6408 | ;; The last element of `exec-path' is `exec-directory'. |
| 6407 | ;; The shell "sh" shall always exist. | 6409 | (should |
| 6408 | (should (executable-find "sh" 'remote))) | 6410 | (string-equal path (string-join (butlast orig-exec-path) ":")))) |
| 6411 | ;; The shell "sh" shall always exist. | ||
| 6412 | (should (executable-find "sh" 'remote)))) | ||
| 6409 | 6413 | ||
| 6410 | ;; Cleanup. | 6414 | ;; Cleanup. |
| 6411 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) | 6415 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) |
| @@ -7056,17 +7060,24 @@ This is used in tests which we don't want to tag | |||
| 7056 | (not (and (tramp--test-adb-p) | 7060 | (not (and (tramp--test-adb-p) |
| 7057 | (string-match-p (rx multibyte) default-directory))))) | 7061 | (string-match-p (rx multibyte) default-directory))))) |
| 7058 | 7062 | ||
| 7059 | (defun tramp--test-crypt-p () | ||
| 7060 | "Check, whether the remote directory is encrypted." | ||
| 7061 | (tramp-crypt-file-name-p ert-remote-temporary-file-directory)) | ||
| 7062 | |||
| 7063 | (defun tramp--test-container-p () | 7063 | (defun tramp--test-container-p () |
| 7064 | "Check, whether a container method is used. | 7064 | "Check, whether a container method is used. |
| 7065 | This does not support some special file names." | 7065 | This does not support some special file names." |
| 7066 | (string-match-p | 7066 | (string-match-p |
| 7067 | (rx bol (| "docker" "podman") eol) | 7067 | (rx bol (| "docker" "podman")) |
| 7068 | (file-remote-p ert-remote-temporary-file-directory 'method))) | 7068 | (file-remote-p ert-remote-temporary-file-directory 'method))) |
| 7069 | 7069 | ||
| 7070 | (defun tramp--test-container-oob-p () | ||
| 7071 | "Check, whether the dockercp or podmancp method is used. | ||
| 7072 | They does not support wildcard copy." | ||
| 7073 | (string-match-p | ||
| 7074 | (rx bol (| "dockercp" "podmancp") eol) | ||
| 7075 | (file-remote-p ert-remote-temporary-file-directory 'method))) | ||
| 7076 | |||
| 7077 | (defun tramp--test-crypt-p () | ||
| 7078 | "Check, whether the remote directory is encrypted." | ||
| 7079 | (tramp-crypt-file-name-p ert-remote-temporary-file-directory)) | ||
| 7080 | |||
| 7070 | (defun tramp--test-expensive-test-p () | 7081 | (defun tramp--test-expensive-test-p () |
| 7071 | "Whether expensive tests are run. | 7082 | "Whether expensive tests are run. |
| 7072 | This is used in tests which we don't want to tag `:expensive' | 7083 | This is used in tests which we don't want to tag `:expensive' |
| @@ -7483,7 +7494,8 @@ This requires restrictions of file name syntax." | |||
| 7483 | (tramp--test-gvfs-p) | 7494 | (tramp--test-gvfs-p) |
| 7484 | (tramp--test-windows-nt-or-smb-p)) | 7495 | (tramp--test-windows-nt-or-smb-p)) |
| 7485 | "?foo?bar?baz?") | 7496 | "?foo?bar?baz?") |
| 7486 | (unless (or (tramp--test-ftp-p) | 7497 | (unless (or (tramp--test-container-oob-p) |
| 7498 | (tramp--test-ftp-p) | ||
| 7487 | (tramp--test-gvfs-p) | 7499 | (tramp--test-gvfs-p) |
| 7488 | (tramp--test-windows-nt-or-smb-p)) | 7500 | (tramp--test-windows-nt-or-smb-p)) |
| 7489 | "*foo+bar*baz+") | 7501 | "*foo+bar*baz+") |
| @@ -7503,7 +7515,10 @@ This requires restrictions of file name syntax." | |||
| 7503 | (unless (or (tramp--test-gvfs-p) (tramp--test-windows-nt-or-smb-p)) | 7515 | (unless (or (tramp--test-gvfs-p) (tramp--test-windows-nt-or-smb-p)) |
| 7504 | "<foo>bar<baz>") | 7516 | "<foo>bar<baz>") |
| 7505 | "(foo)bar(baz)" | 7517 | "(foo)bar(baz)" |
| 7506 | (unless (or (tramp--test-ftp-p) (tramp--test-gvfs-p)) "[foo]bar[baz]") | 7518 | (unless (or (tramp--test-container-oob-p) |
| 7519 | (tramp--test-ftp-p) | ||
| 7520 | (tramp--test-gvfs-p)) | ||
| 7521 | "[foo]bar[baz]") | ||
| 7507 | "{foo}bar{baz}"))) | 7522 | "{foo}bar{baz}"))) |
| 7508 | ;; Simplify test in order to speed up. | 7523 | ;; Simplify test in order to speed up. |
| 7509 | (apply #'tramp--test-check-files | 7524 | (apply #'tramp--test-check-files |