[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / lldb / packages / Python / lldbsuite / test / lldbpexpect.py
blobd599bc397622ed2a0693cd7d2060c4cf9cfaf9be
1 from __future__ import absolute_import
3 # System modules
4 import os
5 import sys
7 # Third-party modules
8 import six
10 # LLDB Modules
11 import lldb
12 from .lldbtest import *
13 from . import lldbutil
15 if sys.platform.startswith('win32'):
16 # llvm.org/pr22274: need a pexpect replacement for windows
17 class PExpectTest(object):
18 pass
19 else:
20 import pexpect
22 class PExpectTest(TestBase):
24 NO_DEBUG_INFO_TESTCASE = True
25 PROMPT = "(lldb) "
27 def expect_prompt(self):
28 self.child.expect_exact(self.PROMPT)
30 def launch(self, executable=None, extra_args=None, timeout=30, dimensions=None):
31 logfile = getattr(sys.stdout, 'buffer',
32 sys.stdout) if self.TraceOn() else None
34 args = ['--no-lldbinit', '--no-use-colors']
35 for cmd in self.setUpCommands():
36 args += ['-O', cmd]
37 if executable is not None:
38 args += ['--file', executable]
39 if extra_args is not None:
40 args.extend(extra_args)
42 env = dict(os.environ)
43 env["TERM"]="vt100"
45 self.child = pexpect.spawn(
46 lldbtest_config.lldbExec, args=args, logfile=logfile,
47 timeout=timeout, dimensions=dimensions, env=env)
48 self.expect_prompt()
49 for cmd in self.setUpCommands():
50 self.child.expect_exact(cmd)
51 self.expect_prompt()
52 if executable is not None:
53 self.child.expect_exact("target create")
54 self.child.expect_exact("Current executable set to")
55 self.expect_prompt()
57 def expect(self, cmd, substrs=None):
58 self.assertNotIn('\n', cmd)
59 self.child.sendline(cmd)
60 if substrs is not None:
61 for s in substrs:
62 self.child.expect_exact(s)
63 self.expect_prompt()
65 def quit(self, gracefully=True):
66 self.child.sendeof()
67 self.child.close(force=not gracefully)
68 self.child = None