LLDB test failures while building Swift 5.0 toolchain

swift5

#1

LLDB test failures while building Swift 5.0 toolchain.

Sample test failure:-


Testing: 0 .
FAIL: lldb-Suite :: benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py (116 of 1566)
******************** TEST 'lldb-Suite :: benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py' FAILED ********************
lldb version 7.0.0 (https://github.com/apple/swift-lldb.git revision 450ac50b3d6c87b246f22f6a883b15c02f372e0c)
Swift-5.0 (revision f6eeb3adca4f6ed7e66d4463883540c361e8f2cf)
clang revision ad7fb41b1dc11fb61584125212aec259ebc583db
llvm revision f63b283c7143aef31863d5915c28ee79ed390be3
LLDB library dir: /root/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/bin
LLDB import library dir: /root/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/bin
Traceback (most recent call last):
File "/root/swift-source/lldb/test/dotest.py", line 7, in
lldbsuite.test.run_suite()
File "/root/swift-source/lldb/packages/Python/lldbsuite/test/dotest.py", line 1258, in run_suite
import lldb
File "/root/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lib/python3.5/site-packages/lldb/init.py", line 53, in
_lldb = swig_import_helper()
File "/root/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lib/python3.5/site-packages/lldb/init.py", line 49, in swig_import_helper
_mod = imp.load_module('_lldb', fp, pathname, description)
ImportError: dynamic module does not define init function (init_lldb)


(Adrian Prantl) #2

From the looks of it, the python bindings are either incomplete or you have some search path problem. As a starting point, I'd try importing the lldb module from within a python interpreter, and debug why that doesn't work.


#3

Hi,

I have installed all the development dependencies as mentioned in https://github.com/apple/swift:-

sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev libcurl4-openssl-dev systemtap-sdt-dev tzdata rsync

I also tried setting the PYTHONPATH as mentioned in:-

The problem still persists and affects around 865 tests due to this reason.

Let me know if I am missing anything else.


(Davide C. C. Italiano) #4

Just set PYTHON_PATH to what lldb -P evaluates to.

e.g.

$ lldb -P
/Applications/Xcode3.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python
$ export PYTHONPATH="/Applications/Xcode3.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python"

Then open python and type
import lldb

Does that work? If not, you have an include problem. If that does, try to run some basic lldb python commands and see what happens (you can probably copy test cases bodies).


#5

Hi @dcci ,

Thanks for the above suggestion, it worked!

Set the python path environment variable PYTHONPATH to what lldb -P evaluated to:-

root@877e1c79bb05:~# /root/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/bin/lldb -P
/root/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lib/python2.7/site-packages

root@877e1c79bb05:~# export PYTHONPATH="/root/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lib/python2.7/site-packages"

With this 865/883 failing test cases passed which previously failed with common errors as mentioned in previous comments above.

Current status of lldb test suite is as below:-
Expected Passes : 1402
Unsupported Tests : 49
Unexpected Failures: 127

Investigating on the failure test cases further.

Around 51 test cases fail due to the following errors:-

FAIL: test_dwarf (lldbsuite.test.lldbtest.TestArrayEnum)

Traceback (most recent call last):
File "/root/swift-source/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1744, in test_method
return attrvalue(self)
File "/root/swift-source/lldb/packages/Python/lldbsuite/test/decorators.py", line 144, in wrapper
func(*args, **kwargs)
File "/root/swift-source/lldb/packages/Python/lldbsuite/test/lldbinline.py", line 134, in _test
self.do_test()
File "/root/swift-source/lldb/packages/Python/lldbsuite/test/lldbinline.py", line 161, in do_test
"inline test did not hit a single breakpoint")
AssertionError: False is not True : inline test did not hit a single breakpoint
Config=ppc64le-/root/swift-source/build/buildbot_linux/llvm-linux-powerpc64le/bin/clang-7

Let me know if anything looks familiar to you. Thanks! :slight_smile:


(Davide C. C. Italiano) #6

Looks like the inline category of tests is broken. I haven't seen this one earlier, but I do recommend to start debugging the python code responsible for this.
(Random guess, given some breakpoints are not hit, could be that the sources aren't built with -g).


#7

Checked, sources are built with -g.


#8

Current status of lldb test suite is as below:-
Expected Passes : 1402
Unsupported Tests : 49
Unexpected Failures: 127

Many of the remaining test cases throw up errors like below:-
Error Type 1(Approx 49 occurences):-

error: Couldn't lookup symbols:
swift_beginAccess
swift_endAccess
error: Couldn't lookup symbols:
swift_allocError
swift_getWitnessTable
swift_willThrow
error: Couldn't lookup symbols:
method descriptor for Swift.Hashable._rawHashValue(seed: Swift.Int) -> Swift.Int
method descriptor for Swift.Hashable.hash(into: inout Swift.Hasher) -> ()
method descriptor for Swift.Hashable.hashValue.getter : Swift.Int
protocol descriptor for Swift.Hashable
[...Many More...]

Error Type 2(Approx 51 occurences):-

AssertionError: False is not True : inline test did not hit a single breakpoint

Error Type 3(Approx 13 occurences):-

AssertionError: False is not True : Expected 1 thread to stop at breakpoint, 0 did.

Investigating on the failure test cases further.

Tried setting the appropriate environment variables like LD_LIBRARY_PATH, LIBRARY_PATH, PATH, etc, however they don't help much.


(Davide C. C. Italiano) #9

In my experience this happens because the REPL doesn't know how to locate libswiftCore.so/dylib.

Can you make sure the RPATH of the repl_swift binary is set up correctly?
(points to something that contains libSwiftcore ?)

To test my theory you can run lldb --repl and type print() and see if you see the errors.