]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/history/TestHistoryRecall.py
Vendor import of lldb trunk r338536:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / history / TestHistoryRecall.py
1 """
2 Make sure the !N and !-N commands work properly.
3 """
4
5 from __future__ import print_function
6
7
8 import os
9 import time
10 import re
11 import lldb
12 import lldbsuite.test.lldbutil as lldbutil
13 from lldbsuite.test.lldbtest import *
14
15
16 class TestHistoryRecall(TestBase):
17
18     mydir = TestBase.compute_mydir(__file__)
19
20     # If your test case doesn't stress debug info, the
21     # set this to true.  That way it won't be run once for
22     # each debug info format.
23     NO_DEBUG_INFO_TESTCASE = True
24
25     def test_history_recall(self):
26         """Test the !N and !-N functionality of the command interpreter."""
27         self.sample_test()
28
29     def setUp(self):
30         # Call super's setUp().
31         TestBase.setUp(self)
32
33     def sample_test(self):
34         interp = self.dbg.GetCommandInterpreter()
35         result = lldb.SBCommandReturnObject()
36         interp.HandleCommand("command history", result, True)
37         interp.HandleCommand("platform list", result, True)
38
39         interp.HandleCommand("!0", result, False)
40         self.assertTrue(result.Succeeded(), "!0 command did not work: %s"%(result.GetError()))
41         self.assertTrue("command history" in result.GetOutput(), "!0 didn't rerun command history")
42
43         interp.HandleCommand("!-1", result, False)
44         self.assertTrue(result.Succeeded(), "!-1 command did not work: %s"%(result.GetError()))
45         self.assertTrue("host:" in result.GetOutput(), "!-1 didn't rerun platform list.")