PATCH: Tweak DejaGNU Reader
Mark Mitchell
mark at codesourcery.com
Fri Nov 4 20:39:41 UTC 2005
This patch makes a few tweaks to the DejaGNU reader.
* DejaGNU logs sometimes contain "ERROR" markers. These aren't
test results, in that they're not associated with particular tests.
So, we don't try to create test results for them.
* Repeating the same cause of failure (in the combined mode) is just
annoying.
* In the non-combined mode, we don't really have a good way of finding
out causes of failure; just leave them blank.
Committed.
--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
2005-11-04 Mark Mitchell <mark at codesourcery.com>
* qm/test/classes/dejagnu_stream.py (DejaGNUReader.__NextOutcome):
Ignore ERROR results.
(DejaGNUReader.__UpdateResult): Don't repeat causes. Don't use
causes at all for non-combined results.
Index: qm/test/classes/dejagnu_stream.py
===================================================================
RCS file: /home/qm/Repository/qm/qm/test/classes/dejagnu_stream.py,v
retrieving revision 1.7
diff -c -5 -p -r1.7 dejagnu_stream.py
*** qm/test/classes/dejagnu_stream.py 26 Oct 2005 00:20:12 -0000 1.7
--- qm/test/classes/dejagnu_stream.py 4 Nov 2005 20:33:57 -0000
*************** class DejaGNUReader(FileResultReader):
*** 259,270 ****
# Each test result is printed on a line by itself,
# beginning with the DejaGNU outcome. For example:
# PASS: g++.dg/compat/eh/template1 cp_compat_y_tst.o compile
dejagnu_outcome = None
for o in DejaGNUTest.dejagnu_outcomes:
! # Ignore WARNING; those are not really test results.
! if o != DejaGNUTest.WARNING and line.startswith(o):
o_len = len(o)
if line[o_len:o_len + 2] == ": ":
dejagnu_outcome = o
break
if dejagnu_outcome:
--- 259,273 ----
# Each test result is printed on a line by itself,
# beginning with the DejaGNU outcome. For example:
# PASS: g++.dg/compat/eh/template1 cp_compat_y_tst.o compile
dejagnu_outcome = None
for o in DejaGNUTest.dejagnu_outcomes:
! # Ignore WARNING and ERROR; those are not really test
! # results.
! if (o not in (DejaGNUTest.WARNING,
! DejaGNUTest.ERROR)
! and line.startswith(o)):
o_len = len(o)
if line[o_len:o_len + 2] == ": ":
dejagnu_outcome = o
break
if dejagnu_outcome:
*************** class DejaGNUReader(FileResultReader):
*** 281,298 ****
test_id = line[len(dejagnu_outcome) + 2:].strip()
# Extract the cause of faiulre.
cause = None
if "execution test" in line:
cause = "Compiled program behaved incorrectly."
! else:
match = self.__cause_regexp.search(line)
if match:
cause = match.group("cause").capitalize()
if cause and cause[-1] != ".":
cause += "."
! elif dejagnu_outcome == DejaGNUTest.UNSUPPORTED:
! cause = "Test is not applicable on this platform."
return test_id, dejagnu_outcome, cause
def __UpdateResult(self, result, dejagnu_outcome, cause):
"""Update 'result' as indicated.
--- 284,303 ----
test_id = line[len(dejagnu_outcome) + 2:].strip()
# Extract the cause of faiulre.
cause = None
if "execution test" in line:
cause = "Compiled program behaved incorrectly."
! elif dejagnu_outcome == DejaGNUTest.UNSUPPORTED:
! cause = "Test is not applicable on this platform."
! elif self.__UseCombinedMode():
match = self.__cause_regexp.search(line)
if match:
cause = match.group("cause").capitalize()
if cause and cause[-1] != ".":
cause += "."
! else:
! cause = ""
return test_id, dejagnu_outcome, cause
def __UpdateResult(self, result, dejagnu_outcome, cause):
"""Update 'result' as indicated.
*************** class DejaGNUReader(FileResultReader):
*** 334,347 ****
and result.GetOutcome() not in (Result.ERROR,
Result.UNTESTED)):
result.SetOutcome(Result.FAIL)
if qmtest_outcome != Result.PASS and cause:
old_cause = result.GetCause()
! if old_cause:
! old_cause += " "
! old_cause += cgi.escape(cause)
! result.SetCause(old_cause)
def __UseCombinedMode(self):
"""Returns true in the combined mode.
--- 339,356 ----
and result.GetOutcome() not in (Result.ERROR,
Result.UNTESTED)):
result.SetOutcome(Result.FAIL)
if qmtest_outcome != Result.PASS and cause:
old_cause = result.GetCause()
! if old_cause and cause in old_cause:
! # Don't repeat the same cause multiple times.
! pass
! else:
! if old_cause:
! old_cause += " "
! old_cause += cgi.escape(cause)
! result.SetCause(old_cause)
def __UseCombinedMode(self):
"""Returns true in the combined mode.
More information about the qmtest
mailing list