diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-11 00:03:31 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-11 00:03:31 -0500 |
| commit | e72bc4165739d07d2258992c6376759723270a57 (patch) | |
| tree | 1888718891fbb84c8b9be4b080959a6c75dde218 /tests | |
| parent | 287ca3a7cb8a351e5cae1b2480fbe2baf42e2fc8 (diff) | |
| download | dotemacs-e72bc4165739d07d2258992c6376759723270a57.tar.gz dotemacs-e72bc4165739d07d2258992c6376759723270a57.zip | |
fix(config-utilities): detect native-comp with the right predicate, clear eln-cache
cj/recompile-emacs-home selected native compilation with (boundp 'native-compile-async), but that's a function, so boundp is always nil. The command silently byte-compiled every time, even on native-comp builds. Detection now goes through cj/--native-comp-p, which uses native-comp-available-p. The native cleanup also deleted <dir>/eln, but the real cache is eln-cache/, so a stale cache survived. Both are pinned by tests: a regression on the detection helper, and the cache test now targets eln-cache.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-config-utilities--recompile-emacs-home.el | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/tests/test-config-utilities--recompile-emacs-home.el b/tests/test-config-utilities--recompile-emacs-home.el index 18d17f96..da364e24 100644 --- a/tests/test-config-utilities--recompile-emacs-home.el +++ b/tests/test-config-utilities--recompile-emacs-home.el @@ -81,20 +81,29 @@ Returns the temp dir path." (should-not (file-exists-p (expand-file-name "sub/c.elc" dir)))) (delete-directory dir t)))) -(ert-deftest test-config-utilities-recompile-removes-eln-dir-on-native-path () - "Boundary: the native path removes the eln cache directory when present." +(ert-deftest test-config-utilities-recompile-removes-eln-cache-dir-on-native-path () + "Boundary: the native path removes the eln-cache directory when present. +The native cache is eln-cache/, not eln/, so that is the directory to clear." (let ((dir (test-config-utilities--make-recompile-fixture)) - (eln-dir nil)) + (eln-cache-dir nil)) (unwind-protect (progn - (setq eln-dir (expand-file-name "eln" dir)) - (make-directory eln-dir) - (with-temp-file (expand-file-name "stale.eln" eln-dir) (insert "")) + (setq eln-cache-dir (expand-file-name "eln-cache" dir)) + (make-directory eln-cache-dir) + (with-temp-file (expand-file-name "stale.eln" eln-cache-dir) (insert "")) (cl-letf (((symbol-function 'native-compile-async) (lambda (&rest _) nil))) (cj/--recompile-emacs-home dir t)) - (should-not (file-exists-p eln-dir))) + (should-not (file-exists-p eln-cache-dir))) (delete-directory dir t)))) +(ert-deftest test-config-utilities-native-comp-detection-not-boundp () + "Regression: native-comp detection must not test `boundp' of the async +function -- native-compile-async is a function, so `boundp' is always nil and +native compilation would never be selected. On a native-comp build, detection +returns non-nil." + (when (and (fboundp 'native-comp-available-p) (native-comp-available-p)) + (should (cj/--native-comp-p)))) + (ert-deftest test-config-utilities-recompile-removes-elc-dir-on-byte-path () "Boundary: the byte path removes the elc cache directory when present." (let ((dir (test-config-utilities--make-recompile-fixture)) |
