1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-22 07:09:54 +00:00

Make a process test faster.

The test 'process-tests/fd-setsize-no-crash/make-process' used to call
'sleep' to ensure that enough processes are live to trigger a
FD_SETSIZE overflow.  However, we can just call 'cat' instead and
close standard input when done.  That way, we only wait as long as
needed.

* process-tests.el
(process-tests/fd-setsize-no-crash/make-process): Invoke 'cat' instead
of 'sleep'.  Close standard input to exit the 'cat' processes.
This commit is contained in:
Philipp Stephani 2021-01-02 13:53:17 +01:00
parent df605870fd
commit 64f2c96cbe

View File

@ -535,8 +535,8 @@ Afterwards, delete the directory."
"Check that Emacs doesn't crash when trying to use more than
FD_SETSIZE file descriptors (Bug#24325)."
(with-timeout (60 (ert-fail "Test timed out"))
(let ((sleep (executable-find "sleep")))
(skip-unless sleep)
(let ((cat (executable-find "cat")))
(skip-unless cat)
(dolist (conn-type '(pipe pty))
(ert-info ((format "Connection type `%s'" conn-type))
(process-tests--fd-setsize-test
@ -552,7 +552,7 @@ FD_SETSIZE file descriptors (Bug#24325)."
;; ignore `file-error'.
(process-tests--ignore-EMFILE
(make-process :name (format "test %d" i)
:command (list sleep "5")
:command (list cat)
:connection-type conn-type
:coding 'no-conversion
:noquery t))))
@ -560,6 +560,8 @@ FD_SETSIZE file descriptors (Bug#24325)."
;; We should have managed to start at least one process.
(should processes)
(dolist (process processes)
(should (process-live-p process))
(process-send-eof process)
(while (accept-process-output process))
(should (eq (process-status process) 'exit))
;; If there's an error between fork and exec, Emacs