summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJim Porter <jporterbugs@gmail.com>2026-05-17 15:35:44 -0700
committerJim Porter <jporterbugs@gmail.com>2026-05-17 17:24:10 -0700
commita557bf69b49ada1e777f9f031e975ce15ccbc2e7 (patch)
tree0a4c6db9d8b606c1161280c588712577fd421ffb /test
parent7626993c6fce9a9a71d4406ffdb1d14c462675b6 (diff)
Ensure that process-tests clean up test processes
* test/src/process-tests.el (start-process-should-not-modify-arguments): Clean up test process. (process-test--check-pipe-process): New macro... (process-test-make-pipe-process-no-buffer): ... call it.
Diffstat (limited to 'test')
-rw-r--r--test/src/process-tests.el31
1 files changed, 21 insertions, 10 deletions
diff --git a/test/src/process-tests.el b/test/src/process-tests.el
index 55657a23fa9..e854d3d3b87 100644
--- a/test/src/process-tests.el
+++ b/test/src/process-tests.el
@@ -189,13 +189,17 @@ process to complete."
;; convert forward slashes to backslashes.
(expand-file-name (executable-find "attrib.exe")))
(_ "/bin//sh")))
- (samepath (copy-sequence path)))
- ;; Make sure 'start-process' actually goes all the way and invokes
- ;; the program.
- (should (process-live-p (condition-case nil
- (start-process "" nil path)
- (error nil))))
- (should (equal path samepath)))))
+ (samepath (copy-sequence path))
+ (process (condition-case nil
+ (start-process "" nil path)
+ (error nil))))
+ (unwind-protect
+ (progn
+ ;; Make sure 'start-process' actually goes all the way and
+ ;; invokes the program.
+ (should (process-live-p process))
+ (should (equal path samepath)))
+ (delete-process process)))))
(ert-deftest make-process/noquery-stderr ()
"Checks that Bug#30031 is fixed."
@@ -1056,11 +1060,18 @@ Return nil if FILENAME doesn't exist."
(should (integerp (num-processors)))
(should (< 0 (num-processors))))
+(defmacro process-test--check-pipe-process (args should-have-buffer)
+ `(let ((pipe-process (make-pipe-process ,@args)))
+ (unwind-protect
+ (,(if should-have-buffer 'should 'should-not)
+ (process-buffer pipe-process))
+ (delete-process pipe-process))))
+
(ert-deftest process-test-make-pipe-process-no-buffer ()
"Test that a pipe process can be created without a buffer."
- (should (process-buffer (make-pipe-process :name "test")))
- (should (process-buffer (make-pipe-process :name "test" :buffer "test")))
- (should-not (process-buffer (make-pipe-process :name "test" :buffer nil))))
+ (process-test--check-pipe-process (:name "test") t)
+ (process-test--check-pipe-process (:name "test" :buffer "test") t)
+ (process-test--check-pipe-process (:name "test" :buffer nil) nil))
(provide 'process-tests)
;;; process-tests.el ends here