[PATCH] D32910: [Lit] Fix to prevent creation of "%SystemDrive%" directory on Windows.

Andrew Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 08:20:31 PDT 2017


andrewng created this revision.

This patch propogates the environment variable SYSTEMDRIVE on Windows when
running the unit tests. This prevents the creation of a directory named
"%SystemDrive%" when running the unit tests from FileSystemTest that use the
function llvm::sys::fs::remove_directories which in turn uses SHFileOperationW.
It is within SHFileOperationW that this environment variable may be used and if
undefined causes the creation of a "%SystemDrive%" directory in the current
directory.


https://reviews.llvm.org/D32910

Files:
  test/Unit/lit.cfg


Index: test/Unit/lit.cfg
===================================================================
--- test/Unit/lit.cfg
+++ test/Unit/lit.cfg
@@ -43,6 +43,10 @@
     config.environment['PATH'] = os.path.pathsep.join((
             config.shlibdir, config.environment['PATH']))
 
+# Win32 may use %SYSTEMDRIVE% during file system shell operations, so propogate.
+if sys.platform == 'win32' and 'SYSTEMDRIVE' in os.environ:
+    config.environment['SYSTEMDRIVE'] = os.environ['SYSTEMDRIVE']
+
 ###
 
 # Check that the object root is known.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32910.97957.patch
Type: text/x-patch
Size: 533 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170505/f74f1ccf/attachment.bin>


More information about the llvm-commits mailing list