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 @skipIf(bugnumber="rdar://97460266") 20 def test_gui(self): 21 self.build() 22 23 self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100,500)) 24 self.expect("breakpoint set -n break_here", substrs=["Breakpoint 1", "address ="]) 25 self.expect("run", substrs=["stop reason ="]) 26 27 escape_key = chr(27).encode() 28 29 # Start the GUI and close the welcome window. 30 self.child.sendline("gui") 31 self.child.send(escape_key) 32 self.child.expect_exact("Threads") 33 34 # The thread running thread_start_routine should be expanded. 35 self.child.expect_exact("#0: break_here") 36 37 # Exit GUI. 38 self.child.send(escape_key) 39 self.expect_prompt() 40 41 # Select the main thread. 42 self.child.sendline("thread select 1") 43 44 # Start the GUI. 45 self.child.sendline("gui") 46 self.child.expect_exact("Threads") 47 48 # The main thread should be expanded. 49 self.child.expect("#\d+: main") 50 51 # Quit the GUI 52 self.child.send(escape_key) 53 54 self.expect_prompt() 55 self.quit() 56