]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/expression_command/multiline/TestMultilineExpressions.py
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / expression_command / multiline / TestMultilineExpressions.py
1 """Test multiline expressions."""
2
3 from __future__ import print_function
4
5 import os
6 import lldb
7 from lldbsuite.test.decorators import *
8 from lldbsuite.test.lldbtest import *
9 from lldbsuite.test import lldbutil
10
11
12 class MultilineExpressionsTestCase(TestBase):
13
14     mydir = TestBase.compute_mydir(__file__)
15
16     def setUp(self):
17         # Call super's setUp().
18         TestBase.setUp(self)
19         # Find the line number to break on inside main.cpp.
20         self.line = line_number('main.c', 'break')
21
22     @skipIfRemote
23     @expectedFailureAll(
24         oslist=["windows"],
25         bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
26     def test_with_run_commands(self):
27         """Test that multiline expressions work correctly"""
28         self.build()
29         import pexpect
30         exe = os.path.join(os.getcwd(), "a.out")
31         prompt = "(lldb) "
32
33         # So that the child gets torn down after the test.
34         self.child = pexpect.spawn(
35             '%s %s %s' %
36             (lldbtest_config.lldbExec, self.lldbOption, exe))
37         child = self.child
38         # Turn on logging for what the child sends back.
39         if self.TraceOn():
40             child.logfile_read = sys.stdout
41
42         # Set the breakpoint, run the inferior, when it breaks, issue print on
43         # the various convenience variables.
44         child.expect_exact(prompt)
45         child.sendline('breakpoint set -f main.c -l %d' % self.line)
46         child.expect_exact(prompt)
47         child.sendline('run')
48         child.expect_exact("stop reason = breakpoint 1.1")
49         child.expect_exact(prompt)
50         child.sendline('expr')
51         child.expect_exact('1:')
52
53         child.sendline('2+')
54         child.expect_exact('2:')
55
56         child.sendline('3')
57         child.expect_exact('3:')
58
59         child.sendline('')
60         child.expect_exact(prompt)
61         self.expect(child.before, exe=False,
62                     patterns=['= 5'])