[Lldb-commits] [lldb] r316393 - [lldbtests] Handle errors instead of crashing.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 23 16:17:53 PDT 2017


Author: davide
Date: Mon Oct 23 16:17:53 2017
New Revision: 316393

URL: http://llvm.org/viewvc/llvm-project?rev=316393&view=rev
Log:
[lldbtests] Handle errors instead of crashing.

If you pass an invalid compiler/debugger path on the cmdline to `dotest.py`  this is what you get.

  Traceback (most recent call last):
  [...]
    File "dotest.py", line 7, in <module>
      lldbsuite.test.run_suite()
  [...]

And with the patch applied:

  /home/davide/work/build-lldb/bin/clandasfasg is not a valid path, exiting

Differential Revision:  https://reviews.llvm.org/D39199

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=316393&r1=316392&r2=316393&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Oct 23 16:17:53 2017
@@ -50,7 +50,11 @@ from ..support import seven
 
 
 def is_exe(fpath):
-    """Returns true if fpath is an executable."""
+    """Returns true if fpath is an executable.
+       Exits with an error code if the specified path is invalid"""
+    if not os.path.exists(fpath):
+        print(fpath  + " is not a valid path, exiting")
+        sys.exit(-1)
     return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
 
 




More information about the lldb-commits mailing list