[PATCH] D54328: Added 'cd -' built in to lit
Jason Mittertreiner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 9 09:25:38 PST 2018
jmittert created this revision.
jmittert added a reviewer: rnk.
Herald added subscribers: llvm-commits, delcypher.
Pass '-' to cd return to the previous directory. I had encountered some (non
llvm) lit tests which use `(cd %t && ... )` to run commands and this seemed
like a more portable way to do that.
Repository:
rL LLVM
https://reviews.llvm.org/D54328
Files:
utils/lit/lit/TestRunner.py
Index: utils/lit/lit/TestRunner.py
===================================================================
--- utils/lit/lit/TestRunner.py
+++ utils/lit/lit/TestRunner.py
@@ -60,6 +60,7 @@
def __init__(self, cwd, env):
self.cwd = cwd
+ self.prevCwd = cwd
self.env = dict(env)
class TimeoutHelper(object):
@@ -749,6 +750,10 @@
raise ValueError("'cd' supports only one argument")
newdir = cmd.commands[0].args[1]
# Update the cwd in the parent environment.
+ if newdir == '-':
+ shenv.prevCwd,shenv.cwd = shenv.cwd,shenv.prevCwd
+ return 0
+ shenv.prevCwd = shenv.cwd
if os.path.isabs(newdir):
shenv.cwd = newdir
else:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54328.173363.patch
Type: text/x-patch
Size: 746 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181109/143afd4a/attachment.bin>
More information about the llvm-commits
mailing list