[PATCH] D54636: [lit] Add test directory to sys.path before invoking it.
Zachary Turner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 16 10:41:20 PST 2018
zturner added inline comments.
================
Comment at: llvm/utils/lit/lit/TestingConfig.py:109
path, traceback.format_exc()))
-
+ finally:
+ sys.path = original_sys_path
----------------
stella.stamenova wrote:
> Won't this always reset the path back to the original path since the finally block always executes?
Yes, but I think that's actually what we want. In fact I think not doing this is a bug that's always been present. i.e. even if we don't append our own path, we should still be doing this. Imagine a case where the code you exec / compile modifies `sys.path`. Then later we run another test suite, it will have had its `sys.path` affected by the run of the first test suite. Since `sys.path` is a module level property, any test suite could affect any other test suite this way.
I don't think any test suites are currently modifying `sys.path` so this has never been a problem before, but now that we are explicitly modifying it, we definitely don't want test suite B to be affected by test suite A.
https://reviews.llvm.org/D54636
More information about the llvm-commits
mailing list