[Lldb-commits] [lldb] r298111 - executables should be validated before spawning subprocesses

Tim Hammerquist via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 17 11:10:58 PDT 2017


Author: penryu
Date: Fri Mar 17 13:10:58 2017
New Revision: 298111

URL: http://llvm.org/viewvc/llvm-project?rev=298111&view=rev
Log:
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>

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/dotest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=298111&r1=298110&r2=298111&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Fri Mar 17 13:10:58 2017
@@ -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
 




More information about the lldb-commits mailing list