Commit 7fc27ea7 authored by Eli Zaretskii's avatar Eli Zaretskii

Fix crashing emacs-module tests on MS-Windows

* src/w32fns.c (syms_of_w32fns) <w32-disable-abort-dialog>: New
(emacs_abort): If w32-disable-abort-dialog is non-nil, abort right
away, without displaying the Abort dialog, which waits for the user.

* test/src/emacs-module-tests.el (module--test-assertion): Run the
inferior Emacs with the w32 abort dialog disabled.  Expect the
status of the aborted Emacs sub-process to be 3 on MS-Windows and
2 on MS-DOS.
parent da4438e1
......@@ -10708,6 +10708,11 @@ default value t means to add the width of one canonical character of the
tip frame. */);
Vw32_tooltip_extra_pixels = Qt;
DEFVAR_BOOL ("w32-disable-abort-dialog",
doc: /* Non-nil means don't display the abort dialog when aborting. */);
w32_disable_abort_dialog = 0;
#if 0 /* TODO: Port to W32 */
defsubr (&Sx_change_window_property);
defsubr (&Sx_delete_window_property);
......@@ -10902,6 +10907,9 @@ w32_backtrace (void **buffer, int limit)
emacs_abort (void)
if (w32_disable_abort_dialog)
abort ();
int button;
button = MessageBox (NULL,
"A fatal error has occurred!\n\n"
......@@ -208,14 +208,22 @@ must evaluate to a regular expression string."
(let* ((default-directory tempdir)
(status (call-process mod-test-emacs nil t nil
"-batch" "-Q" "-module-assertions" "-eval"
"-batch" "-Q" "-module-assertions"
"-eval" "(setq w32-disable-abort-dialog t)"
(require 'mod-test ,mod-test-file)
(should (stringp status))
;; eg "Aborted" or "Abort trap: 6"
(should (string-prefix-p "Abort" status))
;; Aborting doesn't raise a signal on MS-DOS/Windows, but
;; rather exits with a non-zero status: 2 on MS-DOS (see
;; msdos.c:msdos_abort), 3 on Windows, per MSDN documentation
;; of 'abort'.
(if (memq system-type '(ms-dos windows-nt))
(should (>= status 2))
(should (stringp status))
;; eg "Aborted" or "Abort trap: 6"
(should (string-prefix-p "Abort" status)))
(search-backward "Emacs module assertion: ")
(goto-char (match-end 0))
(should (string-match-p ,pattern
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment