Johnny Chen | 7f5f280 | 2010-08-02 21:26:00 +0000 | [diff] [blame] | 1 | """ |
| 2 | Test lldb help command. |
| 3 | |
| 4 | See also CommandInterpreter::OutputFormattedHelpText(). |
| 5 | """ |
Johnny Chen | 9320d4a | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 6 | |
Johnny Chen | 8c3f918 | 2010-07-01 00:18:39 +0000 | [diff] [blame] | 7 | import os, time |
Johnny Chen | 7325883 | 2010-08-05 23:42:46 +0000 | [diff] [blame^] | 8 | import unittest2 |
Johnny Chen | bf6ffa3 | 2010-07-03 03:41:59 +0000 | [diff] [blame] | 9 | import lldb |
| 10 | import lldbtest |
Johnny Chen | 9320d4a | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 11 | |
Johnny Chen | bf6ffa3 | 2010-07-03 03:41:59 +0000 | [diff] [blame] | 12 | class TestHelpCommand(lldbtest.TestBase): |
Johnny Chen | 119b53e | 2010-07-01 22:52:57 +0000 | [diff] [blame] | 13 | |
Johnny Chen | bf6ffa3 | 2010-07-03 03:41:59 +0000 | [diff] [blame] | 14 | mydir = "help" |
Johnny Chen | 9320d4a | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 15 | |
| 16 | def test_simplehelp(self): |
| 17 | """A simple test of 'help' command and its output.""" |
| 18 | res = lldb.SBCommandReturnObject() |
Johnny Chen | 7e363f5 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 19 | self.ci.HandleCommand("help", res) |
Johnny Chen | 8c3f918 | 2010-07-01 00:18:39 +0000 | [diff] [blame] | 20 | time.sleep(0.1) |
Johnny Chen | 7e363f5 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 21 | self.assertTrue(res.Succeeded()) |
| 22 | self.assertTrue(res.GetOutput().startswith( |
| 23 | 'The following is a list of built-in, permanent debugger commands')) |
Johnny Chen | 7e363f5 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 24 | |
| 25 | def test_help_should_not_hang_emacsshell(self): |
Johnny Chen | 94a6899 | 2010-06-29 23:17:15 +0000 | [diff] [blame] | 26 | """Command 'set term-width 0' should not hang the help command.""" |
Johnny Chen | 7e363f5 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 27 | res = lldb.SBCommandReturnObject() |
| 28 | self.ci.HandleCommand("set term-width 0", res) |
Johnny Chen | 8c3f918 | 2010-07-01 00:18:39 +0000 | [diff] [blame] | 29 | time.sleep(0.1) |
Johnny Chen | 7e363f5 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 30 | self.assertTrue(res.Succeeded()) |
| 31 | self.ci.HandleCommand("help", res) |
Johnny Chen | 8c3f918 | 2010-07-01 00:18:39 +0000 | [diff] [blame] | 32 | time.sleep(0.1) |
Johnny Chen | 9320d4a | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 33 | self.assertTrue(res.Succeeded()) |
| 34 | self.assertTrue(res.GetOutput().startswith( |
| 35 | 'The following is a list of built-in, permanent debugger commands')) |
Johnny Chen | 9320d4a | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 36 | |
| 37 | |
| 38 | if __name__ == '__main__': |
Johnny Chen | a212495 | 2010-08-05 21:23:45 +0000 | [diff] [blame] | 39 | import atexit |
Johnny Chen | 4657be6 | 2010-06-29 19:44:16 +0000 | [diff] [blame] | 40 | lldb.SBDebugger.Initialize() |
Johnny Chen | a212495 | 2010-08-05 21:23:45 +0000 | [diff] [blame] | 41 | atexit.register(lambda: lldb.SBDebugger.Terminate()) |
Johnny Chen | 7325883 | 2010-08-05 23:42:46 +0000 | [diff] [blame^] | 42 | unittest2.main() |