[Lldb-commits] [lldb] r109806 - in /lldb/trunk/test/command_source: ./ .lldb TestCommandSource.py my.py

Johnny Chen johnny.chen at apple.com
Thu Jul 29 14:42:28 PDT 2010


Author: johnny
Date: Thu Jul 29 16:42:28 2010
New Revision: 109806

URL: http://llvm.org/viewvc/llvm-project?rev=109806&view=rev
Log:
Add a test case to test that lldb command "command source" works correctly.

Added:
    lldb/trunk/test/command_source/
    lldb/trunk/test/command_source/.lldb
    lldb/trunk/test/command_source/TestCommandSource.py
    lldb/trunk/test/command_source/my.py

Added: lldb/trunk/test/command_source/.lldb
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/command_source/.lldb?rev=109806&view=auto
==============================================================================
--- lldb/trunk/test/command_source/.lldb (added)
+++ lldb/trunk/test/command_source/.lldb Thu Jul 29 16:42:28 2010
@@ -0,0 +1 @@
+script import my

Added: lldb/trunk/test/command_source/TestCommandSource.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/command_source/TestCommandSource.py?rev=109806&view=auto
==============================================================================
--- lldb/trunk/test/command_source/TestCommandSource.py (added)
+++ lldb/trunk/test/command_source/TestCommandSource.py Thu Jul 29 16:42:28 2010
@@ -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()

Added: lldb/trunk/test/command_source/my.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/command_source/my.py?rev=109806&view=auto
==============================================================================
--- lldb/trunk/test/command_source/my.py (added)
+++ lldb/trunk/test/command_source/my.py Thu Jul 29 16:42:28 2010
@@ -0,0 +1,4 @@
+def date():
+    import datetime
+    today = datetime.date.today()
+    print today





More information about the lldb-commits mailing list