[libc++] Make sure we create the working directory for running config check commands
authorLouis Dionne <ldionne@apple.com>
Thu, 30 Apr 2020 18:09:39 +0000 (14:09 -0400)
committerLouis Dionne <ldionne@apple.com>
Thu, 30 Apr 2020 18:10:56 +0000 (14:10 -0400)
The internal Lit shell requires the current working directory to exist.
This didn't show up locally because the directories were already created
by previous runs of the tests.

libcxx/utils/libcxx/test/dsl.py

index 5f88bd7..523c5d9 100644 (file)
@@ -34,8 +34,10 @@ def _executeScriptInternal(test, commands):
       self.maxIndividualTestTime = 0
   litConfig = FakeLitConfig()
   _, tmpBase = lit.TestRunner.getTempPaths(test)
-  execdir = os.path.dirname(test.getExecPath())
-  res = lit.TestRunner.executeScriptInternal(test, litConfig, tmpBase, commands, execdir)
+  execDir = os.path.dirname(test.getExecPath())
+  if not os.path.exists(execDir):
+    os.makedirs(execDir)
+  res = lit.TestRunner.executeScriptInternal(test, litConfig, tmpBase, commands, execDir)
   if isinstance(res, lit.Test.Result):
     res = ('', '', 127, None)
   return res
@@ -110,7 +112,7 @@ def compilerMacros(config, flags=''):
     commands = libcxx.test.newformat.parseScript(test, preamble=commands, fileDependencies=[])
     unparsedOutput, err, exitCode, timeoutInfo = _executeScriptInternal(test, commands)
     parsedMacros = dict()
-    defines = (l.strip() for l in unparsedOutput.split('\n') if l.startswith('#define'))
+    defines = (l.strip() for l in unparsedOutput.split('\n') if l.startswith('#define '))
     for line in defines:
       line = line[len('#define '):]
       macro, _, value = line.partition(' ')