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 @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('br set -f main.c -p "// Break here"', substrs=["Breakpoint 1", "address ="]) 24 self.expect("run", substrs=["stop reason ="]) 25 26 27 escape_key = chr(27).encode() 28 29 # Start the GUI. 30 self.child.sendline("gui") 31 32 # Check for GUI elements in the menu bar. 33 self.child.expect_exact("Target") 34 self.child.expect_exact("Process") 35 self.child.expect_exact("Thread") 36 self.child.expect_exact("View") 37 self.child.expect_exact("Help") 38 39 # Check the sources window. 40 self.child.expect_exact("Sources") 41 self.child.expect_exact("main") 42 self.child.expect_exact("funky_var_name_that_should_be_rendered") 43 44 # Check the variable window. 45 self.child.expect_exact("Variables") 46 self.child.expect_exact("(int) funky_var_name_that_should_be_rendered = 22") 47 48 # Check the bar at the bottom. 49 self.child.expect_exact("Frame:") 50 51 # Press escape to quit the gui 52 self.child.send(escape_key) 53 54 self.expect_prompt() 55 self.quit() 56