Commit 76c92fdd authored by Michael Albinus's avatar Michael Albinus
Browse files

* automated/tramp-tests.el (tramp-test17-insert-directory):

Make first line "total 123" optional.
(tramp-test20-file-modes, tramp-test22-file-times)
(tramp-test26-process-file, tramp-test27-start-file-process)
(tramp-test28-shell-command): Skip for tramp-gvfs.el and
tramp-smb.el.
(tramp-test20-file-modes): Check for "root" only when there is an
explicit user name.
(tramp-test21-file-links): Handle "... not supported" error.
(tramp-test22-file-times): Skip for "don't know" return values.
(tramp-test26-process-file, tramp-test28-shell-command):
Remove color escape sequences.
(tramp-test28-shell-command): Use `accept-process-output' rather
than `sit-for'.
(tramp-test30-utf8): Set coding system `utf-8'.
parent 50bfdd5d
2014-02-19 Michael Albinus <michael.albinus@gmx.de>
* automated/tramp-tests.el (tramp-test17-insert-directory):
Make first line "total 123" optional.
(tramp-test20-file-modes, tramp-test22-file-times)
(tramp-test26-process-file, tramp-test27-start-file-process)
(tramp-test28-shell-command): Skip for tramp-gvfs.el and
tramp-smb.el.
(tramp-test20-file-modes): Check for "root" only when there is an
explicit user name.
(tramp-test21-file-links): Handle "... not supported" error.
(tramp-test22-file-times): Skip for "don't know" return values.
(tramp-test26-process-file, tramp-test28-shell-command):
Remove color escape sequences.
(tramp-test28-shell-command): Use `accept-process-output' rather
than `sit-for'.
(tramp-test30-utf8): Set coding system `utf-8'.
2014-02-17 Michael Albinus <michael.albinus@gmx.de> 2014-02-17 Michael Albinus <michael.albinus@gmx.de>
* automated/tramp-tests.el (tramp-test28-shell-command): Perform * automated/tramp-tests.el (tramp-test28-shell-command): Perform
......
...@@ -822,7 +822,8 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." ...@@ -822,7 +822,8 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
(file-name-as-directory tmp-name1) "-al" nil 'full-directory-p) (file-name-as-directory tmp-name1) "-al" nil 'full-directory-p)
(goto-char (point-min)) (goto-char (point-min))
(should (should
(looking-at-p "total +[[:digit:]]+\n.+ \\.\n.+ \\.\\.\n.+ foo$")))) (looking-at-p
"\\(total +[[:digit:]]+\n\\)?.+ \\.\n.+ \\.\\.\n.+ foo$"))))
(ignore-errors (delete-directory tmp-name1 'recursive))))) (ignore-errors (delete-directory tmp-name1 'recursive)))))
(ert-deftest tramp-test18-file-attributes () (ert-deftest tramp-test18-file-attributes ()
...@@ -905,6 +906,11 @@ This tests also `file-readable-p' and `file-regular-p'." ...@@ -905,6 +906,11 @@ This tests also `file-readable-p' and `file-regular-p'."
"Check `file-modes'. "Check `file-modes'.
This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
(skip-unless (tramp--test-enabled)) (skip-unless (tramp--test-enabled))
(skip-unless
(not
(memq
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
'(tramp-gvfs-file-name-handler tramp-smb-file-name-handler))))
(tramp-cleanup-connection (tramp-cleanup-connection
(tramp-dissect-file-name tramp-test-temporary-file-directory) (tramp-dissect-file-name tramp-test-temporary-file-directory)
nil 'keep-password) nil 'keep-password)
...@@ -922,7 +928,8 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." ...@@ -922,7 +928,8 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
(should (= (file-modes tmp-name) #o444)) (should (= (file-modes tmp-name) #o444))
(should-not (file-executable-p tmp-name)) (should-not (file-executable-p tmp-name))
;; A file is always writable for user "root". ;; A file is always writable for user "root".
(unless (string-equal (file-remote-p tmp-name 'user) "root") (when (and (stringp (file-remote-p tmp-name 'user))
(not (string-equal (file-remote-p tmp-name 'user) "root")))
(should-not (file-writable-p tmp-name)))) (should-not (file-writable-p tmp-name))))
(ignore-errors (delete-file tmp-name))))) (ignore-errors (delete-file tmp-name)))))
...@@ -941,7 +948,15 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -941,7 +948,15 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(progn (progn
(write-region "foo" nil tmp-name1) (write-region "foo" nil tmp-name1)
(should (file-exists-p tmp-name1)) (should (file-exists-p tmp-name1))
(make-symbolic-link tmp-name1 tmp-name2) ;; Method "smb" supports `make-symbolic-link' only if the
;; remote host has CIFS capabilities. tramp-adb.el and
;; tramp-gvfs.el do not support symbolic links at all.
(condition-case err
(make-symbolic-link tmp-name1 tmp-name2)
(file-error
(skip-unless
(not (string-equal (error-message-string err)
"make-symbolic-link not supported")))))
(should (file-symlink-p tmp-name2)) (should (file-symlink-p tmp-name2))
(should-error (make-symbolic-link tmp-name1 tmp-name2)) (should-error (make-symbolic-link tmp-name1 tmp-name2))
(make-symbolic-link tmp-name1 tmp-name2 'ok-if-already-exists) (make-symbolic-link tmp-name1 tmp-name2 'ok-if-already-exists)
...@@ -983,6 +998,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -983,6 +998,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(ert-deftest tramp-test22-file-times () (ert-deftest tramp-test22-file-times ()
"Check `set-file-times' and `file-newer-than-file-p'." "Check `set-file-times' and `file-newer-than-file-p'."
(skip-unless (tramp--test-enabled)) (skip-unless (tramp--test-enabled))
(skip-unless
(not
(memq
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
'(tramp-gvfs-file-name-handler tramp-smb-file-name-handler))))
(tramp-cleanup-connection (tramp-cleanup-connection
(tramp-dissect-file-name tramp-test-temporary-file-directory) (tramp-dissect-file-name tramp-test-temporary-file-directory)
nil 'keep-password) nil 'keep-password)
...@@ -997,6 +1017,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -997,6 +1017,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(should (consp (nth 5 (file-attributes tmp-name1)))) (should (consp (nth 5 (file-attributes tmp-name1))))
;; '(0 0) means don't know, and will be replaced by `current-time'. ;; '(0 0) means don't know, and will be replaced by `current-time'.
(set-file-times tmp-name1 '(0 1)) (set-file-times tmp-name1 '(0 1))
;; Dumb busyboxes are not able to return the date correctly.
;; They say "don't know.
(skip-unless (not (equal (nth 5 (file-attributes tmp-name1)) '(0 0))))
(should (equal (nth 5 (file-attributes tmp-name1)) '(0 1))) (should (equal (nth 5 (file-attributes tmp-name1)) '(0 1)))
(write-region "bla" nil tmp-name2) (write-region "bla" nil tmp-name2)
(should (file-exists-p tmp-name2)) (should (file-exists-p tmp-name2))
...@@ -1077,6 +1100,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -1077,6 +1100,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(ert-deftest tramp-test26-process-file () (ert-deftest tramp-test26-process-file ()
"Check `process-file'." "Check `process-file'."
(skip-unless (tramp--test-enabled)) (skip-unless (tramp--test-enabled))
(skip-unless
(not
(memq
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
'(tramp-gvfs-file-name-handler tramp-smb-file-name-handler))))
(tramp-cleanup-connection (tramp-cleanup-connection
(tramp-dissect-file-name tramp-test-temporary-file-directory) (tramp-dissect-file-name tramp-test-temporary-file-directory)
nil 'keep-password) nil 'keep-password)
...@@ -1096,6 +1124,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -1096,6 +1124,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(should (should
(zerop (zerop
(process-file "ls" nil t nil (file-name-nondirectory tmp-name)))) (process-file "ls" nil t nil (file-name-nondirectory tmp-name))))
;; `ls' could produce colorized output.
(goto-char (point-min))
(while (re-search-forward tramp-color-escape-sequence-regexp nil t)
(replace-match "" nil nil))
(should (should
(string-equal (string-equal
(format "%s\n" (file-name-nondirectory tmp-name)) (format "%s\n" (file-name-nondirectory tmp-name))
...@@ -1105,6 +1137,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -1105,6 +1137,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(ert-deftest tramp-test27-start-file-process () (ert-deftest tramp-test27-start-file-process ()
"Check `start-file-process'." "Check `start-file-process'."
(skip-unless (tramp--test-enabled)) (skip-unless (tramp--test-enabled))
(skip-unless
(not
(memq
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
'(tramp-gvfs-file-name-handler tramp-smb-file-name-handler))))
(tramp-cleanup-connection (tramp-cleanup-connection
(tramp-dissect-file-name tramp-test-temporary-file-directory) (tramp-dissect-file-name tramp-test-temporary-file-directory)
nil 'keep-password) nil 'keep-password)
...@@ -1153,6 +1190,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -1153,6 +1190,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(ert-deftest tramp-test28-shell-command () (ert-deftest tramp-test28-shell-command ()
"Check `shell-command'." "Check `shell-command'."
(skip-unless (tramp--test-enabled)) (skip-unless (tramp--test-enabled))
(skip-unless
(not
(memq
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
'(tramp-gvfs-file-name-handler tramp-smb-file-name-handler))))
(tramp-cleanup-connection (tramp-cleanup-connection
(tramp-dissect-file-name tramp-test-temporary-file-directory) (tramp-dissect-file-name tramp-test-temporary-file-directory)
nil 'keep-password) nil 'keep-password)
...@@ -1165,6 +1207,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -1165,6 +1207,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(should (file-exists-p tmp-name)) (should (file-exists-p tmp-name))
(shell-command (shell-command
(format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer)) (format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer))
;; `ls' could produce colorized output.
(goto-char (point-min))
(while (re-search-forward tramp-color-escape-sequence-regexp nil t)
(replace-match "" nil nil))
(should (should
(string-equal (string-equal
(format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string))))
...@@ -1176,11 +1222,15 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -1176,11 +1222,15 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(should (file-exists-p tmp-name)) (should (file-exists-p tmp-name))
(async-shell-command (async-shell-command
(format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer)) (format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer))
(sit-for 1 'nodisplay) (accept-process-output (get-buffer-process (current-buffer)) 1)
(while (ignore-errors (while (ignore-errors
(memq (process-status (get-buffer-process (current-buffer))) (memq (process-status (get-buffer-process (current-buffer)))
'(run open))) '(run open)))
(sit-for 1 'nodisplay)) (accept-process-output (get-buffer-process (current-buffer)) 1))
;; `ls' could produce colorized output.
(goto-char (point-min))
(while (re-search-forward tramp-color-escape-sequence-regexp nil t)
(replace-match "" nil nil))
(should (should
(string-equal (string-equal
(format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string))))
...@@ -1194,11 +1244,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -1194,11 +1244,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(process-send-string (process-send-string
(get-buffer-process (current-buffer)) (get-buffer-process (current-buffer))
(format "%s\n" (file-name-nondirectory tmp-name))) (format "%s\n" (file-name-nondirectory tmp-name)))
(sit-for 1 'nodisplay) (accept-process-output (get-buffer-process (current-buffer)) 1)
(while (ignore-errors (while (ignore-errors
(memq (process-status (get-buffer-process (current-buffer))) (memq (process-status (get-buffer-process (current-buffer)))
'(run open))) '(run open)))
(sit-for 1 'nodisplay)) (accept-process-output (get-buffer-process (current-buffer)) 1))
(should (should
(string-equal (string-equal
(format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string))))
...@@ -1260,6 +1310,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -1260,6 +1310,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
nil 'keep-password) nil 'keep-password)
(let ((tmp-name (tramp--test-make-temp-name)) (let ((tmp-name (tramp--test-make-temp-name))
(coding-system-for-read 'utf-8)
(coding-system-for-write 'utf-8)
(arabic "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت") (arabic "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت")
(chinese "银河系漫游指南系列") (chinese "银河系漫游指南系列")
(russian "Автостопом по гала́ктике")) (russian "Автостопом по гала́ктике"))
...@@ -1293,10 +1345,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -1293,10 +1345,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
;; * set-file-selinux-context ;; * set-file-selinux-context
;; * Fix `tramp-test17-insert-directory' for ;; * Fix `tramp-test17-insert-directory' for
;; `ls-lisp-insert-directory' ("plink" and friends). ;; `ls-lisp-insert-directory' ("plink" and friends, tramp-gvfs.el).
;; * Fix `tramp-test27-start-file-process' on MS Windows ;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?).
;; (`process-send-eof'?). ;; * Fix `tramp-test28-shell-command' on MS Windows (`process-send-eof'?).
;; * Fix `tramp-test29-utf8' on MS Windows. ;; * Fix `tramp-test30-utf8' on MS Windows. Seems to be in `directory-files'.
(defun tramp-test-all (&optional interactive) (defun tramp-test-all (&optional interactive)
"Run all tests for \\[tramp]." "Run all tests for \\[tramp]."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment