aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2021-10-04 22:47:30 +0200
committerAndrea Corallo2021-10-04 22:49:45 +0200
commit63cb65dccecb1146cdad7134e4b62ea3e1433880 (patch)
tree50edce98b25bbf22b1bd05338d052dd4d8521262
parente606cc6f4023a3b20179ed51e339941be7c36bd2 (diff)
downloademacs-63cb65dccecb1146cdad7134e4b62ea3e1433880.tar.gz
emacs-63cb65dccecb1146cdad7134e4b62ea3e1433880.zip
* Fix mh tests for native comp builds (bug#50975)
* test/lisp/mh-e/mh-utils-tests.el (mh-ensure-native-trampolines): New function. (mh-test-utils-setup-with-mocks) (mh-test-utils-setup-with-variant): Use it.
-rw-r--r--test/lisp/mh-e/mh-utils-tests.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/lisp/mh-e/mh-utils-tests.el b/test/lisp/mh-e/mh-utils-tests.el
index 68152ce3b64..82afbab6474 100644
--- a/test/lisp/mh-e/mh-utils-tests.el
+++ b/test/lisp/mh-e/mh-utils-tests.el
@@ -107,6 +107,15 @@ install an MH variant and test it interactively."
107 (if temp-home-dir (delete-directory temp-home-dir t)) 107 (if temp-home-dir (delete-directory temp-home-dir t))
108 (setenv "MH" original-mh-envvar)))) 108 (setenv "MH" original-mh-envvar))))
109 109
110(defun mh-ensure-native-trampolines ()
111 "Build head of time the trampolines we'll need.
112As `call-process'' and `file-directory-p' will be redefined, the
113native compiler will invoke `call-process' to compile the
114respective trampolines. To avoid interferences with the
115`call-process' mocking we build these AOT."
116 (when (featurep 'native-compile)
117 (mapc #'comp-subr-trampoline-install '(call-process file-directory-p))))
118
110(defun mh-test-utils-setup-with-mocks () 119(defun mh-test-utils-setup-with-mocks ()
111 "Set dynamically bound variables so that MH programs are mocked out. 120 "Set dynamically bound variables so that MH programs are mocked out.
112The tests use this method if no configured MH variant is found." 121The tests use this method if no configured MH variant is found."
@@ -116,6 +125,7 @@ The tests use this method if no configured MH variant is found."
116 (mh-populate-sub-folders-cache "+rela-folder/bar") 125 (mh-populate-sub-folders-cache "+rela-folder/bar")
117 (mh-populate-sub-folders-cache "+rela-folder/foo") 126 (mh-populate-sub-folders-cache "+rela-folder/foo")
118 (mh-populate-sub-folders-cache "+rela-folder/food") 127 (mh-populate-sub-folders-cache "+rela-folder/food")
128 (mh-ensure-native-trampolines)
119 (fset 'call-process #'mh-test-utils-mock-call-process) 129 (fset 'call-process #'mh-test-utils-mock-call-process)
120 (fset 'file-directory-p #'mh-test-utils-mock-file-directory-p)) 130 (fset 'file-directory-p #'mh-test-utils-mock-file-directory-p))
121 131
@@ -205,6 +215,7 @@ The tests use this method if a configured MH variant is found."
205 (make-directory (expand-file-name "foo" abso-folder) t) 215 (make-directory (expand-file-name "foo" abso-folder) t)
206 (make-directory (expand-file-name "food" abso-folder) t) 216 (make-directory (expand-file-name "food" abso-folder) t)
207 (setq mh-test-abs-folder abso-folder) 217 (setq mh-test-abs-folder abso-folder)
218 (mh-ensure-native-trampolines)
208 (fset 'call-process #'mh-test-utils-log-call-process) 219 (fset 'call-process #'mh-test-utils-log-call-process)
209 (fset 'file-directory-p #'mh-test-utils-log-file-directory-p) 220 (fset 'file-directory-p #'mh-test-utils-log-file-directory-p)
210 temp-home-dir)) 221 temp-home-dir))