diff options
| author | Michael Albinus | 2014-11-08 09:46:20 +0100 |
|---|---|---|
| committer | Michael Albinus | 2014-11-08 09:46:20 +0100 |
| commit | b03f9b583cf80b765cc41c095cb6c2ee04e19f40 (patch) | |
| tree | f21c6c663370dc4adaf784fffaf6960d8054aa31 | |
| parent | 121ccd275a4805dbee9b1a3c43a83cea5491fbb4 (diff) | |
| download | emacs-b03f9b583cf80b765cc41c095cb6c2ee04e19f40.tar.gz emacs-b03f9b583cf80b765cc41c095cb6c2ee04e19f40.zip | |
Backport Tramp changes from trunk.
* automated/tramp-tests.el (tramp-remote-process-environment):
Declare.
(tramp--test-enabled): Ignore errors.
(tramp--instrument-test-case): Extend docstring. Print debug
buffer in any case.
(tramp-test15-copy-directory): Skip for tramp-smb.el.
(tramp-test21-file-links): Use `file-truename' for directories.
(tramp-test26-process-file): Extend test according to Bug#17815.
(tramp-test27-start-file-process, tramp-test28-shell-command):
Retrieve process output more robustly.
(tramp-test29-vc-registered): Set $BZR_HOME.
(tramp--test-check-files): Extend test with `substitute-in-file-name'.
(tramp-test30-special-characters): Skip for tramp-adb.el,
tramp-gvfs.el and tramp-smb.el. Add further file names.
| -rw-r--r-- | test/ChangeLog | 19 | ||||
| -rw-r--r-- | test/automated/tramp-tests.el | 184 |
2 files changed, 151 insertions, 52 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index c1c2f5c870b..a5ee4b60589 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,22 @@ | |||
| 1 | 2014-11-08 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | Backport Tramp changes from trunk. | ||
| 4 | |||
| 5 | * automated/tramp-tests.el (tramp-remote-process-environment): | ||
| 6 | Declare. | ||
| 7 | (tramp--test-enabled): Ignore errors. | ||
| 8 | (tramp--instrument-test-case): Extend docstring. Print debug | ||
| 9 | buffer in any case. | ||
| 10 | (tramp-test15-copy-directory): Skip for tramp-smb.el. | ||
| 11 | (tramp-test21-file-links): Use `file-truename' for directories. | ||
| 12 | (tramp-test26-process-file): Extend test according to Bug#17815. | ||
| 13 | (tramp-test27-start-file-process, tramp-test28-shell-command): | ||
| 14 | Retrieve process output more robustly. | ||
| 15 | (tramp-test29-vc-registered): Set $BZR_HOME. | ||
| 16 | (tramp--test-check-files): Extend test with `substitute-in-file-name'. | ||
| 17 | (tramp-test30-special-characters): Skip for tramp-adb.el, | ||
| 18 | tramp-gvfs.el and tramp-smb.el. Add further file names. | ||
| 19 | |||
| 1 | 2014-10-20 Glenn Morris <rgm@gnu.org> | 20 | 2014-10-20 Glenn Morris <rgm@gnu.org> |
| 2 | 21 | ||
| 3 | * Version 24.4 released. | 22 | * Version 24.4 released. |
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index 2640ee9cef5..864a43d638f 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | (declare-function tramp-find-executable "tramp-sh") | 47 | (declare-function tramp-find-executable "tramp-sh") |
| 48 | (declare-function tramp-get-remote-path "tramp-sh") | 48 | (declare-function tramp-get-remote-path "tramp-sh") |
| 49 | (defvar tramp-copy-size-limit) | 49 | (defvar tramp-copy-size-limit) |
| 50 | (defvar tramp-remote-process-environment) | ||
| 50 | 51 | ||
| 51 | ;; There is no default value on w32 systems, which could work out of the box. | 52 | ;; There is no default value on w32 systems, which could work out of the box. |
| 52 | (defconst tramp-test-temporary-file-directory | 53 | (defconst tramp-test-temporary-file-directory |
| @@ -92,9 +93,10 @@ being the result.") | |||
| 92 | 93 | ||
| 93 | (when (cdr tramp--test-enabled-checked) | 94 | (when (cdr tramp--test-enabled-checked) |
| 94 | ;; Cleanup connection. | 95 | ;; Cleanup connection. |
| 95 | (tramp-cleanup-connection | 96 | (ignore-errors |
| 96 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | 97 | (tramp-cleanup-connection |
| 97 | nil 'keep-password)) | 98 | (tramp-dissect-file-name tramp-test-temporary-file-directory) |
| 99 | nil 'keep-password))) | ||
| 98 | 100 | ||
| 99 | ;; Return result. | 101 | ;; Return result. |
| 100 | (cdr tramp--test-enabled-checked)) | 102 | (cdr tramp--test-enabled-checked)) |
| @@ -108,27 +110,21 @@ being the result.") | |||
| 108 | (defmacro tramp--instrument-test-case (verbose &rest body) | 110 | (defmacro tramp--instrument-test-case (verbose &rest body) |
| 109 | "Run BODY with `tramp-verbose' equal VERBOSE. | 111 | "Run BODY with `tramp-verbose' equal VERBOSE. |
| 110 | Print the the content of the Tramp debug buffer, if BODY does not | 112 | Print the the content of the Tramp debug buffer, if BODY does not |
| 111 | eval properly in `should', `should-not' or `should-error'." | 113 | eval properly in `should', `should-not' or `should-error'. BODY |
| 114 | shall not contain a timeout." | ||
| 112 | (declare (indent 1) (debug (natnump body))) | 115 | (declare (indent 1) (debug (natnump body))) |
| 113 | `(let ((tramp-verbose ,verbose) | 116 | `(let ((tramp-verbose ,verbose) |
| 114 | (tramp-message-show-message t) | 117 | (tramp-message-show-message t) |
| 115 | (tramp-debug-on-error t)) | 118 | (tramp-debug-on-error t)) |
| 116 | (condition-case err | 119 | (unwind-protect |
| 117 | ;; In general, we cannot use a timeout here: this would | 120 | (progn ,@body) |
| 118 | ;; prevent traces when the test runs into an error. | 121 | (when (> tramp-verbose 3) |
| 119 | ; (with-timeout (10 (ert-fail "`tramp--instrument-test-case' timed out")) | 122 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil |
| 120 | (progn | 123 | (with-current-buffer (tramp-get-connection-buffer v) |
| 121 | ,@body) | 124 | (message "%s" (buffer-string))) |
| 122 | (ert-test-skipped | 125 | (with-current-buffer |
| 123 | (signal (car err) (cdr err))) | 126 | (tramp-get-debug-buffer v) |
| 124 | ((error quit) | 127 | (message "%s" (buffer-string)))))))) |
| 125 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | ||
| 126 | (with-current-buffer (tramp-get-connection-buffer v) | ||
| 127 | (message "%s" (buffer-string))) | ||
| 128 | (with-current-buffer (tramp-get-debug-buffer v) | ||
| 129 | (message "%s" (buffer-string)))) | ||
| 130 | (message "%s" err) | ||
| 131 | (signal (car err) (cdr err)))))) | ||
| 132 | 128 | ||
| 133 | (ert-deftest tramp-test00-availability () | 129 | (ert-deftest tramp-test00-availability () |
| 134 | "Test availability of Tramp functions." | 130 | "Test availability of Tramp functions." |
| @@ -867,6 +863,11 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 867 | (ert-deftest tramp-test15-copy-directory () | 863 | (ert-deftest tramp-test15-copy-directory () |
| 868 | "Check `copy-directory'." | 864 | "Check `copy-directory'." |
| 869 | (skip-unless (tramp--test-enabled)) | 865 | (skip-unless (tramp--test-enabled)) |
| 866 | (skip-unless | ||
| 867 | (not | ||
| 868 | (eq | ||
| 869 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) | ||
| 870 | 'tramp-smb-file-name-handler))) | ||
| 870 | 871 | ||
| 871 | (let* ((tmp-name1 (tramp--test-make-temp-name)) | 872 | (let* ((tmp-name1 (tramp--test-make-temp-name)) |
| 872 | (tmp-name2 (tramp--test-make-temp-name)) | 873 | (tmp-name2 (tramp--test-make-temp-name)) |
| @@ -1073,9 +1074,14 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 1073 | This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | 1074 | This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." |
| 1074 | (skip-unless (tramp--test-enabled)) | 1075 | (skip-unless (tramp--test-enabled)) |
| 1075 | 1076 | ||
| 1076 | (let ((tmp-name1 (tramp--test-make-temp-name)) | 1077 | ;; We must use `file-truename' for the temporary directory, because |
| 1077 | (tmp-name2 (tramp--test-make-temp-name)) | 1078 | ;; it could be located on a symlinked directory. This would let the |
| 1078 | (tmp-name3 (tramp--test-make-temp-name 'local))) | 1079 | ;; test fail. |
| 1080 | (let* ((tramp-test-temporary-file-directory | ||
| 1081 | (file-truename tramp-test-temporary-file-directory)) | ||
| 1082 | (tmp-name1 (tramp--test-make-temp-name)) | ||
| 1083 | (tmp-name2 (tramp--test-make-temp-name)) | ||
| 1084 | (tmp-name3 (tramp--test-make-temp-name 'local))) | ||
| 1079 | (unwind-protect | 1085 | (unwind-protect |
| 1080 | (progn | 1086 | (progn |
| 1081 | (write-region "foo" nil tmp-name1) | 1087 | (write-region "foo" nil tmp-name1) |
| @@ -1237,9 +1243,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1237 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) | 1243 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) |
| 1238 | '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) | 1244 | '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) |
| 1239 | 1245 | ||
| 1240 | (let ((tmp-name (tramp--test-make-temp-name)) | 1246 | (let* ((tmp-name (tramp--test-make-temp-name)) |
| 1241 | (default-directory tramp-test-temporary-file-directory) | 1247 | (fnnd (file-name-nondirectory tmp-name)) |
| 1242 | kill-buffer-query-functions) | 1248 | (default-directory tramp-test-temporary-file-directory) |
| 1249 | kill-buffer-query-functions) | ||
| 1243 | (unwind-protect | 1250 | (unwind-protect |
| 1244 | (progn | 1251 | (progn |
| 1245 | ;; We cannot use "/bin/true" and "/bin/false"; those paths | 1252 | ;; We cannot use "/bin/true" and "/bin/false"; those paths |
| @@ -1250,17 +1257,25 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1250 | (with-temp-buffer | 1257 | (with-temp-buffer |
| 1251 | (write-region "foo" nil tmp-name) | 1258 | (write-region "foo" nil tmp-name) |
| 1252 | (should (file-exists-p tmp-name)) | 1259 | (should (file-exists-p tmp-name)) |
| 1253 | (should | 1260 | (should (zerop (process-file "ls" nil t nil fnnd))) |
| 1254 | (zerop | 1261 | ;; `ls' could produce colorized output. |
| 1255 | (process-file "ls" nil t nil (file-name-nondirectory tmp-name)))) | 1262 | (goto-char (point-min)) |
| 1263 | (while (re-search-forward tramp-color-escape-sequence-regexp nil t) | ||
| 1264 | (replace-match "" nil nil)) | ||
| 1265 | (should (string-equal (format "%s\n" fnnd) (buffer-string))) | ||
| 1266 | (should-not (get-buffer-window (current-buffer) t)) | ||
| 1267 | |||
| 1268 | ;; Second run. The output must be appended. | ||
| 1269 | (should (zerop (process-file "ls" nil t t fnnd))) | ||
| 1256 | ;; `ls' could produce colorized output. | 1270 | ;; `ls' could produce colorized output. |
| 1257 | (goto-char (point-min)) | 1271 | (goto-char (point-min)) |
| 1258 | (while (re-search-forward tramp-color-escape-sequence-regexp nil t) | 1272 | (while (re-search-forward tramp-color-escape-sequence-regexp nil t) |
| 1259 | (replace-match "" nil nil)) | 1273 | (replace-match "" nil nil)) |
| 1260 | (should | 1274 | (should |
| 1261 | (string-equal | 1275 | (string-equal (format "%s\n%s\n" fnnd fnnd) (buffer-string))) |
| 1262 | (format "%s\n" (file-name-nondirectory tmp-name)) | 1276 | ;; A non-nil DISPLAY must not raise the buffer. |
| 1263 | (buffer-string))))) | 1277 | (should-not (get-buffer-window (current-buffer) t)))) |
| 1278 | |||
| 1264 | (ignore-errors (delete-file tmp-name))))) | 1279 | (ignore-errors (delete-file tmp-name))))) |
| 1265 | 1280 | ||
| 1266 | (ert-deftest tramp-test27-start-file-process () | 1281 | (ert-deftest tramp-test27-start-file-process () |
| @@ -1284,7 +1299,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1284 | (should (equal (process-status proc) 'run)) | 1299 | (should (equal (process-status proc) 'run)) |
| 1285 | (process-send-string proc "foo") | 1300 | (process-send-string proc "foo") |
| 1286 | (process-send-eof proc) | 1301 | (process-send-eof proc) |
| 1287 | (accept-process-output proc 1) | 1302 | ;; Read output. |
| 1303 | (with-timeout (10 (ert-fail "`start-file-process' timed out")) | ||
| 1304 | (while (< (- (point-max) (point-min)) (length "foo")) | ||
| 1305 | (accept-process-output proc 1))) | ||
| 1288 | (should (string-equal (buffer-string) "foo"))) | 1306 | (should (string-equal (buffer-string) "foo"))) |
| 1289 | (ignore-errors (delete-process proc))) | 1307 | (ignore-errors (delete-process proc))) |
| 1290 | 1308 | ||
| @@ -1297,22 +1315,30 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1297 | "test2" (current-buffer) | 1315 | "test2" (current-buffer) |
| 1298 | "cat" (file-name-nondirectory tmp-name))) | 1316 | "cat" (file-name-nondirectory tmp-name))) |
| 1299 | (should (processp proc)) | 1317 | (should (processp proc)) |
| 1300 | (accept-process-output proc 1) | 1318 | ;; Read output. |
| 1319 | (with-timeout (10 (ert-fail "`start-file-process' timed out")) | ||
| 1320 | (while (< (- (point-max) (point-min)) (length "foo")) | ||
| 1321 | (accept-process-output proc 1))) | ||
| 1301 | (should (string-equal (buffer-string) "foo"))) | 1322 | (should (string-equal (buffer-string) "foo"))) |
| 1302 | (ignore-errors | 1323 | (ignore-errors |
| 1303 | (delete-process proc) | 1324 | (delete-process proc) |
| 1304 | (delete-file tmp-name))) | 1325 | (delete-file tmp-name))) |
| 1305 | 1326 | ||
| 1306 | (unwind-protect | 1327 | (unwind-protect |
| 1307 | (progn | 1328 | (with-temp-buffer |
| 1308 | (setq proc (start-file-process "test3" nil "cat")) | 1329 | (setq proc (start-file-process "test3" (current-buffer) "cat")) |
| 1309 | (should (processp proc)) | 1330 | (should (processp proc)) |
| 1310 | (should (equal (process-status proc) 'run)) | 1331 | (should (equal (process-status proc) 'run)) |
| 1311 | (set-process-filter | 1332 | (set-process-filter |
| 1312 | proc (lambda (_p s) (should (string-equal s "foo")))) | 1333 | proc |
| 1334 | (lambda (p s) (with-current-buffer (process-buffer p) (insert s)))) | ||
| 1313 | (process-send-string proc "foo") | 1335 | (process-send-string proc "foo") |
| 1314 | (process-send-eof proc) | 1336 | (process-send-eof proc) |
| 1315 | (accept-process-output proc 1)) | 1337 | ;; Read output. |
| 1338 | (with-timeout (10 (ert-fail "`start-file-process' timed out")) | ||
| 1339 | (while (< (- (point-max) (point-min)) (length "foo")) | ||
| 1340 | (accept-process-output proc 1))) | ||
| 1341 | (should (string-equal (buffer-string) "foo"))) | ||
| 1316 | (ignore-errors (delete-process proc))))) | 1342 | (ignore-errors (delete-process proc))))) |
| 1317 | 1343 | ||
| 1318 | (ert-deftest tramp-test28-shell-command () | 1344 | (ert-deftest tramp-test28-shell-command () |
| @@ -1350,17 +1376,20 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1350 | (should (file-exists-p tmp-name)) | 1376 | (should (file-exists-p tmp-name)) |
| 1351 | (async-shell-command | 1377 | (async-shell-command |
| 1352 | (format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer)) | 1378 | (format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer)) |
| 1353 | (accept-process-output (get-buffer-process (current-buffer)) 1) | 1379 | (set-process-sentinel (get-buffer-process (current-buffer)) nil) |
| 1380 | ;; Read output. | ||
| 1354 | (with-timeout (10 (ert-fail "`async-shell-command' timed out")) | 1381 | (with-timeout (10 (ert-fail "`async-shell-command' timed out")) |
| 1355 | (while | 1382 | (while (< (- (point-max) (point-min)) |
| 1356 | (ignore-errors | 1383 | (1+ (length (file-name-nondirectory tmp-name)))) |
| 1357 | (memq (process-status (get-buffer-process (current-buffer))) | ||
| 1358 | '(run open))) | ||
| 1359 | (accept-process-output (get-buffer-process (current-buffer)) 1))) | 1384 | (accept-process-output (get-buffer-process (current-buffer)) 1))) |
| 1360 | ;; `ls' could produce colorized output. | 1385 | ;; `ls' could produce colorized output. |
| 1361 | (goto-char (point-min)) | 1386 | (goto-char (point-min)) |
| 1362 | (while (re-search-forward tramp-color-escape-sequence-regexp nil t) | 1387 | (while (re-search-forward tramp-color-escape-sequence-regexp nil t) |
| 1363 | (replace-match "" nil nil)) | 1388 | (replace-match "" nil nil)) |
| 1389 | ;; There might be a nasty "Process *Async Shell* finished" message. | ||
| 1390 | (goto-char (point-min)) | ||
| 1391 | (forward-line) | ||
| 1392 | (narrow-to-region (point-min) (point)) | ||
| 1364 | (should | 1393 | (should |
| 1365 | (string-equal | 1394 | (string-equal |
| 1366 | (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) | 1395 | (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) |
| @@ -1371,16 +1400,23 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1371 | (write-region "foo" nil tmp-name) | 1400 | (write-region "foo" nil tmp-name) |
| 1372 | (should (file-exists-p tmp-name)) | 1401 | (should (file-exists-p tmp-name)) |
| 1373 | (async-shell-command "read line; ls $line" (current-buffer)) | 1402 | (async-shell-command "read line; ls $line" (current-buffer)) |
| 1403 | (set-process-sentinel (get-buffer-process (current-buffer)) nil) | ||
| 1374 | (process-send-string | 1404 | (process-send-string |
| 1375 | (get-buffer-process (current-buffer)) | 1405 | (get-buffer-process (current-buffer)) |
| 1376 | (format "%s\n" (file-name-nondirectory tmp-name))) | 1406 | (format "%s\n" (file-name-nondirectory tmp-name))) |
| 1377 | (accept-process-output (get-buffer-process (current-buffer)) 1) | 1407 | ;; Read output. |
| 1378 | (with-timeout (10 (ert-fail "`async-shell-command' timed out")) | 1408 | (with-timeout (10 (ert-fail "`async-shell-command' timed out")) |
| 1379 | (while | 1409 | (while (< (- (point-max) (point-min)) |
| 1380 | (ignore-errors | 1410 | (1+ (length (file-name-nondirectory tmp-name)))) |
| 1381 | (memq (process-status (get-buffer-process (current-buffer))) | ||
| 1382 | '(run open))) | ||
| 1383 | (accept-process-output (get-buffer-process (current-buffer)) 1))) | 1411 | (accept-process-output (get-buffer-process (current-buffer)) 1))) |
| 1412 | ;; `ls' could produce colorized output. | ||
| 1413 | (goto-char (point-min)) | ||
| 1414 | (while (re-search-forward tramp-color-escape-sequence-regexp nil t) | ||
| 1415 | (replace-match "" nil nil)) | ||
| 1416 | ;; There might be a nasty "Process *Async Shell* finished" message. | ||
| 1417 | (goto-char (point-min)) | ||
| 1418 | (forward-line) | ||
| 1419 | (narrow-to-region (point-min) (point)) | ||
| 1384 | (should | 1420 | (should |
| 1385 | (string-equal | 1421 | (string-equal |
| 1386 | (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) | 1422 | (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) |
| @@ -1397,10 +1433,19 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1397 | (let* ((default-directory tramp-test-temporary-file-directory) | 1433 | (let* ((default-directory tramp-test-temporary-file-directory) |
| 1398 | (tmp-name1 (tramp--test-make-temp-name)) | 1434 | (tmp-name1 (tramp--test-make-temp-name)) |
| 1399 | (tmp-name2 (expand-file-name "foo" tmp-name1)) | 1435 | (tmp-name2 (expand-file-name "foo" tmp-name1)) |
| 1436 | (tramp-remote-process-environment tramp-remote-process-environment) | ||
| 1400 | (vc-handled-backends | 1437 | (vc-handled-backends |
| 1401 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | 1438 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil |
| 1402 | (cond | 1439 | (cond |
| 1403 | ((tramp-find-executable v vc-bzr-program (tramp-get-remote-path v)) | 1440 | ((tramp-find-executable v vc-bzr-program (tramp-get-remote-path v)) |
| 1441 | (setq tramp-remote-process-environment | ||
| 1442 | (cons (format "BZR_HOME=%s" | ||
| 1443 | (file-remote-p tmp-name1 'localname)) | ||
| 1444 | tramp-remote-process-environment)) | ||
| 1445 | ;; We must force a reconnect, in order to activate $BZR_HOME. | ||
| 1446 | (tramp-cleanup-connection | ||
| 1447 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 1448 | nil 'keep-password) | ||
| 1404 | '(Bzr)) | 1449 | '(Bzr)) |
| 1405 | ((tramp-find-executable v vc-git-program (tramp-get-remote-path v)) | 1450 | ((tramp-find-executable v vc-git-program (tramp-get-remote-path v)) |
| 1406 | '(Git)) | 1451 | '(Git)) |
| @@ -1455,13 +1500,34 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1455 | (should-not (file-exists-p file1)) | 1500 | (should-not (file-exists-p file1)) |
| 1456 | (copy-file file2 tmp-name1) | 1501 | (copy-file file2 tmp-name1) |
| 1457 | (should (file-exists-p file1)))) | 1502 | (should (file-exists-p file1)))) |
| 1503 | |||
| 1458 | ;; Check file names. | 1504 | ;; Check file names. |
| 1459 | (should (equal (directory-files | 1505 | (should (equal (directory-files |
| 1460 | tmp-name1 nil directory-files-no-dot-files-regexp) | 1506 | tmp-name1 nil directory-files-no-dot-files-regexp) |
| 1461 | (sort (copy-sequence files) 'string-lessp))) | 1507 | (sort (copy-sequence files) 'string-lessp))) |
| 1462 | (should (equal (directory-files | 1508 | (should (equal (directory-files |
| 1463 | tmp-name2 nil directory-files-no-dot-files-regexp) | 1509 | tmp-name2 nil directory-files-no-dot-files-regexp) |
| 1464 | (sort files 'string-lessp)))) | 1510 | (sort (copy-sequence files) 'string-lessp))) |
| 1511 | |||
| 1512 | ;; `substitute-in-file-name' could return different values. | ||
| 1513 | ;; For `adb', there could be strange file permissions | ||
| 1514 | ;; preventing overwriting a file. We don't care in this | ||
| 1515 | ;; testcase. | ||
| 1516 | (dolist (elt files) | ||
| 1517 | (let ((file1 | ||
| 1518 | (substitute-in-file-name (expand-file-name elt tmp-name1))) | ||
| 1519 | (file2 | ||
| 1520 | (substitute-in-file-name (expand-file-name elt tmp-name2)))) | ||
| 1521 | (ignore-errors (write-region elt nil file1)) | ||
| 1522 | (should (file-exists-p file1)) | ||
| 1523 | (ignore-errors (write-region elt nil file2 nil 'nomessage)) | ||
| 1524 | (should (file-exists-p file2)))) | ||
| 1525 | |||
| 1526 | (should (equal (directory-files | ||
| 1527 | tmp-name1 nil directory-files-no-dot-files-regexp) | ||
| 1528 | (directory-files | ||
| 1529 | tmp-name2 nil directory-files-no-dot-files-regexp)))) | ||
| 1530 | |||
| 1465 | (ignore-errors (delete-directory tmp-name1 'recursive)) | 1531 | (ignore-errors (delete-directory tmp-name1 'recursive)) |
| 1466 | (ignore-errors (delete-directory tmp-name2 'recursive))))) | 1532 | (ignore-errors (delete-directory tmp-name2 'recursive))))) |
| 1467 | 1533 | ||
| @@ -1469,6 +1535,13 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1469 | (ert-deftest tramp-test30-special-characters () | 1535 | (ert-deftest tramp-test30-special-characters () |
| 1470 | "Check special characters in file names." | 1536 | "Check special characters in file names." |
| 1471 | (skip-unless (tramp--test-enabled)) | 1537 | (skip-unless (tramp--test-enabled)) |
| 1538 | (skip-unless | ||
| 1539 | (not | ||
| 1540 | (memq | ||
| 1541 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) | ||
| 1542 | '(tramp-adb-file-name-handler | ||
| 1543 | tramp-gvfs-file-name-handler | ||
| 1544 | tramp-smb-file-name-handler)))) | ||
| 1472 | 1545 | ||
| 1473 | ;; Newlines, slashes and backslashes in file names are not supported. | 1546 | ;; Newlines, slashes and backslashes in file names are not supported. |
| 1474 | ;; So we don't test. | 1547 | ;; So we don't test. |
| @@ -1481,11 +1554,13 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1481 | "?foo?bar?baz?" | 1554 | "?foo?bar?baz?" |
| 1482 | "*foo*bar*baz*" | 1555 | "*foo*bar*baz*" |
| 1483 | "'foo\"bar'baz\"" | 1556 | "'foo\"bar'baz\"" |
| 1484 | "#foo#bar#baz#" | 1557 | "#foo~bar#baz~" |
| 1485 | "!foo|bar!baz|" | 1558 | "!foo|bar!baz|" |
| 1486 | ":foo;bar:baz;" | 1559 | ":foo;bar:baz;" |
| 1487 | "<foo>bar<baz>" | 1560 | "<foo>bar<baz>" |
| 1488 | "(foo)bar(baz)")) | 1561 | "(foo)bar(baz)" |
| 1562 | "[foo]bar[baz]" | ||
| 1563 | "{foo}bar{baz}")) | ||
| 1489 | 1564 | ||
| 1490 | (ert-deftest tramp-test31-utf8 () | 1565 | (ert-deftest tramp-test31-utf8 () |
| 1491 | "Check UTF8 encoding in file names and file contents." | 1566 | "Check UTF8 encoding in file names and file contents." |
| @@ -1657,8 +1732,13 @@ Since it unloads Tramp, it shall be the last test to run." | |||
| 1657 | ;; * set-file-acl | 1732 | ;; * set-file-acl |
| 1658 | ;; * set-file-selinux-context | 1733 | ;; * set-file-selinux-context |
| 1659 | 1734 | ||
| 1660 | ;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). | 1735 | ;; * Work on skipped tests. Make a comment, when it is impossible. |
| 1736 | ;; * Fix `tramp-test15-copy-directory' for `smb'. Using tar in a pipe | ||
| 1737 | ;; doesn't work well when an interactive password must be provided. | ||
| 1738 | ;; * Fix `tramp-test27-start-file-process' for `nc' and on MS | ||
| 1739 | ;; Windows (`process-send-eof'?). | ||
| 1661 | ;; * Fix `tramp-test28-shell-command' on MS Windows (nasty plink message). | 1740 | ;; * Fix `tramp-test28-shell-command' on MS Windows (nasty plink message). |
| 1741 | ;; * Fix `tramp-test30-special-characters' for `adb', `nc' and `smb'. | ||
| 1662 | ;; * Fix `tramp-test31-utf8' for MS Windows and `nc'/`telnet' (when | 1742 | ;; * Fix `tramp-test31-utf8' for MS Windows and `nc'/`telnet' (when |
| 1663 | ;; target is a dumb busybox). Seems to be in `directory-files'. | 1743 | ;; target is a dumb busybox). Seems to be in `directory-files'. |
| 1664 | ;; * Fix Bug#16928. Set expected error of `tramp-test32-asynchronous-requests'. | 1744 | ;; * Fix Bug#16928. Set expected error of `tramp-test32-asynchronous-requests'. |