[PATCH] D31499: Use os.path.realpath when tracking the cwd

Rafael Ávila de Espíndola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 08:38:18 PDT 2017


rafael created this revision.
Herald added a reviewer: modocache.

This is needed by TestCases/Posix/coverage-direct.cc

The problem is that the test does:

mkdir <dir>
cd <dir>
cd ..
rm -rf <dir>
<more commands>

the current directory currently looks like "/.../<dir>/../" which doesn't exist when dir is deleted.

at some point we should probably switch to using the os current directory (specially if we want to add subshell), but this is a small incremental improvement.


https://reviews.llvm.org/D31499

Files:
  utils/lit/lit/TestRunner.py


Index: utils/lit/lit/TestRunner.py
===================================================================
--- utils/lit/lit/TestRunner.py
+++ utils/lit/lit/TestRunner.py
@@ -250,7 +250,7 @@
         if os.path.isabs(newdir):
             shenv.cwd = newdir
         else:
-            shenv.cwd = os.path.join(shenv.cwd, newdir)
+            shenv.cwd = os.path.realpath(os.path.join(shenv.cwd, newdir))
         # The cd builtin always succeeds. If the directory does not exist, the
         # following Popen calls will fail instead.
         return 0


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31499.93483.patch
Type: text/x-patch
Size: 551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170330/b7c9a48f/attachment.bin>


More information about the llvm-commits mailing list