summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Volf <~@wolfsden.cz>2024-08-10 00:54:32 +0200
committerLudovic Courtès <ludo@gnu.org>2024-10-20 21:22:23 +0200
commit1746dbbe4d134073087f9ba8220e60a3a02ec8c0 (patch)
tree85ebe72d7719a48073c0a77a1dc2fe9b89bbfad4
parent8579b73abace8c3e3469b23883190be0ce431b53 (diff)
downloadguile-1746dbbe4d134073087f9ba8220e60a3a02ec8c0.tar.gz
tests: Fix spawn with #:environment on MacOS.
MacOS adds __CF_USER_TEXT_ENCODING to every program, in similar way GNU Hurd prepends LD_ORIGIN_PATH (based on the comment). So extend the logic to do similar stripping on MacOS. * test-suite/tests/posix.test ("spawn") ["env with #:environment and #:output"]: Strip trailing __CF_USER_TEXT_ENCODING environment variable when on Darwin. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--test-suite/tests/posix.test23
1 files changed, 17 insertions, 6 deletions
diff --git a/test-suite/tests/posix.test b/test-suite/tests/posix.test
index 18dad8902..ac5a3b289 100644
--- a/test-suite/tests/posix.test
+++ b/test-suite/tests/posix.test
@@ -442,12 +442,23 @@
(close-port (car input+output))
(waitpid pid)
- ;; On GNU/Hurd, the exec server prepends 'LD_ORIGIN_PATH' for
- ;; every program: <https://bugs.gnu.org/62501>. Strip it.
- (if (and (string=? "GNU" (utsname:sysname (uname)))
- (string-prefix? "LD_ORIGIN_PATH=" str))
- (string-drop str (+ 1 (string-index str #\newline)))
- str))))
+ (let ((sysname (utsname:sysname (uname))))
+ (cond
+ ((string=? "GNU" sysname)
+ ;; On GNU/Hurd, the exec server prepends 'LD_ORIGIN_PATH' for
+ ;; every program: <https://bugs.gnu.org/62501>. Strip it.
+ (if (string-prefix? "LD_ORIGIN_PATH=" str)
+ (string-drop str (+ 1 (string-index str #\newline)))
+ str))
+ ((string-ci=? "darwin" sysname)
+ ;; MacOS appends '__CF_USER_TEXT_ENCODING' for every program. Strip
+ ;; it.
+ (let ((pos (string-contains str "__CF_USER_TEXT_ENCODING=")))
+ (if pos
+ (string-drop-right str (- (string-length str) pos))
+ str)))
+ (else
+ str))))))
(pass-if-equal "ls /proc/self/fd"
"0\n1\n2\n3\n" ;fourth FD is for /proc/self/fd