Johnny Chen | b9e7c0a | 2010-07-29 21:42:28 +0000 | [diff] [blame] | 1 | """ |
| 2 | Test that lldb command "command source" works correctly. |
Johnny Chen | 8402832 | 2010-08-02 21:19:08 +0000 | [diff] [blame] | 3 | |
| 4 | See also http://llvm.org/viewvc/llvm-project?view=rev&revision=109673. |
Johnny Chen | b9e7c0a | 2010-07-29 21:42:28 +0000 | [diff] [blame] | 5 | """ |
| 6 | |
| 7 | import os, time |
Johnny Chen | 7325883 | 2010-08-05 23:42:46 +0000 | [diff] [blame] | 8 | import unittest2 |
Johnny Chen | b9e7c0a | 2010-07-29 21:42:28 +0000 | [diff] [blame] | 9 | import lldb |
Johnny Chen | 1794184 | 2010-08-09 23:44:24 +0000 | [diff] [blame] | 10 | from lldbtest import * |
Johnny Chen | b9e7c0a | 2010-07-29 21:42:28 +0000 | [diff] [blame] | 11 | |
Johnny Chen | 1794184 | 2010-08-09 23:44:24 +0000 | [diff] [blame] | 12 | class TestCommandSource(TestBase): |
Johnny Chen | b9e7c0a | 2010-07-29 21:42:28 +0000 | [diff] [blame] | 13 | |
| 14 | mydir = "command_source" |
| 15 | |
| 16 | def test_command_source(self): |
| 17 | """Test that lldb command "command source" works correctly.""" |
Johnny Chen | b9e7c0a | 2010-07-29 21:42:28 +0000 | [diff] [blame] | 18 | |
| 19 | # Sourcing .lldb in the current working directory, which in turn imports |
| 20 | # the "my" package that defines the date() function. |
Johnny Chen | 617cca9 | 2010-08-20 17:04:20 +0000 | [diff] [blame^] | 21 | self.runCmd("command source .lldb") |
Johnny Chen | b9e7c0a | 2010-07-29 21:42:28 +0000 | [diff] [blame] | 22 | |
Johnny Chen | 8402832 | 2010-08-02 21:19:08 +0000 | [diff] [blame] | 23 | # Python should evaluate "my.date()" successfully. |
Johnny Chen | 617cca9 | 2010-08-20 17:04:20 +0000 | [diff] [blame^] | 24 | self.runCmd("script my.date()") |
Johnny Chen | b9e7c0a | 2010-07-29 21:42:28 +0000 | [diff] [blame] | 25 | |
Johnny Chen | b9e7c0a | 2010-07-29 21:42:28 +0000 | [diff] [blame] | 26 | |
| 27 | if __name__ == '__main__': |
Johnny Chen | a212495 | 2010-08-05 21:23:45 +0000 | [diff] [blame] | 28 | import atexit |
Johnny Chen | b9e7c0a | 2010-07-29 21:42:28 +0000 | [diff] [blame] | 29 | lldb.SBDebugger.Initialize() |
Johnny Chen | a212495 | 2010-08-05 21:23:45 +0000 | [diff] [blame] | 30 | atexit.register(lambda: lldb.SBDebugger.Terminate()) |
Johnny Chen | 7325883 | 2010-08-05 23:42:46 +0000 | [diff] [blame] | 31 | unittest2.main() |