aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test-system-commands-resolve-and-run.el10
-rw-r--r--todo.org5
2 files changed, 11 insertions, 4 deletions
diff --git a/tests/test-system-commands-resolve-and-run.el b/tests/test-system-commands-resolve-and-run.el
index af2288fd9..9d92c5d68 100644
--- a/tests/test-system-commands-resolve-and-run.el
+++ b/tests/test-system-commands-resolve-and-run.el
@@ -172,9 +172,15 @@ does not run the command."
(ert-deftest test-system-cmd-restart-emacs-no-service-aborts ()
"Error: when no emacs.service exists, restart aborts without running anything."
(let ((ran nil))
+ ;; Drive the real service check to nil at its boundary (no systemctl on
+ ;; PATH) rather than mocking cj/system-cmd--emacs-service-available-p
+ ;; itself: cj/system-cmd-restart-emacs reaches that helper through a
+ ;; native-comp intra-file direct call that bypasses a symbol-function
+ ;; redefinition, so the helper-level mock silently no-ops and the real
+ ;; check passes on a machine that has emacs.service. executable-find is a
+ ;; subr the helper calls, and its trampoline honors the cl-letf swap.
(cl-letf (((symbol-function 'daemonp) (lambda () t))
- ((symbol-function 'cj/system-cmd--emacs-service-available-p)
- (lambda () nil))
+ ((symbol-function 'executable-find) (lambda (&rest _) nil))
((symbol-function 'read-char-choice) (lambda (&rest _) ?y))
((symbol-function 'call-process-shell-command)
(lambda (&rest _) (setq ran t))))
diff --git a/todo.org b/todo.org
index a68028a4d..629717583 100644
--- a/todo.org
+++ b/todo.org
@@ -55,8 +55,9 @@ Tags are additive. For example, a small wrong-behavior fix can be
=:bug:quick:=, and a feature that requires internal restructuring can be
=:feature:refactor:=.
* Emacs Open Work
-** TODO [#C] restart-emacs no-service test fails on machines with emacs.service :test:bug:
-=test-system-cmd-restart-emacs-no-service-aborts= (=tests/test-system-commands-resolve-and-run.el:172=) fails on velox and passes where no =emacs.service= exists. It mocks =cj/system-cmd--emacs-service-available-p= to return nil via =cl-letf=, but =cj/system-cmd-restart-emacs= (in =system-commands.el=, natively compiled) calls that helper through an intra-file direct reference in its =.eln=, which bypasses the symbol-function redefinition. So the real check runs, finds =emacs.service=, and restart proceeds instead of aborting -- the =should-error= sees "did not signal an error". Same native-comp mocking trap noted in CLAUDE.md, here for a same-file defun rather than a subr. Fix: mock at the boundary the helper uses (=executable-find= / the =systemctl= =call-process-shell-command=) the way the passing sibling tests =service-available-false-on-nonzero-exit= and =service-available-false-when-systemctl-absent= do, instead of mocking the helper directly; or inject the check. Pre-existing (fails on clean HEAD), surfaced during the 2026-06-29 structural speedrun.
+** DONE [#C] restart-emacs no-service test fails on machines with emacs.service :test:bug:
+CLOSED: [2026-06-29 Mon]
+=test-system-cmd-restart-emacs-no-service-aborts= mocked =cj/system-cmd--emacs-service-available-p= directly, but =cj/system-cmd-restart-emacs= (natively compiled) reaches that helper through an intra-file direct reference in its =.eln= that bypasses the symbol-function redefinition, so the real check ran and passed on velox (which has =emacs.service=). Fixed by mocking at the boundary the helper uses (=executable-find= -> nil) instead of the helper itself, matching the passing sibling tests; the helper's =executable-find= call goes through a subr trampoline that honors =cl-letf=. 19/19 green.
** PROJECT [#A] Manual testing and validation
Exercised once the phases above land.