Add tag :tramp-asynchronous-processes to tramp-tests.el
* test/lisp/net/tramp-tests.el (tramp-test29-start-file-process) (tramp--test--deftest-direct-async-process) (tramp-test30-make-process, tramp-test31-interrupt-process) (tramp-test34-explicit-shell-file-name) (tramp-test44-asynchronous-requests): Add :tramp-asynchronous-processes tag. (tramp--test-asynchronous-processes-p): New defun. (tramp-test32-shell-command, tramp-test33-environment-variables): Use it. (tramp--test-expensive-test-p): Rename from `tramp--test-expensive-test'. Make it a defun. Adapt all callees.
This commit is contained in:
parent
b6fac9aaaf
commit
54c96badf9
1 changed files with 122 additions and 97 deletions
|
@ -157,13 +157,6 @@ being the result.")
|
|||
;; Return result.
|
||||
(cdr tramp--test-enabled-checked))
|
||||
|
||||
(defsubst tramp--test-expensive-test ()
|
||||
"Whether expensive tests are run."
|
||||
(ert-select-tests
|
||||
(ert--stats-selector ert--current-run-stats)
|
||||
(list (make-ert-test :name (ert-test-name (ert-running-test))
|
||||
:body nil :tags '(:expensive-test)))))
|
||||
|
||||
(defun tramp--test-make-temp-name (&optional local quoted)
|
||||
"Return a temporary file name for test.
|
||||
If LOCAL is non-nil, a local file name is returned.
|
||||
|
@ -2330,7 +2323,7 @@ This checks also `file-name-as-directory', `file-name-directory',
|
|||
"Check `file-exist-p', `write-region' and `delete-file'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((tmp-name (tramp--test-make-temp-name nil quoted)))
|
||||
(should-not (file-exists-p tmp-name))
|
||||
(write-region "foo" nil tmp-name)
|
||||
|
@ -2365,7 +2358,7 @@ This checks also `file-name-as-directory', `file-name-directory',
|
|||
"Check `file-local-copy'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
tmp-name2)
|
||||
(unwind-protect
|
||||
|
@ -2397,7 +2390,7 @@ This checks also `file-name-as-directory', `file-name-directory',
|
|||
"Check `insert-file-contents'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((tmp-name (tramp--test-make-temp-name nil quoted)))
|
||||
(unwind-protect
|
||||
(with-temp-buffer
|
||||
|
@ -2434,7 +2427,7 @@ This checks also `file-name-as-directory', `file-name-directory',
|
|||
"Check `write-region'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((tmp-name (tramp--test-make-temp-name nil quoted))
|
||||
(inhibit-message t))
|
||||
(unwind-protect
|
||||
|
@ -2570,8 +2563,9 @@ This checks also `file-name-as-directory', `file-name-directory',
|
|||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
|
||||
(dolist (quoted (if (and (tramp--test-expensive-test) (tramp--test-emacs27-p))
|
||||
'(nil t) '(nil)))
|
||||
(dolist (quoted
|
||||
(if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
|
||||
'(nil t) '(nil)))
|
||||
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name3 (tramp--test-make-temp-name 'local quoted)))
|
||||
|
@ -2598,7 +2592,7 @@ This checks also `file-name-as-directory', `file-name-directory',
|
|||
(with-temp-buffer
|
||||
(insert-file-contents target)
|
||||
(should (string-equal (buffer-string) "foo")))
|
||||
(when (tramp--test-expensive-test)
|
||||
(when (tramp--test-expensive-test-p)
|
||||
(should-error
|
||||
(copy-file source target)
|
||||
:type 'file-already-exists))
|
||||
|
@ -2616,7 +2610,7 @@ This checks also `file-name-as-directory', `file-name-directory',
|
|||
(should (file-exists-p source))
|
||||
(make-directory target)
|
||||
(should (file-directory-p target))
|
||||
(when (tramp--test-expensive-test)
|
||||
(when (tramp--test-expensive-test-p)
|
||||
(should-error
|
||||
(copy-file source target)
|
||||
:type 'file-already-exists)
|
||||
|
@ -2681,8 +2675,9 @@ This checks also `file-name-as-directory', `file-name-directory',
|
|||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
|
||||
(dolist (quoted (if (and (tramp--test-expensive-test) (tramp--test-emacs27-p))
|
||||
'(nil t) '(nil)))
|
||||
(dolist (quoted
|
||||
(if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
|
||||
'(nil t) '(nil)))
|
||||
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name3 (tramp--test-make-temp-name 'local quoted)))
|
||||
|
@ -2712,7 +2707,7 @@ This checks also `file-name-as-directory', `file-name-directory',
|
|||
(should (string-equal (buffer-string) "foo")))
|
||||
(write-region "foo" nil source)
|
||||
(should (file-exists-p source))
|
||||
(when (tramp--test-expensive-test)
|
||||
(when (tramp--test-expensive-test-p)
|
||||
(should-error
|
||||
(rename-file source target)
|
||||
:type 'file-already-exists))
|
||||
|
@ -2730,7 +2725,7 @@ This checks also `file-name-as-directory', `file-name-directory',
|
|||
(should (file-exists-p source))
|
||||
(make-directory target)
|
||||
(should (file-directory-p target))
|
||||
(when (tramp--test-expensive-test)
|
||||
(when (tramp--test-expensive-test-p)
|
||||
(should-error
|
||||
(rename-file source target)
|
||||
:type 'file-already-exists)
|
||||
|
@ -2798,7 +2793,7 @@ This checks also `file-name-as-directory', `file-name-directory',
|
|||
This tests also `file-directory-p' and `file-accessible-directory-p'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (expand-file-name "foo/bar" tmp-name1))
|
||||
(unusual-file-mode-1 #o740)
|
||||
|
@ -2836,7 +2831,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
|
|||
"Check `delete-directory'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (expand-file-name "foo" tmp-name1)))
|
||||
;; Delete empty directory.
|
||||
|
@ -2913,7 +2908,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
|
|||
(skip-unless (tramp--test-enabled))
|
||||
(skip-unless (not (tramp--test-rclone-p)))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name3 (expand-file-name
|
||||
|
@ -3022,7 +3017,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
|
|||
"Check `directory-files'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (expand-file-name "bla" tmp-name1))
|
||||
(tmp-name3 (expand-file-name "foo" tmp-name1)))
|
||||
|
@ -3066,7 +3061,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
|
|||
"Check `file-expand-wildcards'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (expand-file-name "foo" tmp-name1))
|
||||
(tmp-name3 (expand-file-name "bar" tmp-name1))
|
||||
|
@ -3136,7 +3131,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
|
|||
;; Emacs 27.1.
|
||||
(skip-unless (or (not (tramp--test-crypt-p)) (tramp--test-emacs27-p)))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let* ((tmp-name1
|
||||
(expand-file-name (tramp--test-make-temp-name nil quoted)))
|
||||
(tmp-name2 (expand-file-name "foo" tmp-name1))
|
||||
|
@ -3217,7 +3212,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
|
|||
;; Wildcards are not supported in tramp-crypt.el.
|
||||
(skip-unless (not (tramp--test-crypt-p)))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let* ((tmp-name1
|
||||
(expand-file-name (tramp--test-make-temp-name nil quoted)))
|
||||
(tmp-name2
|
||||
|
@ -3321,7 +3316,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
|
|||
;; Relative file names in dired are not supported in tramp-crypt.el.
|
||||
(skip-unless (not (tramp--test-crypt-p)))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let* ((tmp-name1
|
||||
(expand-file-name (tramp--test-make-temp-name nil quoted)))
|
||||
(tmp-name2 (expand-file-name "foo" tmp-name1))
|
||||
|
@ -3375,7 +3370,7 @@ This tests also `access-file', `file-readable-p',
|
|||
`file-regular-p' and `file-ownership-preserved-p'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
;; We must use `file-truename' for the temporary directory,
|
||||
;; because it could be located on a symlinked directory. This
|
||||
;; would let the test fail.
|
||||
|
@ -3580,7 +3575,7 @@ They might differ only in time attributes or directory size."
|
|||
"Check `directory-files-and-attributes'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
;; `directory-files-and-attributes' contains also values for
|
||||
;; "../". Ensure that this doesn't change during tests, for
|
||||
;; example due to handling temporary files.
|
||||
|
@ -3638,7 +3633,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
|
|||
(skip-unless (tramp--test-enabled))
|
||||
(skip-unless (tramp--test-supports-set-file-modes-p))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (tramp--test-make-temp-name nil quoted)))
|
||||
|
||||
|
@ -3729,7 +3724,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
|
|||
This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
;; We must use `file-truename' for the temporary directory,
|
||||
;; because it could be located on a symlinked directory. This
|
||||
;; would let the test fail.
|
||||
|
@ -3754,11 +3749,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
(if quoted #'tramp-compat-file-name-unquote #'identity)
|
||||
(file-remote-p tmp-name1 'localname))
|
||||
(file-symlink-p tmp-name2)))
|
||||
(when (tramp--test-expensive-test)
|
||||
(when (tramp--test-expensive-test-p)
|
||||
(should-error
|
||||
(make-symbolic-link tmp-name1 tmp-name2)
|
||||
:type 'file-already-exists))
|
||||
(when (tramp--test-expensive-test)
|
||||
(when (tramp--test-expensive-test-p)
|
||||
;; A number means interactive case.
|
||||
(cl-letf (((symbol-function #'yes-or-no-p) #'ignore))
|
||||
(should-error
|
||||
|
@ -3798,7 +3793,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
(string-equal tmp-name1 (file-symlink-p tmp-name3))))
|
||||
;; Check directory as newname.
|
||||
(make-directory tmp-name4)
|
||||
(when (tramp--test-expensive-test)
|
||||
(when (tramp--test-expensive-test-p)
|
||||
(should-error
|
||||
(make-symbolic-link tmp-name1 tmp-name4)
|
||||
:type 'file-already-exists))
|
||||
|
@ -3826,7 +3821,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
|
||||
;; Check `add-name-to-file'.
|
||||
(unwind-protect
|
||||
(when (tramp--test-expensive-test)
|
||||
(when (tramp--test-expensive-test-p)
|
||||
(tramp--test-ignore-add-name-to-file-error
|
||||
(write-region "foo" nil tmp-name1)
|
||||
(should (file-exists-p tmp-name1))
|
||||
|
@ -3941,11 +3936,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
(string-equal
|
||||
(file-truename tmp-name2)
|
||||
(file-truename tmp-name3)))
|
||||
(when (tramp--test-expensive-test)
|
||||
(when (tramp--test-expensive-test-p)
|
||||
(should-error
|
||||
(with-temp-buffer (insert-file-contents tmp-name2))
|
||||
:type 'file-missing))
|
||||
(when (tramp--test-expensive-test)
|
||||
(when (tramp--test-expensive-test-p)
|
||||
(should-error
|
||||
(with-temp-buffer (insert-file-contents tmp-name3))
|
||||
:type 'file-missing))
|
||||
|
@ -3963,7 +3958,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
|
||||
;; Detect cyclic symbolic links.
|
||||
(unwind-protect
|
||||
(when (tramp--test-expensive-test)
|
||||
(when (tramp--test-expensive-test-p)
|
||||
(tramp--test-ignore-make-symbolic-link-error
|
||||
(make-symbolic-link tmp-name2 tmp-name1)
|
||||
(should (file-symlink-p tmp-name1))
|
||||
|
@ -4001,7 +3996,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
(or (tramp--test-adb-p) (tramp--test-gvfs-p)
|
||||
(tramp--test-sh-p) (tramp--test-sudoedit-p)))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name3 (tramp--test-make-temp-name nil quoted)))
|
||||
|
@ -4050,7 +4045,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
"Check `set-visited-file-modtime' and `verify-visited-file-modtime'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((tmp-name (tramp--test-make-temp-name nil quoted)))
|
||||
(unwind-protect
|
||||
(progn
|
||||
|
@ -4083,8 +4078,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
(skip-unless (not (tramp--test-crypt-p)))
|
||||
|
||||
;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
|
||||
(dolist (quoted (if (and (tramp--test-expensive-test) (tramp--test-emacs27-p))
|
||||
'(nil t) '(nil)))
|
||||
(dolist (quoted
|
||||
(if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
|
||||
'(nil t) '(nil)))
|
||||
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name3 (tramp--test-make-temp-name 'local quoted)))
|
||||
|
@ -4162,8 +4158,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
(skip-unless (not (tramp--test-crypt-p)))
|
||||
|
||||
;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
|
||||
(dolist (quoted (if (and (tramp--test-expensive-test) (tramp--test-emacs27-p))
|
||||
'(nil t) '(nil)))
|
||||
(dolist (quoted
|
||||
(if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
|
||||
'(nil t) '(nil)))
|
||||
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name3 (tramp--test-make-temp-name 'local quoted)))
|
||||
|
@ -4310,7 +4307,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
(unwind-protect
|
||||
(dolist
|
||||
(syntax
|
||||
(if (tramp--test-expensive-test)
|
||||
(if (tramp--test-expensive-test-p)
|
||||
(tramp-syntax-values) `(,orig-syntax)))
|
||||
(tramp-change-syntax syntax)
|
||||
;; This has cleaned up all connection data, which are used
|
||||
|
@ -4352,7 +4349,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
(tramp-change-syntax orig-syntax))))
|
||||
|
||||
(dolist (non-essential '(nil t))
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((tmp-name (tramp--test-make-temp-name nil quoted)))
|
||||
|
||||
(unwind-protect
|
||||
|
@ -4419,7 +4416,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
"Check `load'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((tmp-name (tramp--test-make-temp-name nil quoted)))
|
||||
(unwind-protect
|
||||
(progn
|
||||
|
@ -4448,7 +4445,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
(skip-unless (tramp--test-enabled))
|
||||
(skip-unless (tramp--test-supports-processes-p))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let* ((tmp-name (tramp--test-make-temp-name nil quoted))
|
||||
(fnnd (file-name-nondirectory tmp-name))
|
||||
(default-directory tramp-test-temporary-file-directory)
|
||||
|
@ -4524,11 +4521,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
|
||||
(ert-deftest tramp-test29-start-file-process ()
|
||||
"Check `start-file-process'."
|
||||
:tags '(:expensive-test)
|
||||
:tags '(:expensive-test :tramp-asynchronous-processes)
|
||||
(skip-unless (tramp--test-enabled))
|
||||
(skip-unless (tramp--test-supports-processes-p))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((default-directory tramp-test-temporary-file-directory)
|
||||
(tmp-name (tramp--test-make-temp-name nil quoted))
|
||||
kill-buffer-query-functions proc)
|
||||
|
@ -4680,7 +4677,8 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
|
|||
(ignore-errors (make-process :file-handler t)))
|
||||
`(ert-deftest ,(intern (concat (symbol-name test) "-direct-async")) ()
|
||||
,docstring
|
||||
:tags (if ,unstable '(:expensive-test :unstable) '(:expensive-test))
|
||||
:tags (append '(:expensive-test :tramp-asynchronous-processes)
|
||||
(and ,unstable '(:unstable)))
|
||||
(skip-unless (tramp--test-enabled))
|
||||
(let ((default-directory tramp-test-temporary-file-directory)
|
||||
(ert-test (ert-get-test ',test))
|
||||
|
@ -4703,13 +4701,13 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
|
|||
|
||||
(ert-deftest tramp-test30-make-process ()
|
||||
"Check `make-process'."
|
||||
:tags '(:expensive-test)
|
||||
:tags '(:expensive-test :tramp-asynchronous-processes)
|
||||
(skip-unless (tramp--test-enabled))
|
||||
(skip-unless (tramp--test-supports-processes-p))
|
||||
;; `make-process' supports file name handlers since Emacs 27.
|
||||
(skip-unless (tramp--test-emacs27-p))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((default-directory tramp-test-temporary-file-directory)
|
||||
(tmp-name (tramp--test-make-temp-name nil quoted))
|
||||
kill-buffer-query-functions proc)
|
||||
|
@ -4946,8 +4944,9 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
|
|||
|
||||
(ert-deftest tramp-test31-interrupt-process ()
|
||||
"Check `interrupt-process'."
|
||||
:tags (if (or (getenv "EMACS_HYDRA_CI") (getenv "EMACS_EMBA_CI"))
|
||||
'(:expensive-test :unstable) '(:expensive-test))
|
||||
:tags (append '(:expensive-test :tramp-asynchronous-processes)
|
||||
(and (or (getenv "EMACS_HYDRA_CI") (getenv "EMACS_EMBA_CI"))
|
||||
'(:unstable)))
|
||||
(skip-unless (tramp--test-enabled))
|
||||
(skip-unless (tramp--test-sh-p))
|
||||
(skip-unless (not (tramp--test-crypt-p)))
|
||||
|
@ -5012,7 +5011,7 @@ INPUT, if non-nil, is a string sent to the process."
|
|||
(when (tramp--test-adb-p)
|
||||
(skip-unless (tramp--test-emacs27-p)))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((tmp-name (tramp--test-make-temp-name nil quoted))
|
||||
(default-directory tramp-test-temporary-file-directory)
|
||||
;; Suppress nasty messages.
|
||||
|
@ -5020,10 +5019,12 @@ INPUT, if non-nil, is a string sent to the process."
|
|||
kill-buffer-query-functions)
|
||||
|
||||
(dolist (this-shell-command
|
||||
'(;; Synchronously.
|
||||
shell-command
|
||||
;; Asynchronously.
|
||||
tramp--test-async-shell-command))
|
||||
(append
|
||||
;; Synchronously.
|
||||
'(shell-command)
|
||||
;; Asynchronously.
|
||||
(and (tramp--test-asynchronous-processes-p)
|
||||
'(tramp--test-async-shell-command))))
|
||||
|
||||
;; Test ordinary `{async-}shell-command'.
|
||||
(unwind-protect
|
||||
|
@ -5064,31 +5065,34 @@ INPUT, if non-nil, is a string sent to the process."
|
|||
(ignore-errors (kill-buffer stderr))))))
|
||||
|
||||
;; Test sending string to `async-shell-command'.
|
||||
(unwind-protect
|
||||
(with-temp-buffer
|
||||
(write-region "foo" nil tmp-name)
|
||||
(should (file-exists-p tmp-name))
|
||||
(tramp--test-async-shell-command
|
||||
"read line; ls $line" (current-buffer) nil
|
||||
;; String to be sent.
|
||||
(format "%s\n" (file-name-nondirectory tmp-name)))
|
||||
(should
|
||||
(string-equal
|
||||
;; tramp-adb.el echoes, so we must add the string.
|
||||
(if (and (tramp--test-adb-p) (not (tramp-direct-async-process-p)))
|
||||
(format
|
||||
"%s\n%s\n"
|
||||
(file-name-nondirectory tmp-name)
|
||||
(file-name-nondirectory tmp-name))
|
||||
(format "%s\n" (file-name-nondirectory tmp-name)))
|
||||
(buffer-string))))
|
||||
(when (tramp--test-asynchronous-processes-p)
|
||||
(unwind-protect
|
||||
(with-temp-buffer
|
||||
(write-region "foo" nil tmp-name)
|
||||
(should (file-exists-p tmp-name))
|
||||
(tramp--test-async-shell-command
|
||||
"read line; ls $line" (current-buffer) nil
|
||||
;; String to be sent.
|
||||
(format "%s\n" (file-name-nondirectory tmp-name)))
|
||||
(should
|
||||
(string-equal
|
||||
;; tramp-adb.el echoes, so we must add the string.
|
||||
(if (and (tramp--test-adb-p)
|
||||
(not (tramp-direct-async-process-p)))
|
||||
(format
|
||||
"%s\n%s\n"
|
||||
(file-name-nondirectory tmp-name)
|
||||
(file-name-nondirectory tmp-name))
|
||||
(format "%s\n" (file-name-nondirectory tmp-name)))
|
||||
(buffer-string))))
|
||||
|
||||
;; Cleanup.
|
||||
(ignore-errors (delete-file tmp-name)))))
|
||||
;; Cleanup.
|
||||
(ignore-errors (delete-file tmp-name))))))
|
||||
|
||||
;; Test `async-shell-command-width'. It exists since Emacs 26.1,
|
||||
;; but seems to work since Emacs 27.1 only.
|
||||
(when (and (tramp--test-sh-p) (tramp--test-emacs27-p))
|
||||
(when (and (tramp--test-asynchronous-processes-p)
|
||||
(tramp--test-sh-p) (tramp--test-emacs27-p))
|
||||
(let* ((async-shell-command-width 1024)
|
||||
(default-directory tramp-test-temporary-file-directory)
|
||||
(cols (ignore-errors
|
||||
|
@ -5235,10 +5239,12 @@ INPUT, if non-nil, is a string sent to the process."
|
|||
(skip-unless (not (tramp--test-crypt-p)))
|
||||
|
||||
(dolist (this-shell-command-to-string
|
||||
'(;; Synchronously.
|
||||
shell-command-to-string
|
||||
;; Asynchronously.
|
||||
tramp--test-shell-command-to-string-asynchronously))
|
||||
(append
|
||||
;; Synchronously.
|
||||
'(shell-command-to-string)
|
||||
;; Asynchronously.
|
||||
(and (tramp--test-asynchronous-processes-p)
|
||||
'(tramp--test-shell-command-to-string-asynchronously))))
|
||||
|
||||
(let ((default-directory tramp-test-temporary-file-directory)
|
||||
(shell-file-name "/bin/sh")
|
||||
|
@ -5422,7 +5428,7 @@ Use direct async.")
|
|||
|
||||
(ert-deftest tramp-test34-explicit-shell-file-name ()
|
||||
"Check that connection-local `explicit-shell-file-name' is set."
|
||||
:tags '(:expensive-test)
|
||||
:tags '(:expensive-test :tramp-asynchronous-processes)
|
||||
(skip-unless (tramp--test-enabled))
|
||||
(skip-unless (tramp--test-supports-processes-p))
|
||||
;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for
|
||||
|
@ -5587,7 +5593,7 @@ Use direct async.")
|
|||
(skip-unless (tramp--test-sh-p))
|
||||
(skip-unless (not (tramp--test-crypt-p)))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
;; We must use `file-truename' for the temporary directory, in
|
||||
;; order to establish the connection prior running an asynchronous
|
||||
;; process.
|
||||
|
@ -5657,7 +5663,7 @@ Use direct async.")
|
|||
"Check `make-auto-save-file-name'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (tramp--test-make-temp-name nil quoted))
|
||||
tramp-allow-unsafe-temporary-files)
|
||||
|
@ -5780,7 +5786,7 @@ Use direct async.")
|
|||
"Check `find-backup-file-name'."
|
||||
(skip-unless (tramp--test-enabled))
|
||||
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (tramp--test-make-temp-name nil quoted))
|
||||
(ange-ftp-make-backup-files t)
|
||||
|
@ -5931,7 +5937,7 @@ Use direct async.")
|
|||
;; `lock-file', `unlock-file', `file-locked-p' and
|
||||
;; `make-lock-file-name' exists since Emacs 28.1. We don't want to
|
||||
;; see compiler warnings for older Emacsen.
|
||||
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
|
||||
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
|
||||
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (tramp--test-make-temp-name nil quoted))
|
||||
(remote-file-name-inhibit-cache t)
|
||||
|
@ -6111,6 +6117,15 @@ This requires restrictions of file name syntax."
|
|||
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
|
||||
'tramp-ftp-file-name-handler))
|
||||
|
||||
(defun tramp--test-asynchronous-processes-p ()
|
||||
"Whether asynchronous processes tests are run.
|
||||
This is used in tests which we dont't want to tag
|
||||
`:tramp-asynchronous-processes' completely."
|
||||
(ert-select-tests
|
||||
(ert--stats-selector ert--current-run-stats)
|
||||
(list (make-ert-test :name (ert-test-name (ert-running-test))
|
||||
:body nil :tags '(:tramp-asynchronous-processes)))))
|
||||
|
||||
(defun tramp--test-crypt-p ()
|
||||
"Check, whether the remote directory is crypted."
|
||||
(tramp-crypt-file-name-p tramp-test-temporary-file-directory))
|
||||
|
@ -6121,6 +6136,15 @@ This does not support some special file names."
|
|||
(string-equal
|
||||
"docker" (file-remote-p tramp-test-temporary-file-directory 'method)))
|
||||
|
||||
(defun tramp--test-expensive-test-p ()
|
||||
"Whether expensive tests are run.
|
||||
This is used in tests which we dont't want to tag `:expensive'
|
||||
completely."
|
||||
(ert-select-tests
|
||||
(ert--stats-selector ert--current-run-stats)
|
||||
(list (make-ert-test :name (ert-test-name (ert-running-test))
|
||||
:body nil :tags '(:expensive-test)))))
|
||||
|
||||
(defun tramp--test-ftp-p ()
|
||||
"Check, whether an FTP-like method is used.
|
||||
This does not support globbing characters in file names (yet)."
|
||||
|
@ -6264,8 +6288,9 @@ This requires restrictions of file name syntax."
|
|||
(defun tramp--test-check-files (&rest files)
|
||||
"Run a simple but comprehensive test over every file in FILES."
|
||||
;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
|
||||
(dolist (quoted (if (and (tramp--test-expensive-test) (tramp--test-emacs27-p))
|
||||
'(nil t) '(nil)))
|
||||
(dolist (quoted
|
||||
(if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
|
||||
'(nil t) '(nil)))
|
||||
;; We must use `file-truename' for the temporary directory,
|
||||
;; because it could be located on a symlinked directory. This
|
||||
;; would let the test fail.
|
||||
|
@ -6425,7 +6450,7 @@ This requires restrictions of file name syntax."
|
|||
;; Check, that environment variables are set correctly.
|
||||
;; We do not run on macOS due to encoding problems. See
|
||||
;; Bug#36940.
|
||||
(when (and (tramp--test-expensive-test) (tramp--test-sh-p)
|
||||
(when (and (tramp--test-expensive-test-p) (tramp--test-sh-p)
|
||||
(not (tramp--test-crypt-p))
|
||||
(not (eq system-type 'darwin)))
|
||||
(dolist (elt files)
|
||||
|
@ -6507,7 +6532,7 @@ This requires restrictions of file name syntax."
|
|||
"{foo}bar{baz}")))
|
||||
;; Simplify test in order to speed up.
|
||||
(apply #'tramp--test-check-files
|
||||
(if (tramp--test-expensive-test)
|
||||
(if (tramp--test-expensive-test-p)
|
||||
files (list (mapconcat #'identity files ""))))))
|
||||
|
||||
;; These tests are inspired by Bug#17238.
|
||||
|
@ -6606,7 +6631,7 @@ Use the \"ls\" command."
|
|||
;; to U+1FFFF).
|
||||
"🌈🍒👋")
|
||||
|
||||
(when (tramp--test-expensive-test)
|
||||
(when (tramp--test-expensive-test-p)
|
||||
(delete-dups
|
||||
(mapcar
|
||||
;; Use all available language specific snippets.
|
||||
|
@ -6778,8 +6803,8 @@ This is needed in timer functions as well as process filters and sentinels."
|
|||
"Check parallel asynchronous requests.
|
||||
Such requests could arrive from timers, process filters and
|
||||
process sentinels. They shall not disturb each other."
|
||||
:tags (if (getenv "EMACS_EMBA_CI")
|
||||
'(:expensive-test :unstable) '(:expensive-test))
|
||||
:tags (append '(:expensive-test :tramp-asynchronous-processes)
|
||||
(and (getenv "EMACS_HYDRA_CI") '(:unstable)))
|
||||
(skip-unless (tramp--test-enabled))
|
||||
(skip-unless (tramp--test-supports-processes-p))
|
||||
;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for
|
||||
|
|
Loading…
Add table
Reference in a new issue