]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/command_source/TestCommandSource.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / command_source / TestCommandSource.py
1 """
2 Test that lldb command "command source" works correctly.
3
4 See also http://llvm.org/viewvc/llvm-project?view=rev&revision=109673.
5 """
6
7 from __future__ import print_function
8
9
10
11 import os, sys
12 import lldb
13 from lldbsuite.test.lldbtest import *
14
15 class CommandSourceTestCase(TestBase):
16
17     mydir = TestBase.compute_mydir(__file__)
18
19     @no_debug_info_test
20     def test_command_source(self):
21         """Test that lldb command "command source" works correctly."""
22
23         # Sourcing .lldb in the current working directory, which in turn imports
24         # the "my" package that defines the date() function.
25         self.runCmd("command source .lldb")
26
27         # Python should evaluate "my.date()" successfully.
28         command_interpreter = self.dbg.GetCommandInterpreter()
29         self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
30         result = lldb.SBCommandReturnObject()
31         command_interpreter.HandleCommand("script my.date()", result)
32
33         import datetime
34         self.expect(result.GetOutput(), "script my.date() runs successfully",
35                     exe=False,
36             substrs = [str(datetime.date.today())])