def test_user_crash_signal_duplicate(self): description = {"analyzer": "problems2testsuite_analyzer", "type": "problems2testsuite_type", "reason": "Application has been killed", "backtrace": "die()", "executable": "/usr/bin/foo"} origin = create_problem(self, self.p2, bus=self.bus, description=description, wait=True) time.sleep(30) uuid, duphash = create_problem(self, self.p2, bus=self.bus, description=description, wait=False) self.loop_counter += 1 self.wait_for_signals(["Crash"]) self.assertEqual(len(self.crash_signal_occurrences), 2, "Duplicate Crash signal wasn't emitted") self.p2_entry_path = self.crash_signal_occurrences[1][0] self.assertEqual(origin, self.p2_entry_path, "Crash signal was emitted with wrong UID") self.assertEqual(os.geteuid(), self.crash_signal_occurrences[1][1], "Crash signal was emitted with wrong UID") p2e = Problems2Entry(self.root_bus, self.p2_entry_path) self.assertEqual(uuid, p2e.getproperty("UUID")) self.assertEqual(duphash, p2e.getproperty("Duphash")) self.assertEqual(2, p2e.getproperty("Count"))
def setUp(self): logging.debug("Creating user problem") self.p2_entry_path = create_problem(self, self.p2, bus=self.bus, wait=True) logging.debug("Creating root problem") self.p2_entry_root_path = create_problem(self, self.root_p2, bus=self.root_bus, wait=True) logging.debug("Problems created")
def test_user_crash_signal_duplicate(self): description = { "analyzer": "problems2testsuite_analyzer", "type": "problems2testsuite_type", "reason": "Application has been killed", "backtrace": "die()", "executable": "/usr/bin/foo" } origin = create_problem(self, self.p2, bus=self.bus, description=description, wait=True) time.sleep(30) uuid, duphash = create_problem(self, self.p2, bus=self.bus, description=description, wait=False) self.loop_counter += 1 self.wait_for_signals(["Crash"]) self.assertEqual(len(self.crash_signal_occurrences), 2, "Duplicate Crash signal wasn't emitted") self.p2_entry_path = self.crash_signal_occurrences[1][0] self.assertEqual(origin, self.p2_entry_path, "Crash signal was emitted with wrong UID") self.assertEqual(os.geteuid(), self.crash_signal_occurrences[1][1], "Crash signal was emitted with wrong UID") p2e = Problems2Entry(self.root_bus, self.p2_entry_path) self.assertEqual(uuid, p2e.getproperty("UUID")) self.assertEqual(duphash, p2e.getproperty("Duphash")) self.assertEqual(2, p2e.getproperty("Count"))
def test_user_crash_signal(self): uuid, duphash = create_problem(self, self.p2, bus=self.bus, wait=False) self.loop_counter += 1 self.wait_for_signals(["Crash"]) self.assertEqual(len(self.crash_signal_occurrences), 2, "Crash signal wasn't emitted") self.assertEqual(os.geteuid(), self.crash_signal_occurrences[0][1], "Crash signal was emitted with wrong UID") self.p2_entry_path = self.crash_signal_occurrences[0][0] p2e = Problems2Entry(self.root_bus, self.p2_entry_path) self.assertEqual(uuid, p2e.getproperty("UUID")) self.assertEqual(duphash, p2e.getproperty("Duphash"))
def test_foreign_crash_signal(self): with authorize_session(self) as session: uuid, duphash = create_problem(self, self.root_p2, bus=self.root_bus, wait=False) self.loop_counter += 1 self.wait_for_signals(["Crash"]) self.assertEqual(len(self.crash_signal_occurrences), 2, "Crash signal for root's problem wasn't emitted") self.assertEqual(0, self.crash_signal_occurrences[0][1], "Crash signal was emitted with wrong UID") self.p2_entry_root_path = self.crash_signal_occurrences[0][0] p2e_root = Problems2Entry(self.root_bus, self.p2_entry_root_path) self.assertEqual(uuid, p2e_root.getproperty("UUID")) self.assertEqual(duphash, p2e_root.getproperty("Duphash"))
def test_foreign_crash_signal_not_authorized(self): uuid, duphash = create_problem(self, self.root_p2, bus=self.root_bus, wait=False) # This must timeout - the signal should be delivered only to # root's session. self.loop_counter += 1 self.wait_for_signals(["Crash"]) self.assertEqual(len(self.crash_signal_occurrences), 1, "Crash signal for root's problem wasn't emitted") self.assertEqual(0, self.crash_signal_occurrences[0][1], "Crash signal was emitted with wrong UID") self.p2_entry_root_path = self.crash_signal_occurrences[0][0] p2e_root = Problems2Entry(self.root_bus, self.p2_entry_root_path) self.assertEqual(uuid, p2e_root.getproperty("UUID")) self.assertEqual(duphash, p2e_root.getproperty("Duphash"))
def _bunch_of_new_problems(self, upper_limit): self.problems = list() for i in range(0, upper_limit): problem_path = create_problem(self, self.p2, wait=True) self.problems.append(problem_path)
def setUp(self): self.p2_entry_path = create_fully_initialized_problem(self, self.p2) self.p2_entry_root_path = create_problem(self, self.root_p2, bus=self.root_bus)