def __call__(self, iline): answ = [] result_dict = {} m_comment = self.comment_re.match(iline) if m_comment: (line, comment) = m_comment.groups() m_directive = self.directive_re.match(comment) if m_directive: (_, directive, _) = m_directive.groups() else: directive = '' else: line = iline comment = '' directive = '' if comment: result_dict['diagnostics'] = comment if directive: result_dict['directive'] = directive if not self.plan: m_plan = self.plan_re.match(line) if m_plan: plan = m_plan.groups() self.plan = (int(plan[0]), int(plan[1])) self.test_case = self.plan[0]-1 return answ m_testcase = self.testcase_re.match(line) if m_testcase: if not self.plan: self.plan = (-1, -1) if not m_testcase.group(1): result = RC.PASS else: result = RC.FAIL self.test_case = int(m_testcase.group(2) or '0') or self.test_case+1 description = m_testcase.group(3) if self.plan[0] >= 0: if self.test_case < self.plan[0] or \ self.test_case > self.plan[1]: answ.append(event.lwarning( message="${test_case} is out of plan range ${test_plan}!", origin=self.origin, test_case=self.test_case, test_plan=self.plan)) if self.test_cases.has_key(self.test_case): if self.test_cases[self.test_case] != result: answ.append(event.lwarning( message="${test_case} was processed already and returned different result ${prev_result}!", origin=self.origin, test_case=self.test_case, prev_result=result)) else: answ.append(event.lwarning( message="${test_case} was processed already", origin=self.origin, test_case=self.test_case)) self.test_cases[self.test_case] = result result_dict['test_case'] = self.test_case if description: result_dict['message'] = description answ.append(event.result(result,**result_dict)) return answ m_bailout = self.bail_out_re.match(line) if m_bailout: result_dict['message'] = line answ.append(event.result(RC.FATAL, **result_dict)) return answ if self.error_re.match(line): # FIXME: using ${var} in strings. This is both well understood and # easy to process on server dict_update(result_dict, origin=self.origin, message="${line} does not match Test::Harness::TAP format", line=line) # we update result_dict in this case, not to lose information answ.append(event.lwarning(**result_dict)) return answ if comment or directive: answ.append(event.linfo(**result_dict)) return answ return answ
def kill(self, signal='TERM', message=''): log.debug("%s:kill(%r, %r)", self.__class__.__name__, signal, message) self.transport.signalProcess(signal) evt = event.lwarning("Sending %s signal. Reason: %s" % (signal, message)) self.task.proc_input(evt)
def __call__(self, iline): answ = [] result_dict = {} m_comment = self.comment_re.match(iline) if m_comment: (line, comment) = m_comment.groups() m_directive = self.directive_re.match(comment) if m_directive: (_, directive, _) = m_directive.groups() else: directive = '' else: line = iline comment = '' directive = '' if comment: result_dict['diagnostics'] = comment if directive: result_dict['directive'] = directive if not self.plan: m_plan = self.plan_re.match(line) if m_plan: plan = m_plan.groups() self.plan = (int(plan[0]), int(plan[1])) self.test_case = self.plan[0] - 1 return answ m_testcase = self.testcase_re.match(line) if m_testcase: if not self.plan: self.plan = (-1, -1) if not m_testcase.group(1): result = RC.PASS else: result = RC.FAIL self.test_case = int(m_testcase.group(2) or '0') or self.test_case + 1 description = m_testcase.group(3) if self.plan[0] >= 0: if self.test_case < self.plan[0] or \ self.test_case > self.plan[1]: answ.append( event.lwarning( message= "${test_case} is out of plan range ${test_plan}!", origin=self.origin, test_case=self.test_case, test_plan=self.plan)) if self.test_cases.has_key(self.test_case): if self.test_cases[self.test_case] != result: answ.append( event.lwarning( message= "${test_case} was processed already and returned different result ${prev_result}!", origin=self.origin, test_case=self.test_case, prev_result=result)) else: answ.append( event.lwarning( message="${test_case} was processed already", origin=self.origin, test_case=self.test_case)) self.test_cases[self.test_case] = result result_dict['test_case'] = self.test_case if description: result_dict['message'] = description answ.append(event.result(result, **result_dict)) return answ m_bailout = self.bail_out_re.match(line) if m_bailout: result_dict['message'] = line answ.append(event.result(RC.FATAL, **result_dict)) return answ if self.error_re.match(line): # FIXME: using ${var} in strings. This is both well understood and # easy to process on server dict_update( result_dict, origin=self.origin, message="${line} does not match Test::Harness::TAP format", line=line) # we update result_dict in this case, not to lose information answ.append(event.lwarning(**result_dict)) return answ if comment or directive: answ.append(event.linfo(**result_dict)) return answ return answ
def kill(self, signal='TERM', message=''): log.debug("%s:kill(%r, %r)", self.__class__.__name__, signal, message) self.transport.signalProcess(signal) evt = event.lwarning("Sending %s signal. Reason: %s" % (signal, message)) self.task.proc_input(evt)