emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 f7262b8f81e: Fix comint-tests on MS-Windows


From: Eli Zaretskii
Subject: emacs-29 f7262b8f81e: Fix comint-tests on MS-Windows
Date: Wed, 7 Dec 2022 14:24:40 -0500 (EST)

branch: emacs-29
commit f7262b8f81e66a1963b020b1fe720575dc8aaba9
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix comint-tests on MS-Windows
    
    * test/lisp/comint-tests.el (comint-tests/test-password-function):
    On MS-Windows, call 'w32-native-executable-find' instead of
    'executable-find', to find the native version of the 'cat'
    program.
    (w32-native-executable-p, w32-native-executable-find): New
    functions.
---
 test/lisp/comint-tests.el | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el
index 8402c13daf3..88427dd05b1 100644
--- a/test/lisp/comint-tests.el
+++ b/test/lisp/comint-tests.el
@@ -59,9 +59,23 @@
   (dolist (str comint-testsuite-password-strings)
     (should (string-match comint-password-prompt-regexp str))))
 
+(declare-function 'w32-application-type "w32proc.c")
+(defun w32-native-executable-p (fname)
+  "Predicate to test program FNAME for being a native Windows application."
+  (and (memq (w32-application-type fname) '(w32-native dos))
+       (file-executable-p fname)))
+
+(defun w32-native-executable-find (name)
+  "Find a native MS-Windows application named NAME.
+This is needed to avoid invoking MSYS or Cygwin executables that
+happen to lurk on PATH when running the test suite."
+  (locate-file name exec-path exec-suffixes 'w32-native-executable-p))
+
 (defun comint-tests/test-password-function (password-function)
   "PASSWORD-FUNCTION can return nil or a string."
-  (when-let ((cat (executable-find "cat")))
+  (when-let ((cat (if (eq system-type 'windows-nt)
+                      (w32-native-executable-find "cat")
+                    (executable-find "cat"))))
     (let ((comint-password-function password-function))
       (cl-letf (((symbol-function 'read-passwd)
                  (lambda (&rest _args) "non-nil")))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]