davide created this revision.
If you pass an invalid compiler/debugger path on the cmdline to `dotest.py`
this is what you get.
$ python dotest.py --executable /home/davide/work/build-lldb/bin/lldb
--compiler /home/davide/work/build-lldb/bin/clandasfaasdfsg
Traceback (most recent call last):
File "dotest.py", line 7, in <module>
lldbsuite.test.run_suite()
File
"/home/davide/work/llvm-lldb/tools/lldb/packages/Python/lldbsuite/test/dotest.py",
line 1099, in run_suite
parseOptionsAndInitTestdirs()
File
"/home/davide/work/llvm-lldb/tools/lldb/packages/Python/lldbsuite/test/dotest.py",
line 282, in parseOptionsAndInitTestdirs
if not is_exe(configuration.compiler):
File
"/home/davide/work/llvm-lldb/tools/lldb/packages/Python/lldbsuite/test/dotest.py",
line 54, in is_exe
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
File "/usr/lib64/python2.7/genericpath.py", line 37, in isfile
st = os.stat(path)
TypeError: coercing to Unicode: need string or buffer, NoneType found
And with the patch applied:
$ python dotest.py --executable /home/davide/work/build-lldb/bin/lldb
--compiler /home/davide/work/build-lldb/bin/clandasfasg
/home/davide/work/build-lldb/bin/clandasfasg is not a valid path, exiting
Please let me know what you think.
Repository:
rL LLVM
https://reviews.llvm.org/D39199
Files:
packages/Python/lldbsuite/test/dotest.py
Index: packages/Python/lldbsuite/test/dotest.py
===================================================================
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -50,7 +50,11 @@
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)
Index: packages/Python/lldbsuite/test/dotest.py
===================================================================
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -50,7 +50,11 @@
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)
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits