Add a mkdir -p to builddir into lldbtest.py

Based on how it is executed, it may not have been yet created.

llvm-svn: 340791
This commit is contained in:
Adrian Prantl 2018-08-27 23:06:37 +00:00
parent c615910be5
commit 7e6ce43ef0
1 changed files with 11 additions and 0 deletions

View File

@ -18,6 +18,16 @@ def getBuildDir(cmd):
found = True
return None
def mkdir_p(path):
import errno
try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST:
raise
if not os.path.isdir(path):
raise OSError(errno.ENOTDIR, "%s is not a directory"%path)
class LLDBTest(TestFormat):
def __init__(self, dotest_cmd):
self.dotest_cmd = dotest_cmd
@ -64,6 +74,7 @@ class LLDBTest(TestFormat):
sys.executable.startswith('/System/'):
builddir = getBuildDir(cmd)
assert(builddir)
mkdir_p(builddir)
copied_python = os.path.join(builddir, 'copied-system-python')
import shutil
shutil.copy(sys.executable, os.path.join(builddir, copied_python))