[Lldb-commits] [PATCH] D19633: Move TestCommandScriptImmediateOutput from PExpectTest to TestBase

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 27 15:16:55 PDT 2016


You can probably remove the expected failure windows if this is no longer
going to be a pexpect test.

On Wed, Apr 27, 2016 at 3:14 PM Francis Ricci <fjricci at fb.com> wrote:

> fjricci created this revision.
> fjricci added reviewers: granata.enrico, zturner.
> fjricci added subscribers: sas, lldb-commits.
>
> This should make TestCommandScriptImmediateOutput more consistent
> with the rest of the test suite.
>
> http://reviews.llvm.org/D19633
>
> Files:
>
> packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
>
> Index:
> packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
> ===================================================================
> ---
> packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
> +++
> packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
> @@ -13,28 +13,25 @@
>  from lldbsuite.test.lldbpexpect import *
>  from lldbsuite.test import lldbutil
>
> -class CommandScriptImmediateOutputTestCase (PExpectTest):
> +class CommandScriptImmediateOutputTestCase (TestBase):
>
>      mydir = TestBase.compute_mydir(__file__)
>
>      def setUp(self):
>          # Call super's setUp().
> -        PExpectTest.setUp(self)
> +        TestBase.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)
> -
>          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.runCmd('command script import %s' % script)
> +        self.runCmd('command script add -f
> custom_command.command_function mycommand')
> +        self.expect('mycommand', substrs = ['this is a test string, just
> a test string'])
> +        self.runCmd('command script delete mycommand')
>
>          test_files = {os.path.join(os.getcwd(), 'read.txt')        :'r',
>                        os.path.join(os.getcwd(), 'write.txt')       :'w',
> @@ -50,15 +47,12 @@
>              with open(path, 'w+') as init:
>                  init.write(starter_string)
>
> -        self.sendline('command script add -f custom_command.write_file
> mywrite', patterns=[prompt])
> +        self.runCmd('command script add -f custom_command.write_file
> mywrite')
> +        self.runCmd('command script list')
>          for path, mode in test_files.iteritems():
> -            command = 'mywrite "' + path + '" ' + mode
> -
> -            self.sendline(command, patterns=[prompt])
> -
> -        self.sendline('command script delete mywrite', patterns=[prompt])
> +            self.runCmd('mywrite ' + path + ' ' + mode)
>
> -        self.quit(gracefully=False)
> +        self.runCmd('command script delete mywrite')
>
>          for path, mode in test_files.iteritems():
>              with open(path, 'r') as result:
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160427/2ed1effb/attachment.html>


More information about the lldb-commits mailing list