diff options
| author | Michael Albinus | 2014-03-07 15:11:37 +0100 |
|---|---|---|
| committer | Michael Albinus | 2014-03-07 15:11:37 +0100 |
| commit | 162427fe6a9fbcd9f4b8f747d8469577951a1b00 (patch) | |
| tree | fd539be408456a9ef60ea7fcb5d3ee3cf4a0b34f | |
| parent | e50772e36a4b02892c9b36ff58529a11017d53f0 (diff) | |
| download | emacs-162427fe6a9fbcd9f4b8f747d8469577951a1b00.tar.gz emacs-162427fe6a9fbcd9f4b8f747d8469577951a1b00.zip | |
* automated/tramp-tests.el (tramp-copy-size-limit): Declare.
(tramp-test10-write-region): Extend for out-of-band copy.
(tramp-test31-asynchronous-requests): New test.
| -rw-r--r-- | test/ChangeLog | 6 | ||||
| -rw-r--r-- | test/automated/tramp-tests.el | 109 |
2 files changed, 110 insertions, 5 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 2586b7434bb..c87022cd948 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2014-03-07 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * automated/tramp-tests.el (tramp-copy-size-limit): Declare. | ||
| 4 | (tramp-test10-write-region): Extend for out-of-band copy. | ||
| 5 | (tramp-test31-asynchronous-requests): New test. | ||
| 6 | |||
| 1 | 2014-03-02 Barry O'Reilly <gundaetiapo@gmail.com> | 7 | 2014-03-02 Barry O'Reilly <gundaetiapo@gmail.com> |
| 2 | 8 | ||
| 3 | * automated/undo-tests.el (undo-test-in-region-not-most-recent): | 9 | * automated/undo-tests.el (undo-test-in-region-not-most-recent): |
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index 02473f4c63f..7bf0ab4e9c8 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el | |||
| @@ -44,6 +44,7 @@ | |||
| 44 | 44 | ||
| 45 | (declare-function tramp-find-executable "tramp-sh") | 45 | (declare-function tramp-find-executable "tramp-sh") |
| 46 | (declare-function tramp-get-remote-path "tramp-sh") | 46 | (declare-function tramp-get-remote-path "tramp-sh") |
| 47 | (defvar tramp-copy-size-limit) | ||
| 47 | 48 | ||
| 48 | ;; There is no default value on w32 systems, which could work out of the box. | 49 | ;; There is no default value on w32 systems, which could work out of the box. |
| 49 | (defconst tramp-test-temporary-file-directory | 50 | (defconst tramp-test-temporary-file-directory |
| @@ -83,8 +84,7 @@ being the result.") | |||
| 83 | (file-writable-p tramp-test-temporary-file-directory)))))) | 84 | (file-writable-p tramp-test-temporary-file-directory)))))) |
| 84 | 85 | ||
| 85 | (when (cdr tramp--test-enabled-checked) | 86 | (when (cdr tramp--test-enabled-checked) |
| 86 | ;; Cleanup connection. We don't cleanup for adb, because it | 87 | ;; Cleanup connection. |
| 87 | ;; doesn't behave well when is disconnect several times. | ||
| 88 | (tramp-cleanup-connection | 88 | (tramp-cleanup-connection |
| 89 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | 89 | (tramp-dissect-file-name tramp-test-temporary-file-directory) |
| 90 | nil 'keep-password)) | 90 | nil 'keep-password)) |
| @@ -662,8 +662,16 @@ and `file-name-nondirectory'." | |||
| 662 | (write-region 3 5 tmp-name)) | 662 | (write-region 3 5 tmp-name)) |
| 663 | (with-temp-buffer | 663 | (with-temp-buffer |
| 664 | (insert-file-contents tmp-name) | 664 | (insert-file-contents tmp-name) |
| 665 | (should (string-equal (buffer-string) "34")))) | 665 | (should (string-equal (buffer-string) "34"))) |
| 666 | (ignore-errors (delete-file tmp-name))))) | 666 | ;; Trigger out-of-band copy. |
| 667 | (let ((string "")) | ||
| 668 | (while (<= (length string) tramp-copy-size-limit) | ||
| 669 | (setq string (concat string (md5 string)))) | ||
| 670 | (write-region string nil tmp-name) | ||
| 671 | (with-temp-buffer | ||
| 672 | (insert-file-contents tmp-name) | ||
| 673 | (should (string-equal (buffer-string) string))))) | ||
| 674 | (ignore-errors (delete-file tmp-name))))) | ||
| 667 | 675 | ||
| 668 | (ert-deftest tramp-test11-copy-file () | 676 | (ert-deftest tramp-test11-copy-file () |
| 669 | "Check `copy-file'." | 677 | "Check `copy-file'." |
| @@ -1314,6 +1322,96 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1314 | (sort `(,arabic ,chinese ,russian) 'string-lessp)))) | 1322 | (sort `(,arabic ,chinese ,russian) 'string-lessp)))) |
| 1315 | (ignore-errors (delete-directory tmp-name 'recursive))))) | 1323 | (ignore-errors (delete-directory tmp-name 'recursive))))) |
| 1316 | 1324 | ||
| 1325 | ;; This test is inspired by Bug#16928. | ||
| 1326 | (ert-deftest tramp-test31-asynchronous-requests () | ||
| 1327 | "Check parallel asynchronous requests. | ||
| 1328 | Such requests could arrive from timers, process filters and | ||
| 1329 | process sentinels. They shall not disturb each other." | ||
| 1330 | ;; Mark as failed until bug has been fixed. | ||
| 1331 | :expected-result :failed | ||
| 1332 | (skip-unless (tramp--test-enabled)) | ||
| 1333 | (skip-unless | ||
| 1334 | (eq | ||
| 1335 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) | ||
| 1336 | 'tramp-sh-file-name-handler)) | ||
| 1337 | |||
| 1338 | ;; Keep instrumentation verbosity 0 until Tramp bug is fixed. This | ||
| 1339 | ;; has the side effect, that this test fails instead to abort. Good | ||
| 1340 | ;; for hydra. | ||
| 1341 | (tramp--instrument-test-case 0 | ||
| 1342 | (let* ((tmp-name (tramp--test-make-temp-name)) | ||
| 1343 | (default-directory tmp-name) | ||
| 1344 | (remote-file-name-inhibit-cache t) | ||
| 1345 | timer buffers kill-buffer-query-functions) | ||
| 1346 | |||
| 1347 | (unwind-protect | ||
| 1348 | (progn | ||
| 1349 | (make-directory tmp-name) | ||
| 1350 | |||
| 1351 | ;; Setup a timer in order to raise an ordinary command again | ||
| 1352 | ;; and again. `vc-registered' is well suited, because there | ||
| 1353 | ;; are many checks. | ||
| 1354 | (setq | ||
| 1355 | timer | ||
| 1356 | (run-at-time | ||
| 1357 | 0 1 | ||
| 1358 | (lambda () | ||
| 1359 | (when buffers | ||
| 1360 | (vc-registered | ||
| 1361 | (buffer-name (nth (random (length buffers)) buffers))))))) | ||
| 1362 | |||
| 1363 | ;; Create temporary buffers. The number of buffers | ||
| 1364 | ;; corresponds to the number of processes; it could be | ||
| 1365 | ;; increased in order to make pressure on Tramp. | ||
| 1366 | (dotimes (i 5) | ||
| 1367 | (add-to-list 'buffers (generate-new-buffer "*temp*"))) | ||
| 1368 | |||
| 1369 | ;; Open asynchronous processes. Set process sentinel. | ||
| 1370 | (dolist (buf buffers) | ||
| 1371 | (async-shell-command "read line; touch $line; echo $line" buf) | ||
| 1372 | (set-process-sentinel | ||
| 1373 | (get-buffer-process buf) | ||
| 1374 | (lambda (proc _state) | ||
| 1375 | (delete-file (buffer-name (process-buffer proc)))))) | ||
| 1376 | |||
| 1377 | ;; Send a string. Use a random order of the buffers. Mix | ||
| 1378 | ;; with regular operation. | ||
| 1379 | (let ((buffers (copy-sequence buffers)) | ||
| 1380 | buf) | ||
| 1381 | (while buffers | ||
| 1382 | (setq buf (nth (random (length buffers)) buffers)) | ||
| 1383 | (process-send-string | ||
| 1384 | (get-buffer-process buf) (format "'%s'\n" buf)) | ||
| 1385 | (file-attributes (buffer-name buf)) | ||
| 1386 | (setq buffers (delq buf buffers)))) | ||
| 1387 | |||
| 1388 | ;; Wait until the whole output has been read. | ||
| 1389 | (with-timeout ((* 10 (length buffers)) | ||
| 1390 | (ert-fail "`async-shell-command' timed out")) | ||
| 1391 | (let ((buffers (copy-sequence buffers)) | ||
| 1392 | buf) | ||
| 1393 | (while buffers | ||
| 1394 | (setq buf (nth (random (length buffers)) buffers)) | ||
| 1395 | (if (ignore-errors | ||
| 1396 | (memq (process-status (get-buffer-process buf)) | ||
| 1397 | '(run open))) | ||
| 1398 | (accept-process-output (get-buffer-process buf) 0.1) | ||
| 1399 | (setq buffers (delq buf buffers)))))) | ||
| 1400 | |||
| 1401 | ;; Check. | ||
| 1402 | (dolist (buf buffers) | ||
| 1403 | (with-current-buffer buf | ||
| 1404 | (should | ||
| 1405 | (string-equal (format "'%s'\n" buf) (buffer-string))))) | ||
| 1406 | (should-not | ||
| 1407 | (directory-files tmp-name nil directory-files-no-dot-files-regexp))) | ||
| 1408 | |||
| 1409 | ;; Cleanup. | ||
| 1410 | (ignore-errors (cancel-timer timer)) | ||
| 1411 | (ignore-errors (delete-directory tmp-name 'recursive)) | ||
| 1412 | (dolist (buf buffers) | ||
| 1413 | (ignore-errors (kill-buffer buf))))))) | ||
| 1414 | |||
| 1317 | ;; TODO: | 1415 | ;; TODO: |
| 1318 | 1416 | ||
| 1319 | ;; * dired-compress-file | 1417 | ;; * dired-compress-file |
| @@ -1327,8 +1425,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1327 | ;; * set-file-selinux-context | 1425 | ;; * set-file-selinux-context |
| 1328 | 1426 | ||
| 1329 | ;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). | 1427 | ;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). |
| 1330 | ;; * Fix `tramp-test28-shell-command' on MS Windows (`process-send-eof'?). | 1428 | ;; * Fix `tramp-test28-shell-command' on MS Windows (nasty plink message). |
| 1331 | ;; * Fix `tramp-test30-utf8' on MS Windows. Seems to be in `directory-files'. | 1429 | ;; * Fix `tramp-test30-utf8' on MS Windows. Seems to be in `directory-files'. |
| 1430 | ;; * Fix Bug#16928. Set expected error of `tramp-test31-asynchronous-requests'. | ||
| 1332 | 1431 | ||
| 1333 | (defun tramp-test-all (&optional interactive) | 1432 | (defun tramp-test-all (&optional interactive) |
| 1334 | "Run all tests for \\[tramp]." | 1433 | "Run all tests for \\[tramp]." |