"""
Test the 'gui' default thread tree expansion.
The root process tree item and the tree item corresponding to the selected
thread should be expanded by default.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test.lldbpexpect import PExpectTest
class TestGuiExpandThreadsTree(PExpectTest):
@skipIfAsan
@skipIfCursesSupportMissing
@skipIf(oslist=["linux"], archs=["arm", "aarch64"])
@skipIf(bugnumber="rdar://97460266")
def test_gui(self):
self.build()
self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100, 500))
self.expect(
"breakpoint set -n break_here", substrs=["Breakpoint 1", "address ="]
)
self.expect("run", substrs=["stop reason ="])
escape_key = chr(27).encode()
self.child.sendline("gui")
self.child.send(escape_key)
self.child.expect_exact("Threads")
self.child.expect_exact("#0: break_here")
self.child.send(escape_key)
self.expect_prompt()
self.child.sendline("thread select 1")
self.child.sendline("gui")
self.child.expect_exact("Threads")
self.child.expect("#\d+: main")
self.child.send(escape_key)
self.expect_prompt()
self.quit()