1""" 2Test that the 'gui' displays the help window and basic UI. 3""" 4 5import lldb 6from lldbsuite.test.decorators import * 7from lldbsuite.test.lldbtest import * 8from lldbsuite.test.lldbpexpect import PExpectTest 9 10class BasicGuiCommandTest(PExpectTest): 11 12 mydir = TestBase.compute_mydir(__file__) 13 14 # PExpect uses many timeouts internally and doesn't play well 15 # under ASAN on a loaded machine.. 16 @skipIfAsan 17 @skipIfCursesSupportMissing 18 def test_gui(self): 19 self.build() 20 21 self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100,500)) 22 self.expect('br set -f main.c -p "// Break here"', substrs=["Breakpoint 1", "address ="]) 23 self.expect("run", substrs=["stop reason ="]) 24 25 26 escape_key = chr(27).encode() 27 28 # Start the GUI for the first time and check for the welcome window. 29 self.child.sendline("gui") 30 self.child.expect_exact("Welcome to the LLDB curses GUI.") 31 32 # Press escape to quit the welcome screen 33 self.child.send(escape_key) 34 # Press escape again to quit the gui 35 self.child.send(escape_key) 36 self.expect_prompt() 37 38 # Start the GUI a second time, this time we should have the normal GUI. 39 self.child.sendline("gui") 40 # Check for GUI elements in the menu bar. 41 self.child.expect_exact("Target") 42 self.child.expect_exact("Process") 43 self.child.expect_exact("Thread") 44 self.child.expect_exact("View") 45 self.child.expect_exact("Help") 46 47 # Check the sources window. 48 self.child.expect_exact("Sources") 49 self.child.expect_exact("main") 50 self.child.expect_exact("funky_var_name_that_should_be_rendered") 51 52 # Check the variable window. 53 self.child.expect_exact("Variables") 54 self.child.expect_exact("(int) funky_var_name_that_should_be_rendered = 22") 55 56 # Check the bar at the bottom. 57 self.child.expect_exact("Frame:") 58 59 # Press escape to quit the gui 60 self.child.send(escape_key) 61 62 self.expect_prompt() 63 self.quit() 64