blob: 1a78a7f4285f1c5b218cfb5e8bf535438ea61c7c [file] [log] [blame]
Johnny Chenb9e7c0a2010-07-29 21:42:28 +00001"""
2Test that lldb command "command source" works correctly.
Johnny Chen84028322010-08-02 21:19:08 +00003
4See also http://llvm.org/viewvc/llvm-project?view=rev&revision=109673.
Johnny Chenb9e7c0a2010-07-29 21:42:28 +00005"""
6
7import os, time
Johnny Chen73258832010-08-05 23:42:46 +00008import unittest2
Johnny Chenb9e7c0a2010-07-29 21:42:28 +00009import lldb
Johnny Chen17941842010-08-09 23:44:24 +000010from lldbtest import *
Johnny Chenb9e7c0a2010-07-29 21:42:28 +000011
Johnny Chen17941842010-08-09 23:44:24 +000012class TestCommandSource(TestBase):
Johnny Chenb9e7c0a2010-07-29 21:42:28 +000013
14 mydir = "command_source"
15
16 def test_command_source(self):
17 """Test that lldb command "command source" works correctly."""
Johnny Chenb9e7c0a2010-07-29 21:42:28 +000018
19 # Sourcing .lldb in the current working directory, which in turn imports
20 # the "my" package that defines the date() function.
Johnny Chen617cca92010-08-20 17:04:20 +000021 self.runCmd("command source .lldb")
Johnny Chenb9e7c0a2010-07-29 21:42:28 +000022
Johnny Chen84028322010-08-02 21:19:08 +000023 # Python should evaluate "my.date()" successfully.
Johnny Chen617cca92010-08-20 17:04:20 +000024 self.runCmd("script my.date()")
Johnny Chenb9e7c0a2010-07-29 21:42:28 +000025
Johnny Chenb9e7c0a2010-07-29 21:42:28 +000026
27if __name__ == '__main__':
Johnny Chena2124952010-08-05 21:23:45 +000028 import atexit
Johnny Chenb9e7c0a2010-07-29 21:42:28 +000029 lldb.SBDebugger.Initialize()
Johnny Chena2124952010-08-05 21:23:45 +000030 atexit.register(lambda: lldb.SBDebugger.Terminate())
Johnny Chen73258832010-08-05 23:42:46 +000031 unittest2.main()