[PATCH] D78229: Pass system PYTHONPATH into lit-spawned shells
James Nagurne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 12:04:37 PDT 2020
JamesNagurne created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Pass system PYTHONPATH into lit-spawned shells
lit generates script files and executes them via '/bin/bash <script>'.
This does not pass down environment variables unless they are explicitly
set by the test configuration.
In this example, there are a number of tests for the 'opt-viewer' utility
that require the pygments module. The check for these modules is done
during LLVM configuration (llvm/cmake/config-ix.cmake), where PYTHONPATH
is set.
Because PYTHONPATH is set in LLVM configuration, we find the pygments
module and set a cmake variable indicating that we can run the test.
Then, when we actually go to run the test, /bin/bash resets PYTHONPATH and
the test fails because it can no longer import pygments.
My proposed solution here is to pass PYTHONPATH down through lit into
spawned shells.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78229
Files:
llvm/test/lit.cfg.py
Index: llvm/test/lit.cfg.py
===================================================================
--- llvm/test/lit.cfg.py
+++ llvm/test/lit.cfg.py
@@ -40,7 +40,7 @@
# Propagate some variables from the host environment.
llvm_config.with_system_environment(
- ['HOME', 'INCLUDE', 'LIB', 'TMP', 'TEMP', 'ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'])
+ ['HOME', 'INCLUDE', 'LIB', 'TMP', 'TEMP', 'ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH', 'PYTHONPATH'])
# Set up OCAMLPATH to include newly built OCaml libraries.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78229.257793.patch
Type: text/x-patch
Size: 529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/0babff9b/attachment.bin>
More information about the llvm-commits
mailing list