79 lines · python
1"""2Test that the 'gui' displays long lines/names correctly without overruns.3"""4 5import lldb6from lldbsuite.test.decorators import *7from lldbsuite.test.lldbtest import *8from lldbsuite.test.lldbpexpect import PExpectTest9 10 11class GuiViewLargeCommandTest(PExpectTest):12 # PExpect uses many timeouts internally and doesn't play well13 # under ASAN on a loaded machine..14 @skipIfAsan15 @skipIfCursesSupportMissing16 @skipIfRemote # "run" command will not work correctly for remote debug17 @expectedFailureNetBSD18 @skipIf(oslist=["linux"], archs=["arm$", "aarch64"])19 def test_gui(self):20 self.build()21 22 # Limit columns to 80, so that long lines will not be displayed completely.23 self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100, 80))24 self.expect(25 'br set -f main.c -p "// Break here"', substrs=["Breakpoint 1", "address ="]26 )27 self.expect("run", substrs=["stop reason ="])28 29 escape_key = chr(27).encode()30 left_key = chr(27) + "OD" # for vt100 terminal (lldbexpect sets TERM=vt100)31 right_key = chr(27) + "OC"32 ctrl_l = chr(12)33 34 # Start the GUI.35 self.child.sendline("gui")36 37 # Check the sources window.38 self.child.expect_exact("Sources")39 # The string is copy&pasted from a 80-columns terminal. It will be followed by some40 # kind of an escape sequence (color, frame, etc.).41 self.child.expect_exact(42 "int a_variable_with_a_very_looooooooooooooooooooooooooo" + chr(27)43 )44 # The escape here checks that there's no content drawn by the previous line.45 self.child.expect_exact("int shortvar = 1;" + chr(27))46 # Check the triggered breakpoint marker on a long line.47 self.child.expect_exact("<<< Thread 1: breakpoint 1.1" + chr(27))48 49 # Check the variable window.50 self.child.expect_exact("Variables")51 self.child.expect_exact(52 "(int) a_variable_with_a_very_looooooooooooooooooooooooooooooo" + chr(27)53 )54 self.child.expect_exact("(int) shortvar = 1" + chr(27))55 56 # Scroll the sources view twice to the right.57 self.child.send(right_key)58 self.child.send(right_key)59 # Force a redraw, otherwise curses will optimize the drawing to not draw all 'o'.60 self.child.send(ctrl_l)61 # The source code is indented by two spaces, so there'll be just two extra 'o' on the right.62 self.child.expect_exact(63 "int a_variable_with_a_very_looooooooooooooooooooooooooooo" + chr(27)64 )65 66 # And scroll back to the left.67 self.child.send(left_key)68 self.child.send(left_key)69 self.child.send(ctrl_l)70 self.child.expect_exact(71 "int a_variable_with_a_very_looooooooooooooooooooooooooo" + chr(27)72 )73 74 # Press escape to quit the gui75 self.child.send(escape_key)76 77 self.expect_prompt()78 self.quit()79