From 268e4b19915fe668cc2cf583a561c0ff5e8a2569 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 23 Aug 2024 22:10:59 +0000 Subject: [PATCH] scope to only DYLD env vars --- llvm/utils/lit/lit/TestRunner.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index 7079dc46419ca4f..244038cbf58f51e 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/utils/lit/lit/TestRunner.py @@ -1227,9 +1227,13 @@ def executeScript(test, litConfig, tmpBase, commands, cwd): if test.config.pipefail: f.write(b"set -o pipefail;" if mode == "wb" else "set -o pipefail;") + # Manually export any DYLD_* variables used by dyld on macOS because + # otherwise they are lost when the shell executable is run, before the + # lit test is executed. env_str = "\n".join( "export {}={};".format(k, shlex.quote(v)) for k, v in test.config.environment.items() + if k.startswith("DYLD_") ) f.write(bytes(env_str, "utf-8") if mode == "wb" else env_str) f.write(b"set -x;" if mode == "wb" else "set -x;")