diff options
| author | Glenn Morris | 2017-06-12 17:31:25 -0400 |
|---|---|---|
| committer | Glenn Morris | 2017-06-12 17:31:25 -0400 |
| commit | ab2116c9a951cdaf269311a31a8b3da79834742f (patch) | |
| tree | 574a4077f288240c3966f6475554e3beecf8c102 /test/src | |
| parent | 1612d3dd78875b518ebcbcf046e6f9510ff69c99 (diff) | |
| download | emacs-ab2116c9a951cdaf269311a31a8b3da79834742f.tar.gz emacs-ab2116c9a951cdaf269311a31a8b3da79834742f.zip | |
Clean up after module assertion tests
* test/src/emacs-module-tests.el (module--test-assertions):
Use a temporary directory to contain any core dumps.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/emacs-module-tests.el | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 502143dd48d..aea0bba540b 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el | |||
| @@ -187,25 +187,29 @@ changes." | |||
| 187 | (skip-unless (file-executable-p mod-test-emacs)) | 187 | (skip-unless (file-executable-p mod-test-emacs)) |
| 188 | ;; This doesn’t yet cause undefined behavior. | 188 | ;; This doesn’t yet cause undefined behavior. |
| 189 | (should (eq (mod-test-invalid-store) 123)) | 189 | (should (eq (mod-test-invalid-store) 123)) |
| 190 | (with-temp-buffer | 190 | ;; To contain any core dumps. |
| 191 | ;; FIXME this dumps a core file if the user has them enabled, | 191 | (let ((tempdir (make-temp-file "emacs-module-test" t))) |
| 192 | ;; which seems unfriendly. | 192 | (unwind-protect |
| 193 | (should (string-match-p | 193 | (with-temp-buffer |
| 194 | "Abort" ; eg "Aborted" or "Abort trap: 6" | 194 | (should (string-match-p |
| 195 | (call-process mod-test-emacs nil t nil | 195 | "Abort" ; eg "Aborted" or "Abort trap: 6" |
| 196 | "-batch" "-Q" "-module-assertions" "-eval" | 196 | (let ((default-directory tempdir)) |
| 197 | (prin1-to-string | 197 | (call-process mod-test-emacs nil t nil |
| 198 | `(progn | 198 | "-batch" "-Q" "-module-assertions" "-eval" |
| 199 | (require 'mod-test ,mod-test-file) | 199 | (prin1-to-string |
| 200 | ;; Storing and reloading a local value | 200 | `(progn |
| 201 | ;; causes undefined behavior, which should be | 201 | (require 'mod-test ,mod-test-file) |
| 202 | ;; detected by the module assertions. | 202 | ;; Storing and reloading a local |
| 203 | (mod-test-invalid-store) | 203 | ;; value causes undefined behavior, |
| 204 | (mod-test-invalid-load)))))) | 204 | ;; which should be detected by the |
| 205 | ;; FIXME a failure here gives an uninformative error. | 205 | ;; module assertions. |
| 206 | (re-search-backward (rx bos "Emacs module assertion: " | 206 | (mod-test-invalid-store) |
| 207 | "Emacs value not found in " | 207 | (mod-test-invalid-load))))))) |
| 208 | (+ digit) " values of " | 208 | ;; FIXME a failure here gives an uninformative error. |
| 209 | (+ digit) " environments" ?\n eos)))) | 209 | (re-search-backward (rx bos "Emacs module assertion: " |
| 210 | "Emacs value not found in " | ||
| 211 | (+ digit) " values of " | ||
| 212 | (+ digit) " environments" ?\n eos))) | ||
| 213 | (delete-directory tempdir t)))) | ||
| 210 | 214 | ||
| 211 | ;;; emacs-module-tests.el ends here | 215 | ;;; emacs-module-tests.el ends here |