]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/command_source/TestCommandSource.py
Vendor import of lldb trunk r290819:
[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 import os
11 import sys
12 import lldb
13 from lldbsuite.test.decorators import *
14 from lldbsuite.test.lldbtest import *
15 from lldbsuite.test import lldbutil
16
17
18 class CommandSourceTestCase(TestBase):
19
20     mydir = TestBase.compute_mydir(__file__)
21
22     @no_debug_info_test
23     def test_command_source(self):
24         """Test that lldb command "command source" works correctly."""
25
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")
29
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)
35
36         import datetime
37         self.expect(result.GetOutput(), "script my.date() runs successfully",
38                     exe=False,
39                     substrs=[str(datetime.date.today())])