aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorAndrea Corallo2020-07-26 09:40:02 +0200
committerAndrea Corallo2020-07-26 09:40:02 +0200
commit7a161dc688f0eeee64e307a55efbc7d11bab3627 (patch)
tree127cd6d6257e8e484a7021b12790610d308f7594 /test/src
parent79ed90380547128b9919d407901a886fed0306b7 (diff)
parent9f01ce6327af886f26399924a9aadf16cdd4fd9f (diff)
downloademacs-7a161dc688f0eeee64e307a55efbc7d11bab3627.tar.gz
emacs-7a161dc688f0eeee64e307a55efbc7d11bab3627.zip
Merge remote-tracking branch 'savahnna/master' into HEAD
Diffstat (limited to 'test/src')
-rw-r--r--test/src/emacs-module-tests.el29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 411b4505da0..8465fd02e1e 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -272,6 +272,24 @@ must evaluate to a regular expression string."
272 (mod-test-invalid-store) 272 (mod-test-invalid-store)
273 (mod-test-invalid-load))) 273 (mod-test-invalid-load)))
274 274
275(ert-deftest module--test-assertions--load-non-live-object-with-global-copy ()
276 "Check that -module-assertions verify that non-live objects aren't accessed.
277This differs from `module--test-assertions-load-non-live-object'
278in that it stows away a global reference. The module assertions
279should nevertheless detect the invalid load."
280 (skip-unless (or (file-executable-p mod-test-emacs)
281 (and (eq system-type 'windows-nt)
282 (file-executable-p (concat mod-test-emacs ".exe")))))
283 ;; This doesn't yet cause undefined behavior.
284 (should (eq (mod-test-invalid-store-copy) 123))
285 (module--test-assertion (rx "Emacs value not found in "
286 (+ digit) " values of "
287 (+ digit) " environments\n")
288 ;; Storing and reloading a local value causes undefined behavior,
289 ;; which should be detected by the module assertions.
290 (mod-test-invalid-store-copy)
291 (mod-test-invalid-load)))
292
275(ert-deftest module--test-assertions--call-emacs-from-gc () 293(ert-deftest module--test-assertions--call-emacs-from-gc ()
276 "Check that -module-assertions prevents calling Emacs functions 294 "Check that -module-assertions prevents calling Emacs functions
277during garbage collection." 295during garbage collection."
@@ -283,6 +301,17 @@ during garbage collection."
283 (mod-test-invalid-finalizer) 301 (mod-test-invalid-finalizer)
284 (garbage-collect))) 302 (garbage-collect)))
285 303
304(ert-deftest module--test-assertions--globref-invalid-free ()
305 "Check that -module-assertions detects invalid freeing of a
306local reference."
307 (skip-unless (or (file-executable-p mod-test-emacs)
308 (and (eq system-type 'windows-nt)
309 (file-executable-p (concat mod-test-emacs ".exe")))))
310 (module--test-assertion
311 (rx "Global value was not found in list of " (+ digit) " globals")
312 (mod-test-globref-invalid-free)
313 (garbage-collect)))
314
286(ert-deftest module/describe-function-1 () 315(ert-deftest module/describe-function-1 ()
287 "Check that Bug#30163 is fixed." 316 "Check that Bug#30163 is fixed."
288 (with-temp-buffer 317 (with-temp-buffer