summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-09-20 17:08:20 +0000
committerZachary Turner <zturner@google.com>2017-09-20 17:08:20 +0000
commit897836373571b13a8142975dc360ac3538c7b574 (patch)
tree2e3fc196b9a9a57d36828eb4cf96dc1ef55460ea /llvm/utils
parente4bad83edb9abd8bd5b33c74c06dcccacc3c9405 (diff)
downloadbcm5719-llvm-897836373571b13a8142975dc360ac3538c7b574.tar.gz
bcm5719-llvm-897836373571b13a8142975dc360ac3538c7b574.zip
[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. llvm-svn: 313765
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/lit/lit/llvm/config.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index cd1f8eea750..d1f368d0d83 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/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)
OpenPOWER on IntegriCloud