]> code.delx.au - gnu-emacs/blobdiff - test/automated/tramp-tests.el
substitute-command-keys keeps quotes’ text props
[gnu-emacs] / test / automated / tramp-tests.el
index e1039392ea77b8e6030e737c60343d38161b09e0..a12ee387576c4d70c7a4a7216051352dcbc8e9b5 100644 (file)
@@ -1,6 +1,6 @@
 ;;; tramp-tests.el --- Tests of remote file access
 
-;; Copyright (C) 2013-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2016 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 
 (require 'vc-git)
 (require 'vc-hg)
 
+(autoload 'dired-uncache "dired")
 (declare-function tramp-find-executable "tramp-sh")
 (declare-function tramp-get-remote-path "tramp-sh")
 (declare-function tramp-get-remote-stat "tramp-sh")
 (declare-function tramp-get-remote-perl "tramp-sh")
 (defvar tramp-copy-size-limit)
+(defvar tramp-persistency-file-name)
 (defvar tramp-remote-process-environment)
 
 ;; There is no default value on w32 systems, which could work out of the box.
@@ -70,7 +72,8 @@
 (setq password-cache-expiry nil
       tramp-verbose 0
       tramp-copy-size-limit nil
-      tramp-message-show-message nil)
+      tramp-message-show-message nil
+      tramp-persistency-file-name nil)
 
 ;; This shall happen on hydra only.
 (when (getenv "NIX_STORE")
@@ -117,7 +120,9 @@ shall not contain a timeout."
   (declare (indent 1) (debug (natnump body)))
   `(let ((tramp-verbose ,verbose)
         (tramp-message-show-message t)
-        (tramp-debug-on-error t))
+        (tramp-debug-on-error t)
+        (debug-ignored-errors
+         (cons "^make-symbolic-link not supported$" debug-ignored-errors)))
      (unwind-protect
         (progn ,@body)
        (when (> tramp-verbose 3)
@@ -209,6 +214,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/method::" 'user) "default-user"))
     (should (string-equal (file-remote-p "/method::" 'host) "default-host"))
     (should (string-equal (file-remote-p "/method::" 'localname) ""))
+    (should (string-equal (file-remote-p "/method::" 'hop) nil))
 
     ;; Expand `tramp-default-method' and `tramp-default-user'.
     (should (string-equal
@@ -218,6 +224,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/host:" 'user) "default-user"))
     (should (string-equal (file-remote-p "/host:" 'host) "host"))
     (should (string-equal (file-remote-p "/host:" 'localname) ""))
+    (should (string-equal (file-remote-p "/host:" 'hop) nil))
 
     ;; Expand `tramp-default-method' and `tramp-default-host'.
     (should (string-equal
@@ -227,6 +234,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/user@:" 'user) "user"))
     (should (string-equal (file-remote-p "/user@:" 'host) "default-host"))
     (should (string-equal (file-remote-p "/user@:" 'localname) ""))
+    (should (string-equal (file-remote-p "/user@:" 'hop) nil))
 
     ;; Expand `tramp-default-method'.
     (should (string-equal
@@ -237,6 +245,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/user@host:" 'user) "user"))
     (should (string-equal (file-remote-p "/user@host:" 'host) "host"))
     (should (string-equal (file-remote-p "/user@host:" 'localname) ""))
+    (should (string-equal (file-remote-p "/user@host:" 'hop) nil))
 
     ;; Expand `tramp-default-user'.
     (should (string-equal
@@ -246,6 +255,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/method:host:" 'user) "default-user"))
     (should (string-equal (file-remote-p "/method:host:" 'host) "host"))
     (should (string-equal (file-remote-p "/method:host:" 'localname) ""))
+    (should (string-equal (file-remote-p "/method:host:" 'hop) nil))
 
     ;; Expand `tramp-default-host'.
     (should (string-equal
@@ -256,6 +266,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/method:user@:" 'host)
                          "default-host"))
     (should (string-equal (file-remote-p "/method:user@:" 'localname) ""))
+    (should (string-equal (file-remote-p "/method:user@:" 'hop) nil))
 
     ;; No expansion.
     (should (string-equal
@@ -266,6 +277,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/method:user@host:" 'user) "user"))
     (should (string-equal (file-remote-p "/method:user@host:" 'host) "host"))
     (should (string-equal (file-remote-p "/method:user@host:" 'localname) ""))
+    (should (string-equal (file-remote-p "/method:user@host:" 'hop) nil))
 
     ;; No expansion.
     (should (string-equal
@@ -279,6 +291,8 @@ shall not contain a timeout."
             (file-remote-p "/method:user@email@host:" 'host) "host"))
     (should (string-equal
             (file-remote-p "/method:user@email@host:" 'localname) ""))
+    (should (string-equal
+            (file-remote-p "/method:user@email@host:" 'hop) nil))
 
     ;; Expand `tramp-default-method' and `tramp-default-user'.
     (should (string-equal
@@ -289,6 +303,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/host#1234:" 'user) "default-user"))
     (should (string-equal (file-remote-p "/host#1234:" 'host) "host#1234"))
     (should (string-equal (file-remote-p "/host#1234:" 'localname) ""))
+    (should (string-equal (file-remote-p "/host#1234:" 'hop) nil))
 
     ;; Expand `tramp-default-method'.
     (should (string-equal
@@ -299,6 +314,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/user@host#1234:" 'user) "user"))
     (should (string-equal (file-remote-p "/user@host#1234:" 'host) "host#1234"))
     (should (string-equal (file-remote-p "/user@host#1234:" 'localname) ""))
+    (should (string-equal (file-remote-p "/user@host#1234:" 'hop) nil))
 
     ;; Expand `tramp-default-user'.
     (should (string-equal
@@ -311,6 +327,7 @@ shall not contain a timeout."
     (should (string-equal
             (file-remote-p "/method:host#1234:" 'host) "host#1234"))
     (should (string-equal (file-remote-p "/method:host#1234:" 'localname) ""))
+    (should (string-equal (file-remote-p "/method:host#1234:" 'hop) nil))
 
     ;; No expansion.
     (should (string-equal
@@ -324,6 +341,8 @@ shall not contain a timeout."
             (file-remote-p "/method:user@host#1234:" 'host) "host#1234"))
     (should (string-equal
             (file-remote-p "/method:user@host#1234:" 'localname) ""))
+    (should (string-equal
+            (file-remote-p "/method:user@host#1234:" 'hop) nil))
 
     ;; Expand `tramp-default-method' and `tramp-default-user'.
     (should (string-equal
@@ -333,6 +352,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/1.2.3.4:" 'user) "default-user"))
     (should (string-equal (file-remote-p "/1.2.3.4:" 'host) "1.2.3.4"))
     (should (string-equal (file-remote-p "/1.2.3.4:" 'localname) ""))
+    (should (string-equal (file-remote-p "/1.2.3.4:" 'hop) nil))
 
     ;; Expand `tramp-default-method'.
     (should (string-equal
@@ -343,6 +363,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/user@1.2.3.4:" 'user) "user"))
     (should (string-equal (file-remote-p "/user@1.2.3.4:" 'host) "1.2.3.4"))
     (should (string-equal (file-remote-p "/user@1.2.3.4:" 'localname) ""))
+    (should (string-equal (file-remote-p "/user@1.2.3.4:" 'hop) nil))
 
     ;; Expand `tramp-default-user'.
     (should (string-equal
@@ -353,6 +374,7 @@ shall not contain a timeout."
             (file-remote-p "/method:1.2.3.4:" 'user) "default-user"))
     (should (string-equal (file-remote-p "/method:1.2.3.4:" 'host) "1.2.3.4"))
     (should (string-equal (file-remote-p "/method:1.2.3.4:" 'localname) ""))
+    (should (string-equal (file-remote-p "/method:1.2.3.4:" 'hop) nil))
 
     ;; No expansion.
     (should (string-equal
@@ -365,6 +387,8 @@ shall not contain a timeout."
             (file-remote-p "/method:user@1.2.3.4:" 'host) "1.2.3.4"))
     (should (string-equal
             (file-remote-p "/method:user@1.2.3.4:" 'localname) ""))
+    (should (string-equal
+            (file-remote-p "/method:user@1.2.3.4:" 'hop) nil))
 
     ;; Expand `tramp-default-method', `tramp-default-user' and
     ;; `tramp-default-host'.
@@ -376,6 +400,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/[]:" 'user) "default-user"))
     (should (string-equal (file-remote-p "/[]:" 'host) "default-host"))
     (should (string-equal (file-remote-p "/[]:" 'localname) ""))
+    (should (string-equal (file-remote-p "/[]:" 'hop) nil))
 
     ;; Expand `tramp-default-method' and `tramp-default-user'.
     (let ((tramp-default-host "::1"))
@@ -385,7 +410,8 @@ shall not contain a timeout."
       (should (string-equal (file-remote-p "/[]:" 'method) "default-method"))
       (should (string-equal (file-remote-p "/[]:" 'user) "default-user"))
       (should (string-equal (file-remote-p "/[]:" 'host) "::1"))
-      (should (string-equal (file-remote-p "/[]:" 'localname) "")))
+      (should (string-equal (file-remote-p "/[]:" 'localname) ""))
+      (should (string-equal (file-remote-p "/[]:" 'hop) nil)))
 
     ;; Expand `tramp-default-method' and `tramp-default-user'.
     (should (string-equal
@@ -395,6 +421,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/[::1]:" 'user) "default-user"))
     (should (string-equal (file-remote-p "/[::1]:" 'host) "::1"))
     (should (string-equal (file-remote-p "/[::1]:" 'localname) ""))
+    (should (string-equal (file-remote-p "/[::1]:" 'hop) nil))
 
     ;; Expand `tramp-default-method'.
     (should (string-equal
@@ -405,6 +432,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/user@[::1]:" 'user) "user"))
     (should (string-equal (file-remote-p "/user@[::1]:" 'host) "::1"))
     (should (string-equal (file-remote-p "/user@[::1]:" 'localname) ""))
+    (should (string-equal (file-remote-p "/user@[::1]:" 'hop) nil))
 
     ;; Expand `tramp-default-user'.
     (should (string-equal
@@ -415,6 +443,7 @@ shall not contain a timeout."
             (file-remote-p "/method:[::1]:" 'user) "default-user"))
     (should (string-equal (file-remote-p "/method:[::1]:" 'host) "::1"))
     (should (string-equal (file-remote-p "/method:[::1]:" 'localname) ""))
+    (should (string-equal (file-remote-p "/method:[::1]:" 'hop) nil))
 
     ;; No expansion.
     (should (string-equal
@@ -426,6 +455,7 @@ shall not contain a timeout."
     (should (string-equal (file-remote-p "/method:user@[::1]:" 'host) "::1"))
     (should (string-equal
             (file-remote-p "/method:user@[::1]:" 'localname) ""))
+    (should (string-equal (file-remote-p "/method:user@[::1]:" 'hop) nil))
 
     ;; Local file name part.
     (should (string-equal (file-remote-p "/host:/:" 'localname) "/:"))
@@ -440,7 +470,8 @@ shall not contain a timeout."
     (should
      (string-equal
       (file-remote-p "/method1:user1@host1|method2:user2@host2:/path/to/file")
-      (format "/%s:%s@%s:" "method2" "user2" "host2")))
+      (format "/%s:%s@%s|%s:%s@%s:"
+             "method1" "user1" "host1" "method2" "user2" "host2")))
     (should
      (string-equal
       (file-remote-p
@@ -461,12 +492,21 @@ shall not contain a timeout."
       (file-remote-p
        "/method1:user1@host1|method2:user2@host2:/path/to/file" 'localname)
       "/path/to/file"))
+    (should
+     (string-equal
+      (file-remote-p
+       "/method1:user1@host1|method2:user2@host2:/path/to/file" 'hop)
+      (format "%s:%s@%s|"
+             "method1" "user1" "host1")))
 
     (should
      (string-equal
       (file-remote-p
        "/method1:user1@host1|method2:user2@host2|method3:user3@host3:/path/to/file")
-      (format "/%s:%s@%s:" "method3" "user3" "host3")))
+      (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:"
+             "method1" "user1" "host1"
+             "method2" "user2" "host2"
+             "method3" "user3" "host3")))
     (should
      (string-equal
       (file-remote-p
@@ -490,7 +530,14 @@ shall not contain a timeout."
       (file-remote-p
        "/method1:user1@host1|method2:user2@host2|method3:user3@host3:/path/to/file"
        'localname)
-      "/path/to/file"))))
+      "/path/to/file"))
+    (should
+     (string-equal
+      (file-remote-p
+       "/method1:user1@host1|method2:user2@host2|method3:user3@host3:/path/to/file"
+       'hop)
+      (format "%s:%s@%s|%s:%s@%s|"
+             "method1" "user1" "host1" "method2" "user2" "host2")))))
 
 (ert-deftest tramp-test03-file-name-defaults ()
   "Check default values for some methods."
@@ -859,22 +906,20 @@ 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))
 
-  (let ((tmp-name (tramp--test-make-temp-name)))
+  (let* ((tmp-name1 (tramp--test-make-temp-name))
+        (tmp-name2 (expand-file-name "foo/bar" tmp-name1)))
     (unwind-protect
        (progn
-         (make-directory tmp-name)
-         (should (file-directory-p tmp-name))
-         (should (file-accessible-directory-p tmp-name))
-         (should-error
-          (make-directory (expand-file-name "foo/bar" tmp-name))
-          :type 'file-error)
-         (make-directory (expand-file-name "foo/bar" tmp-name) 'parents)
-         (should (file-directory-p (expand-file-name "foo/bar" tmp-name)))
-         (should
-          (file-accessible-directory-p (expand-file-name "foo/bar" tmp-name))))
+         (make-directory tmp-name1)
+         (should (file-directory-p tmp-name1))
+         (should (file-accessible-directory-p tmp-name1))
+         (should-error (make-directory tmp-name2) :type 'file-error)
+         (make-directory tmp-name2 'parents)
+         (should (file-directory-p tmp-name2))
+         (should (file-accessible-directory-p tmp-name2)))
 
       ;; Cleanup.
-      (ignore-errors (delete-directory tmp-name 'recursive)))))
+      (ignore-errors (delete-directory tmp-name1 'recursive)))))
 
 (ert-deftest tramp-test14-delete-directory ()
   "Check `delete-directory'."
@@ -1014,6 +1059,13 @@ This tests also `file-readable-p' and `file-regular-p'."
          (file-truename tramp-test-temporary-file-directory))
         (tmp-name1 (tramp--test-make-temp-name))
         (tmp-name2 (tramp--test-make-temp-name))
+        ;; File name with "//".
+        (tmp-name3
+         (format
+          "%s%s"
+          (file-remote-p tmp-name1)
+          (replace-regexp-in-string
+           "/" "//" (file-remote-p tmp-name1 'localname))))
         attr)
     (unwind-protect
        (progn
@@ -1055,8 +1107,25 @@ This tests also `file-readable-p' and `file-regular-p'."
            (file-error
             (should (string-equal (error-message-string err)
                                   "make-symbolic-link not supported"))))
-         (delete-file tmp-name1)
 
+         ;; Check, that "//" in symlinks are handled properly.
+         (with-temp-buffer
+           (let ((default-directory tramp-test-temporary-file-directory))
+             (shell-command
+              (format
+               "ln -s %s %s"
+               (tramp-file-name-localname (tramp-dissect-file-name tmp-name3))
+               (tramp-file-name-localname (tramp-dissect-file-name tmp-name2)))
+              t)))
+         (when (file-symlink-p tmp-name2)
+           (setq attr (file-attributes tmp-name2))
+           (should
+            (string-equal
+             (car attr)
+             (tramp-file-name-localname (tramp-dissect-file-name tmp-name3))))
+           (delete-file tmp-name2))
+
+         (delete-file tmp-name1)
          (make-directory tmp-name1)
          (should (file-exists-p tmp-name1))
          (should (file-readable-p tmp-name1))
@@ -1065,7 +1134,9 @@ This tests also `file-readable-p' and `file-regular-p'."
          (should (eq (car attr) t)))
 
       ;; Cleanup.
-      (ignore-errors (delete-directory tmp-name1)))))
+      (ignore-errors (delete-directory tmp-name1))
+      (ignore-errors (delete-file tmp-name1))
+      (ignore-errors (delete-file tmp-name2)))))
 
 (ert-deftest tramp-test19-directory-files-and-attributes ()
   "Check `directory-files-and-attributes'."
@@ -1154,6 +1225,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
         (tmp-name1 (tramp--test-make-temp-name))
         (tmp-name2 (tramp--test-make-temp-name))
         (tmp-name3 (tramp--test-make-temp-name 'local)))
+
+    ;; Check `make-symbolic-link'.
     (unwind-protect
        (progn
          (write-region "foo" nil tmp-name1)
@@ -1179,6 +1252,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
        (delete-file tmp-name1)
        (delete-file tmp-name2)))
 
+    ;; Check `add-name-to-file'.
     (unwind-protect
        (progn
          (write-region "foo" nil tmp-name1)
@@ -1196,6 +1270,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
        (delete-file tmp-name1)
        (delete-file tmp-name2)))
 
+    ;; Check `file-truename'.
     (unwind-protect
        (progn
          (write-region "foo" nil tmp-name1)
@@ -1320,6 +1395,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
 
 (ert-deftest tramp-test26-process-file ()
   "Check `process-file'."
+  :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
   (skip-unless
    (not
@@ -1350,6 +1426,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
            (should-not (get-buffer-window (current-buffer) t))
 
            ;; Second run. The output must be appended.
+           (goto-char (point-max))
            (should (zerop (process-file "ls" nil t t fnnd)))
            ;; `ls' could produce colorized output.
            (goto-char (point-min))
@@ -1365,6 +1442,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
 
 (ert-deftest tramp-test27-start-file-process ()
   "Check `start-file-process'."
+  :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
   (skip-unless
    (not
@@ -1434,6 +1512,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
 
 (ert-deftest tramp-test28-shell-command ()
   "Check `shell-command'."
+  :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
   (skip-unless
    (not
@@ -1521,6 +1600,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
 
 (ert-deftest tramp-test29-vc-registered ()
   "Check `vc-registered'."
+  :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
   (skip-unless
    (eq
@@ -1534,6 +1614,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
         (vc-handled-backends
          (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
            (cond
+            ((tramp-find-executable v vc-git-program (tramp-get-remote-path v))
+             '(Git))
+            ((tramp-find-executable v vc-hg-program (tramp-get-remote-path v))
+             '(Hg))
             ((tramp-find-executable v vc-bzr-program (tramp-get-remote-path v))
              (setq tramp-remote-process-environment
                    (cons (format "BZR_HOME=%s"
@@ -1544,10 +1628,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
               (tramp-dissect-file-name tramp-test-temporary-file-directory)
               nil 'keep-password)
              '(Bzr))
-            ((tramp-find-executable v vc-git-program (tramp-get-remote-path v))
-             '(Git))
-            ((tramp-find-executable v vc-hg-program (tramp-get-remote-path v))
-             '(Hg))
             (t nil)))))
     (skip-unless vc-handled-backends)
     (message "%s" vc-handled-backends)
@@ -1563,7 +1643,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
 
          (let ((default-directory tmp-name1))
            ;; Create empty repository, and register the file.
-           (vc-create-repo (car vc-handled-backends))
+           ;; Sometimes, creation of repository fails (bzr!); we skip
+           ;; the test then.
+           (condition-case nil
+               (vc-create-repo (car vc-handled-backends))
+             (error (skip-unless nil)))
            ;; The structure of VC-FILESET is not documented.  Let's
            ;; hope it won't change.
            (condition-case nil
@@ -1574,8 +1658,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
              (error
               (vc-register
                nil (list (car vc-handled-backends)
-                         (list (file-name-nondirectory tmp-name2)))))))
-         (should (vc-registered tmp-name2)))
+                         (list (file-name-nondirectory tmp-name2))))))
+           ;; vc-git uses an own process sentinel, Tramp's sentinel
+           ;; for flushing the cache isn't used.
+           (dired-uncache (concat (file-remote-p default-directory) "/"))
+           (should (vc-registered (file-name-nondirectory tmp-name2)))))
 
       ;; Cleanup.
       (ignore-errors (delete-directory tmp-name1 'recursive)))))
@@ -1667,17 +1754,36 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
 (defun tramp--test-adb-p ()
   "Check, whether the remote host runs Android.
 This requires restrictions of file name syntax."
-  (eq (tramp-find-foreign-file-name-handler
-       tramp-test-temporary-file-directory)
-      'tramp-adb-file-name-handler))
+  (tramp-adb-file-name-p tramp-test-temporary-file-directory))
+
+(defun tramp--test-ftp-p ()
+  "Check, whether an FTP-like method is used.
+This does not support globbing characters in file names (yet)."
+  ;; Globbing characters are ??, ?* and ?\[.
+  (and (eq (tramp-find-foreign-file-name-handler
+           tramp-test-temporary-file-directory)
+          'tramp-sh-file-name-handler)
+       (string-match
+       "ftp$" (file-remote-p tramp-test-temporary-file-directory 'method))))
+
+(defun tramp--test-gvfs-p ()
+  "Check, whether the remote host runs a GVFS based method.
+This requires restrictions of file name syntax."
+  (tramp-gvfs-file-name-p tramp-test-temporary-file-directory))
 
 (defun tramp--test-smb-or-windows-nt-p ()
   "Check, whether the locale or remote host runs MS Windows.
 This requires restrictions of file name syntax."
   (or (eq system-type 'windows-nt)
-      (eq (tramp-find-foreign-file-name-handler
-          tramp-test-temporary-file-directory)
-         'tramp-smb-file-name-handler)))
+      (tramp-smb-file-name-p tramp-test-temporary-file-directory)))
+
+(defun tramp--test-hpux-p ()
+  "Check, whether the remote host runs HP-UX.
+Several special characters do not work properly there."
+  ;; We must refill the cache.  `file-truename' does it.
+  (with-parsed-tramp-file-name
+      (file-truename tramp-test-temporary-file-directory) nil
+    (string-match "^HP-UX" (tramp-get-connection-property v "uname" ""))))
 
 (defun tramp--test-check-files (&rest files)
   "Run a simple but comprehensive test over every file in FILES."
@@ -1815,14 +1921,14 @@ This requires restrictions of file name syntax."
       (ignore-errors (delete-directory tmp-name2 'recursive)))))
 
 (defun tramp--test-special-characters ()
-  "Perform the test in `tramp-test30-special-characters*'."
+  "Perform the test in `tramp-test31-special-characters*'."
   ;; Newlines, slashes and backslashes in file names are not
   ;; supported.  So we don't test.  And we don't test the tab
   ;; character on Windows or Cygwin, because the backslash is
   ;; interpreted as a path separator, preventing "\t" from being
   ;; expanded to <TAB>.
   (tramp--test-check-files
-   (if (tramp--test-smb-or-windows-nt-p)
+   (if (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p))
        "foo bar baz"
      (if (or (tramp--test-adb-p) (eq system-type 'cygwin))
         " foo bar baz "
@@ -1831,15 +1937,28 @@ This requires restrictions of file name syntax."
    "-foo-bar-baz-"
    "%foo%bar%baz%"
    "&foo&bar&baz&"
-   (unless (tramp--test-smb-or-windows-nt-p) "?foo?bar?baz?")
-   (unless (tramp--test-smb-or-windows-nt-p) "*foo*bar*baz*")
-   (if (tramp--test-smb-or-windows-nt-p) "'foo'bar'baz'" "'foo\"bar'baz\"")
+   (unless (or (tramp--test-ftp-p)
+              (tramp--test-gvfs-p)
+              (tramp--test-smb-or-windows-nt-p))
+     "?foo?bar?baz?")
+   (unless (or (tramp--test-ftp-p)
+              (tramp--test-gvfs-p)
+              (tramp--test-smb-or-windows-nt-p))
+     "*foo*bar*baz*")
+   (if (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p))
+       "'foo'bar'baz'"
+     "'foo\"bar'baz\"")
    "#foo~bar#baz~"
-   (if (tramp--test-smb-or-windows-nt-p) "!foo!bar!baz!" "!foo|bar!baz|")
-   (if (tramp--test-smb-or-windows-nt-p) ";foo;bar;baz;" ":foo;bar:baz;")
-   (unless (tramp--test-smb-or-windows-nt-p) "<foo>bar<baz>")
+   (if (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p))
+       "!foo!bar!baz!"
+     "!foo|bar!baz|")
+   (if (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p))
+       ";foo;bar;baz;"
+     ":foo;bar:baz;")
+   (unless (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p))
+     "<foo>bar<baz>")
    "(foo)bar(baz)"
-   "[foo]bar[baz]"
+   (unless (or (tramp--test-ftp-p) (tramp--test-gvfs-p)) "[foo]bar[baz]")
    "{foo}bar{baz}"))
 
 ;; These tests are inspired by Bug#17238.
@@ -1852,6 +1971,7 @@ This requires restrictions of file name syntax."
 (ert-deftest tramp-test31-special-characters-with-stat ()
   "Check special characters in file names.
 Use the `stat' command."
+  :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
   (skip-unless
    (eq
@@ -1860,18 +1980,17 @@ Use the `stat' command."
   (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
     (skip-unless (tramp-get-remote-stat v)))
 
-  (unwind-protect
-      (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
-       (tramp-set-connection-property v "perl" nil)
-       (tramp--test-special-characters))
-
-    ;; Reset suppressed properties.
-    (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
-      (tramp-set-connection-property v "perl" 'undef))))
+  (let ((tramp-connection-properties
+        (append
+         `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory))
+            "perl" nil))
+         tramp-connection-properties)))
+    (tramp--test-special-characters)))
 
 (ert-deftest tramp-test31-special-characters-with-perl ()
   "Check special characters in file names.
 Use the `perl' command."
+  :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
   (skip-unless
    (eq
@@ -1880,43 +1999,50 @@ Use the `perl' command."
   (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
     (skip-unless (tramp-get-remote-perl v)))
 
-  (unwind-protect
-      (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
-       (tramp-set-connection-property v "stat" nil)
-       (tramp--test-special-characters))
-
-    ;; Reset suppressed properties.
-    (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
-      (tramp-set-connection-property v "stat" 'undef))))
+  (let ((tramp-connection-properties
+        (append
+         `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory))
+            "stat" nil)
+           ;; See `tramp-sh-handle-file-truename'.
+           (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory))
+            "readlink" nil))
+         tramp-connection-properties)))
+    (tramp--test-special-characters)))
 
 (ert-deftest tramp-test31-special-characters-with-ls ()
   "Check special characters in file names.
 Use the `ls' command."
+  :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
   (skip-unless
    (eq
     (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
     'tramp-sh-file-name-handler))
 
-  (unwind-protect
-      (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
-       (tramp-set-connection-property v "stat" nil)
-       (tramp-set-connection-property v "perl" nil)
-       (tramp--test-special-characters))
-
-    ;; Reset suppressed properties.
-    (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
-      (tramp-set-connection-property v "stat" 'undef)
-      (tramp-set-connection-property v "perl" 'undef))))
+  (let ((tramp-connection-properties
+        (append
+         `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory))
+            "perl" nil)
+           (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory))
+            "stat" nil)
+           ;; See `tramp-sh-handle-file-truename'.
+           (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory))
+            "readlink" nil))
+         tramp-connection-properties)))
+    (tramp--test-special-characters)))
 
 (defun tramp--test-utf8 ()
-  "Perform the test in `tramp-test31-utf8*'."
-  (let ((coding-system-for-read 'utf-8)
-       (coding-system-for-write 'utf-8)
-       (file-name-coding-system 'utf-8))
+  "Perform the test in `tramp-test32-utf8*'."
+  (let* ((utf8 (if (and (eq system-type 'darwin)
+                       (memq 'utf-8-hfs (coding-system-list)))
+                  'utf-8-hfs 'utf-8))
+        (coding-system-for-read utf8)
+        (coding-system-for-write utf8)
+        (file-name-coding-system utf8))
     (tramp--test-check-files
-     "Γυρίστε το Γαλαξία με Ώτο Στοπ"
-     "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت"
+     (unless (tramp--test-hpux-p) "Γυρίστε το Γαλαξία με Ώτο Στοπ")
+     (unless (tramp--test-hpux-p)
+       "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت")
      "银河系漫游指南系列"
      "Автостопом по гала́ктике")))
 
@@ -1929,6 +2055,7 @@ Use the `ls' command."
 (ert-deftest tramp-test32-utf8-with-stat ()
   "Check UTF8 encoding in file names and file contents.
 Use the `stat' command."
+  :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
   (skip-unless
    (eq
@@ -1937,18 +2064,17 @@ Use the `stat' command."
   (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
     (skip-unless (tramp-get-remote-stat v)))
 
-  (unwind-protect
-      (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
-       (tramp-set-connection-property v "perl" nil)
-       (tramp--test-utf8))
-
-    ;; Reset suppressed properties.
-    (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
-      (tramp-set-connection-property v "perl" 'undef))))
+  (let ((tramp-connection-properties
+        (append
+         `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory))
+            "perl" nil))
+         tramp-connection-properties)))
+    (tramp--test-utf8)))
 
 (ert-deftest tramp-test32-utf8-with-perl ()
   "Check UTF8 encoding in file names and file contents.
 Use the `perl' command."
+  :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
   (skip-unless
    (eq
@@ -1957,34 +2083,37 @@ Use the `perl' command."
   (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
     (skip-unless (tramp-get-remote-perl v)))
 
-  (unwind-protect
-      (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
-       (tramp-set-connection-property v "stat" nil)
-       (tramp--test-utf8))
-
-    ;; Reset suppressed properties.
-    (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
-      (tramp-set-connection-property v "stat" 'undef))))
+  (let ((tramp-connection-properties
+        (append
+         `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory))
+            "stat" nil)
+           ;; See `tramp-sh-handle-file-truename'.
+           (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory))
+            "readlink" nil))
+         tramp-connection-properties)))
+    (tramp--test-utf8)))
 
 (ert-deftest tramp-test32-utf8-with-ls ()
   "Check UTF8 encoding in file names and file contents.
 Use the `ls' command."
+  :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
   (skip-unless
    (eq
     (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
     'tramp-sh-file-name-handler))
 
-  (unwind-protect
-      (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
-       (tramp-set-connection-property v "stat" nil)
-       (tramp-set-connection-property v "perl" nil)
-       (tramp--test-utf8))
-
-    ;; Reset suppressed properties.
-    (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
-      (tramp-set-connection-property v "stat" 'undef)
-      (tramp-set-connection-property v "perl" 'undef))))
+  (let ((tramp-connection-properties
+        (append
+         `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory))
+            "perl" nil)
+           (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory))
+            "stat" nil)
+           ;; See `tramp-sh-handle-file-truename'.
+           (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory))
+            "readlink" nil))
+         tramp-connection-properties)))
+    (tramp--test-utf8)))
 
 ;; This test is inspired by Bug#16928.
 (ert-deftest tramp-test33-asynchronous-requests ()
@@ -1993,6 +2122,7 @@ Such requests could arrive from timers, process filters and
 process sentinels.  They shall not disturb each other."
   ;; Mark as failed until bug has been fixed.
   :expected-result :failed
+  :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
   (skip-unless
    (eq
@@ -2104,6 +2234,7 @@ process sentinels.  They shall not disturb each other."
 Since it unloads Tramp, it shall be the last test to run."
   ;; Mark as failed until all symbols are unbound.
   :expected-result (if (featurep 'tramp) :failed :passed)
+  :tags '(:expensive-test)
   (when (featurep 'tramp)
     (unload-feature 'tramp 'force)
     ;; No Tramp feature must be left.
@@ -2145,13 +2276,9 @@ Since it unloads Tramp, it shall be the last test to run."
 ;; * Work on skipped tests.  Make a comment, when it is impossible.
 ;; * Fix `tramp-test15-copy-directory' for `smb'.  Using tar in a pipe
 ;;   doesn't work well when an interactive password must be provided.
-;; * Fix `tramp-test27-start-file-process' for `nc' and on MS
-;;   Windows (`process-send-eof'?).
-;; * Fix `tramp-test30-special-characters' for `nc'.
-;; * Fix `tramp-test31-utf8' for `nc'/`telnet' (when target is a dumb
-;;   busybox).  Seems to be in `directory-files'.
-;; * Fix Bug#16928.  Set expected error of `tramp-test32-asynchronous-requests'.
-;; * Fix `tramp-test34-unload' (Not all symbols are unbound).  Set
+;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?).
+;; * Fix Bug#16928.  Set expected error of `tramp-test33-asynchronous-requests'.
+;; * Fix `tramp-test35-unload' (Not all symbols are unbound).  Set
 ;;   expected error.
 
 (defun tramp-test-all (&optional interactive)