1""" 2Test the 'gui' default thread tree expansion. 3The root process tree item and the tree item corresponding to the selected 4thread should be expanded by default. 5""" 6 7import lldb 8from lldbsuite.test.decorators import * 9from lldbsuite.test.lldbtest import * 10from lldbsuite.test.lldbpexpect import PExpectTest 11 12class TestGuiExpandThreadsTree(PExpectTest): 13 14 # PExpect uses many timeouts internally and doesn't play well 15 # under ASAN on a loaded machine.. 16 @skipIfAsan 17 @skipIfCursesSupportMissing 18 @skipIf(oslist=["linux"], archs=["arm", "aarch64"]) 19 def test_gui(self): 20 self.build() 21 22 self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100,500)) 23 self.expect("breakpoint set -n break_here", substrs=["Breakpoint 1", "address ="]) 24 self.expect("run", substrs=["stop reason ="]) 25 26 escape_key = chr(27).encode() 27 28 # Start the GUI and close the welcome window. 29 self.child.sendline("gui") 30 self.child.send(escape_key) 31 self.child.expect_exact("Threads") 32 33 # The thread running thread_start_routine should be expanded. 34 self.child.expect_exact("#0: break_here") 35 36 # Exit GUI. 37 self.child.send(escape_key) 38 self.expect_prompt() 39 40 # Select the main thread. 41 self.child.sendline("thread select 1") 42 43 # Start the GUI. 44 self.child.sendline("gui") 45 self.child.expect_exact("Threads") 46 47 # The main thread should be expanded. 48 self.child.expect("#\d+: main") 49 50 # Quit the GUI 51 self.child.send(escape_key) 52 53 self.expect_prompt() 54 self.quit() 55