"""
Test that LLDB correctly allows scripted commands to set an immediate output file
"""

from __future__ import print_function



import os, time
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.lldbpexpect import *

class CommandScriptImmediateOutputTestCase (PExpectTest):

    mydir = TestBase.compute_mydir(__file__)

    def setUp(self):
        # Call super's setUp().
        PExpectTest.setUp(self)

    @skipIfRemote # test not remote-ready llvm.org/pr24813
    @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
    @expectedFlakeyLinux("llvm.org/pr25172")
    @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
    def test_command_script_immediate_output (self):
        """Test that LLDB correctly allows scripted commands to set an immediate output file."""
        self.launch(timeout=5)

        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)

"""
Test that LLDB correctly allows scripted commands to set an immediate output file
"""

from __future__ import print_function



import os, time
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.lldbpexpect import *

class CommandScriptImmediateOutputTestCase (PExpectTest):

    mydir = TestBase.compute_mydir(__file__)

    def setUp(self):
        # Call super's setUp().
        PExpectTest.setUp(self)

    @skipIfRemote # test not remote-ready llvm.org/pr24813
    @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
    def test_command_script_immediate_output (self):
        """Test that LLDB correctly allows scripted commands to set an immediate output file."""
        self.launch(timeout=5)

        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)

Mark these tests on FreeBSD and Linux as non-flakey. We don't know that they are
Mark these tests on FreeBSD and Linux as non-flakey. We don't know that they are

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@257656 91177308-0d34-0410-b5e6-96231b3b80d8
