diff options
| author | Michael Albinus | 2018-01-07 18:50:06 +0100 |
|---|---|---|
| committer | Michael Albinus | 2018-01-07 18:50:06 +0100 |
| commit | 95d0be0ae596b9f9f8b100576ca5d53a681e329c (patch) | |
| tree | acbb82ca0c622a5a53eb53bf4fdad94e302386a9 /test | |
| parent | f352ea6efd4554cee95568cee72a3dfa00de2abe (diff) | |
| download | emacs-95d0be0ae596b9f9f8b100576ca5d53a681e329c.tar.gz emacs-95d0be0ae596b9f9f8b100576ca5d53a681e329c.zip | |
Make tramp-tests.el more robust on w32
* test/lisp/net/tramp-tests.el (tramp-test21-file-links):
Do not call `make-symbolic-link' on w32.
(tramp-test36-find-backup-file-name): Call also
`convert-standard-filename' due to w32.
(tramp--test-windows-nt): New defun.
(tramp-test42-auto-load, tramp-test42-delay-load)
(tramp-test42-recursive-load, tramp-test42-remote-load-path):
Quote command due to w32.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 71 |
1 files changed, 49 insertions, 22 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index ec7e25247c7..24dfee55134 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -2760,9 +2760,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2760 | (file-symlink-p tmp-name2))) | 2760 | (file-symlink-p tmp-name2))) |
| 2761 | ;; `tmp-name3' is a local file name. Therefore, the link | 2761 | ;; `tmp-name3' is a local file name. Therefore, the link |
| 2762 | ;; target remains unchanged, even if quoted. | 2762 | ;; target remains unchanged, even if quoted. |
| 2763 | (make-symbolic-link tmp-name1 tmp-name3) | 2763 | ;; `make-symbolic-link' might not be permitted on w32 systems. |
| 2764 | (should | 2764 | (unless (tramp--test-windows-nt) |
| 2765 | (string-equal tmp-name1 (file-symlink-p tmp-name3))) | 2765 | (make-symbolic-link tmp-name1 tmp-name3) |
| 2766 | (should | ||
| 2767 | (string-equal tmp-name1 (file-symlink-p tmp-name3)))) | ||
| 2766 | ;; Check directory as newname. | 2768 | ;; Check directory as newname. |
| 2767 | (make-directory tmp-name4) | 2769 | (make-directory tmp-name4) |
| 2768 | (should-error | 2770 | (should-error |
| @@ -2864,15 +2866,17 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2864 | (tramp-compat-file-name-quote | 2866 | (tramp-compat-file-name-quote |
| 2865 | (concat (file-remote-p tmp-name2) "/penguin:motd:")))) | 2867 | (concat (file-remote-p tmp-name2) "/penguin:motd:")))) |
| 2866 | ;; `tmp-name3' is a local file name. | 2868 | ;; `tmp-name3' is a local file name. |
| 2867 | (make-symbolic-link tmp-name1 tmp-name3) | 2869 | ;; `make-symbolic-link' might not be permitted on w32 systems. |
| 2868 | (should (file-symlink-p tmp-name3)) | 2870 | (unless (tramp--test-windows-nt) |
| 2869 | (should-not (string-equal tmp-name3 (file-truename tmp-name3))) | 2871 | (make-symbolic-link tmp-name1 tmp-name3) |
| 2870 | ;; `file-truename' returns a quoted file name for `tmp-name3'. | 2872 | (should (file-symlink-p tmp-name3)) |
| 2871 | ;; We must unquote it. | 2873 | (should-not (string-equal tmp-name3 (file-truename tmp-name3))) |
| 2872 | (should | 2874 | ;; `file-truename' returns a quoted file name for `tmp-name3'. |
| 2873 | (string-equal | 2875 | ;; We must unquote it. |
| 2874 | (tramp-compat-file-name-unquote (file-truename tmp-name1)) | 2876 | (should |
| 2875 | (tramp-compat-file-name-unquote (file-truename tmp-name3))))) | 2877 | (string-equal |
| 2878 | (tramp-compat-file-name-unquote (file-truename tmp-name1)) | ||
| 2879 | (tramp-compat-file-name-unquote (file-truename tmp-name3)))))) | ||
| 2876 | 2880 | ||
| 2877 | ;; Cleanup. | 2881 | ;; Cleanup. |
| 2878 | (ignore-errors | 2882 | (ignore-errors |
| @@ -3961,9 +3965,14 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3961 | (expand-file-name | 3965 | (expand-file-name |
| 3962 | (format | 3966 | (format |
| 3963 | "%s~" | 3967 | "%s~" |
| 3964 | ;; This is taken from `make-backup-file-name-1'. | 3968 | ;; This is taken from `make-backup-file-name-1'. We |
| 3969 | ;; call `convert-standard-filename', because on MS | ||
| 3970 | ;; Windows the (local) colons must be replaced by | ||
| 3971 | ;; exclamation marks. | ||
| 3965 | (subst-char-in-string | 3972 | (subst-char-in-string |
| 3966 | ?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1))) | 3973 | ?/ ?! |
| 3974 | (replace-regexp-in-string | ||
| 3975 | "!" "!!" (convert-standard-filename tmp-name1)))) | ||
| 3967 | tmp-name2))))) | 3976 | tmp-name2))))) |
| 3968 | ;; The backup directory is created. | 3977 | ;; The backup directory is created. |
| 3969 | (should (file-directory-p tmp-name2))) | 3978 | (should (file-directory-p tmp-name2))) |
| @@ -3984,9 +3993,14 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3984 | (expand-file-name | 3993 | (expand-file-name |
| 3985 | (format | 3994 | (format |
| 3986 | "%s~" | 3995 | "%s~" |
| 3987 | ;; This is taken from `make-backup-file-name-1'. | 3996 | ;; This is taken from `make-backup-file-name-1'. We |
| 3997 | ;; call `convert-standard-filename', because on MS | ||
| 3998 | ;; Windows the (local) colons must be replaced by | ||
| 3999 | ;; exclamation marks. | ||
| 3988 | (subst-char-in-string | 4000 | (subst-char-in-string |
| 3989 | ?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1))) | 4001 | ?/ ?! |
| 4002 | (replace-regexp-in-string | ||
| 4003 | "!" "!!" (convert-standard-filename tmp-name1)))) | ||
| 3990 | tmp-name2))))) | 4004 | tmp-name2))))) |
| 3991 | ;; The backup directory is created. | 4005 | ;; The backup directory is created. |
| 3992 | (should (file-directory-p tmp-name2))) | 4006 | (should (file-directory-p tmp-name2))) |
| @@ -4008,9 +4022,14 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4008 | (expand-file-name | 4022 | (expand-file-name |
| 4009 | (format | 4023 | (format |
| 4010 | "%s~" | 4024 | "%s~" |
| 4011 | ;; This is taken from `make-backup-file-name-1'. | 4025 | ;; This is taken from `make-backup-file-name-1'. We |
| 4026 | ;; call `convert-standard-filename', because on MS | ||
| 4027 | ;; Windows the (local) colons must be replaced by | ||
| 4028 | ;; exclamation marks. | ||
| 4012 | (subst-char-in-string | 4029 | (subst-char-in-string |
| 4013 | ?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1))) | 4030 | ?/ ?! |
| 4031 | (replace-regexp-in-string | ||
| 4032 | "!" "!!" (convert-standard-filename tmp-name1)))) | ||
| 4014 | tmp-name2))))) | 4033 | tmp-name2))))) |
| 4015 | ;; The backup directory is created. | 4034 | ;; The backup directory is created. |
| 4016 | (should (file-directory-p tmp-name2))) | 4035 | (should (file-directory-p tmp-name2))) |
| @@ -4116,6 +4135,10 @@ This does not support special file names." | |||
| 4116 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) | 4135 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) |
| 4117 | 'tramp-sh-file-name-handler)) | 4136 | 'tramp-sh-file-name-handler)) |
| 4118 | 4137 | ||
| 4138 | (defun tramp--test-windows-nt () | ||
| 4139 | "Check, whether the locale host runs MS Windows." | ||
| 4140 | (eq system-type 'windows-nt)) | ||
| 4141 | |||
| 4119 | (defun tramp--test-windows-nt-and-batch () | 4142 | (defun tramp--test-windows-nt-and-batch () |
| 4120 | "Check, whether the locale host runs MS Windows in batch mode. | 4143 | "Check, whether the locale host runs MS Windows in batch mode. |
| 4121 | This does not support special characters." | 4144 | This does not support special characters." |
| @@ -4706,7 +4729,8 @@ process sentinels. They shall not disturb each other." | |||
| 4706 | (shell-command-to-string | 4729 | (shell-command-to-string |
| 4707 | (format | 4730 | (format |
| 4708 | "%s -batch -Q -L %s --eval %s" | 4731 | "%s -batch -Q -L %s --eval %s" |
| 4709 | (expand-file-name invocation-name invocation-directory) | 4732 | (shell-quote-argument |
| 4733 | (expand-file-name invocation-name invocation-directory)) | ||
| 4710 | (mapconcat 'shell-quote-argument load-path " -L ") | 4734 | (mapconcat 'shell-quote-argument load-path " -L ") |
| 4711 | (shell-quote-argument code))))))) | 4735 | (shell-quote-argument code))))))) |
| 4712 | 4736 | ||
| @@ -4738,7 +4762,8 @@ process sentinels. They shall not disturb each other." | |||
| 4738 | (shell-command-to-string | 4762 | (shell-command-to-string |
| 4739 | (format | 4763 | (format |
| 4740 | "%s -batch -Q -L %s --eval %s" | 4764 | "%s -batch -Q -L %s --eval %s" |
| 4741 | (expand-file-name invocation-name invocation-directory) | 4765 | (shell-quote-argument |
| 4766 | (expand-file-name invocation-name invocation-directory)) | ||
| 4742 | (mapconcat 'shell-quote-argument load-path " -L ") | 4767 | (mapconcat 'shell-quote-argument load-path " -L ") |
| 4743 | (shell-quote-argument (format code tm))))))))) | 4768 | (shell-quote-argument (format code tm))))))))) |
| 4744 | 4769 | ||
| @@ -4761,7 +4786,8 @@ process sentinels. They shall not disturb each other." | |||
| 4761 | (shell-command-to-string | 4786 | (shell-command-to-string |
| 4762 | (format | 4787 | (format |
| 4763 | "%s -batch -Q -L %s --eval %s" | 4788 | "%s -batch -Q -L %s --eval %s" |
| 4764 | (expand-file-name invocation-name invocation-directory) | 4789 | (shell-quote-argument |
| 4790 | (expand-file-name invocation-name invocation-directory)) | ||
| 4765 | (mapconcat 'shell-quote-argument load-path " -L ") | 4791 | (mapconcat 'shell-quote-argument load-path " -L ") |
| 4766 | (shell-quote-argument code)))))))) | 4792 | (shell-quote-argument code)))))))) |
| 4767 | 4793 | ||
| @@ -4788,7 +4814,8 @@ process sentinels. They shall not disturb each other." | |||
| 4788 | (shell-command-to-string | 4814 | (shell-command-to-string |
| 4789 | (format | 4815 | (format |
| 4790 | "%s -batch -Q -L %s -l tramp-sh --eval %s" | 4816 | "%s -batch -Q -L %s -l tramp-sh --eval %s" |
| 4791 | (expand-file-name invocation-name invocation-directory) | 4817 | (shell-quote-argument |
| 4818 | (expand-file-name invocation-name invocation-directory)) | ||
| 4792 | (mapconcat 'shell-quote-argument load-path " -L ") | 4819 | (mapconcat 'shell-quote-argument load-path " -L ") |
| 4793 | (shell-quote-argument code))))))) | 4820 | (shell-quote-argument code))))))) |
| 4794 | 4821 | ||