blob: e0782d667bb8f0e7e05ea9cd94b627b9e3ef6976 [file] [log] [blame]
Johnny Chen7f5f2802010-08-02 21:26:00 +00001"""
2Test lldb help command.
3
4See also CommandInterpreter::OutputFormattedHelpText().
5"""
Johnny Chen9320d4a2010-06-25 23:15:47 +00006
Johnny Chen8c3f9182010-07-01 00:18:39 +00007import os, time
Johnny Chen73258832010-08-05 23:42:46 +00008import unittest2
Johnny Chenbf6ffa32010-07-03 03:41:59 +00009import lldb
Johnny Chen17941842010-08-09 23:44:24 +000010from lldbtest import *
Johnny Chen9320d4a2010-06-25 23:15:47 +000011
Johnny Chen17941842010-08-09 23:44:24 +000012class TestHelpCommand(TestBase):
Johnny Chen119b53e2010-07-01 22:52:57 +000013
Johnny Chenbf6ffa32010-07-03 03:41:59 +000014 mydir = "help"
Johnny Chen9320d4a2010-06-25 23:15:47 +000015
16 def test_simplehelp(self):
17 """A simple test of 'help' command and its output."""
18 res = lldb.SBCommandReturnObject()
Johnny Chen7e363f52010-06-28 20:55:57 +000019 self.ci.HandleCommand("help", res)
Johnny Chen17941842010-08-09 23:44:24 +000020 #time.sleep(0.1)
Johnny Chen7e363f52010-06-28 20:55:57 +000021 self.assertTrue(res.Succeeded())
22 self.assertTrue(res.GetOutput().startswith(
Johnny Chen17941842010-08-09 23:44:24 +000023 'The following is a list of built-in, permanent debugger commands'),
24 CMD_MSG('help'))
Johnny Chen7e363f52010-06-28 20:55:57 +000025
26 def test_help_should_not_hang_emacsshell(self):
Johnny Chen94a68992010-06-29 23:17:15 +000027 """Command 'set term-width 0' should not hang the help command."""
Johnny Chen7e363f52010-06-28 20:55:57 +000028 res = lldb.SBCommandReturnObject()
29 self.ci.HandleCommand("set term-width 0", res)
Johnny Chen17941842010-08-09 23:44:24 +000030 #time.sleep(0.1)
31 self.assertTrue(res.Succeeded(), CMD_MSG('set term-width 0'))
Johnny Chen7e363f52010-06-28 20:55:57 +000032 self.ci.HandleCommand("help", res)
Johnny Chen17941842010-08-09 23:44:24 +000033 #time.sleep(0.1)
Johnny Chen9320d4a2010-06-25 23:15:47 +000034 self.assertTrue(res.Succeeded())
35 self.assertTrue(res.GetOutput().startswith(
Johnny Chen17941842010-08-09 23:44:24 +000036 'The following is a list of built-in, permanent debugger commands'),
37 CMD_MSG('help'))
Johnny Chen9320d4a2010-06-25 23:15:47 +000038
39
40if __name__ == '__main__':
Johnny Chena2124952010-08-05 21:23:45 +000041 import atexit
Johnny Chen4657be62010-06-29 19:44:16 +000042 lldb.SBDebugger.Initialize()
Johnny Chena2124952010-08-05 21:23:45 +000043 atexit.register(lambda: lldb.SBDebugger.Terminate())
Johnny Chen73258832010-08-05 23:42:46 +000044 unittest2.main()