emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master d640ec2: New test for src/process.c on MS-Windows


From: Eli Zaretskii
Subject: master d640ec2: New test for src/process.c on MS-Windows
Date: Sat, 6 Feb 2021 13:19:41 -0500 (EST)

branch: master
commit d640ec27183c9424daaf2d5dcb683ed1ff39d036
Author: Ioannis Kappas <ioannis.kappas@gmail.com>
Commit: Eli Zaretskii <eliz@gnu.org>

    New test for src/process.c on MS-Windows
    
    * test/src/process-tests.el (process-sentinel-interrupt-event):
    New test.  (Bug#46284)
    
    Copyright-paperwork-exempt: yes
---
 test/src/process-tests.el | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/test/src/process-tests.el b/test/src/process-tests.el
index a3fba8d..950d081 100644
--- a/test/src/process-tests.el
+++ b/test/src/process-tests.el
@@ -879,5 +879,34 @@ Return nil if FILENAME doesn't exist."
          (file-regular-p filename)
          filename)))
 
+;; Bug#46284
+(ert-deftest process-sentinel-interrupt-event ()
+  "Test that interrupting a process on MS-Windows sends the
+  \"interrupt\" event to the process sentinel."
+  (skip-unless (eq system-type 'windows-nt))
+  (with-temp-buffer
+    (let* ((proc-buf (current-buffer))
+          ;; Start a new emacs process to wait idly until interrupted.
+          (cmd "emacs -batch --eval=\"(sit-for 50000)\"")
+          (proc (start-file-process-shell-command
+                  "test/process-sentinel-signal-event" proc-buf cmd))
+          (events '()))
+
+      ;; Capture any incoming events.
+      (set-process-sentinel proc
+                            (lambda (proc event)
+                             (push event events)))
+      ;; Wait for the process to start.
+      (sleep-for 2)
+      (should (equal 'run (process-status proc)))
+      ;; Interrupt the sub-process and wait for it to die.
+      (interrupt-process proc)
+      (sleep-for 2)
+      ;; Should have received SIGINT...
+      (should (equal 'signal (process-status proc)))
+      (should (equal 2 (process-exit-status proc)))
+      ;; ...and the change description should be "interrupt".
+      (should (equal '("interrupt\n") events)))))
+
 (provide 'process-tests)
 ;;; process-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]