;;; 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")
(ert-deftest tramp-test26-process-file ()
"Check `process-file'."
+ :tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
(skip-unless
(not
(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))
(ert-deftest tramp-test27-start-file-process ()
"Check `start-file-process'."
+ :tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
(skip-unless
(not
(ert-deftest tramp-test28-shell-command ()
"Check `shell-command'."
+ :tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
(skip-unless
(not
(ert-deftest tramp-test29-vc-registered ()
"Check `vc-registered'."
+ :tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
(skip-unless
(eq
(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"
(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)
(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
(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)))))
(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
(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
(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
(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
(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)
"أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت")
"银河系漫游指南系列"
"Автостопом по гала́ктике")))
(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
(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
(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
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
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.