[llvm] r299113 - Use os.path.realpath when tracking the cwd.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 14:05:31 PDT 2017


Author: rafael
Date: Thu Mar 30 16:05:31 2017
New Revision: 299113

URL: http://llvm.org/viewvc/llvm-project?rev=299113&view=rev
Log:
Use os.path.realpath when tracking the cwd.

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.

Modified:
    llvm/trunk/utils/lit/lit/TestRunner.py

Modified: llvm/trunk/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=299113&r1=299112&r2=299113&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Thu Mar 30 16:05:31 2017
@@ -252,7 +252,7 @@ def _executeShCmd(cmd, shenv, results, t
         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




More information about the llvm-commits mailing list