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 # PExpect uses many timeouts internally and doesn't play well 13 # under ASAN on a loaded machine.. 14 @skipIfAsan 15 @skipIfCursesSupportMissing 16 @skipIf(oslist=["linux"], archs=["arm", "aarch64"]) 17 def test_gui(self): 18 self.build() 19 20 self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100,500)) 21 self.expect('br set -f main.c -p "// Break here"', substrs=["Breakpoint 1", "address ="]) 22 self.expect("run", substrs=["stop reason ="]) 23 24 25 escape_key = chr(27).encode() 26 27 # Start the GUI. 28 self.child.sendline("gui") 29 30 # Check for GUI elements in the menu bar. 31 self.child.expect_exact("Target") 32 self.child.expect_exact("Process") 33 self.child.expect_exact("Thread") 34 self.child.expect_exact("View") 35 self.child.expect_exact("Help") 36 37 # Check the sources window. 38 self.child.expect_exact("Sources") 39 self.child.expect_exact("main") 40 self.child.expect_exact("funky_var_name_that_should_be_rendered") 41 42 # Check the variable window. 43 self.child.expect_exact("Variables") 44 self.child.expect_exact("(int) funky_var_name_that_should_be_rendered = 22") 45 46 # Check the bar at the bottom. 47 self.child.expect_exact("Frame:") 48 49 # Press escape to quit the gui 50 self.child.send(escape_key) 51 52 self.expect_prompt() 53 self.quit() 54