[Lldb-commits] [PATCH] D39199: [lldbtests] Handle errors instead of crashing

Davide Italiano via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 23 13:21:41 PDT 2017


davide added inline comments.


================
Comment at: packages/Python/lldbsuite/test/dotest.py:52
 
 def is_exe(fpath):
+    """Returns true if fpath is an executable.
----------------
clayborg wrote:
> We could add a default parameter here like:
> 
> ```
> def is_exe(fpath, fatal=False):
>   if fatal and not os.path.exists(fpath):
>      ...
> ```
> 
> Then modify any callers. For the --compiler option we should verify it does exist and it should be fatal. Not sure how many other places use this.
Is there any use case where we want to have this relaxed behaviour?
FWIW, I see this being checked in two cases:
1) cmdline handling, in which case can have typing mistakes. In that case, I think we should just exit.
2) input from other scripts. In that case, I think the test scripts implicitly guarantee the validity of the path/handle [and if the path is invalid, it's much nicer to just print a diagnostic instead of an unhandled exception trace, IMHO].

In other words, I'm not entirely convinced we want an additional argument unless there's a good reason for it.


https://reviews.llvm.org/D39199





More information about the lldb-commits mailing list