This is an archive of the discontinued LLVM Phabricator instance.

Re-enable most lldb-vscode tests on Linux.
ClosedPublic

Authored by jgorbe on Apr 2 2019, 2:42 PM.

Details

Summary

After https://reviews.llvm.org/D59828 and https://reviews.llvm.org/D59849,
I believe the problems with these tests hanging have been solved.

I tried enabling all of them on my machine, and got two failures:

  • One of them was spawning a child process that lives for 5 seconds, waited for 5 seconds to attach to the child, and failed because the child wasn't there.
  • The other one was a legit failure because shell expansion of arguments doesn't work on Linux.

This tests enables all lldb-vscode tests on Linux except for "launch process
with shell expansion of args" (which doesn't work), and fixes the other broken
test by reducing the time it waits before attaching to its child process.

Diff Detail

Repository
rL LLVM

Event Timeline

jgorbe created this revision.Apr 2 2019, 2:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2019, 2:42 PM
labath accepted this revision.Apr 3 2019, 12:24 AM
labath added a subscriber: labath.

I think we can give this a shot. We can always re-disable tests that are still flaky and iterate. Thank you for working on this.

lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/attach/TestVSCode_attach.py
95–97 ↗(On Diff #193365)

I am not sure this will be enough. I've seen tests fail sporadically (like 1 time out of a 1000 or so) even with bigger margins than this. I'd increase the wait in the test to at least 10 seconds. If you don't want to wait that long in the common case when things finish quickly, you can implement a debugger_flag pattern like some of the other tests do: https://github.com/llvm-mirror/lldb/blob/master/packages/Python/lldbsuite/test/functionalities/attach_resume/main.cpp.

This revision is now accepted and ready to land.Apr 3 2019, 12:24 AM

Thanks for getting this stuff reliably working. I debug using VS Code every day using lldb-vscode and it is my favorite LLDB based debugger! I look forward to seeing support for Windows and linux being tested and available.

jgorbe updated this revision to Diff 193585.Apr 3 2019, 1:38 PM

Increased wait time in test binary for TestVSCode_attach.py from 5 to 10 seconds.

If this is still unreliable, or it makes the test take too long, I'll switch it
to use the debugger_flag pattern as suggested.

This revision was automatically updated to reflect the committed changes.
jgorbe marked 2 inline comments as done.
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2019, 1:42 PM

You might be interested to know that I've just seen TestVSCode_step flake (so far just once out of ~dozen runs) locally. I've committed r357747 to get a better error message if it happens again.

Thanks! Please let me know if it happens again and I'll try my best to debug it.

Thanks! Please let me know if it happens again and I'll try my best to debug it.

It is still happening (e.g. http://lab.llvm.org:8014/builders/lldb-x86_64-debian/builds/141), but I already have a fix for that: <D60608>.

A couple of the tests from TestVSCode_attach.py (test_by_pid and test_by_name) are failing for us on Ubuntu because they are failing to attach: AssertionError: False is not True : attach failed (Operation not permitted). It looks like attaching by pid or by name requires elevation - if I rerun the same tests with sudo, they pass reliably. How did you run the tests when they passed for you?

Incidentally, AFAIK there is no Ubuntu lldb bot...

labath added a comment.May 9 2019, 4:08 AM

A couple of the tests from TestVSCode_attach.py (test_by_pid and test_by_name) are failing for us on Ubuntu because they are failing to attach: AssertionError: False is not True : attach failed (Operation not permitted). It looks like attaching by pid or by name requires elevation - if I rerun the same tests with sudo, they pass reliably. How did you run the tests when they passed for you?

Incidentally, AFAIK there is no Ubuntu lldb bot...

You probably have YAMA enabled on those machines. In the rest of our attach tests, we have the inferiors disable YAMA so that the debugger can attach, but it looks like the vscode tests are not making use of that feature. The fix should be as simple as adding lldb_enable_attach() at the start of the inferior main function.

Thanks, Pavel! I tested out the proposed change and all of our Ubuntu bots now work. I've committed it as well.

BTW, it looks like the attach test is still flaky http://lab.llvm.org:8014/builders/lldb-x86_64-debian/builds/1541/steps/test/logs/stdio, though it looks like the failures are super-rare (this is the first time I've seen it do that). Judging by the error message alone, it's not clear to me whether this is due to the sleep being too small, or if there's something else going on.