[Lldb-commits] [PATCH] D90875: [lldb] [test] Avoid double negations in llgs/debugserver logic

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 6 00:29:56 PST 2020


labath added inline comments.


================
Comment at: lldb/packages/Python/lldbsuite/test/dotest.py:950
+    configuration.llgs_platform = (
+        target_platform in ["linux", "freebsd", "netbsd", "windows"])
+
----------------
mgorny wrote:
> labath wrote:
> > This is not entirely equivalent to the previous version -- it won't match "platforms" like "freebsd4.7". Fortunately, we already have some canonicalization code in `lldbplatformutil.getPlatform()`, so if you switch to that, it should be fine.
> Good catch! However, this doesn't seem to work:
> 
> ```
> Command Output (stderr):
> --
> Traceback (most recent call last):
>   File "/home/mgorny/llvm-project/llvm/tools/lldb/test/API/dotest.py", line 7, in <module>
>     lldbsuite.test.run_suite()
>   File "/usr/home/mgorny/llvm-project/lldb/packages/Python/lldbsuite/test/dotest.py", line 855, in run_suite
>     from lldbsuite.test import lldbplatformutil
>   File "/usr/home/mgorny/llvm-project/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py", line 19, in <module>
>     import lldb
> ModuleNotFoundError: No module named 'lldb'
> 
> --
> ```
> 
> There is apparently some obscure problem behind the scenes and it seems above my pay grade. I'll just revert to the old code.
This is fiddly, because all of this happens very early, before everything is set up.
You've tried to import this package much too early. The paths necessary for "import lldb" to work are only set up on line 869 (setupSysPath()). And `lldb.selected_platform` is only set on line ~931. You need to put the import statement after those -- say line 941, to replace the manual triple chopping...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90875/new/

https://reviews.llvm.org/D90875



More information about the lldb-commits mailing list