summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
authorTim Hammerquist <penryu@apple.com>2017-03-17 18:10:58 +0000
committerTim Hammerquist <penryu@apple.com>2017-03-17 18:10:58 +0000
commit848582181ebd274b1f3d222b2b934d958b06173d (patch)
tree7b0fad1aff4d6dd2102a4ac220b2b84b1737e947 /lldb/packages/Python/lldbsuite/test
parente60343d6b09b6f8eba27a6c27048b5023efbfe5e (diff)
downloadbcm5719-llvm-848582181ebd274b1f3d222b2b934d958b06173d.tar.gz
bcm5719-llvm-848582181ebd274b1f3d222b2b934d958b06173d.zip
executables should be validated before spawning subprocesses
dotest.py script doesn't validate executables passed on the command line before spawning dozens of subprocesses, all of which fail silently, leaving an empty results file. We should validate the lldb and compiler executables on configuration, aborting when given invalid paths, to prevent numerous, cryptic, and spurious failures. <rdar://problem/31117272> llvm-svn: 298111
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/dotest.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 22b02900a22..2dc61f62835 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -25,6 +25,7 @@ from __future__ import print_function
import atexit
import os
import errno
+import logging
import platform
import re
import signal
@@ -275,7 +276,12 @@ def parseOptionsAndInitTestdirs():
do_help = True
if args.compiler:
- configuration.compiler = args.compiler
+ configuration.compiler = os.path.realpath(args.compiler)
+ if not is_exe(configuration.compiler):
+ logging.error(
+ '%s is not a valid compiler executable; aborting...',
+ args.compiler)
+ sys.exit(-1)
else:
# Use a compiler appropriate appropriate for the Apple SDK if one was
# specified
@@ -361,8 +367,14 @@ def parseOptionsAndInitTestdirs():
configuration.lldbFrameworkPath = args.framework
if args.executable:
+ # lldb executable is passed explicitly
lldbtest_config.lldbExec = os.path.realpath(args.executable)
-
+ if not is_exe(lldbtest_config.lldbExec):
+ logging.error(
+ '%s is not a valid executable to test; aborting...',
+ args.executable)
+ sys.exit(-1)
+
if args.server:
os.environ['LLDB_DEBUGSERVER_PATH'] = args.server
OpenPOWER on IntegriCloud