tmpBase = os.path.join(tmpDir, 't')
return tmpDir, tmpBase
+def _checkBaseSubstitutions(substitutions):
+ substitutions = [s for (s, _) in substitutions]
+ for s in ['%{cxx}', '%{compile_flags}', '%{link_flags}', '%{flags}', '%{exec}']:
+ assert s in substitutions, "Required substitution {} was not provided".format(s)
+
def parseScript(test, preamble):
"""
Extract the script from a test, with substitutions applied.
substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir, tmpBase,
normalize_slashes=useExternalSh)
- # Add the %{build} and %{run} convenience substitutions
+ # Check base substitutions and add the %{build} and %{run} convenience substitutions
+ _checkBaseSubstitutions(substitutions)
substitutions.append(('%{build}', '%{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe'))
substitutions.append(('%{run}', '%{exec} %t.exe'))
if any([re.search(ext, filename) for ext in SUPPORTED_SUFFIXES]):
yield lit.Test.Test(testSuite, pathInSuite + (filename,), localConfig)
- def _checkBaseSubstitutions(self, substitutions):
- substitutions = [s for (s, _) in substitutions]
- for s in ['%{cxx}', '%{compile_flags}', '%{link_flags}', '%{flags}', '%{exec}']:
- assert s in substitutions, "Required substitution {} was not provided".format(s)
-
def _disableWithModules(self, test):
with open(test.getSourcePath(), 'rb') as f:
contents = f.read()
return b'#define _LIBCPP_ASSERT' in contents
def execute(self, test, litConfig):
- self._checkBaseSubstitutions(test.config.substitutions)
VERIFY_FLAGS = '-Xclang -verify -Xclang -verify-ignore-unexpected=note -ferror-limit=0'
supportsVerify = _supportsVerify(test.config)
filename = test.path_in_suite[-1]