org-test-for-executable: Detect stub executables

* testing/org-test.el (org-test-for-executable): Make sure that EXE
can be actually executed.  Some OSes (darwin) provide command stubs,
which are present, but useless to call.

Link: https://orgmode.org/list/CALo8A5ULVNQLhP=yReO-V9Uni=caqkjiQtcWUOrtr1XOXakjYA@mail.gmail.com
This commit is contained in:
Ihor Radchenko 2024-11-09 15:53:22 +01:00
parent 0624f57df3
commit cab233fb96
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 8 additions and 4 deletions

View File

@ -97,10 +97,14 @@ org-test searches this directory up the directory tree.")
This can be used at the top of code-block-language specific test
files to avoid loading the file on systems without the
executable."
(unless (cl-reduce
(lambda (acc dir)
(or acc (file-exists-p (expand-file-name exe dir))))
exec-path :initial-value nil)
(unless (and (cl-reduce
(lambda (acc dir)
(or acc (file-exists-p (expand-file-name exe dir))))
exec-path :initial-value nil)
;; Sometimes, the program is only available as a stub.
;; Check if it can be actually called.
;; See https://list.orgmode.org/orgmode/CALo8A5XfjiJdFb382J+kACuGw2QPGpqYdE7JUS+h7035MKyO+w@mail.gmail.com/
(= 0 (call-process exe nil nil nil "--version")))
(signal 'missing-test-dependency (list exe))))
(defun org-test-buffer (&optional _file)