aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPaul Eggert2016-08-05 14:09:08 -0700
committerPaul Eggert2016-08-05 14:09:08 -0700
commit6b780a2e97c032d1749f190e0f5cfbbce99d0a60 (patch)
tree18287633d9eb2d63d8badf035144e8a3143c00db /test
parent95c6606a477e017ed7b418fcc81fd937895fee20 (diff)
parent9ba51edf62b25c678508a316ec78a09b18d3bf9e (diff)
downloademacs-6b780a2e97c032d1749f190e0f5cfbbce99d0a60.tar.gz
emacs-6b780a2e97c032d1749f190e0f5cfbbce99d0a60.zip
Merge from origin/emacs-25
9ba51ed Document buffer-swap-text+save-excursion interaction 452aa94 Fix eieio vs cl-generic incompatibilities found in Rudel (bug... 248d5dd Include cl-generic in package--builtin-versions (bug#22817) 8f5a8b6 Improve timing in `tramp-test29-environment-variables' 05ba7a0 Add test for handling environment variables in Tramp e393d4f * lisp/emacs-lisp/package.el (describe-package-1) (package-st... 5e38887 ; * lisp/net/tramp.el: Fix 2010-10-04 comment typo. (Bug#23913) 90f2169 ; Spelling fixes 069fc05 Improve documentation of search functions 0a0144a Delete environment variables in Tramp when needed f624671 Add "New in Emacs 25" section to the FAQ 658daf9 Fix 'vertical-motion' in non-interactive sessions 686b520 Fix memory leak in imagemagick-types 4069b71 Update ELisp manual to match 'string-collate-equalp' doc string 1b2d6a6 Clarify docstring of find-feature-regexp aac62a6 Add details to cl-lib defining macros' docstrings d6aa4da Clarify doc string of 'save-buffer' 03bcf11 Un-confuse doc string of 'string-collate-equalp' c53135b Clarify documentation of 'mouse-on-link-p' # Conflicts: # lisp/emacs-lisp/eieio-core.el
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/tramp-tests.el126
1 files changed, 109 insertions, 17 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index a1ae78ab5c3..e05786fa070 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -1702,7 +1702,99 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1702 ;; Cleanup. 1702 ;; Cleanup.
1703 (ignore-errors (delete-file tmp-name))))) 1703 (ignore-errors (delete-file tmp-name)))))
1704 1704
1705(ert-deftest tramp-test29-vc-registered () 1705(defun tramp-test--shell-command-to-string-asynchronously (command)
1706 "Like `shell-command-to-string', but for asynchronous processes."
1707 (with-temp-buffer
1708 (async-shell-command command (current-buffer))
1709 ;; Suppress nasty messages.
1710 (set-process-sentinel (get-buffer-process (current-buffer)) nil)
1711 (while (get-buffer-process (current-buffer))
1712 (accept-process-output (get-buffer-process (current-buffer)) 0.1))
1713 (accept-process-output)
1714 (buffer-substring-no-properties (point-min) (point-max))))
1715
1716;; This test is inspired by Bug#23952.
1717(ert-deftest tramp-test29-environment-variables ()
1718 "Check that remote processes set / unset environment variables properly."
1719 :tags '(:expensive-test)
1720 (skip-unless (tramp--test-enabled))
1721 (skip-unless
1722 (eq
1723 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
1724 'tramp-sh-file-name-handler))
1725
1726 (dolist (this-shell-command-to-string
1727 '(;; Synchronously.
1728 shell-command-to-string
1729 ;; Asynchronously.
1730 tramp-test--shell-command-to-string-asynchronously))
1731
1732 (let ((default-directory tramp-test-temporary-file-directory)
1733 (shell-file-name "/bin/sh")
1734 (envvar (concat "VAR_" (upcase (md5 (current-time-string)))))
1735 kill-buffer-query-functions)
1736
1737 (unwind-protect
1738 ;; Set a value.
1739 (let ((process-environment
1740 (cons (concat envvar "=foo") process-environment)))
1741 ;; Default value.
1742 (should
1743 (string-match
1744 "foo"
1745 (funcall
1746 this-shell-command-to-string
1747 (format "echo -n ${%s:?bla}" envvar))))))
1748
1749 (unwind-protect
1750 ;; Set the empty value.
1751 (let ((process-environment
1752 (cons (concat envvar "=") process-environment)))
1753 ;; Value is null.
1754 (should
1755 (string-match
1756 "bla"
1757 (funcall
1758 this-shell-command-to-string
1759 (format "echo -n ${%s:?bla}" envvar))))
1760 ;; Variable is set.
1761 (should
1762 (string-match
1763 (regexp-quote envvar)
1764 (funcall this-shell-command-to-string "set")))))
1765
1766 ;; We force a reconnect, in order to have a clean environment.
1767 (tramp-cleanup-connection
1768 (tramp-dissect-file-name tramp-test-temporary-file-directory)
1769 'keep-debug 'keep-password)
1770 (unwind-protect
1771 ;; Unset the variable.
1772 (let ((tramp-remote-process-environment
1773 (cons (concat envvar "=foo")
1774 tramp-remote-process-environment)))
1775 ;; Set the initial value, we want to unset below.
1776 (should
1777 (string-match
1778 "foo"
1779 (funcall
1780 this-shell-command-to-string
1781 (format "echo -n ${%s:?bla}" envvar))))
1782 (let ((process-environment
1783 (cons envvar process-environment)))
1784 ;; Variable is unset.
1785 (should
1786 (string-match
1787 "bla"
1788 (funcall
1789 this-shell-command-to-string
1790 (format "echo -n ${%s:?bla}" envvar))))
1791 ;; Variable is unset.
1792 (should-not
1793 (string-match
1794 (regexp-quote envvar)
1795 (funcall this-shell-command-to-string "set")))))))))
1796
1797(ert-deftest tramp-test30-vc-registered ()
1706 "Check `vc-registered'." 1798 "Check `vc-registered'."
1707 :tags '(:expensive-test) 1799 :tags '(:expensive-test)
1708 (skip-unless (tramp--test-enabled)) 1800 (skip-unless (tramp--test-enabled))
@@ -1771,7 +1863,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1771 ;; Cleanup. 1863 ;; Cleanup.
1772 (ignore-errors (delete-directory tmp-name1 'recursive))))) 1864 (ignore-errors (delete-directory tmp-name1 'recursive)))))
1773 1865
1774(ert-deftest tramp-test30-make-auto-save-file-name () 1866(ert-deftest tramp-test31-make-auto-save-file-name ()
1775 "Check `make-auto-save-file-name'." 1867 "Check `make-auto-save-file-name'."
1776 (skip-unless (tramp--test-enabled)) 1868 (skip-unless (tramp--test-enabled))
1777 1869
@@ -2031,7 +2123,7 @@ Several special characters do not work properly there."
2031 (ignore-errors (delete-directory tmp-name2 'recursive))))) 2123 (ignore-errors (delete-directory tmp-name2 'recursive)))))
2032 2124
2033(defun tramp--test-special-characters () 2125(defun tramp--test-special-characters ()
2034 "Perform the test in `tramp-test31-special-characters*'." 2126 "Perform the test in `tramp-test32-special-characters*'."
2035 ;; Newlines, slashes and backslashes in file names are not 2127 ;; Newlines, slashes and backslashes in file names are not
2036 ;; supported. So we don't test. And we don't test the tab 2128 ;; supported. So we don't test. And we don't test the tab
2037 ;; character on Windows or Cygwin, because the backslash is 2129 ;; character on Windows or Cygwin, because the backslash is
@@ -2072,14 +2164,14 @@ Several special characters do not work properly there."
2072 "{foo}bar{baz}")) 2164 "{foo}bar{baz}"))
2073 2165
2074;; These tests are inspired by Bug#17238. 2166;; These tests are inspired by Bug#17238.
2075(ert-deftest tramp-test31-special-characters () 2167(ert-deftest tramp-test32-special-characters ()
2076 "Check special characters in file names." 2168 "Check special characters in file names."
2077 (skip-unless (tramp--test-enabled)) 2169 (skip-unless (tramp--test-enabled))
2078 (skip-unless (not (tramp--test-rsync-p))) 2170 (skip-unless (not (tramp--test-rsync-p)))
2079 2171
2080 (tramp--test-special-characters)) 2172 (tramp--test-special-characters))
2081 2173
2082(ert-deftest tramp-test31-special-characters-with-stat () 2174(ert-deftest tramp-test32-special-characters-with-stat ()
2083 "Check special characters in file names. 2175 "Check special characters in file names.
2084Use the `stat' command." 2176Use the `stat' command."
2085 :tags '(:expensive-test) 2177 :tags '(:expensive-test)
@@ -2099,7 +2191,7 @@ Use the `stat' command."
2099 tramp-connection-properties))) 2191 tramp-connection-properties)))
2100 (tramp--test-special-characters))) 2192 (tramp--test-special-characters)))
2101 2193
2102(ert-deftest tramp-test31-special-characters-with-perl () 2194(ert-deftest tramp-test32-special-characters-with-perl ()
2103 "Check special characters in file names. 2195 "Check special characters in file names.
2104Use the `perl' command." 2196Use the `perl' command."
2105 :tags '(:expensive-test) 2197 :tags '(:expensive-test)
@@ -2122,7 +2214,7 @@ Use the `perl' command."
2122 tramp-connection-properties))) 2214 tramp-connection-properties)))
2123 (tramp--test-special-characters))) 2215 (tramp--test-special-characters)))
2124 2216
2125(ert-deftest tramp-test31-special-characters-with-ls () 2217(ert-deftest tramp-test32-special-characters-with-ls ()
2126 "Check special characters in file names. 2218 "Check special characters in file names.
2127Use the `ls' command." 2219Use the `ls' command."
2128 :tags '(:expensive-test) 2220 :tags '(:expensive-test)
@@ -2146,7 +2238,7 @@ Use the `ls' command."
2146 (tramp--test-special-characters))) 2238 (tramp--test-special-characters)))
2147 2239
2148(defun tramp--test-utf8 () 2240(defun tramp--test-utf8 ()
2149 "Perform the test in `tramp-test32-utf8*'." 2241 "Perform the test in `tramp-test33-utf8*'."
2150 (let* ((utf8 (if (and (eq system-type 'darwin) 2242 (let* ((utf8 (if (and (eq system-type 'darwin)
2151 (memq 'utf-8-hfs (coding-system-list))) 2243 (memq 'utf-8-hfs (coding-system-list)))
2152 'utf-8-hfs 'utf-8)) 2244 'utf-8-hfs 'utf-8))
@@ -2160,14 +2252,14 @@ Use the `ls' command."
2160 "银河系漫游指南系列" 2252 "银河系漫游指南系列"
2161 "Автостопом по гала́ктике"))) 2253 "Автостопом по гала́ктике")))
2162 2254
2163(ert-deftest tramp-test32-utf8 () 2255(ert-deftest tramp-test33-utf8 ()
2164 "Check UTF8 encoding in file names and file contents." 2256 "Check UTF8 encoding in file names and file contents."
2165 (skip-unless (tramp--test-enabled)) 2257 (skip-unless (tramp--test-enabled))
2166 (skip-unless (not (tramp--test-rsync-p))) 2258 (skip-unless (not (tramp--test-rsync-p)))
2167 2259
2168 (tramp--test-utf8)) 2260 (tramp--test-utf8))
2169 2261
2170(ert-deftest tramp-test32-utf8-with-stat () 2262(ert-deftest tramp-test33-utf8-with-stat ()
2171 "Check UTF8 encoding in file names and file contents. 2263 "Check UTF8 encoding in file names and file contents.
2172Use the `stat' command." 2264Use the `stat' command."
2173 :tags '(:expensive-test) 2265 :tags '(:expensive-test)
@@ -2187,7 +2279,7 @@ Use the `stat' command."
2187 tramp-connection-properties))) 2279 tramp-connection-properties)))
2188 (tramp--test-utf8))) 2280 (tramp--test-utf8)))
2189 2281
2190(ert-deftest tramp-test32-utf8-with-perl () 2282(ert-deftest tramp-test33-utf8-with-perl ()
2191 "Check UTF8 encoding in file names and file contents. 2283 "Check UTF8 encoding in file names and file contents.
2192Use the `perl' command." 2284Use the `perl' command."
2193 :tags '(:expensive-test) 2285 :tags '(:expensive-test)
@@ -2210,7 +2302,7 @@ Use the `perl' command."
2210 tramp-connection-properties))) 2302 tramp-connection-properties)))
2211 (tramp--test-utf8))) 2303 (tramp--test-utf8)))
2212 2304
2213(ert-deftest tramp-test32-utf8-with-ls () 2305(ert-deftest tramp-test33-utf8-with-ls ()
2214 "Check UTF8 encoding in file names and file contents. 2306 "Check UTF8 encoding in file names and file contents.
2215Use the `ls' command." 2307Use the `ls' command."
2216 :tags '(:expensive-test) 2308 :tags '(:expensive-test)
@@ -2234,7 +2326,7 @@ Use the `ls' command."
2234 (tramp--test-utf8))) 2326 (tramp--test-utf8)))
2235 2327
2236;; This test is inspired by Bug#16928. 2328;; This test is inspired by Bug#16928.
2237(ert-deftest tramp-test33-asynchronous-requests () 2329(ert-deftest tramp-test34-asynchronous-requests ()
2238 "Check parallel asynchronous requests. 2330 "Check parallel asynchronous requests.
2239Such requests could arrive from timers, process filters and 2331Such requests could arrive from timers, process filters and
2240process sentinels. They shall not disturb each other." 2332process sentinels. They shall not disturb each other."
@@ -2324,7 +2416,7 @@ process sentinels. They shall not disturb each other."
2324 (dolist (buf buffers) 2416 (dolist (buf buffers)
2325 (ignore-errors (kill-buffer buf))))))) 2417 (ignore-errors (kill-buffer buf)))))))
2326 2418
2327(ert-deftest tramp-test34-recursive-load () 2419(ert-deftest tramp-test35-recursive-load ()
2328 "Check that Tramp does not fail due to recursive load." 2420 "Check that Tramp does not fail due to recursive load."
2329 (skip-unless (tramp--test-enabled)) 2421 (skip-unless (tramp--test-enabled))
2330 2422
@@ -2347,7 +2439,7 @@ process sentinels. They shall not disturb each other."
2347 (mapconcat 'shell-quote-argument load-path " -L ") 2439 (mapconcat 'shell-quote-argument load-path " -L ")
2348 (shell-quote-argument code))))))) 2440 (shell-quote-argument code)))))))
2349 2441
2350(ert-deftest tramp-test35-unload () 2442(ert-deftest tramp-test36-unload ()
2351 "Check that Tramp and its subpackages unload completely. 2443 "Check that Tramp and its subpackages unload completely.
2352Since it unloads Tramp, it shall be the last test to run." 2444Since it unloads Tramp, it shall be the last test to run."
2353 ;; Mark as failed until all symbols are unbound. 2445 ;; Mark as failed until all symbols are unbound.
@@ -2395,8 +2487,8 @@ Since it unloads Tramp, it shall be the last test to run."
2395;; * Fix `tramp-test06-directory-file-name' for `ftp'. 2487;; * Fix `tramp-test06-directory-file-name' for `ftp'.
2396;; * Fix `tramp-test15-copy-directory' for `rsync'. 2488;; * Fix `tramp-test15-copy-directory' for `rsync'.
2397;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). 2489;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?).
2398;; * Fix Bug#16928. Set expected error of `tramp-test33-asynchronous-requests'. 2490;; * Fix Bug#16928. Set expected error of `tramp-test34-asynchronous-requests'.
2399;; * Fix `tramp-test35-unload' (Not all symbols are unbound). Set 2491;; * Fix `tramp-test36-unload' (Not all symbols are unbound). Set
2400;; expected error. 2492;; expected error.
2401 2493
2402(defun tramp-test-all (&optional interactive) 2494(defun tramp-test-all (&optional interactive)