From 313d55391877c5039228fdaedec0975dd54dc177 Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Sat, 29 Feb 2020 20:11:54 +0100 Subject: [PATCH] tests: fix embedding tests on cygwin --- src/tests/normal-tests/embedding.lsp | 65 ++++++++++++++++------------ 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/src/tests/normal-tests/embedding.lsp b/src/tests/normal-tests/embedding.lsp index bcc1a7c2f..43df6ea27 100644 --- a/src/tests/normal-tests/embedding.lsp +++ b/src/tests/normal-tests/embedding.lsp @@ -16,34 +16,43 @@ (princ c-code s)) (c::compiler-cc "tmp/ecl-aux.c" "tmp/ecl-aux.o") (c::linker-cc "tmp/ecl-aux.exe" '("tmp/ecl-aux.o")) - (ecase capture-output - ((nil) - (return-from test-C-program (zerop (si::system #+windows (format nil "PATH=%PATH%;~a tmp\\ecl-aux.exe" c::*ecl-library-directory*) - #-windows "tmp/ecl-aux.exe")))) - ((string :string) - (with-output-to-string (s) - (let ((in (si::run-program "tmp/ecl-aux.exe" '() :output :stream - :environ (append #+windows (list (format nil "PATH=~a;~a" - (ext:getenv "PATH") - c::*ecl-library-directory*)) - (ext:environ)))) - line) - (loop - (setf line (read-line in nil)) - (unless line (return)) - (write-line line s))))) - ((t forms :forms) - (do* ((all '()) - (x t) - (in (si::run-program "tmp/ecl-aux.exe" '() :output :stream - :environ (append #+windows (list (format nil "PATH=~a;~a" - (ext:getenv "PATH") - c::*ecl-library-directory*)) - (ext:environ))))) - ((null in) all) - (setf x (ignore-errors (read in nil nil))) - (unless x (return all)) - (push x all))))) + (let ((environment + (append #+windows (list (format nil "PATH=~a;~a" + (ext:getenv "PATH") + c::*ecl-library-directory*)) + #+cygwin (list (format nil "PATH=~a:~a" + (ext:getenv "PATH") + c::*ecl-library-directory*)) + #-(or windows cygwin) (list (format nil "LD_LIBRARY_PATH=~a:~a" + (ext:getenv "LD_LIBRARY_PATH") + c::*ecl-library-directory*)) + (ext:environ)))) + (ecase capture-output + ((nil) + (multiple-value-bind (stream return-code) + (si::run-program "tmp/ecl-aux.exe" '() + :output t :error t + :environ environment) + (declare (ignore stream)) + (zerop return-code))) + ((string :string) + (with-output-to-string (s) + (let ((in (si::run-program "tmp/ecl-aux.exe" '() :output :stream + :environ environment)) + line) + (loop + (setf line (read-line in nil)) + (unless line (return)) + (write-line line s))))) + ((t forms :forms) + (do* ((all '()) + (x t) + (in (si::run-program "tmp/ecl-aux.exe" '() :output :stream + :environ environment))) + ((null in) all) + (setf x (ignore-errors (read in nil nil))) + (unless x (return all)) + (push x all)))))) ;;; Date: 21/06/2006 (goffioul) ;;; Fixed: 23/06/2006 (juanjo)