Johnny Chen | 9320d4a | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 1 | """Test lldb help command.""" |
| 2 | |
Johnny Chen | 8c3f918 | 2010-07-01 00:18:39 +0000 | [diff] [blame] | 3 | import os, time |
Johnny Chen | 9320d4a | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 4 | import unittest |
Johnny Chen | bf6ffa3 | 2010-07-03 03:41:59 +0000 | [diff] [blame^] | 5 | import lldb |
| 6 | import lldbtest |
Johnny Chen | 9320d4a | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 7 | |
Johnny Chen | bf6ffa3 | 2010-07-03 03:41:59 +0000 | [diff] [blame^] | 8 | class TestHelpCommand(lldbtest.TestBase): |
Johnny Chen | 119b53e | 2010-07-01 22:52:57 +0000 | [diff] [blame] | 9 | |
Johnny Chen | bf6ffa3 | 2010-07-03 03:41:59 +0000 | [diff] [blame^] | 10 | mydir = "help" |
Johnny Chen | 9320d4a | 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 | 7e363f5 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 15 | self.ci.HandleCommand("help", res) |
Johnny Chen | 8c3f918 | 2010-07-01 00:18:39 +0000 | [diff] [blame] | 16 | time.sleep(0.1) |
Johnny Chen | 7e363f5 | 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 | 7e363f5 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 20 | |
| 21 | def test_help_should_not_hang_emacsshell(self): |
Johnny Chen | 94a6899 | 2010-06-29 23:17:15 +0000 | [diff] [blame] | 22 | """Command 'set term-width 0' should not hang the help command.""" |
Johnny Chen | 7e363f5 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 23 | res = lldb.SBCommandReturnObject() |
| 24 | self.ci.HandleCommand("set term-width 0", res) |
Johnny Chen | 8c3f918 | 2010-07-01 00:18:39 +0000 | [diff] [blame] | 25 | time.sleep(0.1) |
Johnny Chen | 7e363f5 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 26 | self.assertTrue(res.Succeeded()) |
| 27 | self.ci.HandleCommand("help", res) |
Johnny Chen | 8c3f918 | 2010-07-01 00:18:39 +0000 | [diff] [blame] | 28 | time.sleep(0.1) |
Johnny Chen | 9320d4a | 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 | 9320d4a | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 32 | |
| 33 | |
| 34 | if __name__ == '__main__': |
Johnny Chen | 4657be6 | 2010-06-29 19:44:16 +0000 | [diff] [blame] | 35 | lldb.SBDebugger.Initialize() |
Johnny Chen | 9320d4a | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 36 | unittest.main() |
Johnny Chen | 4657be6 | 2010-06-29 19:44:16 +0000 | [diff] [blame] | 37 | lldb.SBDebugger.Terminate() |