Fixed the failing test TestCommandScriptImmediateOutput on MacOSX. Turns out that...
authorGreg Clayton <gclayton@apple.com>
Wed, 30 Mar 2016 00:02:13 +0000 (00:02 +0000)
committerGreg Clayton <gclayton@apple.com>
Wed, 30 Mar 2016 00:02:13 +0000 (00:02 +0000)
commit3de2a90574cdf8b0a76afcb3d843219c1387a8ff
treee0a9b23591ae268094c140caeb80f6afb3bd95c2
parent49fe4eda4c06b1a29eb9a39bc60b89f5f2f6e97d
Fixed the failing test TestCommandScriptImmediateOutput on MacOSX. Turns out that there are few things to watch out for when writing pexpect tests:

1 - If you plan on looking for the "(lldb) " prompt as a regular expression, look for "\(lldb\) " so you don't just find "lldb".
2 - Make sure to not use colors (specify --no-use-colors as an option to lldb when launching it) as our editline will print:

"(lldb) <color junk>(lldb) "

where "<color junk>" is a work around that is used to allow us to colorize our prompts. The bad thing is this will make pexepct code like this not execute as you would expect:

prompt = "\(lldb\) "
self.child.sendline("breakpoint set ...", prompt)
self.child.sendline("breakpoint clear ...", prompt)

The problem is the first "sendline" will create two lldb prompts and will match both the first and second prompts and you output will get off. So be sure to disable colors if you need to.

Fixed a case where "TestCommandScriptImmediateOutput.py" would fail if you have spaces in your directory names. I modified custom_command.py to use shlex to parse arguments and I quoted the file path we sent down to the custom_command.write_file function.

llvm-svn: 264810
lldb/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
lldb/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py
lldb/packages/Python/lldbsuite/test/lldbpexpect.py