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
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 22b0290..2dc61f6 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -25,6 +25,7 @@
import atexit
import os
import errno
+import logging
import platform
import re
import signal
@@ -275,7 +276,12 @@
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 @@
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