| Johnny Chen | 64845fd | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 1 | """Test lldb help command.""" |
| 2 | |
| Johnny Chen | d0ab3cd | 2010-07-01 00:18:39 +0000 | [diff] [blame] | 3 | import os, time |
| Johnny Chen | 64845fd | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 4 | import unittest |
| Johnny Chen | a1affab | 2010-07-03 03:41:59 +0000 | [diff] [blame^] | 5 | import lldb |
| 6 | import lldbtest |
| Johnny Chen | 64845fd | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 7 | |
| Johnny Chen | a1affab | 2010-07-03 03:41:59 +0000 | [diff] [blame^] | 8 | class TestHelpCommand(lldbtest.TestBase): |
| Johnny Chen | 909e5a6 | 2010-07-01 22:52:57 +0000 | [diff] [blame] | 9 | |
| Johnny Chen | a1affab | 2010-07-03 03:41:59 +0000 | [diff] [blame^] | 10 | mydir = "help" |
| Johnny Chen | 64845fd | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 11 | |
| 12 | def test_simplehelp(self): |
| 13 | """A simple test of 'help' command and its output.""" |
| 14 | res = lldb.SBCommandReturnObject() |
| Johnny Chen | 6b8fc82 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 15 | self.ci.HandleCommand("help", res) |
| Johnny Chen | d0ab3cd | 2010-07-01 00:18:39 +0000 | [diff] [blame] | 16 | time.sleep(0.1) |
| Johnny Chen | 6b8fc82 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 17 | self.assertTrue(res.Succeeded()) |
| 18 | self.assertTrue(res.GetOutput().startswith( |
| 19 | 'The following is a list of built-in, permanent debugger commands')) |
| Johnny Chen | 6b8fc82 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 20 | |
| 21 | def test_help_should_not_hang_emacsshell(self): |
| Johnny Chen | 16b9747 | 2010-06-29 23:17:15 +0000 | [diff] [blame] | 22 | """Command 'set term-width 0' should not hang the help command.""" |
| Johnny Chen | 6b8fc82 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 23 | res = lldb.SBCommandReturnObject() |
| 24 | self.ci.HandleCommand("set term-width 0", res) |
| Johnny Chen | d0ab3cd | 2010-07-01 00:18:39 +0000 | [diff] [blame] | 25 | time.sleep(0.1) |
| Johnny Chen | 6b8fc82 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 26 | self.assertTrue(res.Succeeded()) |
| 27 | self.ci.HandleCommand("help", res) |
| Johnny Chen | d0ab3cd | 2010-07-01 00:18:39 +0000 | [diff] [blame] | 28 | time.sleep(0.1) |
| Johnny Chen | 64845fd | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 29 | self.assertTrue(res.Succeeded()) |
| 30 | self.assertTrue(res.GetOutput().startswith( |
| 31 | 'The following is a list of built-in, permanent debugger commands')) |
| Johnny Chen | 64845fd | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 32 | |
| 33 | |
| 34 | if __name__ == '__main__': |
| Johnny Chen | 1bfbd41 | 2010-06-29 19:44:16 +0000 | [diff] [blame] | 35 | lldb.SBDebugger.Initialize() |
| Johnny Chen | 64845fd | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 36 | unittest.main() |
| Johnny Chen | 1bfbd41 | 2010-06-29 19:44:16 +0000 | [diff] [blame] | 37 | lldb.SBDebugger.Terminate() |