Skip to content

Commit

Permalink
Split out console and file writing cases in TestCommandScriptImmediat…
Browse files Browse the repository at this point in the history
…eOutput

Summary:
As these are really testing separate issues, they should be run as separate
tests.

Reviewers: zturner, granata.enrico, clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D19690

llvm-svn: 268397
  • Loading branch information
fjricci committed May 3, 2016
1 parent 4a304b3 commit 3cf8e16
Showing 1 changed file with 17 additions and 4 deletions.
Expand Up @@ -24,17 +24,25 @@ def setUp(self):
@skipIfRemote # test not remote-ready llvm.org/pr24813
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@expectedFailureAll(oslist=["freebsd","linux"], bugnumber="llvm.org/pr26139")
def test_command_script_immediate_output (self):
"""Test that LLDB correctly allows scripted commands to set an immediate output file."""
self.launch(timeout=60)
def test_command_script_immediate_output_console (self):
"""Test that LLDB correctly allows scripted commands to set immediate output to the console."""
self.launch(timeout=10)

script = os.path.join(os.getcwd(), 'custom_command.py')
prompt = "\(lldb\) "

self.sendline('command script import %s' % script, patterns=[prompt])
self.sendline('command script add -f custom_command.command_function mycommand', patterns=[prompt])
self.sendline('mycommand', patterns='this is a test string, just a test string')
self.sendline('command script delete mycommand', patterns=[prompt])
self.quit(gracefully=False)

@skipIfRemote # test not remote-ready llvm.org/pr24813
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@expectedFailureAll(oslist=["freebsd","linux"], bugnumber="llvm.org/pr26139")
def test_command_script_immediate_output_file (self):
"""Test that LLDB correctly allows scripted commands to set immediate output to a file."""
self.launch(timeout=10)

test_files = {os.path.join(os.getcwd(), 'read.txt') :'r',
os.path.join(os.getcwd(), 'write.txt') :'w',
Expand All @@ -50,6 +58,11 @@ def test_command_script_immediate_output (self):
with open(path, 'w+') as init:
init.write(starter_string)

script = os.path.join(os.getcwd(), 'custom_command.py')
prompt = "\(lldb\) "

self.sendline('command script import %s' % script, patterns=[prompt])

self.sendline('command script add -f custom_command.write_file mywrite', patterns=[prompt])
for path, mode in test_files.iteritems():
command = 'mywrite "' + path + '" ' + mode
Expand Down

0 comments on commit 3cf8e16

Please sign in to comment.