brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 0649f3d Raw
59 lines · python
1"""2Test some features of "session history" and history recall.3"""4 5 6import lldb7import lldbsuite.test.lldbutil as lldbutil8from lldbsuite.test.lldbtest import *9 10 11class TestHistoryRecall(TestBase):12    # If your test case doesn't stress debug info, then13    # set this to true.  That way it won't be run once for14    # each debug info format.15    NO_DEBUG_INFO_TESTCASE = True16 17    def test_history_recall(self):18        """Test the !N and !-N functionality of the command interpreter."""19        self.do_bang_N_test()20 21    def test_regex_history(self):22        """Test the regex commands don't add two elements to the history"""23        self.do_regex_history_test()24 25    def do_regex_history_test(self):26        interp = self.dbg.GetCommandInterpreter()27        result = lldb.SBCommandReturnObject()28        command = "_regexp-break foo.c:12"29        self.runCmd(command, msg="Run the regex break command", inHistory=True)30        interp.HandleCommand("session history", result, True)31        self.assertTrue(result.Succeeded(), "session history ran successfully")32        results = result.GetOutput()33        self.assertIn(command, results, "Recorded the actual command")34        self.assertNotIn(35            "breakpoint set --file 'foo.c' --line 12",36            results,37            "Didn't record the resolved command",38        )39 40    def do_bang_N_test(self):41        interp = self.dbg.GetCommandInterpreter()42        result = lldb.SBCommandReturnObject()43        interp.HandleCommand("session history", result, True)44        interp.HandleCommand("platform list", result, True)45 46        interp.HandleCommand("!0", result, False)47        self.assertTrue(48            result.Succeeded(), "!0 command did not work: %s" % (result.GetError())49        )50        self.assertIn(51            "session history", result.GetOutput(), "!0 didn't rerun session history"52        )53 54        interp.HandleCommand("!-1", result, False)55        self.assertTrue(56            result.Succeeded(), "!-1 command did not work: %s" % (result.GetError())57        )58        self.assertIn("host:", result.GetOutput(), "!-1 didn't rerun platform list.")59