2010-07-29 21:42:28 +00:00
|
|
|
"""
|
|
|
|
|
Test that lldb command "command source" works correctly.
|
2010-08-02 21:19:08 +00:00
|
|
|
|
|
|
|
|
See also http://llvm.org/viewvc/llvm-project?view=rev&revision=109673.
|
2010-07-29 21:42:28 +00:00
|
|
|
"""
|
|
|
|
|
|
2015-10-23 17:04:29 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
|
2015-11-03 19:20:39 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
import os
|
|
|
|
|
import sys
|
2010-07-29 21:42:28 +00:00
|
|
|
import lldb
|
2016-02-04 23:04:17 +00:00
|
|
|
from lldbsuite.test.decorators import *
|
2015-11-03 02:06:18 +00:00
|
|
|
from lldbsuite.test.lldbtest import *
|
2016-02-04 23:04:17 +00:00
|
|
|
from lldbsuite.test import lldbutil
|
2010-07-29 21:42:28 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2010-09-01 19:59:58 +00:00
|
|
|
class CommandSourceTestCase(TestBase):
|
2010-07-29 21:42:28 +00:00
|
|
|
|
2013-12-10 23:19:29 +00:00
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
2010-07-29 21:42:28 +00:00
|
|
|
|
2015-09-30 10:12:40 +00:00
|
|
|
@no_debug_info_test
|
2010-07-29 21:42:28 +00:00
|
|
|
def test_command_source(self):
|
|
|
|
|
"""Test that lldb command "command source" works correctly."""
|
|
|
|
|
|
|
|
|
|
# Sourcing .lldb in the current working directory, which in turn imports
|
|
|
|
|
# the "my" package that defines the date() function.
|
2010-08-20 17:04:20 +00:00
|
|
|
self.runCmd("command source .lldb")
|
2010-07-29 21:42:28 +00:00
|
|
|
|
2010-08-02 21:19:08 +00:00
|
|
|
# Python should evaluate "my.date()" successfully.
|
2014-01-27 23:43:24 +00:00
|
|
|
command_interpreter = self.dbg.GetCommandInterpreter()
|
|
|
|
|
self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
|
|
|
|
|
result = lldb.SBCommandReturnObject()
|
|
|
|
|
command_interpreter.HandleCommand("script my.date()", result)
|
2011-01-28 19:39:06 +00:00
|
|
|
|
2011-01-28 19:30:12 +00:00
|
|
|
import datetime
|
2014-01-27 23:43:24 +00:00
|
|
|
self.expect(result.GetOutput(), "script my.date() runs successfully",
|
2011-01-28 19:30:12 +00:00
|
|
|
exe=False,
|
2016-09-06 20:57:50 +00:00
|
|
|
substrs=[str(datetime.date.today())])
|