207
|
1 """
|
|
2 Test that the 'gui' displays long lines/names correctly without overruns.
|
|
3 """
|
|
4
|
|
5 import lldb
|
|
6 from lldbsuite.test.decorators import *
|
|
7 from lldbsuite.test.lldbtest import *
|
|
8 from lldbsuite.test.lldbpexpect import PExpectTest
|
|
9
|
|
10 class GuiViewLargeCommandTest(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 @skipIfRemote # "run" command will not work correctly for remote debug
|
|
19 @expectedFailureNetBSD
|
|
20 def test_gui(self):
|
|
21 self.build()
|
|
22
|
|
23 # Limit columns to 80, so that long lines will not be displayed completely.
|
|
24 self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100,80))
|
|
25 self.expect('br set -f main.c -p "// Break here"', substrs=["Breakpoint 1", "address ="])
|
|
26 self.expect("run", substrs=["stop reason ="])
|
|
27
|
|
28 escape_key = chr(27).encode()
|
|
29 left_key = chr(27)+'OD' # for vt100 terminal (lldbexpect sets TERM=vt100)
|
|
30 right_key = chr(27)+'OC'
|
|
31 ctrl_l = chr(12)
|
|
32
|
|
33 # Start the GUI and close the welcome window.
|
|
34 self.child.sendline("gui")
|
|
35 self.child.send(escape_key)
|
|
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 some
|
|
40 # kind of an escape sequence (color, frame, etc.).
|
|
41 self.child.expect_exact("int a_variable_with_a_very_looooooooooooooooooooooooooo"+chr(27))
|
|
42 # The escape here checks that there's no content drawn by the previous line.
|
|
43 self.child.expect_exact("int shortvar = 1;"+chr(27))
|
|
44 # Check the triggered breakpoint marker on a long line.
|
|
45 self.child.expect_exact("<<< Thread 1: breakpoint 1.1"+chr(27))
|
|
46
|
|
47 # Check the variable window.
|
|
48 self.child.expect_exact("Variables")
|
|
49 self.child.expect_exact("(int) a_variable_with_a_very_looooooooooooooooooooooooooooooo"+chr(27))
|
|
50 self.child.expect_exact("(int) shortvar = 1"+chr(27))
|
|
51
|
|
52 # Scroll the sources view twice to the right.
|
|
53 self.child.send(right_key)
|
|
54 self.child.send(right_key)
|
|
55 # Force a redraw, otherwise curses will optimize the drawing to not draw all 'o'.
|
|
56 self.child.send(ctrl_l)
|
|
57 # The source code is indented by two spaces, so there'll be just two extra 'o' on the right.
|
|
58 self.child.expect_exact("int a_variable_with_a_very_looooooooooooooooooooooooooooo"+chr(27))
|
|
59
|
|
60 # And scroll back to the left.
|
|
61 self.child.send(left_key)
|
|
62 self.child.send(left_key)
|
|
63 self.child.send(ctrl_l)
|
|
64 self.child.expect_exact("int a_variable_with_a_very_looooooooooooooooooooooooooo"+chr(27))
|
|
65
|
|
66 # Press escape to quit the gui
|
|
67 self.child.send(escape_key)
|
|
68
|
|
69 self.expect_prompt()
|
|
70 self.quit()
|