You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@gump.apache.org by aj...@apache.org on 2003/10/26 16:22:22 UTC
cvs commit: jakarta-gump/python/gump launcher.py context.py document.py
ajack 2003/10/26 07:22:22
Modified: python/gump launcher.py context.py document.py
Log:
Present 'project summary counters' on workspace and modules.
[aka Nick's Win/Loss]
Revision Changes Path
1.31 +1 -1 jakarta-gump/python/gump/launcher.py
Index: launcher.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/launcher.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- launcher.py 23 Oct 2003 19:38:16 -0000 1.30
+++ launcher.py 26 Oct 2003 15:22:22 -0000 1.31
@@ -399,7 +399,7 @@
# low byte = signal that killed it
#
result.signal=(waitcode & 0xFF)
- result.exit_code=(waitcode & 0xFF00)
+ result.exit_code=(((waitcode & 0xFF00) >> 8) & 0xFF)
#
# Assume timed out if this is not running...
1.26 +79 -30 jakarta-gump/python/gump/context.py
Index: context.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/context.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- context.py 20 Oct 2003 23:58:37 -0000 1.25
+++ context.py 26 Oct 2003 15:22:22 -0000 1.26
@@ -291,12 +291,58 @@
class Summary:
""" Contains an overview """
- def __init__(self,successes,failures,prereqs,other,statepairs):
+ def __init__(self,projects=0,successes=0,failures=0,prereqs=0,noworks=0,packages=0,others=0,statepairs=None):
+ self.projects=projects
self.successes=successes
self.failures=failures
self.prereqs=prereqs
- self.other=other
- self.statepair=statepairs
+ self.noworks=noworks
+ self.packages=packages
+ self.others=others
+ self.statepairs=statepairs
+
+ if not self.statepairs: self.statepairs=[]
+
+ def addState(self,pair):
+ status=pair.status
+ # Stand up and be counted
+ if not stateUnset(status):
+ if stateOk(status):
+ self.successes+=1
+ elif STATUS_PREREQ_FAILURE == status:
+ self.prereqs+=1
+ elif STATUS_FAILED == status:
+ self.failures+=1
+ elif STATUS_NO_WORK_PERFORMED == status:
+ self.noworks+=1
+ elif STATUS_STATUS_COMPLETE == status:
+ # :TODO: Accurate?
+ self.packages+=1
+ else:
+ self.others+=1
+
+ # One more project...
+ self.projects += 1
+
+ # Add state, if not already there
+ if not stateUnset(pair.status) and not pair in self.statepairs: \
+ self.statepairs.append(pair)
+
+ def addSummary(self,summary):
+
+ self.projects += summary.projects
+
+ self.successes += summary.successes
+ self.failures += summary.failures
+ self.prereqs += summary.prereqs
+ self.noworks += summary.noworks
+ self.packages += summary.packages
+ self.others += summary.others
+
+ # Add state pair, if not already there
+ for pair in summary.statepairs:
+ if not stateUnset(pair.status) and not pair in self.statepairs: \
+ self.statepairs.append(pair)
class Context:
"""Context for a single entity"""
@@ -367,31 +413,7 @@
ctxt.aggregateStates(states)
return states;
-
- def getSummary(self,summary=None):
- if not summary:
- summary=Summary(0,0,0,0,[])
-
- # Stand up and be counted
- if not stateUnit(self.status):
- if stateOk(self.status):
- summary.successes+=1
- elif STATUS_PREREQ_FAILURE == self.status:
- summary.prereqs+=1
- elif STATUS_FAILED == self.status:
- summary.failures+=1
- else:
- summary.other+=1
-
- # Add state, if not already there
- if not stateUnset(pair.status) and not pair in summary.statepairs: \
- summary.statepairs.append(pair)
-
- # Subordinates
- for ctxt in self:
- ctxt.getSummary(summary)
-
- return summary;
+
def propagateErrorState(self,status,reason=REASON_UNSET,cause=None):
#
@@ -640,7 +662,20 @@
fogFactors=1 # 0/1 is better than 0/0
return round(fogFactor/fogFactors,2)
+
+ # Get a summary of states for each project
+ def getProjectSummary(self,summary=None):
+ if not summary:
+ summary=Summary()
+ #
+ # Subordinates are projects, so get their summary
+ #
+ for ctxt in self:
+ summary.addState(ctxt.getStatePair())
+
+ return summary
+
class GumpContext(Context):
"""Gump Run Context"""
def __init__(self,name="Gump",parent=None):
@@ -742,7 +777,18 @@
projectContext.options.append(optionContext)
except KeyError:
print "Unknown Project : " + option.project
-
+
+ # Get a summary of states for each project
+ def getProjectSummary(self,summary=None):
+ if not summary:
+ summary=Summary()
+
+ # Subordinates are projects
+ for ctxt in self:
+ summary.addSummary(ctxt.getProjectSummary(summary))
+
+ return summary
+
if __name__=='__main__':
# init logging
@@ -761,7 +807,7 @@
cmd.addParameter("A","a")
cmd.addParameter("B")
- item=WorkItem(TYPE_TEST,cmd,CmdResult(cmd))
+ item=WorkItem(WORK_TYPE_CHECK,cmd,CmdResult(cmd))
context=GumpContext()
context.performedWorkOnProject(project1, item);
@@ -774,3 +820,6 @@
moduleContext=gumpContext.getModuleContext("M")
projectContext=gumpContext.getProjectContextForProject(project1)
+
+ summary=gumpContext.getProjectSummary()
+ dump(summary)
\ No newline at end of file
1.93 +31 -1 jakarta-gump/python/gump/document.py
Index: document.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/document.py,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- document.py 24 Oct 2003 18:31:35 -0000 1.92
+++ document.py 26 Oct 2003 15:22:22 -0000 1.93
@@ -256,6 +256,7 @@
x=startXDoc(getWorkspaceDocument(workspace,wdir))
headerXDoc(x,'Workspace')
+
startSectionXDoc(x,'Workspace Definition')
startTableXDoc(x)
titledDataInTableXDoc(x,'Gump Version', setting.version)
@@ -284,6 +285,8 @@
noteXDoc(x,note)
+ documentSummary(x,context.getProjectSummary())
+
documentAnnotations(x,context.annotations)
startSectionXDoc(x,'Details')
@@ -512,7 +515,7 @@
module=Module.list[modulename]
x=startXDoc(getModuleDocument(workspace,modulename,mdir))
headerXDoc(x,'Module : ' + modulename)
-
+
# Provide a description/link back to the module site.
startSectionXDoc(x,'Description')
@@ -529,6 +532,7 @@
xparagraphXDoc(x,description)
endSectionXDoc(x)
+ documentSummary(x,modulecontext.getProjectSummary())
documentAnnotations(x,modulecontext.annotations)
@@ -773,6 +777,32 @@
x.write(' </table>\n')
endSectionXDoc(x)
+def documentSummary(x,summary,description='Project(s) Summary'):
+ if not summary or not summary.projects: return
+ startSectionXDoc(x,description)
+ startTableXDoc(x,'Project Statistics')
+
+ startTableRowXDoc(x)
+ insertTableHeaderXDoc(x, 'Projects')
+ insertTableHeaderXDoc(x, 'Failures')
+ insertTableHeaderXDoc(x, 'Prereqs')
+ insertTableHeaderXDoc(x, 'No Works')
+ insertTableHeaderXDoc(x, 'Packages')
+ insertTableHeaderXDoc(x, 'Others')
+ endTableRowXDoc(x)
+
+ startTableRowXDoc(x)
+ insertTableDataXDoc(x, summary.projects)
+ insertTableDataXDoc(x, summary.failures)
+ insertTableDataXDoc(x, summary.prereqs)
+ insertTableDataXDoc(x, summary.noworks)
+ insertTableDataXDoc(x, summary.packages)
+ insertTableDataXDoc(x, summary.others)
+ endTableRowXDoc(x)
+
+ endTableXDoc(x)
+ endSectionXDoc(x)
+
def documentWorkList(x,workspace,worklist,description='Work',dir='.'):
if not worklist: return
startSectionXDoc(x,description)