Page MenuHomePhabricator

Pass system PYTHONPATH into lit-spawned shells
Needs ReviewPublic

Authored by JamesNagurne on Apr 15 2020, 12:04 PM.
This revision needs review, but there are no reviewers specified.



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.

Diff Detail

Event Timeline

JamesNagurne created this revision.Apr 15 2020, 12:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 15 2020, 12:04 PM