blob: 530bbda1ecd0179c041a70a4119dc89ed66febff [file] [log] [blame]
Johnny Chen9320d4a2010-06-25 23:15:47 +00001"""Test lldb help command."""
2
Johnny Chen8c3f9182010-07-01 00:18:39 +00003import os, time
Johnny Chen9320d4a2010-06-25 23:15:47 +00004import unittest
Johnny Chenbf6ffa32010-07-03 03:41:59 +00005import lldb
6import lldbtest
Johnny Chen9320d4a2010-06-25 23:15:47 +00007
Johnny Chenbf6ffa32010-07-03 03:41:59 +00008class TestHelpCommand(lldbtest.TestBase):
Johnny Chen119b53e2010-07-01 22:52:57 +00009
Johnny Chenbf6ffa32010-07-03 03:41:59 +000010 mydir = "help"
Johnny Chen9320d4a2010-06-25 23:15:47 +000011
12 def test_simplehelp(self):
13 """A simple test of 'help' command and its output."""
14 res = lldb.SBCommandReturnObject()
Johnny Chen7e363f52010-06-28 20:55:57 +000015 self.ci.HandleCommand("help", res)
Johnny Chen8c3f9182010-07-01 00:18:39 +000016 time.sleep(0.1)
Johnny Chen7e363f52010-06-28 20:55:57 +000017 self.assertTrue(res.Succeeded())
18 self.assertTrue(res.GetOutput().startswith(
19 'The following is a list of built-in, permanent debugger commands'))
Johnny Chen7e363f52010-06-28 20:55:57 +000020
21 def test_help_should_not_hang_emacsshell(self):
Johnny Chen94a68992010-06-29 23:17:15 +000022 """Command 'set term-width 0' should not hang the help command."""
Johnny Chen7e363f52010-06-28 20:55:57 +000023 res = lldb.SBCommandReturnObject()
24 self.ci.HandleCommand("set term-width 0", res)
Johnny Chen8c3f9182010-07-01 00:18:39 +000025 time.sleep(0.1)
Johnny Chen7e363f52010-06-28 20:55:57 +000026 self.assertTrue(res.Succeeded())
27 self.ci.HandleCommand("help", res)
Johnny Chen8c3f9182010-07-01 00:18:39 +000028 time.sleep(0.1)
Johnny Chen9320d4a2010-06-25 23:15:47 +000029 self.assertTrue(res.Succeeded())
30 self.assertTrue(res.GetOutput().startswith(
31 'The following is a list of built-in, permanent debugger commands'))
Johnny Chen9320d4a2010-06-25 23:15:47 +000032
33
34if __name__ == '__main__':
Johnny Chen4657be62010-06-29 19:44:16 +000035 lldb.SBDebugger.Initialize()
Johnny Chen9320d4a2010-06-25 23:15:47 +000036 unittest.main()
Johnny Chen4657be62010-06-29 19:44:16 +000037 lldb.SBDebugger.Terminate()