]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/format/TestFormats.py
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / format / TestFormats.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 TestFormats(TestBase):
16
17     mydir = TestBase.compute_mydir(__file__)
18
19     @expectedFailureAll(
20         hostoslist=["windows"],
21         bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
22     def test_formats(self):
23         """Test format string functionality."""
24         self.build()
25         import pexpect
26         prompt = "(lldb) "
27         child = pexpect.spawn(
28             '%s %s -x -o "b main" -o r a.out' %
29             (lldbtest_config.lldbExec, self.lldbOption))
30         # Turn on logging for what the child sends back.
31         if self.TraceOn():
32             child.logfile_read = sys.stdout
33         # So that the spawned lldb session gets shutdown durng teardown.
34         self.child = child
35
36         # Substitute 'Help!' for 'help' using the 'commands regex' mechanism.
37         child.expect_exact(prompt + 'target create "a.out"')
38         child.expect_exact(prompt + 'b main')
39         child.expect_exact(prompt + 'r')
40         child.expect_exact(prompt)
41         child.sendline()
42         # child.expect_exact(prompt + "target create")
43         #
44         # child.sendline("command regex 'Help__'")
45         # child.expect_exact(regex_prompt)
46         # child.sendline('s/^$/help/')
47         # child.expect_exact(regex_prompt1)
48         # child.sendline('')
49         # child.expect_exact(prompt)
50         # # Help!
51         # child.sendline('Help__')
52         # # If we see the familiar 'help' output, the test is done.
53         # child.expect('Debugger commands:')
54         # # Try and incorrectly remove "Help__" using "command unalias" and verify we fail
55         # child.sendline('command unalias Help__')
56         # child.expect_exact("error: 'Help__' is not an alias, it is a debugger command which can be removed using the 'command delete' command")
57         # child.expect_exact(prompt)
58         #
59         # # Delete the regex command using "command delete"
60         # child.sendline('command delete Help__')
61         # child.expect_exact(prompt)
62         # # Verify the command was removed
63         # child.sendline('Help__')
64         # child.expect_exact("error: 'Help__' is not a valid command")
65         # child.expect_exact(prompt)