diff --git a/gdb-port/tests/unit/breakpoint-manager.py b/gdb-port/tests/unit/breakpoint-manager.py index 446de0bf29aaafaf67972e16b28c132b03e2d56e..2bce7c238bcfbd713966401d7fd2c11271abb911 100644 --- a/gdb-port/tests/unit/breakpoint-manager.py +++ b/gdb-port/tests/unit/breakpoint-manager.py @@ -35,11 +35,14 @@ class BreakpointManagerSettingBreakpoints(unittest.TestCase): self.plprbp_mock_object = self.plprbp_patcher.start() self.hpprbp_patcher = unittest.mock.patch('__main__.HPackratParseRetBreakpoint') self.hpprbp_mock_object = self.hpprbp_patcher.start() + self.pvbp_patcher = unittest.mock.patch('__main__.ParserVirtualBreakpoint') + self.pvbp_mock_object = self.pvbp_patcher.start() def tearDown(self): self.hpprbp_patcher.stop() self.plprbp_patcher.stop() self.hrbp_patcher.stop() + self.pvbp_patcher.stop() # TODO: mock breakpoints, assert on arguments to constructor def test_set_h_rule_breakpoints(self): @@ -73,6 +76,27 @@ class BreakpointManagerSettingBreakpoints(unittest.TestCase): #bps_valid = [ bp.is_valid() for bp in bps] #self.assertEqual(bps_valid, 2 * [False]) + @unittest.skip("Need to make a mock binary to find RETQs in for this one") + def test_locate_retqs(self): + self.fail("Not implemented yet") + + @unittest.skip("Need to make a mock binary to find RETQs in for this one") + def test_locate_retq(self): + self.fail("Not implemented yet") + + def test_set_parser_virtual_breakpoints(self): + self.bpm.set_parser_virtual_breakpoints() + virt_bps = [ self.bpm.__getattribute__(a) for a in dir(self.bpm) if a.startswith("parse_")] + for bp in virt_bps: + self.assertTrue(self.pvbp_mock_object.call_count == len(virt_bps)) + + def test_del_parser_virtual_breakpoints(self): + self.bpm.set_parser_virtual_breakpoints() + virt_bps = [ self.bpm.__getattribute__(a) for a in dir(self.bpm) if a.startswith("parse_")] + self.bpm.del_parser_virtual_breakpoints() + for bp in virt_bps: + self.assertTrue(bp.delete.called) + # TODO #def tearDown(self): #self.bpm.delete