aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2016-08-07 13:57:23 +0200
committerMichael Albinus2016-08-07 13:57:23 +0200
commit2c0506173d92dd9d6de409a045668c6b5cf1fcef (patch)
tree2ea1931603ecabe4b544600029b52215cc75f7f7 /test
parenta798547727081de5b99e1036783084fcb9afec75 (diff)
downloademacs-2c0506173d92dd9d6de409a045668c6b5cf1fcef.tar.gz
emacs-2c0506173d92dd9d6de409a045668c6b5cf1fcef.zip
Add `make-nearby-temp-file' and `temporary-file-directory'
* doc/lispref/files.texi (Unique File Names): Introduce `make-nearby-temp-file' and `temporary-file-directory'. (Magic File Names): Mention `make-nearby-temp-file' and `temporary-file-directory'. * etc/NEWS (provided): Mention `make-nearby-temp-file' and `temporary-file-directory'. * lisp/files.el (mounted-file-systems): New defcustom. (temporary-file-directory, make-nearby-temp-file): New defuns. (normal-backup-enable-predicate): Fix docstring. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): <make-nearby-temp-file, temporary-file-directory>: Add handler. * lisp/net/tramp.el (tramp-file-name-for-operation): Add `make-nearby-temp-file' and `temporary-file-directory'. (tramp-get-remote-tmpdir): Remove compatibility code. (tramp-handle-temporary-file-directory) (tramp-handle-make-nearby-temp-file): New defuns. * lisp/org/ob-core.el (org-babel-local-file-name): * lisp/progmodes/gud.el (gud-common-init): * lisp/vc/vc-hooks.el (vc-user-login-name): Use `file-remote-p'. * lisp/vc/vc-git.el (vc-git-checkin): Handle remote log message. * test/lisp/net/tramp-tests.el (tramp-test06-directory-file-name): Check `tramp--test-enabled'. (tramp-test18-file-attributes): Add tests for `file-ownership-preserved-p'. (tramp-test27-start-file-process, tramp-test28-shell-command): Reduce timeouts in `accept-process-output'. (tramp-test--shell-command-to-string-asynchronously): Add timeout. (tramp-test29-environment-variables): Remove additional sleep calls. (tramp-test32-make-nearby-temp-file): New test. (tramp--test-special-characters, tramp--test-utf8): Adapt docstring. (tramp-test33-special-characters) (tramp-test33-special-characters-with-stat) (tramp-test33-special-characters-with-perl) (tramp-test33-special-characters-with-ls, tramp-test34-utf8) (tramp-test34-utf8-with-stat, tramp-test34-utf8-with-perl) (tramp-test34-utf8-with-ls) (tramp-test35-asynchronous-requests) (tramp-test36-recursive-load, tramp-test37-unload): Rename. (tramp--test-ftp-p): Simplify check. (tramp--test-sh-p): New defun. (tramp-test20-file-modes, tramp-test22-file-times) (tramp-test26-process-file, tramp-test27-start-file-process) (tramp-test28-shell-command) (tramp-test29-environment-variables) (tramp-test30-vc-registered) (tramp-test33-special-characters-with-stat) (tramp-test33-special-characters-with-perl) (tramp-test33-special-characters-with-ls) (tramp-test34-utf8-with-stat, tramp-test34-utf8-with-perl) (tramp-test34-utf8-with-ls) (tramp-test35-asynchronous-requests): Use it.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/tramp-tests.el241
1 files changed, 116 insertions, 125 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index e05786fa070..af705f6ce67 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -639,23 +639,24 @@ This checks also `file-name-as-directory', `file-name-directory',
639 (unhandled-file-name-directory "/method:host:/path/to/file")) 639 (unhandled-file-name-directory "/method:host:/path/to/file"))
640 640
641 ;; Bug#10085. 641 ;; Bug#10085.
642 (dolist (n-e '(nil t)) 642 (when (tramp--test-enabled) ;; Packages like tramp-gvfs.el might be disabled.
643 ;; We must clear `tramp-default-method'. On hydra, it is "ftp", 643 (dolist (n-e '(nil t))
644 ;; which ruins the tests. 644 ;; We must clear `tramp-default-method'. On hydra, it is "ftp",
645 (let ((non-essential n-e) 645 ;; which ruins the tests.
646 tramp-default-method) 646 (let ((non-essential n-e)
647 (dolist (file 647 tramp-default-method)
648 `(,(file-remote-p tramp-test-temporary-file-directory 'method) 648 (dolist (file
649 ,(file-remote-p tramp-test-temporary-file-directory 'host))) 649 `(,(file-remote-p tramp-test-temporary-file-directory 'method)
650 (unless (zerop (length file)) 650 ,(file-remote-p tramp-test-temporary-file-directory 'host)))
651 (setq file (format "/%s:" file)) 651 (unless (zerop (length file))
652 (should (string-equal (directory-file-name file) file)) 652 (setq file (format "/%s:" file))
653 (should 653 (should (string-equal (directory-file-name file) file))
654 (string-equal 654 (should
655 (file-name-as-directory file) 655 (string-equal
656 (if (tramp-completion-mode-p) file (concat file "./")))) 656 (file-name-as-directory file)
657 (should (string-equal (file-name-directory file) file)) 657 (if (tramp-completion-mode-p) file (concat file "./"))))
658 (should (string-equal (file-name-nondirectory file) ""))))))) 658 (should (string-equal (file-name-directory file) file))
659 (should (string-equal (file-name-nondirectory file) ""))))))))
659 660
660(ert-deftest tramp-test07-file-exists-p () 661(ert-deftest tramp-test07-file-exists-p ()
661 "Check `file-exist-p', `write-region' and `delete-file'." 662 "Check `file-exist-p', `write-region' and `delete-file'."
@@ -1091,7 +1092,8 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
1091 1092
1092(ert-deftest tramp-test18-file-attributes () 1093(ert-deftest tramp-test18-file-attributes ()
1093 "Check `file-attributes'. 1094 "Check `file-attributes'.
1094This tests also `file-readable-p' and `file-regular-p'." 1095This tests also `file-readable-p', `file-regular-p' and
1096`file-ownership-preserved-p'."
1095 (skip-unless (tramp--test-enabled)) 1097 (skip-unless (tramp--test-enabled))
1096 1098
1097 ;; We must use `file-truename' for the temporary directory, because 1099 ;; We must use `file-truename' for the temporary directory, because
@@ -1111,10 +1113,16 @@ This tests also `file-readable-p' and `file-regular-p'."
1111 attr) 1113 attr)
1112 (unwind-protect 1114 (unwind-protect
1113 (progn 1115 (progn
1116 ;; `file-ownership-preserved-p' should return t for
1117 ;; non-existing files. It is implemented only in tramp-sh.el.
1118 (when (tramp--test-sh-p)
1119 (should (file-ownership-preserved-p tmp-name1 'group)))
1114 (write-region "foo" nil tmp-name1) 1120 (write-region "foo" nil tmp-name1)
1115 (should (file-exists-p tmp-name1)) 1121 (should (file-exists-p tmp-name1))
1116 (should (file-readable-p tmp-name1)) 1122 (should (file-readable-p tmp-name1))
1117 (should (file-regular-p tmp-name1)) 1123 (should (file-regular-p tmp-name1))
1124 (when (tramp--test-sh-p)
1125 (should (file-ownership-preserved-p tmp-name1 'group)))
1118 1126
1119 ;; We do not test inodes and device numbers. 1127 ;; We do not test inodes and device numbers.
1120 (setq attr (file-attributes tmp-name1)) 1128 (setq attr (file-attributes tmp-name1))
@@ -1138,9 +1146,13 @@ This tests also `file-readable-p' and `file-regular-p'."
1138 1146
1139 (condition-case err 1147 (condition-case err
1140 (progn 1148 (progn
1149 (when (tramp--test-sh-p)
1150 (should (file-ownership-preserved-p tmp-name2 'group)))
1141 (make-symbolic-link tmp-name1 tmp-name2) 1151 (make-symbolic-link tmp-name1 tmp-name2)
1142 (should (file-exists-p tmp-name2)) 1152 (should (file-exists-p tmp-name2))
1143 (should (file-symlink-p tmp-name2)) 1153 (should (file-symlink-p tmp-name2))
1154 (when (tramp--test-sh-p)
1155 (should (file-ownership-preserved-p tmp-name2 'group)))
1144 (setq attr (file-attributes tmp-name2)) 1156 (setq attr (file-attributes tmp-name2))
1145 (should (string-equal 1157 (should (string-equal
1146 (car attr) 1158 (car attr)
@@ -1167,11 +1179,15 @@ This tests also `file-readable-p' and `file-regular-p'."
1167 (tramp-file-name-localname (tramp-dissect-file-name tmp-name3)))) 1179 (tramp-file-name-localname (tramp-dissect-file-name tmp-name3))))
1168 (delete-file tmp-name2)) 1180 (delete-file tmp-name2))
1169 1181
1182 (when (tramp--test-sh-p)
1183 (should (file-ownership-preserved-p tmp-name1 'group)))
1170 (delete-file tmp-name1) 1184 (delete-file tmp-name1)
1171 (make-directory tmp-name1) 1185 (make-directory tmp-name1)
1172 (should (file-exists-p tmp-name1)) 1186 (should (file-exists-p tmp-name1))
1173 (should (file-readable-p tmp-name1)) 1187 (should (file-readable-p tmp-name1))
1174 (should-not (file-regular-p tmp-name1)) 1188 (should-not (file-regular-p tmp-name1))
1189 (when (tramp--test-sh-p)
1190 (should (file-ownership-preserved-p tmp-name1 'group)))
1175 (setq attr (file-attributes tmp-name1)) 1191 (setq attr (file-attributes tmp-name1))
1176 (should (eq (car attr) t))) 1192 (should (eq (car attr) t)))
1177 1193
@@ -1227,13 +1243,7 @@ This tests also `file-readable-p' and `file-regular-p'."
1227 "Check `file-modes'. 1243 "Check `file-modes'.
1228This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." 1244This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
1229 (skip-unless (tramp--test-enabled)) 1245 (skip-unless (tramp--test-enabled))
1230 (skip-unless 1246 (skip-unless (tramp--test-sh-p))
1231 (not
1232 (memq
1233 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
1234 '(tramp-adb-file-name-handler
1235 tramp-gvfs-file-name-handler
1236 tramp-smb-file-name-handler))))
1237 1247
1238 (let ((tmp-name (tramp--test-make-temp-name))) 1248 (let ((tmp-name (tramp--test-make-temp-name)))
1239 (unwind-protect 1249 (unwind-protect
@@ -1337,11 +1347,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1337(ert-deftest tramp-test22-file-times () 1347(ert-deftest tramp-test22-file-times ()
1338 "Check `set-file-times' and `file-newer-than-file-p'." 1348 "Check `set-file-times' and `file-newer-than-file-p'."
1339 (skip-unless (tramp--test-enabled)) 1349 (skip-unless (tramp--test-enabled))
1340 (skip-unless 1350 (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
1341 (not
1342 (memq
1343 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
1344 '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler))))
1345 1351
1346 (let ((tmp-name1 (tramp--test-make-temp-name)) 1352 (let ((tmp-name1 (tramp--test-make-temp-name))
1347 (tmp-name2 (tramp--test-make-temp-name)) 1353 (tmp-name2 (tramp--test-make-temp-name))
@@ -1499,11 +1505,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1499 "Check `process-file'." 1505 "Check `process-file'."
1500 :tags '(:expensive-test) 1506 :tags '(:expensive-test)
1501 (skip-unless (tramp--test-enabled)) 1507 (skip-unless (tramp--test-enabled))
1502 (skip-unless 1508 (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
1503 (not
1504 (memq
1505 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
1506 '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler))))
1507 1509
1508 (let* ((tmp-name (tramp--test-make-temp-name)) 1510 (let* ((tmp-name (tramp--test-make-temp-name))
1509 (fnnd (file-name-nondirectory tmp-name)) 1511 (fnnd (file-name-nondirectory tmp-name))
@@ -1548,13 +1550,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1548 "Check `start-file-process'." 1550 "Check `start-file-process'."
1549 :tags '(:expensive-test) 1551 :tags '(:expensive-test)
1550 (skip-unless (tramp--test-enabled)) 1552 (skip-unless (tramp--test-enabled))
1551 (skip-unless 1553 (skip-unless (tramp--test-sh-p))
1552 (not
1553 (memq
1554 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
1555 '(tramp-adb-file-name-handler
1556 tramp-gvfs-file-name-handler
1557 tramp-smb-file-name-handler))))
1558 1554
1559 (let ((default-directory tramp-test-temporary-file-directory) 1555 (let ((default-directory tramp-test-temporary-file-directory)
1560 (tmp-name (tramp--test-make-temp-name)) 1556 (tmp-name (tramp--test-make-temp-name))
@@ -1569,7 +1565,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1569 ;; Read output. 1565 ;; Read output.
1570 (with-timeout (10 (ert-fail "`start-file-process' timed out")) 1566 (with-timeout (10 (ert-fail "`start-file-process' timed out"))
1571 (while (< (- (point-max) (point-min)) (length "foo")) 1567 (while (< (- (point-max) (point-min)) (length "foo"))
1572 (accept-process-output proc 1))) 1568 (accept-process-output proc 0.1)))
1573 (should (string-equal (buffer-string) "foo"))) 1569 (should (string-equal (buffer-string) "foo")))
1574 1570
1575 ;; Cleanup. 1571 ;; Cleanup.
@@ -1587,7 +1583,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1587 ;; Read output. 1583 ;; Read output.
1588 (with-timeout (10 (ert-fail "`start-file-process' timed out")) 1584 (with-timeout (10 (ert-fail "`start-file-process' timed out"))
1589 (while (< (- (point-max) (point-min)) (length "foo")) 1585 (while (< (- (point-max) (point-min)) (length "foo"))
1590 (accept-process-output proc 1))) 1586 (accept-process-output proc 0.1)))
1591 (should (string-equal (buffer-string) "foo"))) 1587 (should (string-equal (buffer-string) "foo")))
1592 1588
1593 ;; Cleanup. 1589 ;; Cleanup.
@@ -1608,7 +1604,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1608 ;; Read output. 1604 ;; Read output.
1609 (with-timeout (10 (ert-fail "`start-file-process' timed out")) 1605 (with-timeout (10 (ert-fail "`start-file-process' timed out"))
1610 (while (< (- (point-max) (point-min)) (length "foo")) 1606 (while (< (- (point-max) (point-min)) (length "foo"))
1611 (accept-process-output proc 1))) 1607 (accept-process-output proc 0.1)))
1612 (should (string-equal (buffer-string) "foo"))) 1608 (should (string-equal (buffer-string) "foo")))
1613 1609
1614 ;; Cleanup. 1610 ;; Cleanup.
@@ -1618,13 +1614,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1618 "Check `shell-command'." 1614 "Check `shell-command'."
1619 :tags '(:expensive-test) 1615 :tags '(:expensive-test)
1620 (skip-unless (tramp--test-enabled)) 1616 (skip-unless (tramp--test-enabled))
1621 (skip-unless 1617 (skip-unless (tramp--test-sh-p))
1622 (not
1623 (memq
1624 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
1625 '(tramp-adb-file-name-handler
1626 tramp-gvfs-file-name-handler
1627 tramp-smb-file-name-handler))))
1628 1618
1629 (let ((tmp-name (tramp--test-make-temp-name)) 1619 (let ((tmp-name (tramp--test-make-temp-name))
1630 (default-directory tramp-test-temporary-file-directory) 1620 (default-directory tramp-test-temporary-file-directory)
@@ -1657,7 +1647,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1657 (with-timeout (10 (ert-fail "`async-shell-command' timed out")) 1647 (with-timeout (10 (ert-fail "`async-shell-command' timed out"))
1658 (while (< (- (point-max) (point-min)) 1648 (while (< (- (point-max) (point-min))
1659 (1+ (length (file-name-nondirectory tmp-name)))) 1649 (1+ (length (file-name-nondirectory tmp-name))))
1660 (accept-process-output (get-buffer-process (current-buffer)) 1))) 1650 (accept-process-output
1651 (get-buffer-process (current-buffer)) 0.1)))
1661 ;; `ls' could produce colorized output. 1652 ;; `ls' could produce colorized output.
1662 (goto-char (point-min)) 1653 (goto-char (point-min))
1663 (while (re-search-forward tramp-display-escape-sequence-regexp nil t) 1654 (while (re-search-forward tramp-display-escape-sequence-regexp nil t)
@@ -1686,7 +1677,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1686 (with-timeout (10 (ert-fail "`async-shell-command' timed out")) 1677 (with-timeout (10 (ert-fail "`async-shell-command' timed out"))
1687 (while (< (- (point-max) (point-min)) 1678 (while (< (- (point-max) (point-min))
1688 (1+ (length (file-name-nondirectory tmp-name)))) 1679 (1+ (length (file-name-nondirectory tmp-name))))
1689 (accept-process-output (get-buffer-process (current-buffer)) 1))) 1680 (accept-process-output
1681 (get-buffer-process (current-buffer)) 0.1)))
1690 ;; `ls' could produce colorized output. 1682 ;; `ls' could produce colorized output.
1691 (goto-char (point-min)) 1683 (goto-char (point-min))
1692 (while (re-search-forward tramp-display-escape-sequence-regexp nil t) 1684 (while (re-search-forward tramp-display-escape-sequence-regexp nil t)
@@ -1708,9 +1700,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1708 (async-shell-command command (current-buffer)) 1700 (async-shell-command command (current-buffer))
1709 ;; Suppress nasty messages. 1701 ;; Suppress nasty messages.
1710 (set-process-sentinel (get-buffer-process (current-buffer)) nil) 1702 (set-process-sentinel (get-buffer-process (current-buffer)) nil)
1711 (while (get-buffer-process (current-buffer)) 1703 (with-timeout (10)
1712 (accept-process-output (get-buffer-process (current-buffer)) 0.1)) 1704 (while (get-buffer-process (current-buffer))
1713 (accept-process-output) 1705 (accept-process-output (get-buffer-process (current-buffer)) 0.1)))
1706 (accept-process-output nil 0.1)
1714 (buffer-substring-no-properties (point-min) (point-max)))) 1707 (buffer-substring-no-properties (point-min) (point-max))))
1715 1708
1716;; This test is inspired by Bug#23952. 1709;; This test is inspired by Bug#23952.
@@ -1718,10 +1711,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1718 "Check that remote processes set / unset environment variables properly." 1711 "Check that remote processes set / unset environment variables properly."
1719 :tags '(:expensive-test) 1712 :tags '(:expensive-test)
1720 (skip-unless (tramp--test-enabled)) 1713 (skip-unless (tramp--test-enabled))
1721 (skip-unless 1714 (skip-unless (tramp--test-sh-p))
1722 (eq
1723 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
1724 'tramp-sh-file-name-handler))
1725 1715
1726 (dolist (this-shell-command-to-string 1716 (dolist (this-shell-command-to-string
1727 '(;; Synchronously. 1717 '(;; Synchronously.
@@ -1798,10 +1788,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1798 "Check `vc-registered'." 1788 "Check `vc-registered'."
1799 :tags '(:expensive-test) 1789 :tags '(:expensive-test)
1800 (skip-unless (tramp--test-enabled)) 1790 (skip-unless (tramp--test-enabled))
1801 (skip-unless 1791 (skip-unless (tramp--test-sh-p))
1802 (eq
1803 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
1804 'tramp-sh-file-name-handler))
1805 1792
1806 (let* ((default-directory tramp-test-temporary-file-directory) 1793 (let* ((default-directory tramp-test-temporary-file-directory)
1807 (tmp-name1 (tramp--test-make-temp-name)) 1794 (tmp-name1 (tramp--test-make-temp-name))
@@ -1947,6 +1934,36 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1947 (ignore-errors (delete-file tmp-name1)) 1934 (ignore-errors (delete-file tmp-name1))
1948 (ignore-errors (delete-directory tmp-name2 'recursive))))) 1935 (ignore-errors (delete-directory tmp-name2 'recursive)))))
1949 1936
1937(ert-deftest tramp-test32-make-nearby-temp-file ()
1938 "Check `make-nearby-temp-file' and `temporary-file-directory'."
1939 (skip-unless (tramp--test-enabled))
1940
1941 (let ((default-directory tramp-test-temporary-file-directory)
1942 tmp-file)
1943 ;; The remote host shall know a tempory file directory.
1944 (should (stringp (temporary-file-directory)))
1945 (should
1946 (string-equal
1947 (file-remote-p default-directory)
1948 (file-remote-p (temporary-file-directory))))
1949
1950 ;; The temporary file shall be located on the remote host.
1951 (setq tmp-file (make-nearby-temp-file "tramp-test"))
1952 (should (file-exists-p tmp-file))
1953 (should (file-regular-p tmp-file))
1954 (should
1955 (string-equal
1956 (file-remote-p default-directory)
1957 (file-remote-p tmp-file)))
1958 (delete-file tmp-file)
1959 (should-not (file-exists-p tmp-file))
1960
1961 (setq tmp-file (make-nearby-temp-file "tramp-test" 'dir))
1962 (should (file-exists-p tmp-file))
1963 (should (file-directory-p tmp-file))
1964 (delete-directory tmp-file)
1965 (should-not (file-exists-p tmp-file))))
1966
1950(defun tramp--test-adb-p () 1967(defun tramp--test-adb-p ()
1951 "Check, whether the remote host runs Android. 1968 "Check, whether the remote host runs Android.
1952This requires restrictions of file name syntax." 1969This requires restrictions of file name syntax."
@@ -1956,11 +1973,13 @@ This requires restrictions of file name syntax."
1956 "Check, whether an FTP-like method is used. 1973 "Check, whether an FTP-like method is used.
1957This does not support globbing characters in file names (yet)." 1974This does not support globbing characters in file names (yet)."
1958 ;; Globbing characters are ??, ?* and ?\[. 1975 ;; Globbing characters are ??, ?* and ?\[.
1959 (and (eq (tramp-find-foreign-file-name-handler 1976 (string-match
1960 tramp-test-temporary-file-directory) 1977 "ftp$" (file-remote-p tramp-test-temporary-file-directory 'method)))
1961 'tramp-sh-file-name-handler) 1978
1962 (string-match 1979(defun tramp--test-gvfs-p ()
1963 "ftp$" (file-remote-p tramp-test-temporary-file-directory 'method)))) 1980 "Check, whether the remote host runs a GVFS based method.
1981This requires restrictions of file name syntax."
1982 (tramp-gvfs-file-name-p tramp-test-temporary-file-directory))
1964 1983
1965(defun tramp--test-rsync-p () 1984(defun tramp--test-rsync-p ()
1966 "Check, whether the rsync method is used. 1985 "Check, whether the rsync method is used.
@@ -1968,10 +1987,11 @@ This does not support special file names."
1968 (string-equal 1987 (string-equal
1969 "rsync" (file-remote-p tramp-test-temporary-file-directory 'method))) 1988 "rsync" (file-remote-p tramp-test-temporary-file-directory 'method)))
1970 1989
1971(defun tramp--test-gvfs-p () 1990(defun tramp--test-sh-p ()
1972 "Check, whether the remote host runs a GVFS based method. 1991 "Check, whether the remote host runs a based method from tramp-sh.el."
1973This requires restrictions of file name syntax." 1992 (eq
1974 (tramp-gvfs-file-name-p tramp-test-temporary-file-directory)) 1993 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
1994 'tramp-sh-file-name-handler))
1975 1995
1976(defun tramp--test-smb-or-windows-nt-p () 1996(defun tramp--test-smb-or-windows-nt-p ()
1977 "Check, whether the locale or remote host runs MS Windows. 1997 "Check, whether the locale or remote host runs MS Windows.
@@ -2123,7 +2143,7 @@ Several special characters do not work properly there."
2123 (ignore-errors (delete-directory tmp-name2 'recursive))))) 2143 (ignore-errors (delete-directory tmp-name2 'recursive)))))
2124 2144
2125(defun tramp--test-special-characters () 2145(defun tramp--test-special-characters ()
2126 "Perform the test in `tramp-test32-special-characters*'." 2146 "Perform the test in `tramp-test33-special-characters*'."
2127 ;; Newlines, slashes and backslashes in file names are not 2147 ;; Newlines, slashes and backslashes in file names are not
2128 ;; supported. So we don't test. And we don't test the tab 2148 ;; supported. So we don't test. And we don't test the tab
2129 ;; character on Windows or Cygwin, because the backslash is 2149 ;; character on Windows or Cygwin, because the backslash is
@@ -2164,23 +2184,19 @@ Several special characters do not work properly there."
2164 "{foo}bar{baz}")) 2184 "{foo}bar{baz}"))
2165 2185
2166;; These tests are inspired by Bug#17238. 2186;; These tests are inspired by Bug#17238.
2167(ert-deftest tramp-test32-special-characters () 2187(ert-deftest tramp-test33-special-characters ()
2168 "Check special characters in file names." 2188 "Check special characters in file names."
2169 (skip-unless (tramp--test-enabled)) 2189 (skip-unless (tramp--test-enabled))
2170 (skip-unless (not (tramp--test-rsync-p))) 2190 (skip-unless (not (tramp--test-rsync-p)))
2171 2191
2172 (tramp--test-special-characters)) 2192 (tramp--test-special-characters))
2173 2193
2174(ert-deftest tramp-test32-special-characters-with-stat () 2194(ert-deftest tramp-test33-special-characters-with-stat ()
2175 "Check special characters in file names. 2195 "Check special characters in file names.
2176Use the `stat' command." 2196Use the `stat' command."
2177 :tags '(:expensive-test) 2197 :tags '(:expensive-test)
2178 (skip-unless (tramp--test-enabled)) 2198 (skip-unless (tramp--test-enabled))
2179 (skip-unless (not (tramp--test-rsync-p))) 2199 (skip-unless (and (tramp--test-sh-p) (not (tramp--test-rsync-p))))
2180 (skip-unless
2181 (eq
2182 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
2183 'tramp-sh-file-name-handler))
2184 (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil 2200 (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
2185 (skip-unless (tramp-get-remote-stat v))) 2201 (skip-unless (tramp-get-remote-stat v)))
2186 2202
@@ -2191,16 +2207,12 @@ Use the `stat' command."
2191 tramp-connection-properties))) 2207 tramp-connection-properties)))
2192 (tramp--test-special-characters))) 2208 (tramp--test-special-characters)))
2193 2209
2194(ert-deftest tramp-test32-special-characters-with-perl () 2210(ert-deftest tramp-test33-special-characters-with-perl ()
2195 "Check special characters in file names. 2211 "Check special characters in file names.
2196Use the `perl' command." 2212Use the `perl' command."
2197 :tags '(:expensive-test) 2213 :tags '(:expensive-test)
2198 (skip-unless (tramp--test-enabled)) 2214 (skip-unless (tramp--test-enabled))
2199 (skip-unless (not (tramp--test-rsync-p))) 2215 (skip-unless (and (tramp--test-sh-p) (not (tramp--test-rsync-p))))
2200 (skip-unless
2201 (eq
2202 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
2203 'tramp-sh-file-name-handler))
2204 (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil 2216 (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
2205 (skip-unless (tramp-get-remote-perl v))) 2217 (skip-unless (tramp-get-remote-perl v)))
2206 2218
@@ -2214,16 +2226,12 @@ Use the `perl' command."
2214 tramp-connection-properties))) 2226 tramp-connection-properties)))
2215 (tramp--test-special-characters))) 2227 (tramp--test-special-characters)))
2216 2228
2217(ert-deftest tramp-test32-special-characters-with-ls () 2229(ert-deftest tramp-test33-special-characters-with-ls ()
2218 "Check special characters in file names. 2230 "Check special characters in file names.
2219Use the `ls' command." 2231Use the `ls' command."
2220 :tags '(:expensive-test) 2232 :tags '(:expensive-test)
2221 (skip-unless (tramp--test-enabled)) 2233 (skip-unless (tramp--test-enabled))
2222 (skip-unless (not (tramp--test-rsync-p))) 2234 (skip-unless (and (tramp--test-sh-p) (not (tramp--test-rsync-p))))
2223 (skip-unless
2224 (eq
2225 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
2226 'tramp-sh-file-name-handler))
2227 2235
2228 (let ((tramp-connection-properties 2236 (let ((tramp-connection-properties
2229 (append 2237 (append
@@ -2238,7 +2246,7 @@ Use the `ls' command."
2238 (tramp--test-special-characters))) 2246 (tramp--test-special-characters)))
2239 2247
2240(defun tramp--test-utf8 () 2248(defun tramp--test-utf8 ()
2241 "Perform the test in `tramp-test33-utf8*'." 2249 "Perform the test in `tramp-test34-utf8*'."
2242 (let* ((utf8 (if (and (eq system-type 'darwin) 2250 (let* ((utf8 (if (and (eq system-type 'darwin)
2243 (memq 'utf-8-hfs (coding-system-list))) 2251 (memq 'utf-8-hfs (coding-system-list)))
2244 'utf-8-hfs 'utf-8)) 2252 'utf-8-hfs 'utf-8))
@@ -2252,23 +2260,19 @@ Use the `ls' command."
2252 "银河系漫游指南系列" 2260 "银河系漫游指南系列"
2253 "Автостопом по гала́ктике"))) 2261 "Автостопом по гала́ктике")))
2254 2262
2255(ert-deftest tramp-test33-utf8 () 2263(ert-deftest tramp-test34-utf8 ()
2256 "Check UTF8 encoding in file names and file contents." 2264 "Check UTF8 encoding in file names and file contents."
2257 (skip-unless (tramp--test-enabled)) 2265 (skip-unless (tramp--test-enabled))
2258 (skip-unless (not (tramp--test-rsync-p))) 2266 (skip-unless (not (tramp--test-rsync-p)))
2259 2267
2260 (tramp--test-utf8)) 2268 (tramp--test-utf8))
2261 2269
2262(ert-deftest tramp-test33-utf8-with-stat () 2270(ert-deftest tramp-test34-utf8-with-stat ()
2263 "Check UTF8 encoding in file names and file contents. 2271 "Check UTF8 encoding in file names and file contents.
2264Use the `stat' command." 2272Use the `stat' command."
2265 :tags '(:expensive-test) 2273 :tags '(:expensive-test)
2266 (skip-unless (tramp--test-enabled)) 2274 (skip-unless (tramp--test-enabled))
2267 (skip-unless (not (tramp--test-rsync-p))) 2275 (skip-unless (and (tramp--test-sh-p) (not (tramp--test-rsync-p))))
2268 (skip-unless
2269 (eq
2270 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
2271 'tramp-sh-file-name-handler))
2272 (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil 2276 (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
2273 (skip-unless (tramp-get-remote-stat v))) 2277 (skip-unless (tramp-get-remote-stat v)))
2274 2278
@@ -2279,16 +2283,12 @@ Use the `stat' command."
2279 tramp-connection-properties))) 2283 tramp-connection-properties)))
2280 (tramp--test-utf8))) 2284 (tramp--test-utf8)))
2281 2285
2282(ert-deftest tramp-test33-utf8-with-perl () 2286(ert-deftest tramp-test34-utf8-with-perl ()
2283 "Check UTF8 encoding in file names and file contents. 2287 "Check UTF8 encoding in file names and file contents.
2284Use the `perl' command." 2288Use the `perl' command."
2285 :tags '(:expensive-test) 2289 :tags '(:expensive-test)
2286 (skip-unless (tramp--test-enabled)) 2290 (skip-unless (tramp--test-enabled))
2287 (skip-unless (not (tramp--test-rsync-p))) 2291 (skip-unless (and (tramp--test-sh-p) (not (tramp--test-rsync-p))))
2288 (skip-unless
2289 (eq
2290 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
2291 'tramp-sh-file-name-handler))
2292 (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil 2292 (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
2293 (skip-unless (tramp-get-remote-perl v))) 2293 (skip-unless (tramp-get-remote-perl v)))
2294 2294
@@ -2302,16 +2302,12 @@ Use the `perl' command."
2302 tramp-connection-properties))) 2302 tramp-connection-properties)))
2303 (tramp--test-utf8))) 2303 (tramp--test-utf8)))
2304 2304
2305(ert-deftest tramp-test33-utf8-with-ls () 2305(ert-deftest tramp-test34-utf8-with-ls ()
2306 "Check UTF8 encoding in file names and file contents. 2306 "Check UTF8 encoding in file names and file contents.
2307Use the `ls' command." 2307Use the `ls' command."
2308 :tags '(:expensive-test) 2308 :tags '(:expensive-test)
2309 (skip-unless (tramp--test-enabled)) 2309 (skip-unless (tramp--test-enabled))
2310 (skip-unless (not (tramp--test-rsync-p))) 2310 (skip-unless (and (tramp--test-sh-p) (not (tramp--test-rsync-p))))
2311 (skip-unless
2312 (eq
2313 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
2314 'tramp-sh-file-name-handler))
2315 2311
2316 (let ((tramp-connection-properties 2312 (let ((tramp-connection-properties
2317 (append 2313 (append
@@ -2326,7 +2322,7 @@ Use the `ls' command."
2326 (tramp--test-utf8))) 2322 (tramp--test-utf8)))
2327 2323
2328;; This test is inspired by Bug#16928. 2324;; This test is inspired by Bug#16928.
2329(ert-deftest tramp-test34-asynchronous-requests () 2325(ert-deftest tramp-test35-asynchronous-requests ()
2330 "Check parallel asynchronous requests. 2326 "Check parallel asynchronous requests.
2331Such requests could arrive from timers, process filters and 2327Such requests could arrive from timers, process filters and
2332process sentinels. They shall not disturb each other." 2328process sentinels. They shall not disturb each other."
@@ -2334,10 +2330,7 @@ process sentinels. They shall not disturb each other."
2334 :expected-result :failed 2330 :expected-result :failed
2335 :tags '(:expensive-test) 2331 :tags '(:expensive-test)
2336 (skip-unless (tramp--test-enabled)) 2332 (skip-unless (tramp--test-enabled))
2337 (skip-unless 2333 (skip-unless (tramp--test-sh-p))
2338 (eq
2339 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
2340 'tramp-sh-file-name-handler))
2341 2334
2342 ;; Keep instrumentation verbosity 0 until Tramp bug is fixed. This 2335 ;; Keep instrumentation verbosity 0 until Tramp bug is fixed. This
2343 ;; has the side effect, that this test fails instead to abort. Good 2336 ;; has the side effect, that this test fails instead to abort. Good
@@ -2416,7 +2409,7 @@ process sentinels. They shall not disturb each other."
2416 (dolist (buf buffers) 2409 (dolist (buf buffers)
2417 (ignore-errors (kill-buffer buf))))))) 2410 (ignore-errors (kill-buffer buf)))))))
2418 2411
2419(ert-deftest tramp-test35-recursive-load () 2412(ert-deftest tramp-test36-recursive-load ()
2420 "Check that Tramp does not fail due to recursive load." 2413 "Check that Tramp does not fail due to recursive load."
2421 (skip-unless (tramp--test-enabled)) 2414 (skip-unless (tramp--test-enabled))
2422 2415
@@ -2439,7 +2432,7 @@ process sentinels. They shall not disturb each other."
2439 (mapconcat 'shell-quote-argument load-path " -L ") 2432 (mapconcat 'shell-quote-argument load-path " -L ")
2440 (shell-quote-argument code))))))) 2433 (shell-quote-argument code)))))))
2441 2434
2442(ert-deftest tramp-test36-unload () 2435(ert-deftest tramp-test37-unload ()
2443 "Check that Tramp and its subpackages unload completely. 2436 "Check that Tramp and its subpackages unload completely.
2444Since it unloads Tramp, it shall be the last test to run." 2437Since it unloads Tramp, it shall be the last test to run."
2445 ;; Mark as failed until all symbols are unbound. 2438 ;; Mark as failed until all symbols are unbound.
@@ -2477,7 +2470,6 @@ Since it unloads Tramp, it shall be the last test to run."
2477;; * dired-compress-file 2470;; * dired-compress-file
2478;; * dired-uncache 2471;; * dired-uncache
2479;; * file-acl 2472;; * file-acl
2480;; * file-ownership-preserved-p
2481;; * file-selinux-context 2473;; * file-selinux-context
2482;; * find-backup-file-name 2474;; * find-backup-file-name
2483;; * set-file-acl 2475;; * set-file-acl
@@ -2485,10 +2477,9 @@ Since it unloads Tramp, it shall be the last test to run."
2485 2477
2486;; * Work on skipped tests. Make a comment, when it is impossible. 2478;; * Work on skipped tests. Make a comment, when it is impossible.
2487;; * Fix `tramp-test06-directory-file-name' for `ftp'. 2479;; * Fix `tramp-test06-directory-file-name' for `ftp'.
2488;; * Fix `tramp-test15-copy-directory' for `rsync'.
2489;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). 2480;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?).
2490;; * Fix Bug#16928. Set expected error of `tramp-test34-asynchronous-requests'. 2481;; * Fix Bug#16928. Set expected error of `tramp-test35-asynchronous-requests'.
2491;; * Fix `tramp-test36-unload' (Not all symbols are unbound). Set 2482;; * Fix `tramp-test37-unload' (Not all symbols are unbound). Set
2492;; expected error. 2483;; expected error.
2493 2484
2494(defun tramp-test-all (&optional interactive) 2485(defun tramp-test-all (&optional interactive)