aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
authorMichael Albinus2019-11-04 17:34:31 +0100
committerMichael Albinus2019-11-04 17:34:31 +0100
commitdd19cc3aa16ccc441a8a2bfcdeb3005a6eef2543 (patch)
tree42bd79ad2020a595244d981f0598b6e4595191bc /test/lisp
parenta256e03bd944384efb3da05858264a5d3b72462d (diff)
downloademacs-dd19cc3aa16ccc441a8a2bfcdeb3005a6eef2543.tar.gz
emacs-dd19cc3aa16ccc441a8a2bfcdeb3005a6eef2543.zip
Improve Tramp error handling
* lisp/net/tramp.el (tramp-set-syntax): Add missing argument. (tramp-signal-hook-function): Make it more robust. (tramp-handle-directory-files): * lisp/net/tramp-adb.el (tramp-adb-handle-directory-files-and-attributes) (tramp-adb-handle-copy-file, tramp-adb-handle-rename-file): * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file): * lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file) (tramp-rclone-handle-directory-files): * lisp/net/tramp-sh.el (tramp-sh-handle-directory-files-and-attributes) (tramp-sh-handle-copy-directory, tramp-do-copy-or-rename-file): * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory) (tramp-smb-handle-copy-file, tramp-smb-handle-directory-files) (tramp-smb-handle-rename-file): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file): Improve error handling. * test/lisp/net/tramp-tests.el (tramp-test11-copy-file) (tramp-test12-rename-file, tramp-test14-delete-directory) (tramp-test15-copy-directory, tramp-test16-directory-files) (tramp-test19-directory-files-and-attributes): Extend tests.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/net/tramp-tests.el44
1 files changed, 32 insertions, 12 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index baebae17e1f..ec9cda0bbdd 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2370,6 +2370,9 @@ This checks also `file-name-as-directory', `file-name-directory',
2370 ;; Copy simple file. 2370 ;; Copy simple file.
2371 (unwind-protect 2371 (unwind-protect
2372 (progn 2372 (progn
2373 (should-error
2374 (copy-file source target)
2375 :type tramp-file-missing)
2373 (write-region "foo" nil source) 2376 (write-region "foo" nil source)
2374 (should (file-exists-p source)) 2377 (should (file-exists-p source))
2375 (copy-file source target) 2378 (copy-file source target)
@@ -2482,6 +2485,9 @@ This checks also `file-name-as-directory', `file-name-directory',
2482 ;; Rename simple file. 2485 ;; Rename simple file.
2483 (unwind-protect 2486 (unwind-protect
2484 (progn 2487 (progn
2488 (should-error
2489 (rename-file source target)
2490 :type tramp-file-missing)
2485 (write-region "foo" nil source) 2491 (write-region "foo" nil source)
2486 (should (file-exists-p source)) 2492 (should (file-exists-p source))
2487 (rename-file source target) 2493 (rename-file source target)
@@ -2605,20 +2611,25 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
2605 (skip-unless (tramp--test-enabled)) 2611 (skip-unless (tramp--test-enabled))
2606 2612
2607 (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) 2613 (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
2608 (let ((tmp-name (tramp--test-make-temp-name nil quoted))) 2614 (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
2615 (tmp-name2 (expand-file-name "foo" tmp-name1)))
2609 ;; Delete empty directory. 2616 ;; Delete empty directory.
2610 (make-directory tmp-name) 2617 (make-directory tmp-name1)
2611 (should (file-directory-p tmp-name)) 2618 (should (file-directory-p tmp-name1))
2612 (delete-directory tmp-name) 2619 (delete-directory tmp-name1)
2613 (should-not (file-directory-p tmp-name)) 2620 (should-not (file-directory-p tmp-name1))
2614 ;; Delete non-empty directory. 2621 ;; Delete non-empty directory.
2615 (make-directory tmp-name) 2622 (make-directory tmp-name1)
2616 (should (file-directory-p tmp-name)) 2623 (should (file-directory-p tmp-name1))
2617 (write-region "foo" nil (expand-file-name "bla" tmp-name)) 2624 (write-region "foo" nil (expand-file-name "bla" tmp-name1))
2618 (should (file-exists-p (expand-file-name "bla" tmp-name))) 2625 (should (file-exists-p (expand-file-name "bla" tmp-name1)))
2619 (should-error (delete-directory tmp-name) :type 'file-error) 2626 (make-directory tmp-name2)
2620 (delete-directory tmp-name 'recursive) 2627 (should (file-directory-p tmp-name2))
2621 (should-not (file-directory-p tmp-name))))) 2628 (write-region "foo" nil (expand-file-name "bla" tmp-name2))
2629 (should (file-exists-p (expand-file-name "bla" tmp-name2)))
2630 (should-error (delete-directory tmp-name1) :type 'file-error)
2631 (delete-directory tmp-name1 'recursive)
2632 (should-not (file-directory-p tmp-name1)))))
2622 2633
2623(ert-deftest tramp-test15-copy-directory () 2634(ert-deftest tramp-test15-copy-directory ()
2624 "Check `copy-directory'." 2635 "Check `copy-directory'."
@@ -2636,6 +2647,9 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
2636 ;; Copy complete directory. 2647 ;; Copy complete directory.
2637 (unwind-protect 2648 (unwind-protect
2638 (progn 2649 (progn
2650 (should-error
2651 (copy-directory tmp-name1 tmp-name2)
2652 :type tramp-file-missing)
2639 ;; Copy empty directory. 2653 ;; Copy empty directory.
2640 (make-directory tmp-name1) 2654 (make-directory tmp-name1)
2641 (write-region "foo" nil tmp-name4) 2655 (write-region "foo" nil tmp-name4)
@@ -2696,6 +2710,9 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
2696 (tmp-name3 (expand-file-name "foo" tmp-name1))) 2710 (tmp-name3 (expand-file-name "foo" tmp-name1)))
2697 (unwind-protect 2711 (unwind-protect
2698 (progn 2712 (progn
2713 (should-error
2714 (directory-files tmp-name1)
2715 :type tramp-file-missing)
2699 (make-directory tmp-name1) 2716 (make-directory tmp-name1)
2700 (write-region "foo" nil tmp-name2) 2717 (write-region "foo" nil tmp-name2)
2701 (write-region "bla" nil tmp-name3) 2718 (write-region "bla" nil tmp-name3)
@@ -3174,6 +3191,9 @@ They might differ only in time attributes or directory size."
3174 attr) 3191 attr)
3175 (unwind-protect 3192 (unwind-protect
3176 (progn 3193 (progn
3194 (should-error
3195 (directory-files-and-attributes tmp-name1)
3196 :type tramp-file-missing)
3177 (make-directory tmp-name1) 3197 (make-directory tmp-name1)
3178 (should (file-directory-p tmp-name1)) 3198 (should (file-directory-p tmp-name1))
3179 (setq tramp--test-start-time 3199 (setq tramp--test-start-time