diff options
author | Yuuki Harano <masm+github@masm11.me> | 2021-01-30 23:37:19 +0900 |
---|---|---|
committer | Yuuki Harano <masm+github@masm11.me> | 2021-01-30 23:37:19 +0900 |
commit | 50c76b844bc79309b4f5d9e28a2386b9a6f735b7 (patch) | |
tree | 29f8273d8afccae1f16b723c36548cee150cb0bc /test/src/process-tests.el | |
parent | 563a0d94c379292bd88e83f18560ed21c497cea9 (diff) | |
parent | 96f20120c97a0a329fff81a0cc3747082a8a2c55 (diff) | |
download | emacs-50c76b844bc79309b4f5d9e28a2386b9a6f735b7.tar.gz emacs-50c76b844bc79309b4f5d9e28a2386b9a6f735b7.tar.bz2 emacs-50c76b844bc79309b4f5d9e28a2386b9a6f735b7.zip |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'test/src/process-tests.el')
-rw-r--r-- | test/src/process-tests.el | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 949f73595b4..a3fba8d328b 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -789,6 +789,36 @@ have written output." (should (equal calls (list (list process "finished\n")))))))))) +(ert-deftest process-tests/multiple-threads-waiting () + (skip-unless (fboundp 'make-thread)) + (with-timeout (60 (ert-fail "Test timed out")) + (process-tests--with-processes processes + (let ((threads ()) + (cat (executable-find "cat"))) + (skip-unless cat) + (dotimes (i 10) + (let* ((name (format "test %d" i)) + (process (make-process :name name + :command (list cat) + :coding 'no-conversion + :noquery t + :connection-type 'pipe))) + (push process processes) + (set-process-thread process nil) + (push (make-thread + (lambda () + (while (accept-process-output process))) + name) + threads))) + (mapc #'process-send-eof processes) + (cl-loop for process in processes + and thread in threads + do + (should-not (thread-join thread)) + (should-not (thread-last-error)) + (should (eq (process-status process) 'exit)) + (should (eql (process-exit-status process) 0))))))) + (defun process-tests--eval (command form) "Return a command that evaluates FORM in an Emacs subprocess. COMMAND must be a list returned by |