]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/command_history/TestCommandHistory.py
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / command_history / TestCommandHistory.py
1 """
2 Test the command history mechanism
3 """
4
5 from __future__ import print_function
6
7
8 import os
9 import lldb
10 from lldbsuite.test.decorators import *
11 from lldbsuite.test.lldbtest import *
12 from lldbsuite.test import lldbutil
13
14
15 class CommandHistoryTestCase(TestBase):
16
17     mydir = TestBase.compute_mydir(__file__)
18
19     @no_debug_info_test
20     def test_history(self):
21         self.runCmd('command history --clear', inHistory=False)
22         self.runCmd('breakpoint list', check=False, inHistory=True)  # 0
23         self.runCmd('register read', check=False, inHistory=True)  # 1
24         self.runCmd('apropos hello', check=False, inHistory=True)  # 2
25         self.runCmd('memory write', check=False, inHistory=True)  # 3
26         self.runCmd('log list', check=False, inHistory=True)  # 4
27         self.runCmd('disassemble', check=False, inHistory=True)  # 5
28         self.runCmd('expression 1', check=False, inHistory=True)  # 6
29         self.runCmd(
30             'type summary list -w default',
31             check=False,
32             inHistory=True)  # 7
33         self.runCmd('version', check=False, inHistory=True)  # 8
34         self.runCmd('frame select 1', check=False, inHistory=True)  # 9
35
36         self.expect(
37             "command history -s 3 -c 3",
38             inHistory=True,
39             substrs=[
40                 '3: memory write',
41                 '4: log list',
42                 '5: disassemble'])
43
44         self.expect("command history -s 3 -e 3", inHistory=True,
45                     substrs=['3: memory write'])
46
47         self.expect(
48             "command history -s 6 -e 7",
49             inHistory=True,
50             substrs=[
51                 '6: expression 1',
52                 '7: type summary list -w default'])
53
54         self.expect("command history -c 2", inHistory=True,
55                     substrs=['0: breakpoint list', '1: register read'])
56
57         self.expect("command history -e 3 -c 1", inHistory=True,
58                     substrs=['3: memory write'])
59
60         self.expect(
61             "command history -e 2",
62             inHistory=True,
63             substrs=[
64                 '0: breakpoint list',
65                 '1: register read',
66                 '2: apropos hello'])
67
68         self.expect(
69             "command history -s 12",
70             inHistory=True,
71             substrs=[
72                 '12: command history -s 6 -e 7',
73                 '13: command history -c 2',
74                 '14: command history -e 3 -c 1',
75                 '15: command history -e 2',
76                 '16: command history -s 12'])
77
78         self.expect(
79             "command history -s end -c 3",
80             inHistory=True,
81             substrs=[
82                 '15: command history -e 2',
83                 '16: command history -s 12',
84                 '17: command history -s end -c 3'])
85
86         self.expect(
87             "command history -s end -e 15",
88             inHistory=True,
89             substrs=[
90                 '15: command history -e 2',
91                 '16: command history -s 12',
92                 '17: command history -s end -c 3',
93                 'command history -s end -e 15'])
94
95         self.expect("command history -s 5 -c 1", inHistory=True,
96                     substrs=['5: disassemble'])
97
98         self.expect("command history -c 1 -s 5", inHistory=True,
99                     substrs=['5: disassemble'])
100
101         self.expect("command history -c 1 -e 3", inHistory=True,
102                     substrs=['3: memory write'])
103
104         self.expect(
105             "command history -c 1 -e 3 -s 5",
106             error=True,
107             inHistory=True,
108             substrs=['error: --count, --start-index and --end-index cannot be all specified in the same invocation'])