annotate lldb/test/API/commands/gui/viewlarge/TestGuiViewLarge.py @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 """
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 Test that the 'gui' displays long lines/names correctly without overruns.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 """
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 import lldb
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 from lldbsuite.test.decorators import *
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 from lldbsuite.test.lldbtest import *
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 from lldbsuite.test.lldbpexpect import PExpectTest
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 class GuiViewLargeCommandTest(PExpectTest):
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 mydir = TestBase.compute_mydir(__file__)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 # PExpect uses many timeouts internally and doesn't play well
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 # under ASAN on a loaded machine..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 @skipIfAsan
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 @skipIfCursesSupportMissing
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 @skipIfRemote # "run" command will not work correctly for remote debug
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 @expectedFailureNetBSD
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 def test_gui(self):
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 self.build()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 # Limit columns to 80, so that long lines will not be displayed completely.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100,80))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 self.expect('br set -f main.c -p "// Break here"', substrs=["Breakpoint 1", "address ="])
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 self.expect("run", substrs=["stop reason ="])
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 escape_key = chr(27).encode()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 left_key = chr(27)+'OD' # for vt100 terminal (lldbexpect sets TERM=vt100)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 right_key = chr(27)+'OC'
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 ctrl_l = chr(12)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 # Start the GUI and close the welcome window.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 self.child.sendline("gui")
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 self.child.send(escape_key)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 # Check the sources window.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 self.child.expect_exact("Sources")
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 # The string is copy&pasted from a 80-columns terminal. It will be followed by some
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 # kind of an escape sequence (color, frame, etc.).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 self.child.expect_exact("int a_variable_with_a_very_looooooooooooooooooooooooooo"+chr(27))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 # The escape here checks that there's no content drawn by the previous line.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 self.child.expect_exact("int shortvar = 1;"+chr(27))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 # Check the triggered breakpoint marker on a long line.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 self.child.expect_exact("<<< Thread 1: breakpoint 1.1"+chr(27))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 # Check the variable window.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 self.child.expect_exact("Variables")
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 self.child.expect_exact("(int) a_variable_with_a_very_looooooooooooooooooooooooooooooo"+chr(27))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 self.child.expect_exact("(int) shortvar = 1"+chr(27))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 # Scroll the sources view twice to the right.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 self.child.send(right_key)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 self.child.send(right_key)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 # Force a redraw, otherwise curses will optimize the drawing to not draw all 'o'.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 self.child.send(ctrl_l)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 # The source code is indented by two spaces, so there'll be just two extra 'o' on the right.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 self.child.expect_exact("int a_variable_with_a_very_looooooooooooooooooooooooooooo"+chr(27))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 # And scroll back to the left.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 self.child.send(left_key)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 self.child.send(left_key)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 self.child.send(ctrl_l)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 self.child.expect_exact("int a_variable_with_a_very_looooooooooooooooooooooooooo"+chr(27))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 # Press escape to quit the gui
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 self.child.send(escape_key)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 self.expect_prompt()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 self.quit()