]> 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 a0be10e39540ccb5414bb9a90242cb66b6d67363..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>
 
@@ -44,6 +44,7 @@
 (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")
@@ -1394,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
@@ -1424,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))
@@ -1439,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
@@ -1508,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
@@ -1595,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
@@ -1608,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"
@@ -1618,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)
@@ -1637,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
@@ -1648,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)))))
@@ -1772,14 +1785,6 @@ Several special characters do not work properly there."
       (file-truename tramp-test-temporary-file-directory) nil
     (string-match "^HP-UX" (tramp-get-connection-property v "uname" ""))))
 
-(defun tramp--test-darwin-p ()
-  "Check, whether the remote host runs Mac OS X.
-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 "^Darwin" (tramp-get-connection-property v "uname" ""))))
-
 (defun tramp--test-check-files (&rest files)
   "Run a simple but comprehensive test over every file in FILES."
   ;; We must use `file-truename' for the temporary directory, because
@@ -1966,6 +1971,7 @@ Several special characters do not work properly there."
 (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
@@ -1984,6 +1990,7 @@ Use the `stat' command."
 (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
@@ -2005,6 +2012,7 @@ Use the `perl' command."
 (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
@@ -2025,12 +2033,15 @@ Use the `ls' command."
 
 (defun tramp--test-utf8 ()
   "Perform the test in `tramp-test32-utf8*'."
-  (let ((coding-system-for-read 'utf-8)
-       (coding-system-for-write 'utf-8)
-       (file-name-coding-system 'utf-8))
+  (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 (or (tramp--test-hpux-p) (tramp--test-darwin-p))
+     (unless (tramp--test-hpux-p)
        "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت")
      "银河系漫游指南系列"
      "Автостопом по гала́ктике")))
@@ -2044,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
@@ -2062,6 +2074,7 @@ Use the `stat' command."
 (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
@@ -2083,6 +2096,7 @@ Use the `perl' command."
 (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
@@ -2108,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
@@ -2219,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.