emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master ab2116c: Clean up after module assertion tests


From: Glenn Morris
Subject: [Emacs-diffs] master ab2116c: Clean up after module assertion tests
Date: Mon, 12 Jun 2017 17:31:42 -0400 (EDT)

branch: master
commit ab2116c9a951cdaf269311a31a8b3da79834742f
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    Clean up after module assertion tests
    
    * test/src/emacs-module-tests.el (module--test-assertions):
    Use a temporary directory to contain any core dumps.
---
 test/src/emacs-module-tests.el | 44 +++++++++++++++++++++++-------------------
 1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 502143d..aea0bba 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -187,25 +187,29 @@ changes."
   (skip-unless (file-executable-p mod-test-emacs))
   ;; This doesn’t yet cause undefined behavior.
   (should (eq (mod-test-invalid-store) 123))
-  (with-temp-buffer
-    ;; FIXME this dumps a core file if the user has them enabled,
-    ;; which seems unfriendly.
-    (should (string-match-p
-             "Abort" ; eg "Aborted" or "Abort trap: 6"
-             (call-process mod-test-emacs nil t nil
-                           "-batch" "-Q" "-module-assertions" "-eval"
-                           (prin1-to-string
-                            `(progn
-                               (require 'mod-test ,mod-test-file)
-                               ;; Storing and reloading a local value
-                               ;; causes undefined behavior, which should be
-                               ;; detected by the module assertions.
-                               (mod-test-invalid-store)
-                               (mod-test-invalid-load))))))
-    ;; FIXME a failure here gives an uninformative error.
-    (re-search-backward (rx bos "Emacs module assertion: "
-                            "Emacs value not found in "
-                            (+ digit) " values of "
-                            (+ digit) " environments" ?\n eos))))
+  ;; To contain any core dumps.
+  (let ((tempdir (make-temp-file "emacs-module-test" t)))
+    (unwind-protect
+        (with-temp-buffer
+          (should (string-match-p
+                   "Abort" ; eg "Aborted" or "Abort trap: 6"
+                   (let ((default-directory tempdir))
+                     (call-process mod-test-emacs nil t nil
+                                   "-batch" "-Q" "-module-assertions" "-eval"
+                                   (prin1-to-string
+                                    `(progn
+                                       (require 'mod-test ,mod-test-file)
+                                       ;; Storing and reloading a local
+                                       ;; value causes undefined behavior,
+                                       ;; which should be detected by the
+                                       ;; module assertions.
+                                       (mod-test-invalid-store)
+                                       (mod-test-invalid-load)))))))
+          ;; FIXME a failure here gives an uninformative error.
+          (re-search-backward (rx bos "Emacs module assertion: "
+                                  "Emacs value not found in "
+                                  (+ digit) " values of "
+                                  (+ digit) " environments" ?\n eos)))
+      (delete-directory tempdir t))))
 
 ;;; emacs-module-tests.el ends here



reply via email to

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