diff options
author | Zachary Turner <zturner@google.com> | 2017-09-20 17:08:20 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-09-20 17:08:20 +0000 |
commit | 76fe1ec31060ec04d4d94958e7eb89e1184cfc76 (patch) | |
tree | 9c8fabeaf7a10468bbc1c306f1285906771bf317 /utils/lit | |
parent | fd4d2852f0093fce3f0b0b6b8cd5d9a09aaf2701 (diff) |
[lit] Reverse path list when updating environment vars.
Bug pointed out by EricWF. This would construct a path where
items would be added in the wrong order, potentially leading
to using the wrong tools for testing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313765 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/lit')
-rw-r--r-- | utils/lit/lit/llvm/config.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/utils/lit/lit/llvm/config.py b/utils/lit/lit/llvm/config.py index cd1f8eea750..d1f368d0d83 100644 --- a/utils/lit/lit/llvm/config.py +++ b/utils/lit/lit/llvm/config.py @@ -106,7 +106,10 @@ class LLVMConfig(object): current_paths = self.config.environment.get(variable, "") current_paths = current_paths.split(os.path.pathsep) paths = [norm(p) for p in current_paths] - for p in paths_to_add: + # If we are passed a list [a b c], then iterating this list forwards + # and adding each to the beginning would result in b c a. So we + # need to iterate in reverse to end up with the original ordering. + for p in reversed(paths_to_add): # Move it to the front if it already exists, otherwise insert it at the # beginning. p = norm(p) |