diff options
| author | Michael Albinus | 2014-02-27 13:07:10 +0100 |
|---|---|---|
| committer | Michael Albinus | 2014-02-27 13:07:10 +0100 |
| commit | 154ba7966c355a9d2db4d8763a78e75e068fe920 (patch) | |
| tree | 8516fa3901e4c99b017ece5fee6e78cf82e33383 /test | |
| parent | 6be7660863fa4a1f4621757dcc57864a23742d36 (diff) | |
| download | emacs-154ba7966c355a9d2db4d8763a78e75e068fe920.tar.gz emacs-154ba7966c355a9d2db4d8763a78e75e068fe920.zip | |
* automated/tramp-tests.el (tramp--test-enabled): Move connection
cleanup into this function. Remove respective code from all test cases.
(tramp--instrument-test-case): Declare `indent' and `debug'.
Handle other errors as well.
(tramp-test14-delete-directory): Check for `file-error' error.
(tramp-test15-copy-directory): Ignore return value of
`copy-directory'. It's too much hassle to handle it for tramp-adb.el.
(tramp-test19-directory-files-and-attributes): Take care of
timestamp of "../".
(tramp-test20-file-modes, tramp-test27-start-file-process)
(tramp-test28-shell-command): Skip for tramp-adb.el.
(tramp-test21-file-links): `file-truename' shall preserve trailing
link of directories.
(tramp-test22-file-times): Skip if `set-file-times' returns nil.
(tramp-test26-process-file, tramp-test28-shell-command): Let-bind
`kill-buffer-query-functions' to nil.
(tramp-test28-shell-command): Run `async-shell-command' with timeouts.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 21 | ||||
| -rw-r--r-- | test/automated/tramp-tests.el | 205 |
2 files changed, 107 insertions, 119 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index cf246b7eda9..0910f0b15b8 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,24 @@ | |||
| 1 | 2014-02-27 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * automated/tramp-tests.el (tramp--test-enabled): Move connection | ||
| 4 | cleanup into this function. Remove respective code from all test | ||
| 5 | cases. | ||
| 6 | (tramp--instrument-test-case): Declare `indent' and `debug'. | ||
| 7 | Handle other errors as well. | ||
| 8 | (tramp-test14-delete-directory): Check for `file-error' error. | ||
| 9 | (tramp-test15-copy-directory): Ignore return value of | ||
| 10 | `copy-directory'. It's too much hassle to handle it for tramp-adb.el. | ||
| 11 | (tramp-test19-directory-files-and-attributes): Take care of | ||
| 12 | timestamp of "../". | ||
| 13 | (tramp-test20-file-modes, tramp-test27-start-file-process) | ||
| 14 | (tramp-test28-shell-command): Skip for tramp-adb.el. | ||
| 15 | (tramp-test21-file-links): `file-truename' shall preserve trailing | ||
| 16 | link of directories. | ||
| 17 | (tramp-test22-file-times): Skip if `set-file-times' returns nil. | ||
| 18 | (tramp-test26-process-file, tramp-test28-shell-command): Let-bind | ||
| 19 | `kill-buffer-query-functions' to nil. | ||
| 20 | (tramp-test28-shell-command): Run `async-shell-command' with timeouts. | ||
| 21 | |||
| 1 | 2014-02-21 Michael Albinus <michael.albinus@gmx.de> | 22 | 2014-02-21 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 23 | ||
| 3 | * automated/tramp-tests.el | 24 | * automated/tramp-tests.el |
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index d93fc78f86c..706e2e0e25e 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el | |||
| @@ -81,6 +81,17 @@ being the result.") | |||
| 81 | (file-remote-p tramp-test-temporary-file-directory) | 81 | (file-remote-p tramp-test-temporary-file-directory) |
| 82 | (file-directory-p tramp-test-temporary-file-directory) | 82 | (file-directory-p tramp-test-temporary-file-directory) |
| 83 | (file-writable-p tramp-test-temporary-file-directory)))))) | 83 | (file-writable-p tramp-test-temporary-file-directory)))))) |
| 84 | |||
| 85 | (when (and (cdr tramp--test-enabled-checked) | ||
| 86 | (not (eq (tramp-find-foreign-file-name-handler | ||
| 87 | tramp-test-temporary-file-directory) | ||
| 88 | 'tramp-adb-file-name-handler))) | ||
| 89 | ;; Cleanup connection. We don't cleanup for adb, because it | ||
| 90 | ;; doesn't behave well when is disconnect several times. | ||
| 91 | (tramp-cleanup-connection | ||
| 92 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 93 | nil 'keep-password)) | ||
| 94 | |||
| 84 | ;; Return result. | 95 | ;; Return result. |
| 85 | (cdr tramp--test-enabled-checked)) | 96 | (cdr tramp--test-enabled-checked)) |
| 86 | 97 | ||
| @@ -93,15 +104,21 @@ being the result.") | |||
| 93 | "Run BODY with `tramp-verbose' equal VERBOSE. | 104 | "Run BODY with `tramp-verbose' equal VERBOSE. |
| 94 | Print the the content of the Tramp debug buffer, if BODY does not | 105 | Print the the content of the Tramp debug buffer, if BODY does not |
| 95 | eval properly in `should', `should-not' or `should-error'." | 106 | eval properly in `should', `should-not' or `should-error'." |
| 96 | `(let ((tramp-verbose ,verbose)) | 107 | (declare (indent 1) (debug (natnump body))) |
| 108 | `(let ((tramp-verbose ,verbose) | ||
| 109 | (tramp-debug-on-error t)) | ||
| 97 | (condition-case err | 110 | (condition-case err |
| 98 | (progn ,@body) | 111 | (progn ,@body) |
| 99 | (ert-test-failed | 112 | (ert-test-skipped |
| 113 | (signal (car err) (cdr err))) | ||
| 114 | (error | ||
| 100 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | 115 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil |
| 116 | (with-current-buffer (tramp-get-connection-buffer v) | ||
| 117 | (message "%s" (buffer-string))) | ||
| 101 | (with-current-buffer (tramp-get-debug-buffer v) | 118 | (with-current-buffer (tramp-get-debug-buffer v) |
| 102 | (message "%s" (buffer-string)))) | 119 | (message "%s" (buffer-string)))) |
| 120 | (message "%s" err) | ||
| 103 | (signal (car err) (cdr err)))))) | 121 | (signal (car err) (cdr err)))))) |
| 104 | (put 'tramp--instrument-test-case 'lisp-indent-function 1) | ||
| 105 | 122 | ||
| 106 | (ert-deftest tramp-test00-availability () | 123 | (ert-deftest tramp-test00-availability () |
| 107 | "Test availability of Tramp functions." | 124 | "Test availability of Tramp functions." |
| @@ -571,9 +588,6 @@ and `file-name-nondirectory'." | |||
| 571 | (ert-deftest tramp-test07-file-exists-p () | 588 | (ert-deftest tramp-test07-file-exists-p () |
| 572 | "Check `file-exist-p', `write-region' and `delete-file'." | 589 | "Check `file-exist-p', `write-region' and `delete-file'." |
| 573 | (skip-unless (tramp--test-enabled)) | 590 | (skip-unless (tramp--test-enabled)) |
| 574 | (tramp-cleanup-connection | ||
| 575 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 576 | nil 'keep-password) | ||
| 577 | 591 | ||
| 578 | (let ((tmp-name (tramp--test-make-temp-name))) | 592 | (let ((tmp-name (tramp--test-make-temp-name))) |
| 579 | (should-not (file-exists-p tmp-name)) | 593 | (should-not (file-exists-p tmp-name)) |
| @@ -585,9 +599,6 @@ and `file-name-nondirectory'." | |||
| 585 | (ert-deftest tramp-test08-file-local-copy () | 599 | (ert-deftest tramp-test08-file-local-copy () |
| 586 | "Check `file-local-copy'." | 600 | "Check `file-local-copy'." |
| 587 | (skip-unless (tramp--test-enabled)) | 601 | (skip-unless (tramp--test-enabled)) |
| 588 | (tramp-cleanup-connection | ||
| 589 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 590 | nil 'keep-password) | ||
| 591 | 602 | ||
| 592 | (let ((tmp-name1 (tramp--test-make-temp-name)) | 603 | (let ((tmp-name1 (tramp--test-make-temp-name)) |
| 593 | tmp-name2) | 604 | tmp-name2) |
| @@ -605,9 +616,6 @@ and `file-name-nondirectory'." | |||
| 605 | (ert-deftest tramp-test09-insert-file-contents () | 616 | (ert-deftest tramp-test09-insert-file-contents () |
| 606 | "Check `insert-file-contents'." | 617 | "Check `insert-file-contents'." |
| 607 | (skip-unless (tramp--test-enabled)) | 618 | (skip-unless (tramp--test-enabled)) |
| 608 | (tramp-cleanup-connection | ||
| 609 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 610 | nil 'keep-password) | ||
| 611 | 619 | ||
| 612 | (let ((tmp-name (tramp--test-make-temp-name))) | 620 | (let ((tmp-name (tramp--test-make-temp-name))) |
| 613 | (unwind-protect | 621 | (unwind-protect |
| @@ -629,9 +637,6 @@ and `file-name-nondirectory'." | |||
| 629 | (ert-deftest tramp-test10-write-region () | 637 | (ert-deftest tramp-test10-write-region () |
| 630 | "Check `write-region'." | 638 | "Check `write-region'." |
| 631 | (skip-unless (tramp--test-enabled)) | 639 | (skip-unless (tramp--test-enabled)) |
| 632 | (tramp-cleanup-connection | ||
| 633 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 634 | nil 'keep-password) | ||
| 635 | 640 | ||
| 636 | (let ((tmp-name (tramp--test-make-temp-name))) | 641 | (let ((tmp-name (tramp--test-make-temp-name))) |
| 637 | (unwind-protect | 642 | (unwind-protect |
| @@ -666,9 +671,6 @@ and `file-name-nondirectory'." | |||
| 666 | (ert-deftest tramp-test11-copy-file () | 671 | (ert-deftest tramp-test11-copy-file () |
| 667 | "Check `copy-file'." | 672 | "Check `copy-file'." |
| 668 | (skip-unless (tramp--test-enabled)) | 673 | (skip-unless (tramp--test-enabled)) |
| 669 | (tramp-cleanup-connection | ||
| 670 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 671 | nil 'keep-password) | ||
| 672 | 674 | ||
| 673 | (let ((tmp-name1 (tramp--test-make-temp-name)) | 675 | (let ((tmp-name1 (tramp--test-make-temp-name)) |
| 674 | (tmp-name2 (tramp--test-make-temp-name))) | 676 | (tmp-name2 (tramp--test-make-temp-name))) |
| @@ -687,9 +689,6 @@ and `file-name-nondirectory'." | |||
| 687 | (ert-deftest tramp-test12-rename-file () | 689 | (ert-deftest tramp-test12-rename-file () |
| 688 | "Check `rename-file'." | 690 | "Check `rename-file'." |
| 689 | (skip-unless (tramp--test-enabled)) | 691 | (skip-unless (tramp--test-enabled)) |
| 690 | (tramp-cleanup-connection | ||
| 691 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 692 | nil 'keep-password) | ||
| 693 | 692 | ||
| 694 | (let ((tmp-name1 (tramp--test-make-temp-name)) | 693 | (let ((tmp-name1 (tramp--test-make-temp-name)) |
| 695 | (tmp-name2 (tramp--test-make-temp-name))) | 694 | (tmp-name2 (tramp--test-make-temp-name))) |
| @@ -708,9 +707,6 @@ and `file-name-nondirectory'." | |||
| 708 | "Check `make-directory'. | 707 | "Check `make-directory'. |
| 709 | This tests also `file-directory-p' and `file-accessible-directory-p'." | 708 | This tests also `file-directory-p' and `file-accessible-directory-p'." |
| 710 | (skip-unless (tramp--test-enabled)) | 709 | (skip-unless (tramp--test-enabled)) |
| 711 | (tramp-cleanup-connection | ||
| 712 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 713 | nil 'keep-password) | ||
| 714 | 710 | ||
| 715 | (let ((tmp-name (tramp--test-make-temp-name))) | 711 | (let ((tmp-name (tramp--test-make-temp-name))) |
| 716 | (unwind-protect | 712 | (unwind-protect |
| @@ -723,9 +719,6 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 723 | (ert-deftest tramp-test14-delete-directory () | 719 | (ert-deftest tramp-test14-delete-directory () |
| 724 | "Check `delete-directory'." | 720 | "Check `delete-directory'." |
| 725 | (skip-unless (tramp--test-enabled)) | 721 | (skip-unless (tramp--test-enabled)) |
| 726 | (tramp-cleanup-connection | ||
| 727 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 728 | nil 'keep-password) | ||
| 729 | 722 | ||
| 730 | (let ((tmp-name (tramp--test-make-temp-name))) | 723 | (let ((tmp-name (tramp--test-make-temp-name))) |
| 731 | ;; Delete empty directory. | 724 | ;; Delete empty directory. |
| @@ -736,16 +729,13 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 736 | ;; Delete non-empty directory. | 729 | ;; Delete non-empty directory. |
| 737 | (make-directory tmp-name) | 730 | (make-directory tmp-name) |
| 738 | (write-region "foo" nil (expand-file-name "bla" tmp-name)) | 731 | (write-region "foo" nil (expand-file-name "bla" tmp-name)) |
| 739 | (should-error (delete-directory tmp-name)) | 732 | (should-error (delete-directory tmp-name) :type 'file-error) |
| 740 | (delete-directory tmp-name 'recursive) | 733 | (delete-directory tmp-name 'recursive) |
| 741 | (should-not (file-directory-p tmp-name)))) | 734 | (should-not (file-directory-p tmp-name)))) |
| 742 | 735 | ||
| 743 | (ert-deftest tramp-test15-copy-directory () | 736 | (ert-deftest tramp-test15-copy-directory () |
| 744 | "Check `copy-directory'." | 737 | "Check `copy-directory'." |
| 745 | (skip-unless (tramp--test-enabled)) | 738 | (skip-unless (tramp--test-enabled)) |
| 746 | (tramp-cleanup-connection | ||
| 747 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 748 | nil 'keep-password) | ||
| 749 | 739 | ||
| 750 | (let* ((tmp-name1 (tramp--test-make-temp-name)) | 740 | (let* ((tmp-name1 (tramp--test-make-temp-name)) |
| 751 | (tmp-name2 (tramp--test-make-temp-name)) | 741 | (tmp-name2 (tramp--test-make-temp-name)) |
| @@ -761,11 +751,14 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 761 | (write-region "foo" nil tmp-name4) | 751 | (write-region "foo" nil tmp-name4) |
| 762 | (should (file-directory-p tmp-name1)) | 752 | (should (file-directory-p tmp-name1)) |
| 763 | (should (file-exists-p tmp-name4)) | 753 | (should (file-exists-p tmp-name4)) |
| 764 | (copy-directory tmp-name1 tmp-name2) | 754 | ;; We do not care, whether file permissions and time stamps |
| 755 | ;; are correct. Sometimes, it is not possible to manage | ||
| 756 | ;; them, for example in tramp-adb.el. | ||
| 757 | (ignore-errors (copy-directory tmp-name1 tmp-name2)) | ||
| 765 | (should (file-directory-p tmp-name2)) | 758 | (should (file-directory-p tmp-name2)) |
| 766 | (should (file-exists-p tmp-name5)) | 759 | (should (file-exists-p tmp-name5)) |
| 767 | ;; Target directory does exist already. | 760 | ;; Target directory does exist already. |
| 768 | (copy-directory tmp-name1 tmp-name2) | 761 | (ignore-errors (copy-directory tmp-name1 tmp-name2)) |
| 769 | (should (file-directory-p tmp-name3)) | 762 | (should (file-directory-p tmp-name3)) |
| 770 | (should (file-exists-p tmp-name6))) | 763 | (should (file-exists-p tmp-name6))) |
| 771 | (ignore-errors | 764 | (ignore-errors |
| @@ -775,9 +768,6 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 775 | (ert-deftest tramp-test16-directory-files () | 768 | (ert-deftest tramp-test16-directory-files () |
| 776 | "Check `directory-files'." | 769 | "Check `directory-files'." |
| 777 | (skip-unless (tramp--test-enabled)) | 770 | (skip-unless (tramp--test-enabled)) |
| 778 | (tramp-cleanup-connection | ||
| 779 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 780 | nil 'keep-password) | ||
| 781 | 771 | ||
| 782 | (let* ((tmp-name1 (tramp--test-make-temp-name)) | 772 | (let* ((tmp-name1 (tramp--test-make-temp-name)) |
| 783 | (tmp-name2 (expand-file-name "bla" tmp-name1)) | 773 | (tmp-name2 (expand-file-name "bla" tmp-name1)) |
| @@ -806,9 +796,6 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 806 | (ert-deftest tramp-test17-insert-directory () | 796 | (ert-deftest tramp-test17-insert-directory () |
| 807 | "Check `insert-directory'." | 797 | "Check `insert-directory'." |
| 808 | (skip-unless (tramp--test-enabled)) | 798 | (skip-unless (tramp--test-enabled)) |
| 809 | (tramp-cleanup-connection | ||
| 810 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 811 | nil 'keep-password) | ||
| 812 | 799 | ||
| 813 | (let* ((tmp-name1 (tramp--test-make-temp-name)) | 800 | (let* ((tmp-name1 (tramp--test-make-temp-name)) |
| 814 | (tmp-name2 (expand-file-name "foo" tmp-name1))) | 801 | (tmp-name2 (expand-file-name "foo" tmp-name1))) |
| @@ -844,9 +831,6 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 844 | "Check `file-attributes'. | 831 | "Check `file-attributes'. |
| 845 | This tests also `file-readable-p' and `file-regular-p'." | 832 | This tests also `file-readable-p' and `file-regular-p'." |
| 846 | (skip-unless (tramp--test-enabled)) | 833 | (skip-unless (tramp--test-enabled)) |
| 847 | (tramp-cleanup-connection | ||
| 848 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 849 | nil 'keep-password) | ||
| 850 | 834 | ||
| 851 | (let ((tmp-name (tramp--test-make-temp-name)) | 835 | (let ((tmp-name (tramp--test-make-temp-name)) |
| 852 | attr) | 836 | attr) |
| @@ -889,39 +873,35 @@ This tests also `file-readable-p' and `file-regular-p'." | |||
| 889 | (ert-deftest tramp-test19-directory-files-and-attributes () | 873 | (ert-deftest tramp-test19-directory-files-and-attributes () |
| 890 | "Check `directory-files-and-attributes'." | 874 | "Check `directory-files-and-attributes'." |
| 891 | (skip-unless (tramp--test-enabled)) | 875 | (skip-unless (tramp--test-enabled)) |
| 892 | (tramp-cleanup-connection | ||
| 893 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 894 | nil 'keep-password) | ||
| 895 | 876 | ||
| 896 | (tramp--instrument-test-case 10 | 877 | ;; `directory-files-and-attributes' contains also values for "../". |
| 897 | (let ((tmp-name (tramp--test-make-temp-name)) | 878 | ;; We must nesure, that this doesn't change during tests, for |
| 898 | attr) | 879 | ;; example due to handling temporary files. |
| 880 | (let* ((tmp-name1 (tramp--test-make-temp-name)) | ||
| 881 | (tmp-name2 (expand-file-name "bla" tmp-name1)) | ||
| 882 | attr) | ||
| 899 | (unwind-protect | 883 | (unwind-protect |
| 900 | (progn | 884 | (progn |
| 901 | (make-directory tmp-name) | 885 | (make-directory tmp-name1) |
| 902 | (should (file-directory-p tmp-name)) | 886 | (should (file-directory-p tmp-name1)) |
| 903 | (write-region "foo" nil (expand-file-name "foo" tmp-name)) | 887 | (make-directory tmp-name2) |
| 904 | (write-region "bar" nil (expand-file-name "bar" tmp-name)) | 888 | (should (file-directory-p tmp-name2)) |
| 905 | (write-region "boz" nil (expand-file-name "boz" tmp-name)) | 889 | (write-region "foo" nil (expand-file-name "foo" tmp-name2)) |
| 906 | (setq attr (directory-files-and-attributes tmp-name)) | 890 | (write-region "bar" nil (expand-file-name "bar" tmp-name2)) |
| 891 | (write-region "boz" nil (expand-file-name "boz" tmp-name2)) | ||
| 892 | (setq attr (directory-files-and-attributes tmp-name2)) | ||
| 907 | (should (consp attr)) | 893 | (should (consp attr)) |
| 908 | (dolist (elt attr) | 894 | (dolist (elt attr) |
| 909 | ;; We cannot include "." and "..". They might have | 895 | (should |
| 910 | ;; changed their timestamp already. | 896 | (equal (file-attributes (expand-file-name (car elt) tmp-name2)) |
| 911 | (when (string-match "foo$\\|bar$\\|baz$" (car elt)) | 897 | (cdr elt)))) |
| 912 | (should | 898 | (setq attr (directory-files-and-attributes tmp-name2 'full)) |
| 913 | (equal (file-attributes (expand-file-name (car elt) tmp-name)) | ||
| 914 | (cdr elt))))) | ||
| 915 | (setq attr (directory-files-and-attributes tmp-name 'full)) | ||
| 916 | (dolist (elt attr) | 899 | (dolist (elt attr) |
| 917 | ;; We cannot include "." and "..". They might have | 900 | (should |
| 918 | ;; changed their timestamp already. | 901 | (equal (file-attributes (car elt)) (cdr elt)))) |
| 919 | (when (string-match "foo$\\|bar$\\|baz$" (car elt)) | 902 | (setq attr (directory-files-and-attributes tmp-name2 nil "^b")) |
| 920 | (should | ||
| 921 | (equal (file-attributes (car elt)) (cdr elt))))) | ||
| 922 | (setq attr (directory-files-and-attributes tmp-name nil "^b")) | ||
| 923 | (should (equal (mapcar 'car attr) '("bar" "boz")))) | 903 | (should (equal (mapcar 'car attr) '("bar" "boz")))) |
| 924 | (ignore-errors (delete-directory tmp-name 'recursive)))))) | 904 | (ignore-errors (delete-directory tmp-name1 'recursive))))) |
| 925 | 905 | ||
| 926 | (ert-deftest tramp-test20-file-modes () | 906 | (ert-deftest tramp-test20-file-modes () |
| 927 | "Check `file-modes'. | 907 | "Check `file-modes'. |
| @@ -931,10 +911,9 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 931 | (not | 911 | (not |
| 932 | (memq | 912 | (memq |
| 933 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) | 913 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) |
| 934 | '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) | 914 | '(tramp-adb-file-name-handler |
| 935 | (tramp-cleanup-connection | 915 | tramp-gvfs-file-name-handler |
| 936 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | 916 | tramp-smb-file-name-handler)))) |
| 937 | nil 'keep-password) | ||
| 938 | 917 | ||
| 939 | (let ((tmp-name (tramp--test-make-temp-name))) | 918 | (let ((tmp-name (tramp--test-make-temp-name))) |
| 940 | (unwind-protect | 919 | (unwind-protect |
| @@ -949,8 +928,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 949 | (should (= (file-modes tmp-name) #o444)) | 928 | (should (= (file-modes tmp-name) #o444)) |
| 950 | (should-not (file-executable-p tmp-name)) | 929 | (should-not (file-executable-p tmp-name)) |
| 951 | ;; A file is always writable for user "root". | 930 | ;; A file is always writable for user "root". |
| 952 | (when (and (stringp (file-remote-p tmp-name 'user)) | 931 | (when (not (string-equal (file-remote-p tmp-name 'user) "root")) |
| 953 | (not (string-equal (file-remote-p tmp-name 'user) "root"))) | ||
| 954 | (should-not (file-writable-p tmp-name)))) | 932 | (should-not (file-writable-p tmp-name)))) |
| 955 | (ignore-errors (delete-file tmp-name))))) | 933 | (ignore-errors (delete-file tmp-name))))) |
| 956 | 934 | ||
| @@ -958,9 +936,6 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 958 | "Check `file-symlink-p'. | 936 | "Check `file-symlink-p'. |
| 959 | This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | 937 | This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." |
| 960 | (skip-unless (tramp--test-enabled)) | 938 | (skip-unless (tramp--test-enabled)) |
| 961 | (tramp-cleanup-connection | ||
| 962 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 963 | nil 'keep-password) | ||
| 964 | 939 | ||
| 965 | (let ((tmp-name1 (tramp--test-make-temp-name)) | 940 | (let ((tmp-name1 (tramp--test-make-temp-name)) |
| 966 | (tmp-name2 (tramp--test-make-temp-name)) | 941 | (tmp-name2 (tramp--test-make-temp-name)) |
| @@ -1014,7 +989,13 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1014 | (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))) | 989 | (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))) |
| 1015 | (ignore-errors | 990 | (ignore-errors |
| 1016 | (delete-file tmp-name1) | 991 | (delete-file tmp-name1) |
| 1017 | (delete-file tmp-name2))))) | 992 | (delete-file tmp-name2))) |
| 993 | |||
| 994 | ;; `file-truename' shall preserve trailing link of directories. | ||
| 995 | (let* ((dir1 (directory-file-name tramp-test-temporary-file-directory)) | ||
| 996 | (dir2 (file-name-as-directory dir1))) | ||
| 997 | (should (string-equal (file-truename dir1) (expand-file-name dir1))) | ||
| 998 | (should (string-equal (file-truename dir2) (expand-file-name dir2)))))) | ||
| 1018 | 999 | ||
| 1019 | (ert-deftest tramp-test22-file-times () | 1000 | (ert-deftest tramp-test22-file-times () |
| 1020 | "Check `set-file-times' and `file-newer-than-file-p'." | 1001 | "Check `set-file-times' and `file-newer-than-file-p'." |
| @@ -1024,9 +1005,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1024 | (memq | 1005 | (memq |
| 1025 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) | 1006 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) |
| 1026 | '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) | 1007 | '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) |
| 1027 | (tramp-cleanup-connection | ||
| 1028 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 1029 | nil 'keep-password) | ||
| 1030 | 1008 | ||
| 1031 | (let ((tmp-name1 (tramp--test-make-temp-name)) | 1009 | (let ((tmp-name1 (tramp--test-make-temp-name)) |
| 1032 | (tmp-name2 (tramp--test-make-temp-name)) | 1010 | (tmp-name2 (tramp--test-make-temp-name)) |
| @@ -1036,8 +1014,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1036 | (write-region "foo" nil tmp-name1) | 1014 | (write-region "foo" nil tmp-name1) |
| 1037 | (should (file-exists-p tmp-name1)) | 1015 | (should (file-exists-p tmp-name1)) |
| 1038 | (should (consp (nth 5 (file-attributes tmp-name1)))) | 1016 | (should (consp (nth 5 (file-attributes tmp-name1)))) |
| 1039 | ;; '(0 0) means don't know, and will be replaced by `current-time'. | 1017 | ;; '(0 0) means don't know, and will be replaced by |
| 1040 | (set-file-times tmp-name1 '(0 1)) | 1018 | ;; `current-time'. Therefore, we use '(0 1). |
| 1019 | ;; We skip the test, if the remote handler is not able to | ||
| 1020 | ;; set the correct time. | ||
| 1021 | (skip-unless (set-file-times tmp-name1 '(0 1))) | ||
| 1041 | ;; Dumb busyboxes are not able to return the date correctly. | 1022 | ;; Dumb busyboxes are not able to return the date correctly. |
| 1042 | ;; They say "don't know. | 1023 | ;; They say "don't know. |
| 1043 | (skip-unless (not (equal (nth 5 (file-attributes tmp-name1)) '(0 0)))) | 1024 | (skip-unless (not (equal (nth 5 (file-attributes tmp-name1)) '(0 0)))) |
| @@ -1055,9 +1036,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1055 | (ert-deftest tramp-test23-visited-file-modtime () | 1036 | (ert-deftest tramp-test23-visited-file-modtime () |
| 1056 | "Check `set-visited-file-modtime' and `verify-visited-file-modtime'." | 1037 | "Check `set-visited-file-modtime' and `verify-visited-file-modtime'." |
| 1057 | (skip-unless (tramp--test-enabled)) | 1038 | (skip-unless (tramp--test-enabled)) |
| 1058 | (tramp-cleanup-connection | ||
| 1059 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 1060 | nil 'keep-password) | ||
| 1061 | 1039 | ||
| 1062 | (let ((tmp-name (tramp--test-make-temp-name))) | 1040 | (let ((tmp-name (tramp--test-make-temp-name))) |
| 1063 | (unwind-protect | 1041 | (unwind-protect |
| @@ -1075,9 +1053,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1075 | (ert-deftest tramp-test24-file-name-completion () | 1053 | (ert-deftest tramp-test24-file-name-completion () |
| 1076 | "Check `file-name-completion' and `file-name-all-completions'." | 1054 | "Check `file-name-completion' and `file-name-all-completions'." |
| 1077 | (skip-unless (tramp--test-enabled)) | 1055 | (skip-unless (tramp--test-enabled)) |
| 1078 | (tramp-cleanup-connection | ||
| 1079 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 1080 | nil 'keep-password) | ||
| 1081 | 1056 | ||
| 1082 | (let ((tmp-name (tramp--test-make-temp-name))) | 1057 | (let ((tmp-name (tramp--test-make-temp-name))) |
| 1083 | (unwind-protect | 1058 | (unwind-protect |
| @@ -1100,9 +1075,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1100 | (ert-deftest tramp-test25-load () | 1075 | (ert-deftest tramp-test25-load () |
| 1101 | "Check `load'." | 1076 | "Check `load'." |
| 1102 | (skip-unless (tramp--test-enabled)) | 1077 | (skip-unless (tramp--test-enabled)) |
| 1103 | (tramp-cleanup-connection | ||
| 1104 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 1105 | nil 'keep-password) | ||
| 1106 | 1078 | ||
| 1107 | (let ((tmp-name (tramp--test-make-temp-name))) | 1079 | (let ((tmp-name (tramp--test-make-temp-name))) |
| 1108 | (unwind-protect | 1080 | (unwind-protect |
| @@ -1126,12 +1098,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1126 | (memq | 1098 | (memq |
| 1127 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) | 1099 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) |
| 1128 | '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) | 1100 | '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) |
| 1129 | (tramp-cleanup-connection | ||
| 1130 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 1131 | nil 'keep-password) | ||
| 1132 | 1101 | ||
| 1133 | (let ((tmp-name (tramp--test-make-temp-name)) | 1102 | (let ((tmp-name (tramp--test-make-temp-name)) |
| 1134 | (default-directory tramp-test-temporary-file-directory)) | 1103 | (default-directory tramp-test-temporary-file-directory) |
| 1104 | kill-buffer-query-functions) | ||
| 1135 | (unwind-protect | 1105 | (unwind-protect |
| 1136 | (progn | 1106 | (progn |
| 1137 | ;; We cannot use "/bin/true" and "/bin/false"; those paths | 1107 | ;; We cannot use "/bin/true" and "/bin/false"; those paths |
| @@ -1162,10 +1132,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1162 | (not | 1132 | (not |
| 1163 | (memq | 1133 | (memq |
| 1164 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) | 1134 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) |
| 1165 | '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) | 1135 | '(tramp-adb-file-name-handler |
| 1166 | (tramp-cleanup-connection | 1136 | tramp-gvfs-file-name-handler |
| 1167 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | 1137 | tramp-smb-file-name-handler)))) |
| 1168 | nil 'keep-password) | ||
| 1169 | 1138 | ||
| 1170 | (let ((default-directory tramp-test-temporary-file-directory) | 1139 | (let ((default-directory tramp-test-temporary-file-directory) |
| 1171 | (tmp-name (tramp--test-make-temp-name)) | 1140 | (tmp-name (tramp--test-make-temp-name)) |
| @@ -1215,13 +1184,13 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1215 | (not | 1184 | (not |
| 1216 | (memq | 1185 | (memq |
| 1217 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) | 1186 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) |
| 1218 | '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) | 1187 | '(tramp-adb-file-name-handler |
| 1219 | (tramp-cleanup-connection | 1188 | tramp-gvfs-file-name-handler |
| 1220 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | 1189 | tramp-smb-file-name-handler)))) |
| 1221 | nil 'keep-password) | ||
| 1222 | 1190 | ||
| 1223 | (let ((tmp-name (tramp--test-make-temp-name)) | 1191 | (let ((tmp-name (tramp--test-make-temp-name)) |
| 1224 | (default-directory tramp-test-temporary-file-directory)) | 1192 | (default-directory tramp-test-temporary-file-directory) |
| 1193 | kill-buffer-query-functions) | ||
| 1225 | (unwind-protect | 1194 | (unwind-protect |
| 1226 | (with-temp-buffer | 1195 | (with-temp-buffer |
| 1227 | (write-region "foo" nil tmp-name) | 1196 | (write-region "foo" nil tmp-name) |
| @@ -1244,10 +1213,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1244 | (async-shell-command | 1213 | (async-shell-command |
| 1245 | (format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer)) | 1214 | (format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer)) |
| 1246 | (accept-process-output (get-buffer-process (current-buffer)) 1) | 1215 | (accept-process-output (get-buffer-process (current-buffer)) 1) |
| 1247 | (while (ignore-errors | 1216 | (with-timeout (10 (ert-fail "`async-shell-command' timed out")) |
| 1248 | (memq (process-status (get-buffer-process (current-buffer))) | 1217 | (while |
| 1249 | '(run open))) | 1218 | (ignore-errors |
| 1250 | (accept-process-output (get-buffer-process (current-buffer)) 1)) | 1219 | (memq (process-status (get-buffer-process (current-buffer))) |
| 1220 | '(run open))) | ||
| 1221 | (accept-process-output (get-buffer-process (current-buffer)) 1))) | ||
| 1251 | ;; `ls' could produce colorized output. | 1222 | ;; `ls' could produce colorized output. |
| 1252 | (goto-char (point-min)) | 1223 | (goto-char (point-min)) |
| 1253 | (while (re-search-forward tramp-color-escape-sequence-regexp nil t) | 1224 | (while (re-search-forward tramp-color-escape-sequence-regexp nil t) |
| @@ -1266,10 +1237,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1266 | (get-buffer-process (current-buffer)) | 1237 | (get-buffer-process (current-buffer)) |
| 1267 | (format "%s\n" (file-name-nondirectory tmp-name))) | 1238 | (format "%s\n" (file-name-nondirectory tmp-name))) |
| 1268 | (accept-process-output (get-buffer-process (current-buffer)) 1) | 1239 | (accept-process-output (get-buffer-process (current-buffer)) 1) |
| 1269 | (while (ignore-errors | 1240 | (with-timeout (10 (ert-fail "`async-shell-command' timed out")) |
| 1270 | (memq (process-status (get-buffer-process (current-buffer))) | 1241 | (while |
| 1271 | '(run open))) | 1242 | (ignore-errors |
| 1272 | (accept-process-output (get-buffer-process (current-buffer)) 1)) | 1243 | (memq (process-status (get-buffer-process (current-buffer))) |
| 1244 | '(run open))) | ||
| 1245 | (accept-process-output (get-buffer-process (current-buffer)) 1))) | ||
| 1273 | (should | 1246 | (should |
| 1274 | (string-equal | 1247 | (string-equal |
| 1275 | (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) | 1248 | (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) |
| @@ -1282,9 +1255,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1282 | (eq | 1255 | (eq |
| 1283 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) | 1256 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) |
| 1284 | 'tramp-sh-file-name-handler)) | 1257 | 'tramp-sh-file-name-handler)) |
| 1285 | (tramp-cleanup-connection | ||
| 1286 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 1287 | nil 'keep-password) | ||
| 1288 | 1258 | ||
| 1289 | (let* ((default-directory tramp-test-temporary-file-directory) | 1259 | (let* ((default-directory tramp-test-temporary-file-directory) |
| 1290 | (tmp-name1 (tramp--test-make-temp-name)) | 1260 | (tmp-name1 (tramp--test-make-temp-name)) |
| @@ -1326,9 +1296,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1326 | (ert-deftest tramp-test30-utf8 () | 1296 | (ert-deftest tramp-test30-utf8 () |
| 1327 | "Check UTF8 encoding in file names and file contents." | 1297 | "Check UTF8 encoding in file names and file contents." |
| 1328 | (skip-unless (tramp--test-enabled)) | 1298 | (skip-unless (tramp--test-enabled)) |
| 1329 | (tramp-cleanup-connection | ||
| 1330 | (tramp-dissect-file-name tramp-test-temporary-file-directory) | ||
| 1331 | nil 'keep-password) | ||
| 1332 | 1299 | ||
| 1333 | (let ((tmp-name (tramp--test-make-temp-name)) | 1300 | (let ((tmp-name (tramp--test-make-temp-name)) |
| 1334 | (coding-system-for-read 'utf-8) | 1301 | (coding-system-for-read 'utf-8) |