test suite issue with Python2.7/3.5

Hi everyone,

I’m trying to run the test suite on lldb and I’m having some issues with Python. I’m on branch 7.0.

When I build lldb, I’ve got a folder “python3.5/site-packages” generated. So I believe that the build system found python3 in my environment.
But when I run the testsuite (using “ninja check-lldb”), I’ve got this issue:

Traceback (most recent call last):
File “/home/rjodin/work/dpu_tools/llvm/lldb/lldb/packages/Python/lldbsuite/test/decorators.py”, line 113, in wrapper
func(*args, **kwargs)
File “/home/rjodin/work/dpu_tools/llvm/lldb/lldb/packages/Python/lldbsuite/test/decorators.py”, line 341, in wrapper
return func(self, *args, **kwargs)
File “/home/rjodin/work/dpu_tools/llvm/lldb/lldb/packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py”, line 39, in test_command_regex
child.expect_exact(prompt)
File “/home/rjodin/work/dpu_tools/llvm/lldb/lldb/third_party/Python/module/pexpect-2.4/pexpect.py”, line 1386, in expect_exact
if type(pattern_list) in types.StringTypes or pattern_list in (
AttributeError: module ‘types’ has no attribute ‘StringTypes’

It seems that it’s because the code in “pexpect.py” is not compatible with python3.5.If I force the system to use python2.7, I’ve got another issue because of the way “_lldb.so” is built (with python3.5):

Traceback (most recent call last):
File “/home/rjodin/work/dpu_tools/llvm/lldb/lldb/test/dotest.py”, line 7, in
lldbsuite.test.run_suite()
File “/home/rjodin/work/dpu_tools/llvm/lldb/lldb/packages/Python/lldbsuite/test/dotest.py”, line 1180, in run_suite
import lldb
File “/home/rjodin/package-sdk-2019.3.0/upmem-internal/usr/share/upmem/lib/python3.5/site-packages/lldb/init.py”, line 39, in
import _lldb
ImportError: dynamic module does not define init function (init_lldb)

What do I do wrong?
Thanks,

logo signature mail 50x50.png

The 7.0 branch is not compatible with Python 3, at least not if you’re not on Windows. The first release that is, would be 9.0, which is currently being qualified. This includes a bunch of compatibility fixes, and a newer version of the vendored pexpect (4.6). As you’ve noticed, using different versions of Python will not work either.

Your only option is to use Python 2.7, both for building LLDB and for running the test suite. Making sure the 2.7 interpreter is first in your PATH should be sufficient. Alternatively, you can explicitly pass -DPYTHON_EXECUTABLE=/path/to/python27.

Cheers,
Jonas

logo signature mail 50x50.png

The 7.0 branch is not compatible with Python 3 … The first release that is, would be 9.0

Should some/all of the recent Python/CMake changes be ported to the 9.0 release branch? ‘git log --grep ython’ turns up r367956, r367153, r367127, r367125, r367115, r366447, and r366383, all of which happened after the fork, I’m wondering if any of them (or others) are important as part of supporting Python 3.

I’ll paste the commit messages below for convenience.

Thanks,

-Joseph

Author: Jonas Devlieghere jonas@devlieghere.com

logo signature mail 50x50.png