aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2017-08-20 21:18:05 +0200
committerMichael Albinus2017-08-20 21:18:05 +0200
commit296472f5c5db2b5c046af67f74dff2640e7127c2 (patch)
treedcbb6795ed345c4a11af70a83bc3245ab911f78b /test
parentcf74c27ba1401aba216267b5a9900e659d1b2a25 (diff)
downloademacs-296472f5c5db2b5c046af67f74dff2640e7127c2.tar.gz
emacs-296472f5c5db2b5c046af67f74dff2640e7127c2.zip
Implement `interrupt-process' for remote processes (Bug#28066)
* lisp/net/tramp-sh.el (tramp-sh-handle-start-file-process): Support sending signals remotely. (tramp-open-connection-setup-interactive-shell): Trace "remote-tty" connection property. * lisp/net/tramp.el (tramp-advice-interrupt-process): New defun. (top): Add advice to `interrupt-process'. (Bug#28066) * test/lisp/net/tramp-tests.el (tramp-test28-interrupt-process): New test. (tramp-test29-shell-command) (tramp-test30-environment-variables) (tramp-test30-environment-variables-and-port-numbers) (tramp-test31-explicit-shell-file-name) (tramp-test32-vc-registered) (tramp-test33-make-auto-save-file-name) (tramp-test34-make-nearby-temp-file) (tramp-test35-special-characters) (tramp-test35-special-characters-with-stat) (tramp-test35-special-characters-with-perl) (tramp-test35-special-characters-with-ls, tramp-test36-utf8) (tramp-test36-utf8-with-stat, tramp-test36-utf8-with-perl) (tramp-test36-utf8-with-ls) (tramp-test37-asynchronous-requests) (tramp-test38-recursive-load, tramp-test39-remote-load-path) (tramp-test40-unload): Rename. (tramp-test40-unload): Test also removal of advice.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/tramp-tests.el68
1 files changed, 45 insertions, 23 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 9dc276b2a93..dba553a2c5e 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2900,7 +2900,26 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
2900 ;; Cleanup. 2900 ;; Cleanup.
2901 (ignore-errors (delete-process proc)))))) 2901 (ignore-errors (delete-process proc))))))
2902 2902
2903(ert-deftest tramp-test28-shell-command () 2903(ert-deftest tramp-test28-interrupt-process ()
2904 "Check `interrupt-process'."
2905 :tags '(:expensive-test)
2906 (skip-unless (tramp--test-enabled))
2907 (skip-unless (tramp--test-sh-p))
2908
2909 (let ((default-directory tramp-test-temporary-file-directory)
2910 kill-buffer-query-functions proc)
2911 (unwind-protect
2912 (with-temp-buffer
2913 (setq proc (start-file-process "test" (current-buffer) "sleep" "10"))
2914 (should (processp proc))
2915 (should (equal (process-status proc) 'run))
2916 (interrupt-process proc)
2917 (should (equal (process-status proc) 'signal)))
2918
2919 ;; Cleanup.
2920 (ignore-errors (delete-process proc)))))
2921
2922(ert-deftest tramp-test29-shell-command ()
2904 "Check `shell-command'." 2923 "Check `shell-command'."
2905 :tags '(:expensive-test) 2924 :tags '(:expensive-test)
2906 (skip-unless (tramp--test-enabled)) 2925 (skip-unless (tramp--test-enabled))
@@ -3004,7 +3023,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3004 (buffer-substring-no-properties (point-min) (point-max)))) 3023 (buffer-substring-no-properties (point-min) (point-max))))
3005 3024
3006;; This test is inspired by Bug#23952. 3025;; This test is inspired by Bug#23952.
3007(ert-deftest tramp-test29-environment-variables () 3026(ert-deftest tramp-test30-environment-variables ()
3008 "Check that remote processes set / unset environment variables properly." 3027 "Check that remote processes set / unset environment variables properly."
3009 :tags '(:expensive-test) 3028 :tags '(:expensive-test)
3010 (skip-unless (tramp--test-enabled)) 3029 (skip-unless (tramp--test-enabled))
@@ -3082,7 +3101,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3082 (funcall this-shell-command-to-string "set"))))))))) 3101 (funcall this-shell-command-to-string "set")))))))))
3083 3102
3084;; This test is inspired by Bug#27009. 3103;; This test is inspired by Bug#27009.
3085(ert-deftest tramp-test29-environment-variables-and-port-numbers () 3104(ert-deftest tramp-test30-environment-variables-and-port-numbers ()
3086 "Check that two connections with separate ports are different." 3105 "Check that two connections with separate ports are different."
3087 (skip-unless (tramp--test-enabled)) 3106 (skip-unless (tramp--test-enabled))
3088 ;; We test it only for the mock-up connection; otherwise there might 3107 ;; We test it only for the mock-up connection; otherwise there might
@@ -3121,7 +3140,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3121 (tramp-cleanup-connection (tramp-dissect-file-name dir))))) 3140 (tramp-cleanup-connection (tramp-dissect-file-name dir)))))
3122 3141
3123;; The functions were introduced in Emacs 26.1. 3142;; The functions were introduced in Emacs 26.1.
3124(ert-deftest tramp-test30-explicit-shell-file-name () 3143(ert-deftest tramp-test31-explicit-shell-file-name ()
3125 "Check that connection-local `explicit-shell-file-name' is set." 3144 "Check that connection-local `explicit-shell-file-name' is set."
3126 :tags '(:expensive-test) 3145 :tags '(:expensive-test)
3127 (skip-unless (tramp--test-enabled)) 3146 (skip-unless (tramp--test-enabled))
@@ -3165,7 +3184,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3165 (put 'explicit-shell-file-name 'permanent-local nil) 3184 (put 'explicit-shell-file-name 'permanent-local nil)
3166 (kill-buffer "*shell*")))) 3185 (kill-buffer "*shell*"))))
3167 3186
3168(ert-deftest tramp-test31-vc-registered () 3187(ert-deftest tramp-test32-vc-registered ()
3169 "Check `vc-registered'." 3188 "Check `vc-registered'."
3170 :tags '(:expensive-test) 3189 :tags '(:expensive-test)
3171 (skip-unless (tramp--test-enabled)) 3190 (skip-unless (tramp--test-enabled))
@@ -3238,7 +3257,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3238 ;; Cleanup. 3257 ;; Cleanup.
3239 (ignore-errors (delete-directory tmp-name1 'recursive)))))) 3258 (ignore-errors (delete-directory tmp-name1 'recursive))))))
3240 3259
3241(ert-deftest tramp-test32-make-auto-save-file-name () 3260(ert-deftest tramp-test33-make-auto-save-file-name ()
3242 "Check `make-auto-save-file-name'." 3261 "Check `make-auto-save-file-name'."
3243 (skip-unless (tramp--test-enabled)) 3262 (skip-unless (tramp--test-enabled))
3244 3263
@@ -3333,7 +3352,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3333 (ignore-errors (delete-directory tmp-name2 'recursive)))))) 3352 (ignore-errors (delete-directory tmp-name2 'recursive))))))
3334 3353
3335;; The functions were introduced in Emacs 26.1. 3354;; The functions were introduced in Emacs 26.1.
3336(ert-deftest tramp-test33-make-nearby-temp-file () 3355(ert-deftest tramp-test34-make-nearby-temp-file ()
3337 "Check `make-nearby-temp-file' and `temporary-file-directory'." 3356 "Check `make-nearby-temp-file' and `temporary-file-directory'."
3338 (skip-unless (tramp--test-enabled)) 3357 (skip-unless (tramp--test-enabled))
3339 ;; Since Emacs 26.1. 3358 ;; Since Emacs 26.1.
@@ -3600,7 +3619,7 @@ This requires restrictions of file name syntax."
3600 (ignore-errors (delete-directory tmp-name2 'recursive)))))) 3619 (ignore-errors (delete-directory tmp-name2 'recursive))))))
3601 3620
3602(defun tramp--test-special-characters () 3621(defun tramp--test-special-characters ()
3603 "Perform the test in `tramp-test34-special-characters*'." 3622 "Perform the test in `tramp-test35-special-characters*'."
3604 ;; Newlines, slashes and backslashes in file names are not 3623 ;; Newlines, slashes and backslashes in file names are not
3605 ;; supported. So we don't test. And we don't test the tab 3624 ;; supported. So we don't test. And we don't test the tab
3606 ;; character on Windows or Cygwin, because the backslash is 3625 ;; character on Windows or Cygwin, because the backslash is
@@ -3643,7 +3662,7 @@ This requires restrictions of file name syntax."
3643 "{foo}bar{baz}")) 3662 "{foo}bar{baz}"))
3644 3663
3645;; These tests are inspired by Bug#17238. 3664;; These tests are inspired by Bug#17238.
3646(ert-deftest tramp-test34-special-characters () 3665(ert-deftest tramp-test35-special-characters ()
3647 "Check special characters in file names." 3666 "Check special characters in file names."
3648 (skip-unless (tramp--test-enabled)) 3667 (skip-unless (tramp--test-enabled))
3649 (skip-unless (not (tramp--test-rsync-p))) 3668 (skip-unless (not (tramp--test-rsync-p)))
@@ -3651,7 +3670,7 @@ This requires restrictions of file name syntax."
3651 3670
3652 (tramp--test-special-characters)) 3671 (tramp--test-special-characters))
3653 3672
3654(ert-deftest tramp-test34-special-characters-with-stat () 3673(ert-deftest tramp-test35-special-characters-with-stat ()
3655 "Check special characters in file names. 3674 "Check special characters in file names.
3656Use the `stat' command." 3675Use the `stat' command."
3657 :tags '(:expensive-test) 3676 :tags '(:expensive-test)
@@ -3669,7 +3688,7 @@ Use the `stat' command."
3669 tramp-connection-properties))) 3688 tramp-connection-properties)))
3670 (tramp--test-special-characters))) 3689 (tramp--test-special-characters)))
3671 3690
3672(ert-deftest tramp-test34-special-characters-with-perl () 3691(ert-deftest tramp-test35-special-characters-with-perl ()
3673 "Check special characters in file names. 3692 "Check special characters in file names.
3674Use the `perl' command." 3693Use the `perl' command."
3675 :tags '(:expensive-test) 3694 :tags '(:expensive-test)
@@ -3690,7 +3709,7 @@ Use the `perl' command."
3690 tramp-connection-properties))) 3709 tramp-connection-properties)))
3691 (tramp--test-special-characters))) 3710 (tramp--test-special-characters)))
3692 3711
3693(ert-deftest tramp-test34-special-characters-with-ls () 3712(ert-deftest tramp-test35-special-characters-with-ls ()
3694 "Check special characters in file names. 3713 "Check special characters in file names.
3695Use the `ls' command." 3714Use the `ls' command."
3696 :tags '(:expensive-test) 3715 :tags '(:expensive-test)
@@ -3713,7 +3732,7 @@ Use the `ls' command."
3713 (tramp--test-special-characters))) 3732 (tramp--test-special-characters)))
3714 3733
3715(defun tramp--test-utf8 () 3734(defun tramp--test-utf8 ()
3716 "Perform the test in `tramp-test35-utf8*'." 3735 "Perform the test in `tramp-test36-utf8*'."
3717 (let* ((utf8 (if (and (eq system-type 'darwin) 3736 (let* ((utf8 (if (and (eq system-type 'darwin)
3718 (memq 'utf-8-hfs (coding-system-list))) 3737 (memq 'utf-8-hfs (coding-system-list)))
3719 'utf-8-hfs 'utf-8)) 3738 'utf-8-hfs 'utf-8))
@@ -3728,7 +3747,7 @@ Use the `ls' command."
3728 "银河系漫游指南系列" 3747 "银河系漫游指南系列"
3729 "Автостопом по гала́ктике"))) 3748 "Автостопом по гала́ктике")))
3730 3749
3731(ert-deftest tramp-test35-utf8 () 3750(ert-deftest tramp-test36-utf8 ()
3732 "Check UTF8 encoding in file names and file contents." 3751 "Check UTF8 encoding in file names and file contents."
3733 (skip-unless (tramp--test-enabled)) 3752 (skip-unless (tramp--test-enabled))
3734 (skip-unless (not (tramp--test-docker-p))) 3753 (skip-unless (not (tramp--test-docker-p)))
@@ -3738,7 +3757,7 @@ Use the `ls' command."
3738 3757
3739 (tramp--test-utf8)) 3758 (tramp--test-utf8))
3740 3759
3741(ert-deftest tramp-test35-utf8-with-stat () 3760(ert-deftest tramp-test36-utf8-with-stat ()
3742 "Check UTF8 encoding in file names and file contents. 3761 "Check UTF8 encoding in file names and file contents.
3743Use the `stat' command." 3762Use the `stat' command."
3744 :tags '(:expensive-test) 3763 :tags '(:expensive-test)
@@ -3758,7 +3777,7 @@ Use the `stat' command."
3758 tramp-connection-properties))) 3777 tramp-connection-properties)))
3759 (tramp--test-utf8))) 3778 (tramp--test-utf8)))
3760 3779
3761(ert-deftest tramp-test35-utf8-with-perl () 3780(ert-deftest tramp-test36-utf8-with-perl ()
3762 "Check UTF8 encoding in file names and file contents. 3781 "Check UTF8 encoding in file names and file contents.
3763Use the `perl' command." 3782Use the `perl' command."
3764 :tags '(:expensive-test) 3783 :tags '(:expensive-test)
@@ -3781,7 +3800,7 @@ Use the `perl' command."
3781 tramp-connection-properties))) 3800 tramp-connection-properties)))
3782 (tramp--test-utf8))) 3801 (tramp--test-utf8)))
3783 3802
3784(ert-deftest tramp-test35-utf8-with-ls () 3803(ert-deftest tramp-test36-utf8-with-ls ()
3785 "Check UTF8 encoding in file names and file contents. 3804 "Check UTF8 encoding in file names and file contents.
3786Use the `ls' command." 3805Use the `ls' command."
3787 :tags '(:expensive-test) 3806 :tags '(:expensive-test)
@@ -3809,7 +3828,7 @@ Use the `ls' command."
3809 (ert-fail (format "`%s' timed out" (ert-test-name (ert-running-test))))) 3828 (ert-fail (format "`%s' timed out" (ert-test-name (ert-running-test)))))
3810 3829
3811;; This test is inspired by Bug#16928. 3830;; This test is inspired by Bug#16928.
3812(ert-deftest tramp-test36-asynchronous-requests () 3831(ert-deftest tramp-test37-asynchronous-requests ()
3813 "Check parallel asynchronous requests. 3832 "Check parallel asynchronous requests.
3814Such requests could arrive from timers, process filters and 3833Such requests could arrive from timers, process filters and
3815process sentinels. They shall not disturb each other." 3834process sentinels. They shall not disturb each other."
@@ -3966,7 +3985,7 @@ process sentinels. They shall not disturb each other."
3966 (ignore-errors (cancel-timer timer)) 3985 (ignore-errors (cancel-timer timer))
3967 (ignore-errors (delete-directory tmp-name 'recursive))))))) 3986 (ignore-errors (delete-directory tmp-name 'recursive)))))))
3968 3987
3969(ert-deftest tramp-test37-recursive-load () 3988(ert-deftest tramp-test38-recursive-load ()
3970 "Check that Tramp does not fail due to recursive load." 3989 "Check that Tramp does not fail due to recursive load."
3971 (skip-unless (tramp--test-enabled)) 3990 (skip-unless (tramp--test-enabled))
3972 3991
@@ -3989,7 +4008,7 @@ process sentinels. They shall not disturb each other."
3989 (mapconcat 'shell-quote-argument load-path " -L ") 4008 (mapconcat 'shell-quote-argument load-path " -L ")
3990 (shell-quote-argument code)))))))) 4009 (shell-quote-argument code))))))))
3991 4010
3992(ert-deftest tramp-test38-remote-load-path () 4011(ert-deftest tramp-test39-remote-load-path ()
3993 "Check that Tramp autoloads its packages with remote `load-path'." 4012 "Check that Tramp autoloads its packages with remote `load-path'."
3994 ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el. 4013 ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el.
3995 ;; It shall still work, when a remote file name is in the 4014 ;; It shall still work, when a remote file name is in the
@@ -4012,7 +4031,7 @@ process sentinels. They shall not disturb each other."
4012 (mapconcat 'shell-quote-argument load-path " -L ") 4031 (mapconcat 'shell-quote-argument load-path " -L ")
4013 (shell-quote-argument code))))))) 4032 (shell-quote-argument code)))))))
4014 4033
4015(ert-deftest tramp-test39-unload () 4034(ert-deftest tramp-test40-unload ()
4016 "Check that Tramp and its subpackages unload completely. 4035 "Check that Tramp and its subpackages unload completely.
4017Since it unloads Tramp, it shall be the last test to run." 4036Since it unloads Tramp, it shall be the last test to run."
4018 :tags '(:expensive-test) 4037 :tags '(:expensive-test)
@@ -4053,7 +4072,10 @@ Since it unloads Tramp, it shall be the last test to run."
4053 (not (string-match "unload-hook$" (symbol-name x))) 4072 (not (string-match "unload-hook$" (symbol-name x)))
4054 (consp (symbol-value x)) 4073 (consp (symbol-value x))
4055 (ignore-errors (all-completions "tramp" (symbol-value x))) 4074 (ignore-errors (all-completions "tramp" (symbol-value x)))
4056 (ert-fail (format "Hook `%s' still contains Tramp function" x))))))) 4075 (ert-fail (format "Hook `%s' still contains Tramp function" x)))))
4076 ;; The advice on `interrupt-process' shall be removed.
4077 (should-not
4078 (advice-member-p 'tramp-advice-interrupt-process 'interrupt-process))))
4057 4079
4058;; TODO: 4080;; TODO:
4059 4081
@@ -4070,7 +4092,7 @@ Since it unloads Tramp, it shall be the last test to run."
4070;; * Fix `tramp-test05-expand-file-name-relative' in `expand-file-name'. 4092;; * Fix `tramp-test05-expand-file-name-relative' in `expand-file-name'.
4071;; * Fix `tramp-test06-directory-file-name' for `ftp'. 4093;; * Fix `tramp-test06-directory-file-name' for `ftp'.
4072;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). 4094;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?).
4073;; * Fix Bug#16928 in `tramp-test36-asynchronous-requests'. 4095;; * Fix Bug#16928 in `tramp-test37-asynchronous-requests'.
4074 4096
4075(defun tramp-test-all (&optional interactive) 4097(defun tramp-test-all (&optional interactive)
4076 "Run all tests for \\[tramp]." 4098 "Run all tests for \\[tramp]."