diff options
Diffstat (limited to 'lldb/test/functionalities/command_source/TestCommandSource.py')
| -rw-r--r-- | lldb/test/functionalities/command_source/TestCommandSource.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/lldb/test/functionalities/command_source/TestCommandSource.py b/lldb/test/functionalities/command_source/TestCommandSource.py index c3eeee6fc56..413b3446aca 100644 --- a/lldb/test/functionalities/command_source/TestCommandSource.py +++ b/lldb/test/functionalities/command_source/TestCommandSource.py @@ -20,21 +20,14 @@ class CommandSourceTestCase(TestBase): # the "my" package that defines the date() function. self.runCmd("command source .lldb") - # Let's temporarily redirect the stdout to our StringIO session object - # in order to capture the script evaluation output. - old_stdout = sys.stdout - session = StringIO.StringIO() - sys.stdout = session - # Python should evaluate "my.date()" successfully. - # Pass 'check=False' so that sys.stdout gets restored unconditionally. - self.runCmd("script my.date()", check=False) - - # Now restore stdout to the way we were. :-) - sys.stdout = old_stdout + command_interpreter = self.dbg.GetCommandInterpreter() + self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER) + result = lldb.SBCommandReturnObject() + command_interpreter.HandleCommand("script my.date()", result) import datetime - self.expect(session.getvalue(), "script my.date() runs successfully", + self.expect(result.GetOutput(), "script my.date() runs successfully", exe=False, substrs = [str(datetime.date.today())]) |

