swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.32k stars 10.34k forks source link

lldb's TestSwiftConsumeOperatorAsync.py Test Fails on Fedora #75353

Open bc-lee opened 2 months ago

bc-lee commented 2 months ago

Both ci.swift.org's Fedora 39 and my Fedora 40 systems are experiencing the same issue with lldb's TestSwiftConsumeOperatorAsync.py. The test fails with the following error message:

Details ``` FAIL: test_swift_consume_operator_async_dwarf (TestSwiftConsumeOperatorAsync.TestSwiftConsumeOperatorAsyncType) Check that we properly show variables at various points of the CFG while ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/build-user/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1692, in test_method return attrvalue(self) ^^^^^^^^^^^^^^^ File "/home/build-user/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 169, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/build-user/llvm-project/lldb/test/API/lang/swift/variables/consume_operator_async/TestSwiftConsumeOperatorAsync.py", line 45, in test_swift_consume_operator_async self.do_check_copyable_value_test() File "/home/build-user/llvm-project/lldb/test/API/lang/swift/variables/consume_operator_async/TestSwiftConsumeOperatorAsync.py", line 75, in do_check_copyable_value_test self.assertGreater(varK.unsigned, 0, "varK not initialized?!") AssertionError: 0 not greater than 0 : varK not initialized?! Config=x86_64-/home/build-user/build/buildbot_linux/llvm-linux-x86_64/bin/clang ```

Relevant CI job: https://ci.swift.org/job/oss-swift-package-fedora-39/165

I manually built the test code and ran it with lldb. The results seem different from what is expected in llvm-project/lldb/test/API/lang/swift/variables/consume_operator_async/TestSwiftConsumeOperatorAsync.py.

Details ``` $ /path/to/build/usr/bin/lldb ./a.out (lldb) target create "./a.out" Current executable set to '/path/to//swift/a.out' (x86_64). (lldb) b main.swift:24 Breakpoint 1: where = a.out`copyableValueTest() + 48 at main.swift:24:11, address = 0x0000000000001530 (lldb) b main.swift:27 Breakpoint 2: 3 locations. (lldb) b main.swift:28 Breakpoint 3: where = a.out`copyableValueTest() + 63 at main.swift:28:11, address = 0x00000000000016ef (lldb) b main.swift:30 Breakpoint 4: where = a.out`copyableValueTest() + 217 at main.swift:30:7, address = 0x0000000000001789 (lldb) b main.swift:32 Breakpoint 5: where = a.out`copyableValueTest() + 46 at main.swift:32:7, address = 0x000000000000185e (lldb) c error: Command requires a current process. (lldb) r Process 2644725 launched: '/path/to//swift/a.out' (x86_64) warning: (x86_64) /lib64/libstdc++.so.6 No LZMA support found for reading .gnu_debugdata section warning: (x86_64) /lib64/libm.so.6 No LZMA support found for reading .gnu_debugdata section warning: (x86_64) /lib64/libgcc_s.so.1 No LZMA support found for reading .gnu_debugdata section Process 2644725 stopped * thread #2, name = 'a.out', stop reason = breakpoint 1.1 frame #0: 0x0000555555555530 a.out`copyableValueTest() at main.swift:24:11 21 ////////////////// 22 23 public func copyableValueTest() async { -> 24 print("stop here") // Set breakpoint 00 25 let k = Klass() 26 k.doSomething() 27 await forceSplit() // Set breakpoint 01 Target 0: (a.out) stopped. (lldb) p k error: Error while searching for SDK: HostInfoError error: :2:1: cannot find 'k' in scope/path/to/swift/build-full/usr/lib/swift/linux/_StringPro... k ^ (lldb) c Process 2644725 resuming stop here Process 2644725 stopped * thread #2, name = 'a.out', stop reason = breakpoint 2.1 frame #0: 0x00005555555555ec a.out`copyableValueTest() at main.swift:27:11 24 print("stop here") // Set breakpoint 00 25 let k = Klass() 26 k.doSomething() -> 27 await forceSplit() // Set breakpoint 01 28 print("stop here") // Set breakpoint 02 29 let m = consume k 30 m.doSomething() // Set breakpoint 03 Target 0: (a.out) stopped. (lldb) p k (a.Klass) (lldb) c Process 2644725 resuming Process 2644725 stopped * thread #2, name = 'a.out', stop reason = breakpoint 2.2 frame #0: 0x0000555555555658 a.out`copyableValueTest() at main.swift:27:11 24 print("stop here") // Set breakpoint 00 25 let k = Klass() 26 k.doSomething() -> 27 await forceSplit() // Set breakpoint 01 28 print("stop here") // Set breakpoint 02 29 let m = consume k 30 m.doSomething() // Set breakpoint 03 Target 0: (a.out) stopped. (lldb) p k (a.Klass) 0x00007ffff0002850 {} (lldb) c Process 2644725 resuming Process 2644725 stopped * thread #2, name = 'a.out', stop reason = breakpoint 2.3 frame #0: 0x00005555555556d1 a.out`copyableValueTest() at main.swift:27:11 24 print("stop here") // Set breakpoint 00 25 let k = Klass() 26 k.doSomething() -> 27 await forceSplit() // Set breakpoint 01 28 print("stop here") // Set breakpoint 02 29 let m = consume k 30 m.doSomething() // Set breakpoint 03 Target 0: (a.out) stopped. (lldb) p k error: :2:1: cannot find 'k' in scope k ^ (lldb) c Process 2644725 resuming Process 2644725 stopped * thread #2, name = 'a.out', stop reason = breakpoint 3.1 frame #0: 0x00005555555556ef a.out`copyableValueTest() at main.swift:28:11 25 let k = Klass() 26 k.doSomething() 27 await forceSplit() // Set breakpoint 01 -> 28 print("stop here") // Set breakpoint 02 29 let m = consume k 30 m.doSomething() // Set breakpoint 03 31 await forceSplit() Target 0: (a.out) stopped. (lldb) p k (a.Klass) (lldb) c Process 2644725 resuming stop here Process 2644725 stopped * thread #2, name = 'a.out', stop reason = breakpoint 4.1 frame #0: 0x0000555555555789 a.out`copyableValueTest() at main.swift:30:7 27 await forceSplit() // Set breakpoint 01 28 print("stop here") // Set breakpoint 02 29 let m = consume k -> 30 m.doSomething() // Set breakpoint 03 31 await forceSplit() 32 m.doSomething() // Set breakpoint 04 33 } Target 0: (a.out) stopped. (lldb) p k error: :2:1: cannot find 'k' in scope k ^ (lldb) c Process 2644725 resuming Process 2644725 stopped * thread #2, name = 'a.out', stop reason = breakpoint 5.1 frame #0: 0x000055555555585e a.out`copyableValueTest() at main.swift:32:7 29 let m = consume k 30 m.doSomething() // Set breakpoint 03 31 await forceSplit() -> 32 m.doSomething() // Set breakpoint 04 33 } 34 35 public func copyableVarTest() async { Target 0: (a.out) stopped. (lldb) p k error: :2:1: cannot find 'k' in scope k ^ (lldb) c Process 2644725 resuming stop here stop here stop here Process 2644725 exited with status = 0 (0x00000000) (lldb) q ```

Even when running lldb, I don't see how varK is initialized on line 24. Additionally, line 27 (await forceSplit()) creates three breakpoints, whereas the test code expects only two breakpoints.

The question is: why does this issue occur only on Fedora? Further investigation is needed.

felipepiovezan commented 1 month ago

The question is: why does this issue occur only on Fedora? Further investigation is needed.

This seems suspicious:

(lldb) p k
error: Error while searching for SDK: HostInfoError
error: <EXPR>:2:1: cannot find 'k' in scope/path/to/swift/build-full/usr/lib/swift/linux/_StringPro...
k