PATCH: Make "qmtest summarize" show resource results, too
Mark Mitchell
mark at codesourcery.com
Fri Aug 18 00:34:05 UTC 2006
The "qmtest summarize" command can be used to show the results of a
previous run. You can say "qmtest summarize results.qmr test" to show
just the results from "test". However, before this patch, there was
no way to show the results of a resource, unless the resource failed,
and, even then, you had to request the results of a test that depended
on the resource.
This patch makes QMTest interpret the IDs given to "qmtest summarize"
as either tests or resources, as convenient.
Applied.
--
Mark Mitchell
CodeSourcery
mark at codesourcery.com
(650) 331-3385 x713
2006-08-17 Mark Mitchell <mark at codesourcery.com>
* qm/test/cmdline.py (QMTest.__ExecuteSummarize): Display resource
results too.
Index: qm/test/cmdline.py
===================================================================
RCS file: /home/qm/Repository/qm/qm/test/cmdline.py,v
retrieving revision 1.119
diff -c -5 -p -r1.119 cmdline.py
*** qm/test/cmdline.py 17 Jul 2006 18:46:06 -0000 1.119
--- qm/test/cmdline.py 18 Aug 2006 00:23:20 -0000
*************** Valid formats are %s.
*** 1451,1478 ****
# The remaining arguments, if any, are test and suite IDs.
id_arguments = self.__arguments[1:]
# Are there any?
# '.' is an alias for <all>, and thus shadows other selectors.
if len(id_arguments) > 0 and not '.' in id_arguments:
! filter = 1
! # Expand arguments into test IDs.
! try:
! if database:
! test_ids = database.ExpandIds(id_arguments)[0]
! else:
! test_ids = id_arguments
! except (qm.test.database.NoSuchTestError,
! qm.test.database.NoSuchSuiteError), exception:
! raise qm.cmdline.CommandError, \
! qm.error("no such ID", id=str(exception))
! except ValueError, exception:
! raise qm.cmdline.CommandError, \
! qm.error("no such ID", id=str(exception))
else:
# No IDs specified. Show all test and resource results.
# Don't show any results by test suite though.
! filter = 0
# Get an iterator over the results.
try:
results = base.load_results(results_path, database)
except Exception, exception:
--- 1451,1478 ----
# The remaining arguments, if any, are test and suite IDs.
id_arguments = self.__arguments[1:]
# Are there any?
# '.' is an alias for <all>, and thus shadows other selectors.
if len(id_arguments) > 0 and not '.' in id_arguments:
! ids = set()
! # Expand arguments into test/resource IDs.
! if database:
! for id in id_arguments:
! extension = database.GetExtension(id)
! if not extension:
! raise qm.cmdline.CommandError, \
! qm.error("no such ID", id = id)
! if extension.kind == database.SUITE:
! ids.update(extension.GetAllTestAndSuiteIds()[0])
! else:
! ids.add(id)
! else:
! ids = set(id_arguments)
else:
# No IDs specified. Show all test and resource results.
# Don't show any results by test suite though.
! ids = None
# Get an iterator over the results.
try:
results = base.load_results(results_path, database)
except Exception, exception:
*************** Valid formats are %s.
*** 1494,1518 ****
# Get the expected outcomes.
outcomes = self.__GetExpectedOutcomes()
resource_results = {}
for r in results:
- if filter and r.GetKind() == Result.RESOURCE_SETUP:
- resource_results[r.GetId()] = r
if r.GetKind() != Result.TEST:
! if not filter:
for s in streams:
s.WriteResult(r)
continue
# We now known that r is test result. If it's not one
# that interests us, we're done.
! if filter and r.GetId() not in test_ids:
continue
# If we're filtering, and this test was not run because it
# depended on a resource that was not set up, emit the
# resource result here.
! if (filter
and r.GetOutcome() == Result.UNTESTED
and r.has_key(Result.RESOURCE)):
rid = r[Result.RESOURCE]
rres = resource_results.get(rid)
if rres:
--- 1494,1518 ----
# Get the expected outcomes.
outcomes = self.__GetExpectedOutcomes()
resource_results = {}
for r in results:
if r.GetKind() != Result.TEST:
! if ids is None or r.GetId() in ids:
for s in streams:
s.WriteResult(r)
+ elif r.GetKind() == Result.RESOURCE_SETUP:
+ resource_results[r.GetId()] = r
continue
# We now known that r is test result. If it's not one
# that interests us, we're done.
! if ids is not None and r.GetId() not in ids:
continue
# If we're filtering, and this test was not run because it
# depended on a resource that was not set up, emit the
# resource result here.
! if (ids is not None
and r.GetOutcome() == Result.UNTESTED
and r.has_key(Result.RESOURCE)):
rid = r[Result.RESOURCE]
rres = resource_results.get(rid)
if rres:
More information about the qmtest
mailing list