aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2014-06-15 17:56:58 +0200
committerMichael Albinus2014-06-15 17:56:58 +0200
commit588001cfc78f30f427efbb0ee41e79d7104b71f6 (patch)
tree9645ea1aaaa5e7aea5786297f88e37c4eecc153b
parent493ce45c928cb843e7e7a1decf8b5d31360ec450 (diff)
downloademacs-588001cfc78f30f427efbb0ee41e79d7104b71f6.tar.gz
emacs-588001cfc78f30f427efbb0ee41e79d7104b71f6.zip
Sync with Tramp 2.2.10.
* test/automated/tramp-tests.el (tramp--test-enabled): Ignore errors. (tramp--instrument-test-case): Extend docstring. (tramp-test15-copy-directory): Skip for tramp-smb.el. (tramp-test21-file-links): Use `file-truename' for directories. (tramp-test27-start-file-process, tramp-test28-shell-command): Retrieve process output more robustly. (tramp--test-check-files): Extend test. (tramp-test30-special-characters): Skip for tramp-adb.el, tramp-gvfs.el and tramp-smb.el. Add further file names.
-rw-r--r--test/ChangeLog14
-rw-r--r--test/automated/tramp-tests.el128
2 files changed, 110 insertions, 32 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 39470d7a79d..716e42ed95d 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,17 @@
12014-06-15 Michael Albinus <michael.albinus@gmx.de>
2
3 Sync with Tramp 2.2.10.
4
5 * automated/tramp-tests.el (tramp--test-enabled): Ignore errors.
6 (tramp--instrument-test-case): Extend docstring.
7 (tramp-test15-copy-directory): Skip for tramp-smb.el.
8 (tramp-test21-file-links): Use `file-truename' for directories.
9 (tramp-test27-start-file-process, tramp-test28-shell-command):
10 Retrieve process output more robustly.
11 (tramp--test-check-files): Extend test.
12 (tramp-test30-special-characters): Skip for tramp-adb.el,
13 tramp-gvfs.el and tramp-smb.el. Add further file names.
14
12014-06-13 Glenn Morris <rgm@gnu.org> 152014-06-13 Glenn Morris <rgm@gnu.org>
2 16
3 * automated/Makefile.in (compile-main): 17 * automated/Makefile.in (compile-main):
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el
index 128a114d666..d30a5b0c9a7 100644
--- a/test/automated/tramp-tests.el
+++ b/test/automated/tramp-tests.el
@@ -93,9 +93,10 @@ being the result.")
93 93
94 (when (cdr tramp--test-enabled-checked) 94 (when (cdr tramp--test-enabled-checked)
95 ;; Cleanup connection. 95 ;; Cleanup connection.
96 (tramp-cleanup-connection 96 (ignore-errors
97 (tramp-dissect-file-name tramp-test-temporary-file-directory) 97 (tramp-cleanup-connection
98 nil 'keep-password)) 98 (tramp-dissect-file-name tramp-test-temporary-file-directory)
99 nil 'keep-password)))
99 100
100 ;; Return result. 101 ;; Return result.
101 (cdr tramp--test-enabled-checked)) 102 (cdr tramp--test-enabled-checked))
@@ -109,17 +110,14 @@ being the result.")
109(defmacro tramp--instrument-test-case (verbose &rest body) 110(defmacro tramp--instrument-test-case (verbose &rest body)
110 "Run BODY with `tramp-verbose' equal VERBOSE. 111 "Run BODY with `tramp-verbose' equal VERBOSE.
111Print the the content of the Tramp debug buffer, if BODY does not 112Print the the content of the Tramp debug buffer, if BODY does not
112eval properly in `should', `should-not' or `should-error'." 113eval properly in `should', `should-not' or `should-error'. BODY
114shall not contain a timeout."
113 (declare (indent 1) (debug (natnump body))) 115 (declare (indent 1) (debug (natnump body)))
114 `(let ((tramp-verbose ,verbose) 116 `(let ((tramp-verbose ,verbose)
115 (tramp-message-show-message t) 117 (tramp-message-show-message t)
116 (tramp-debug-on-error t)) 118 (tramp-debug-on-error t))
117 (condition-case err 119 (condition-case err
118 ;; In general, we cannot use a timeout here: this would 120 (progn ,@body)
119 ;; prevent traces when the test runs into an error.
120; (with-timeout (10 (ert-fail "`tramp--instrument-test-case' timed out"))
121 (progn
122 ,@body)
123 (ert-test-skipped 121 (ert-test-skipped
124 (signal (car err) (cdr err))) 122 (signal (car err) (cdr err)))
125 ((error quit) 123 ((error quit)
@@ -868,6 +866,11 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
868(ert-deftest tramp-test15-copy-directory () 866(ert-deftest tramp-test15-copy-directory ()
869 "Check `copy-directory'." 867 "Check `copy-directory'."
870 (skip-unless (tramp--test-enabled)) 868 (skip-unless (tramp--test-enabled))
869 (skip-unless
870 (not
871 (eq
872 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
873 'tramp-smb-file-name-handler)))
871 874
872 (let* ((tmp-name1 (tramp--test-make-temp-name)) 875 (let* ((tmp-name1 (tramp--test-make-temp-name))
873 (tmp-name2 (tramp--test-make-temp-name)) 876 (tmp-name2 (tramp--test-make-temp-name))
@@ -1074,9 +1077,14 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
1074This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." 1077This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1075 (skip-unless (tramp--test-enabled)) 1078 (skip-unless (tramp--test-enabled))
1076 1079
1077 (let ((tmp-name1 (tramp--test-make-temp-name)) 1080 ;; We must use `file-truename' for the temporary directory, because
1078 (tmp-name2 (tramp--test-make-temp-name)) 1081 ;; it could be located on a symlinked directory. This would let the
1079 (tmp-name3 (tramp--test-make-temp-name 'local))) 1082 ;; test fail.
1083 (let* ((tramp-test-temporary-file-directory
1084 (file-truename tramp-test-temporary-file-directory))
1085 (tmp-name1 (tramp--test-make-temp-name))
1086 (tmp-name2 (tramp--test-make-temp-name))
1087 (tmp-name3 (tramp--test-make-temp-name 'local)))
1080 (unwind-protect 1088 (unwind-protect
1081 (progn 1089 (progn
1082 (write-region "foo" nil tmp-name1) 1090 (write-region "foo" nil tmp-name1)
@@ -1285,7 +1293,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1285 (should (equal (process-status proc) 'run)) 1293 (should (equal (process-status proc) 'run))
1286 (process-send-string proc "foo") 1294 (process-send-string proc "foo")
1287 (process-send-eof proc) 1295 (process-send-eof proc)
1288 (accept-process-output proc 1) 1296 ;; Read output.
1297 (with-timeout (10 (ert-fail "`start-file-process' timed out"))
1298 (while (< (- (point-max) (point-min)) (length "foo"))
1299 (accept-process-output proc 1)))
1289 (should (string-equal (buffer-string) "foo"))) 1300 (should (string-equal (buffer-string) "foo")))
1290 (ignore-errors (delete-process proc))) 1301 (ignore-errors (delete-process proc)))
1291 1302
@@ -1298,22 +1309,30 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1298 "test2" (current-buffer) 1309 "test2" (current-buffer)
1299 "cat" (file-name-nondirectory tmp-name))) 1310 "cat" (file-name-nondirectory tmp-name)))
1300 (should (processp proc)) 1311 (should (processp proc))
1301 (accept-process-output proc 1) 1312 ;; Read output.
1313 (with-timeout (10 (ert-fail "`start-file-process' timed out"))
1314 (while (< (- (point-max) (point-min)) (length "foo"))
1315 (accept-process-output proc 1)))
1302 (should (string-equal (buffer-string) "foo"))) 1316 (should (string-equal (buffer-string) "foo")))
1303 (ignore-errors 1317 (ignore-errors
1304 (delete-process proc) 1318 (delete-process proc)
1305 (delete-file tmp-name))) 1319 (delete-file tmp-name)))
1306 1320
1307 (unwind-protect 1321 (unwind-protect
1308 (progn 1322 (with-temp-buffer
1309 (setq proc (start-file-process "test3" nil "cat")) 1323 (setq proc (start-file-process "test3" (current-buffer) "cat"))
1310 (should (processp proc)) 1324 (should (processp proc))
1311 (should (equal (process-status proc) 'run)) 1325 (should (equal (process-status proc) 'run))
1312 (set-process-filter 1326 (set-process-filter
1313 proc (lambda (_p s) (should (string-equal s "foo")))) 1327 proc
1328 (lambda (p s) (with-current-buffer (process-buffer p) (insert s))))
1314 (process-send-string proc "foo") 1329 (process-send-string proc "foo")
1315 (process-send-eof proc) 1330 (process-send-eof proc)
1316 (accept-process-output proc 1)) 1331 ;; Read output.
1332 (with-timeout (10 (ert-fail "`start-file-process' timed out"))
1333 (while (< (- (point-max) (point-min)) (length "foo"))
1334 (accept-process-output proc 1)))
1335 (should (string-equal (buffer-string) "foo")))
1317 (ignore-errors (delete-process proc))))) 1336 (ignore-errors (delete-process proc)))))
1318 1337
1319(ert-deftest tramp-test28-shell-command () 1338(ert-deftest tramp-test28-shell-command ()
@@ -1351,17 +1370,20 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1351 (should (file-exists-p tmp-name)) 1370 (should (file-exists-p tmp-name))
1352 (async-shell-command 1371 (async-shell-command
1353 (format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer)) 1372 (format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer))
1354 (accept-process-output (get-buffer-process (current-buffer)) 1) 1373 (set-process-sentinel (get-buffer-process (current-buffer)) nil)
1374 ;; Read output.
1355 (with-timeout (10 (ert-fail "`async-shell-command' timed out")) 1375 (with-timeout (10 (ert-fail "`async-shell-command' timed out"))
1356 (while 1376 (while (< (- (point-max) (point-min))
1357 (ignore-errors 1377 (1+ (length (file-name-nondirectory tmp-name))))
1358 (memq (process-status (get-buffer-process (current-buffer)))
1359 '(run open)))
1360 (accept-process-output (get-buffer-process (current-buffer)) 1))) 1378 (accept-process-output (get-buffer-process (current-buffer)) 1)))
1361 ;; `ls' could produce colorized output. 1379 ;; `ls' could produce colorized output.
1362 (goto-char (point-min)) 1380 (goto-char (point-min))
1363 (while (re-search-forward tramp-color-escape-sequence-regexp nil t) 1381 (while (re-search-forward tramp-color-escape-sequence-regexp nil t)
1364 (replace-match "" nil nil)) 1382 (replace-match "" nil nil))
1383 ;; There might be a nasty "Process *Async Shell* finished" message.
1384 (goto-char (point-min))
1385 (forward-line)
1386 (narrow-to-region (point-min) (point))
1365 (should 1387 (should
1366 (string-equal 1388 (string-equal
1367 (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) 1389 (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string))))
@@ -1372,16 +1394,23 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1372 (write-region "foo" nil tmp-name) 1394 (write-region "foo" nil tmp-name)
1373 (should (file-exists-p tmp-name)) 1395 (should (file-exists-p tmp-name))
1374 (async-shell-command "read line; ls $line" (current-buffer)) 1396 (async-shell-command "read line; ls $line" (current-buffer))
1397 (set-process-sentinel (get-buffer-process (current-buffer)) nil)
1375 (process-send-string 1398 (process-send-string
1376 (get-buffer-process (current-buffer)) 1399 (get-buffer-process (current-buffer))
1377 (format "%s\n" (file-name-nondirectory tmp-name))) 1400 (format "%s\n" (file-name-nondirectory tmp-name)))
1378 (accept-process-output (get-buffer-process (current-buffer)) 1) 1401 ;; Read output.
1379 (with-timeout (10 (ert-fail "`async-shell-command' timed out")) 1402 (with-timeout (10 (ert-fail "`async-shell-command' timed out"))
1380 (while 1403 (while (< (- (point-max) (point-min))
1381 (ignore-errors 1404 (1+ (length (file-name-nondirectory tmp-name))))
1382 (memq (process-status (get-buffer-process (current-buffer)))
1383 '(run open)))
1384 (accept-process-output (get-buffer-process (current-buffer)) 1))) 1405 (accept-process-output (get-buffer-process (current-buffer)) 1)))
1406 ;; `ls' could produce colorized output.
1407 (goto-char (point-min))
1408 (while (re-search-forward tramp-color-escape-sequence-regexp nil t)
1409 (replace-match "" nil nil))
1410 ;; There might be a nasty "Process *Async Shell* finished" message.
1411 (goto-char (point-min))
1412 (forward-line)
1413 (narrow-to-region (point-min) (point))
1385 (should 1414 (should
1386 (string-equal 1415 (string-equal
1387 (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) 1416 (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string))))
@@ -1465,13 +1494,34 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1465 (should-not (file-exists-p file1)) 1494 (should-not (file-exists-p file1))
1466 (copy-file file2 tmp-name1) 1495 (copy-file file2 tmp-name1)
1467 (should (file-exists-p file1)))) 1496 (should (file-exists-p file1))))
1497
1468 ;; Check file names. 1498 ;; Check file names.
1469 (should (equal (directory-files 1499 (should (equal (directory-files
1470 tmp-name1 nil directory-files-no-dot-files-regexp) 1500 tmp-name1 nil directory-files-no-dot-files-regexp)
1471 (sort (copy-sequence files) 'string-lessp))) 1501 (sort (copy-sequence files) 'string-lessp)))
1472 (should (equal (directory-files 1502 (should (equal (directory-files
1473 tmp-name2 nil directory-files-no-dot-files-regexp) 1503 tmp-name2 nil directory-files-no-dot-files-regexp)
1474 (sort files 'string-lessp)))) 1504 (sort (copy-sequence files) 'string-lessp)))
1505
1506 ;; `substitute-in-file-name' could return different values.
1507 ;; For `adb', there could be strange file permissions
1508 ;; preventing overwriting a file. We don't care in this
1509 ;; testcase.
1510 (dolist (elt files)
1511 (let ((file1
1512 (substitute-in-file-name (expand-file-name elt tmp-name1)))
1513 (file2
1514 (substitute-in-file-name (expand-file-name elt tmp-name2))))
1515 (ignore-errors (write-region elt nil file1))
1516 (should (file-exists-p file1))
1517 (ignore-errors (write-region elt nil file2 nil 'nomessage))
1518 (should (file-exists-p file2))))
1519
1520 (should (equal (directory-files
1521 tmp-name1 nil directory-files-no-dot-files-regexp)
1522 (directory-files
1523 tmp-name2 nil directory-files-no-dot-files-regexp))))
1524
1475 (ignore-errors (delete-directory tmp-name1 'recursive)) 1525 (ignore-errors (delete-directory tmp-name1 'recursive))
1476 (ignore-errors (delete-directory tmp-name2 'recursive))))) 1526 (ignore-errors (delete-directory tmp-name2 'recursive)))))
1477 1527
@@ -1479,6 +1529,13 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1479(ert-deftest tramp-test30-special-characters () 1529(ert-deftest tramp-test30-special-characters ()
1480 "Check special characters in file names." 1530 "Check special characters in file names."
1481 (skip-unless (tramp--test-enabled)) 1531 (skip-unless (tramp--test-enabled))
1532 (skip-unless
1533 (not
1534 (memq
1535 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
1536 '(tramp-adb-file-name-handler
1537 tramp-gvfs-file-name-handler
1538 tramp-smb-file-name-handler))))
1482 1539
1483 ;; Newlines, slashes and backslashes in file names are not supported. 1540 ;; Newlines, slashes and backslashes in file names are not supported.
1484 ;; So we don't test. 1541 ;; So we don't test.
@@ -1491,11 +1548,13 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1491 "?foo?bar?baz?" 1548 "?foo?bar?baz?"
1492 "*foo*bar*baz*" 1549 "*foo*bar*baz*"
1493 "'foo\"bar'baz\"" 1550 "'foo\"bar'baz\""
1494 "#foo#bar#baz#" 1551 "#foo~bar#baz~"
1495 "!foo|bar!baz|" 1552 "!foo|bar!baz|"
1496 ":foo;bar:baz;" 1553 ":foo;bar:baz;"
1497 "<foo>bar<baz>" 1554 "<foo>bar<baz>"
1498 "(foo)bar(baz)")) 1555 "(foo)bar(baz)"
1556 "[foo]bar[baz]"
1557 "{foo}bar{baz}"))
1499 1558
1500(ert-deftest tramp-test31-utf8 () 1559(ert-deftest tramp-test31-utf8 ()
1501 "Check UTF8 encoding in file names and file contents." 1560 "Check UTF8 encoding in file names and file contents."
@@ -1667,8 +1726,13 @@ Since it unloads Tramp, it shall be the last test to run."
1667;; * set-file-acl 1726;; * set-file-acl
1668;; * set-file-selinux-context 1727;; * set-file-selinux-context
1669 1728
1670;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). 1729;; * Work on skipped tests. Make a comment, when it is impossible.
1730;; * Fix `tramp-test15-copy-directory' for `smb'. Using tar in a pipe
1731;; doesn't work well when an interactive password must be provided.
1732;; * Fix `tramp-test27-start-file-process' for `nc' and on MS
1733;; Windows (`process-send-eof'?).
1671;; * Fix `tramp-test28-shell-command' on MS Windows (nasty plink message). 1734;; * Fix `tramp-test28-shell-command' on MS Windows (nasty plink message).
1735;; * Fix `tramp-test30-special-characters' for `adb', `nc' and `smb'.
1672;; * Fix `tramp-test31-utf8' for MS Windows and `nc'/`telnet' (when 1736;; * Fix `tramp-test31-utf8' for MS Windows and `nc'/`telnet' (when
1673;; target is a dumb busybox). Seems to be in `directory-files'. 1737;; target is a dumb busybox). Seems to be in `directory-files'.
1674;; * Fix Bug#16928. Set expected error of `tramp-test32-asynchronous-requests'. 1738;; * Fix Bug#16928. Set expected error of `tramp-test32-asynchronous-requests'.