Index: docs/CommandGuide/lit.rst =================================================================== --- docs/CommandGuide/lit.rst +++ docs/CommandGuide/lit.rst @@ -402,8 +402,8 @@ %S source dir (directory of the file currently being run) %p same as %S %{pathsep} path separator - %t temporary file name unique to the test - %T temporary directory unique to the test + %t temporary file name unique to the test, if you need a directory + use `mkdir -p %t` %% % ========== ============== Index: docs/TestingGuide.rst =================================================================== --- docs/TestingGuide.rst +++ docs/TestingGuide.rst @@ -455,15 +455,11 @@ File path to a temporary file name that could be used for this test case. The file name won't conflict with other test cases. You can append to it if you need multiple temporaries. This is useful as the destination of - some redirected output. + some redirected output. If your test needs a temporary directory, you can + use ``mkdir -p %t``. Example: ``/home/user/llvm.build/test/MC/ELF/Output/foo_test.s.tmp`` -``%T`` - Directory of ``%t``. - - Example: ``/home/user/llvm.build/test/MC/ELF/Output`` - ``%{pathsep}`` Expands to the path separator, i.e. ``:`` (or ``;`` on Windows). Index: utils/lit/lit/TestRunner.py =================================================================== --- utils/lit/lit/TestRunner.py +++ utils/lit/lit/TestRunner.py @@ -800,9 +800,9 @@ execdir,execbase = os.path.split(execpath) tmpDir = os.path.join(execdir, 'Output') tmpBase = os.path.join(tmpDir, execbase) - return tmpDir, tmpBase + return tmpBase -def getDefaultSubstitutions(test, tmpDir, tmpBase, normalize_slashes=False): +def getDefaultSubstitutions(test, tmpBase, normalize_slashes=False): sourcepath = test.getSourcePath() sourcedir = os.path.dirname(sourcepath) @@ -810,7 +810,6 @@ if normalize_slashes: sourcepath = sourcepath.replace('\\', '/') sourcedir = sourcedir.replace('\\', '/') - tmpDir = tmpDir.replace('\\', '/') tmpBase = tmpBase.replace('\\', '/') # We use #_MARKER_# to hide %% while we do the other substitutions. @@ -825,7 +824,6 @@ ('%{pathsep}', os.pathsep), ('%t', tmpName), ('%basename_t', baseName), - ('%T', tmpDir), ('#_MARKER_#', '%')]) # "%/[STpst]" should be normalized. @@ -834,7 +832,6 @@ ('%/S', sourcedir.replace('\\', '/')), ('%/p', sourcedir.replace('\\', '/')), ('%/t', tmpBase.replace('\\', '/') + '.tmp'), - ('%/T', tmpDir.replace('\\', '/')), ]) # "%:[STpst]" are paths without colons. @@ -844,7 +841,6 @@ ('%:S', re.sub(r'^(.):', r'\1', sourcedir)), ('%:p', re.sub(r'^(.):', r'\1', sourcedir)), ('%:t', re.sub(r'^(.):', r'\1', tmpBase) + '.tmp'), - ('%:T', re.sub(r'^(.):', r'\1', tmpDir)), ]) else: substitutions.extend([ @@ -852,7 +848,6 @@ ('%:S', sourcedir), ('%:p', sourcedir), ('%:t', tmpBase + '.tmp'), - ('%:T', tmpDir), ]) return substitutions @@ -1167,9 +1162,9 @@ if litConfig.noExecute: return lit.Test.Result(Test.PASS) - tmpDir, tmpBase = getTempPaths(test) + tmpBase = getTempPaths(test) substitutions = list(extra_substitutions) - substitutions += getDefaultSubstitutions(test, tmpDir, tmpBase, + substitutions += getDefaultSubstitutions(test, tmpBase, normalize_slashes=useExternalSh) script = applySubstitutions(script, substitutions)