<div dir="ltr">You can probably remove the expected failure windows if this is no longer going to be a pexpect test.</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Apr 27, 2016 at 3:14 PM Francis Ricci <<a href="mailto:fjricci@fb.com">fjricci@fb.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">fjricci created this revision.<br>
fjricci added reviewers: granata.enrico, zturner.<br>
fjricci added subscribers: sas, lldb-commits.<br>
<br>
This should make TestCommandScriptImmediateOutput more consistent<br>
with the rest of the test suite.<br>
<br>
<a href="http://reviews.llvm.org/D19633" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19633</a><br>
<br>
Files:<br>
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py<br>
<br>
Index: packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py<br>
===================================================================<br>
--- packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py<br>
+++ packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py<br>
@@ -13,28 +13,25 @@<br>
from lldbsuite.test.lldbpexpect import *<br>
from lldbsuite.test import lldbutil<br>
<br>
-class CommandScriptImmediateOutputTestCase (PExpectTest):<br>
+class CommandScriptImmediateOutputTestCase (TestBase):<br>
<br>
mydir = TestBase.compute_mydir(__file__)<br>
<br>
def setUp(self):<br>
# Call super's setUp().<br>
- PExpectTest.setUp(self)<br>
+ TestBase.setUp(self)<br>
<br>
@skipIfRemote # test not remote-ready <a href="http://llvm.org/pr24813" rel="noreferrer" target="_blank">llvm.org/pr24813</a><br>
@expectedFailureAll(oslist=["windows"], bugnumber="<a href="http://llvm.org/pr22274" rel="noreferrer" target="_blank">llvm.org/pr22274</a>: need a pexpect replacement for windows")<br>
@expectedFailureAll(oslist=["freebsd","linux"], bugnumber="<a href="http://llvm.org/pr26139" rel="noreferrer" target="_blank">llvm.org/pr26139</a>")<br>
def test_command_script_immediate_output (self):<br>
"""Test that LLDB correctly allows scripted commands to set an immediate output file."""<br>
- self.launch(timeout=60)<br>
-<br>
script = os.path.join(os.getcwd(), 'custom_command.py')<br>
- prompt = "\(lldb\) "<br>
<br>
- self.sendline('command script import %s' % script, patterns=[prompt])<br>
- self.sendline('command script add -f custom_command.command_function mycommand', patterns=[prompt])<br>
- self.sendline('mycommand', patterns='this is a test string, just a test string')<br>
- self.sendline('command script delete mycommand', patterns=[prompt])<br>
+ self.runCmd('command script import %s' % script)<br>
+ self.runCmd('command script add -f custom_command.command_function mycommand')<br>
+ self.expect('mycommand', substrs = ['this is a test string, just a test string'])<br>
+ self.runCmd('command script delete mycommand')<br>
<br>
test_files = {os.path.join(os.getcwd(), 'read.txt') :'r',<br>
os.path.join(os.getcwd(), 'write.txt') :'w',<br>
@@ -50,15 +47,12 @@<br>
with open(path, 'w+') as init:<br>
init.write(starter_string)<br>
<br>
- self.sendline('command script add -f custom_command.write_file mywrite', patterns=[prompt])<br>
+ self.runCmd('command script add -f custom_command.write_file mywrite')<br>
+ self.runCmd('command script list')<br>
for path, mode in test_files.iteritems():<br>
- command = 'mywrite "' + path + '" ' + mode<br>
-<br>
- self.sendline(command, patterns=[prompt])<br>
-<br>
- self.sendline('command script delete mywrite', patterns=[prompt])<br>
+ self.runCmd('mywrite ' + path + ' ' + mode)<br>
<br>
- self.quit(gracefully=False)<br>
+ self.runCmd('command script delete mywrite')<br>
<br>
for path, mode in test_files.iteritems():<br>
with open(path, 'r') as result:<br>
<br>
<br>
</blockquote></div>