-RUN: echo TA > %T/TA.txt\r
-RUN: echo TB > %T/TB.txt\r
-RUN: echo TAB > %T/TAB.txt\r
-\r
-RUN: echo %T/TA* | FileCheck -check-prefix=STAR %s\r
-RUN: echo %T/'TA'* | FileCheck -check-prefix=STAR %s\r
-RUN: echo %T/T'A'* | FileCheck -check-prefix=STAR %s\r
-\r
-RUN: echo %T/T?.txt | FileCheck -check-prefix=QUESTION %s\r
-RUN: echo %T/'T'?.txt | FileCheck -check-prefix=QUESTION %s\r
-\r
-RUN: echo %T/T??.txt | FileCheck -check-prefix=QUESTION2 %s\r
-RUN: echo %T/'T'??.txt | FileCheck -check-prefix=QUESTION2 %s\r
-\r
-RUN: echo 'T*' 'T?.txt' 'T??.txt' | FileCheck -check-prefix=QUOTEDARGS %s\r
-\r
-STAR-NOT: TB.txt\r
-STAR: {{(TA.txt.*TAB.txt|TAB.txt.*TA.txt)}}\r
-\r
-QUESTION-NOT: TAB.txt\r
-QUESTION: {{(TA.txt.*TB.txt|TB.txt.*TA.txt)}}\r
-\r
-QUESTION2-NOT: TA.txt\r
-QUESTION2-NOT: TB.txt\r
-QUESTION2: TAB.txt\r
-\r
-QUOTEDARGS-NOT: .txt\r
-QUOTEDARGS: T* T?.txt T??.txt\r
+RUN: echo XXA > %T/XXA.txt
+RUN: echo XXB > %T/XXB.txt
+RUN: echo XXAB > %T/XXAB.txt
+
+RUN: echo %T/XXA* | FileCheck -check-prefix=STAR %s
+RUN: echo %T/'XXA'* | FileCheck -check-prefix=STAR %s
+RUN: echo %T/XX'A'* | FileCheck -check-prefix=STAR %s
+
+RUN: echo %T/XX?.txt | FileCheck -check-prefix=QUESTION %s
+RUN: echo %T/'XX'?.txt | FileCheck -check-prefix=QUESTION %s
+
+RUN: echo %T/XX??.txt | FileCheck -check-prefix=QUESTION2 %s
+RUN: echo %T/'XX'??.txt | FileCheck -check-prefix=QUESTION2 %s
+
+RUN: echo 'XX*' 'XX?.txt' 'XX??.txt' | FileCheck -check-prefix=QUOTEDARGS %s
+
+STAR-NOT: XXB.txt
+STAR: {{(XXA.txt.*XXAB.txt|XXAB.txt.*XXA.txt)}}
+
+QUESTION-NOT: XXAB.txt
+QUESTION: {{(XXA.txt.*XXB.txt|XXB.txt.*XXA.txt)}}
+
+QUESTION2-NOT: XXA.txt
+QUESTION2-NOT: XXB.txt
+QUESTION2: XXAB.txt
+
+QUOTEDARGS-NOT: .txt
+QUOTEDARGS: XX* XX?.txt XX??.txt
self.exitCode = exitCode
self.timeoutReached = timeoutReached
self.outputFiles = list(outputFiles)
-
+
def executeShCmd(cmd, shenv, results, timeout=0):
"""
Wrapper around _executeShCmd that handles
data = None
if data is not None:
output_files.append((name, path, data))
-
+
results.append(ShellCommandResult(
cmd.commands[i], out, err, res, timeoutHelper.timeoutReached(),
output_files))
else:
out += data
out += "\n"
-
+
if result.stdout.strip():
out += '# command output:\n%s\n' % (result.stdout,)
if result.stderr.strip():
finally:
f.close()
-def getTempPaths(test):
- """Get the temporary location, this is always relative to the test suite
- root, not test source root."""
- execpath = test.getExecPath()
- execdir,execbase = os.path.split(execpath)
- tmpDir = os.path.join(execdir, 'Output')
- tmpBase = os.path.join(tmpDir, execbase)
- return tmpDir, tmpBase
-
-def getDefaultSubstitutions(test, tmpDir, tmpBase, normalize_slashes=False):
+def getDefaultSubstitutions(test, normalize_slashes=False):
sourcepath = test.getSourcePath()
sourcedir = os.path.dirname(sourcepath)
+ tmpDir = test.getTempFileDir()
+ tmpPrefix = test.getTempFilePrefix()
+ baseName = test.getTestBaseName()
# Normalize slashes, if requested.
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.
substitutions = []
substitutions.extend([('%%', '#_MARKER_#')])
substitutions.extend(test.config.substitutions)
- tmpName = tmpBase + '.tmp'
- baseName = os.path.basename(tmpBase)
substitutions.extend([('%s', sourcepath),
('%S', sourcedir),
('%p', sourcedir),
('%{pathsep}', os.pathsep),
- ('%t', tmpName),
+ ('%t', tmpPrefix),
('%basename_t', baseName),
('%T', tmpDir),
('#_MARKER_#', '%')])
('%/s', sourcepath.replace('\\', '/')),
('%/S', sourcedir.replace('\\', '/')),
('%/p', sourcedir.replace('\\', '/')),
- ('%/t', tmpBase.replace('\\', '/') + '.tmp'),
+ ('%/t', tmpPrefix.replace('\\', '/')),
('%/T', tmpDir.replace('\\', '/')),
])
('%:s', re.sub(r'^(.):', r'\1', sourcepath)),
('%: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', tmpPrefix)),
('%:T', re.sub(r'^(.):', r'\1', tmpDir)),
])
else:
('%:s', sourcepath),
('%:S', sourcedir),
('%:p', sourcedir),
- ('%:t', tmpBase + '.tmp'),
+ ('%:t', tmpPrefix),
('%:T', tmpDir),
])
return substitutions
TAG: A keyword taking no value. Ex 'END.'
COMMAND: A keyword taking a list of shell commands. Ex 'RUN:'
LIST: A keyword taking a comma-separated list of values.
- BOOLEAN_EXPR: A keyword taking a comma-separated list of
+ BOOLEAN_EXPR: A keyword taking a comma-separated list of
boolean expressions. Ex 'XFAIL:'
CUSTOM: A keyword with custom parsing semantics.
"""
IntegratedTestKeywordParser('REQUIRES:', ParserKind.BOOLEAN_EXPR,
initial_value=test.requires),
IntegratedTestKeywordParser('REQUIRES-ANY:', ParserKind.CUSTOM,
- IntegratedTestKeywordParser._handleRequiresAny,
- initial_value=test.requires),
+ IntegratedTestKeywordParser._handleRequiresAny,
+ initial_value=test.requires),
IntegratedTestKeywordParser('UNSUPPORTED:', ParserKind.BOOLEAN_EXPR,
initial_value=test.unsupported),
IntegratedTestKeywordParser('END.', ParserKind.TAG)
]
keyword_parsers = {p.keyword: p for p in builtin_parsers}
-
+
# Install user-defined additional parsers.
for parser in additional_parsers:
if not isinstance(parser, IntegratedTestKeywordParser):
raise ValueError("Parser for keyword '%s' already exists"
% parser.keyword)
keyword_parsers[parser.keyword] = parser
-
+
# Collect the test lines from the script.
sourcepath = test.getSourcePath()
for line_number, command_type, ln in \
return script
-
def _runShTest(test, litConfig, useExternalSh, script, tmpBase):
- # Create the output directory if it does not already exist.
- lit.util.mkdir_p(os.path.dirname(tmpBase))
-
- execdir = os.path.dirname(test.getExecPath())
+ execdir = os.path.dirname(test.getTempFileDir())
if useExternalSh:
res = executeScript(test, litConfig, tmpBase, script, execdir)
else:
return script
if litConfig.noExecute:
return lit.Test.Result(Test.PASS)
-
- tmpDir, tmpBase = getTempPaths(test)
substitutions = list(extra_substitutions)
- substitutions += getDefaultSubstitutions(test, tmpDir, tmpBase,
+ substitutions += getDefaultSubstitutions(test,
normalize_slashes=useExternalSh)
script = applySubstitutions(script, substitutions)
if hasattr(test.config, 'test_retry_attempts'):
attempts += test.config.test_retry_attempts
for i in range(attempts):
- res = _runShTest(test, litConfig, useExternalSh, script, tmpBase)
+ res = _runShTest(test, litConfig, useExternalSh, script,
+ test.getTempFilePrefix())
if res.code != Test.FAIL:
break
# If we had to run the test more than once, count it as a flaky pass. These