Add a test case to test that lldb command "command source" works correctly.
llvm-svn: 109806
diff --git a/lldb/test/command_source/.lldb b/lldb/test/command_source/.lldb
new file mode 100644
index 0000000..c544523
--- /dev/null
+++ b/lldb/test/command_source/.lldb
@@ -0,0 +1 @@
+script import my
diff --git a/lldb/test/command_source/TestCommandSource.py b/lldb/test/command_source/TestCommandSource.py
new file mode 100644
index 0000000..979f95c
--- /dev/null
+++ b/lldb/test/command_source/TestCommandSource.py
@@ -0,0 +1,31 @@
+"""
+Test that lldb command "command source" works correctly.
+"""
+
+import os, time
+import unittest
+import lldb
+import lldbtest
+
+class TestCommandSource(lldbtest.TestBase):
+
+ mydir = "command_source"
+
+ def test_command_source(self):
+ """Test that lldb command "command source" works correctly."""
+ res = self.res
+
+ # Sourcing .lldb in the current working directory, which in turn imports
+ # the "my" package that defines the date() function.
+ self.ci.HandleCommand("command source .lldb", res)
+ self.assertTrue(res.Succeeded())
+
+ self.ci.HandleCommand("script my.date()", res)
+ self.assertTrue(res.Succeeded())
+
+ time.sleep(1)
+
+if __name__ == '__main__':
+ lldb.SBDebugger.Initialize()
+ unittest.main()
+ lldb.SBDebugger.Terminate()
diff --git a/lldb/test/command_source/my.py b/lldb/test/command_source/my.py
new file mode 100644
index 0000000..86ce502
--- /dev/null
+++ b/lldb/test/command_source/my.py
@@ -0,0 +1,4 @@
+def date():
+ import datetime
+ today = datetime.date.today()
+ print today