2 Test that lldb command "command source" works correctly.
4 See also http://llvm.org/viewvc/llvm-project?view=rev&revision=109673.
7 from __future__ import print_function
13 from lldbsuite.test.decorators import *
14 from lldbsuite.test.lldbtest import *
15 from lldbsuite.test import lldbutil
18 class CommandSourceTestCase(TestBase):
20 mydir = TestBase.compute_mydir(__file__)
23 def test_command_source(self):
24 """Test that lldb command "command source" works correctly."""
26 # Sourcing .lldb in the current working directory, which in turn imports
27 # the "my" package that defines the date() function.
28 self.runCmd("command source .lldb")
30 # Python should evaluate "my.date()" successfully.
31 command_interpreter = self.dbg.GetCommandInterpreter()
32 self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
33 result = lldb.SBCommandReturnObject()
34 command_interpreter.HandleCommand("script my.date()", result)
37 self.expect(result.GetOutput(), "script my.date() runs successfully",
39 substrs=[str(datetime.date.today())])