def _formatListEntry(self, iEntry): oEntry = self._aoEntries[iEntry] from testmanager.webui.wuiadmin import WuiAdmin # # Test case list. # sHtml = '' if len(oEntry.aoMembers) > 0: for oMember in oEntry.aoMembers: sHtml += '<dl>\n' \ ' <dd><strong>%s</strong> (priority: %d) %s %s</dd>\n' \ % ( webutils.escapeElem(oMember.oTestCase.sName), oMember.iSchedPriority, WuiTmLink('Details', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseDetails, TestCaseData.ksParam_idGenTestCase: oMember.oTestCase.idGenTestCase, } ).toHtml(), WuiTmLink('Edit', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseEdit, TestCaseData.ksParam_idTestCase: oMember.oTestCase.idTestCase, } ).toHtml() if isDbTimestampInfinity(oMember.oTestCase.tsExpire) else '', ) sHtml += ' <dt>\n' fNoGang = True for oVar in oMember.oTestCase.aoTestCaseArgs: if oVar.cGangMembers > 1: fNoGang = False break sHtml += ' <table class="tminnertbl" width="100%">\n' if fNoGang: sHtml += ' <tr><th>Timeout</th><th>Arguments</th></tr>\n' else: sHtml += ' <tr><th>Gang Size</th><th>Timeout</th><th style="text-align:left;">Arguments</th></tr>\n' cArgsIncluded = 0 for oVar in oMember.oTestCase.aoTestCaseArgs: if oMember.aidTestCaseArgs is None or oVar.idTestCaseArgs in oMember.aidTestCaseArgs: cArgsIncluded += 1 if fNoGang: sHtml += ' <tr>' else: sHtml += ' <tr><td>%s</td>' % ( oVar.cGangMembers, ) sHtml += '<td>%s</td><td>%s</td></tr>\n' \ % ( utils.formatIntervalSeconds(oMember.oTestCase.cSecTimeout if oVar.cSecTimeout is None else oVar.cSecTimeout), webutils.escapeElem(oVar.sArgs), ) if cArgsIncluded == 0: sHtml += ' <tr><td colspan="%u">No arguments selected.</td></tr>\n' % ( 2 if fNoGang else 3, ) sHtml += ' </table>\n' \ ' </dl>\n' oTestCases = WuiRawHtml(sHtml) # # Actions. # aoActions = [ WuiTmLink( 'Details', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupDetails, TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup, WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }) ] if isDbTimestampInfinity(oEntry.tsExpire): aoActions.append( WuiTmLink( 'Modify', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupEdit, TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup })) aoActions.append( WuiTmLink( 'Clone', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupClone, TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup, WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, })) aoActions.append( WuiTmLink( 'Remove', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupDoRemove, TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup }, sConfirm='Do you really want to remove test group #%d?' % (oEntry.idTestGroup, ))) else: aoActions.append( WuiTmLink( 'Clone', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupClone, TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup, WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, })) return [ oEntry.idTestGroup, oEntry.sName, oEntry.sDescription if oEntry.sDescription is not None else '', oTestCases, self._formatCommentCell(oEntry.sComment, cMaxLines=max(3, len(oEntry.aoMembers) * 2)), aoActions ]
def _formatListEntry(self, iEntry): oEntry = self._aoEntries[iEntry] from testmanager.webui.wuiadmin import WuiAdmin aoRet = \ [ oEntry.sName.replace('-', u'\u2011'), 'Enabled' if oEntry.fEnabled else 'Disabled', utils.formatIntervalSeconds(oEntry.cSecTimeout), ] # Base command and variations. fNoGang = True fNoSubName = True fAllDefaultTimeouts = True for oVar in oEntry.aoTestCaseArgs: if fNoSubName and oVar.sSubName is not None and len( oVar.sSubName.strip()) > 0: fNoSubName = False if oVar.cGangMembers > 1: fNoGang = False if oVar.cSecTimeout is not None: fAllDefaultTimeouts = False sHtml = ' <table class="tminnertbl" width=100%>\n' \ ' <tr>\n' \ ' ' if not fNoSubName: sHtml += '<th class="tmtcasubname">Sub-name</th>' if not fNoGang: sHtml += '<th class="tmtcagangsize">Gang Size</th>' if not fAllDefaultTimeouts: sHtml += '<th class="tmtcatimeout">Timeout</th>' sHtml += '<th>Additional Arguments</b></th>\n' \ ' </tr>\n' for oTmp in oEntry.aoTestCaseArgs: sHtml += '<tr>' if not fNoSubName: sHtml += '<td>%s</td>' % (webutils.escapeElem(oTmp.sSubName) if oTmp.sSubName is not None else '') if not fNoGang: sHtml += '<td>%d</td>' % (oTmp.cGangMembers, ) if not fAllDefaultTimeouts: sHtml += '<td>%s</td>' \ % (utils.formatIntervalSeconds(oTmp.cSecTimeout) if oTmp.cSecTimeout is not None else 'Default',) sHtml += u'<td>%s</td></tr>' \ % ( webutils.escapeElem(oTmp.sArgs.replace('-', u'\u2011')) if len(oTmp.sArgs) > 0 else u'\u2011',) sHtml += '</tr>\n' sHtml += ' </table>' aoRet.append( [oEntry.sBaseCmd.replace('-', u'\u2011'), WuiRawHtml(sHtml)]) # Next. aoRet += [ oEntry.sValidationKitZips if oEntry.sValidationKitZips is not None else '', ] # Show dependency on other testcases if oEntry.aoDepTestCases not in (None, []): sHtml = ' <ul class="tmshowall">\n' for sTmp in oEntry.aoDepTestCases: sHtml += ' <li class="tmshowall"><a href="%s?%s=%s&%s=%s">%s</a></li>\n' \ % (WuiAdmin.ksScriptName, WuiAdmin.ksParamAction, WuiAdmin.ksActionTestCaseEdit, TestCaseData.ksParam_idTestCase, sTmp.idTestCase, sTmp.sName) sHtml += ' </ul>\n' else: sHtml = '<ul class="tmshowall"><li class="tmshowall">None</li></ul>\n' aoRet.append(WuiRawHtml(sHtml)) # Show dependency on global resources if oEntry.aoDepGlobalResources not in (None, []): sHtml = ' <ul class="tmshowall">\n' for sTmp in oEntry.aoDepGlobalResources: sHtml += ' <li class="tmshowall"><a href="%s?%s=%s&%s=%s">%s</a></li>\n' \ % (WuiAdmin.ksScriptName, WuiAdmin.ksParamAction, WuiAdmin.ksActionGlobalRsrcShowEdit, GlobalResourceData.ksParam_idGlobalRsrc, sTmp.idGlobalRsrc, sTmp.sName) sHtml += ' </ul>\n' else: sHtml = '<ul class="tmshowall"><li class="tmshowall">None</li></ul>\n' aoRet.append(WuiRawHtml(sHtml)) # Comment (note). aoRet.append(self._formatCommentCell(oEntry.sComment)) # Show actions that can be taken. aoActions = [ WuiTmLink( 'Details', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseDetails, TestCaseData.ksParam_idGenTestCase: oEntry.idGenTestCase }), ] if isDbTimestampInfinity(oEntry.tsExpire): aoActions.append( WuiTmLink( 'Modify', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseEdit, TestCaseData.ksParam_idTestCase: oEntry.idTestCase })) aoActions.append( WuiTmLink( 'Clone', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseClone, TestCaseData.ksParam_idGenTestCase: oEntry.idGenTestCase })) if isDbTimestampInfinity(oEntry.tsExpire): aoActions.append( WuiTmLink( 'Remove', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseDoRemove, TestCaseData.ksParam_idTestCase: oEntry.idTestCase }, sConfirm='Are you sure you want to remove test case #%d?' % (oEntry.idTestCase, ))) aoRet.append(aoActions) return aoRet
def showTestCaseResultDetails( self, # pylint: disable=R0914,R0915 oTestResultTree, oTestSet, oBuildEx, oValidationKitEx, oTestBox, oTestGroup, oTestCaseEx, oTestVarEx): """Show detailed result""" def getTcDepsHtmlList(aoTestCaseData): """Get HTML <ul> list of Test Case name items""" if len(aoTestCaseData) > 0: sTmp = '<ul>' for oTestCaseData in aoTestCaseData: sTmp += '<li>%s</li>' % (webutils.escapeElem( oTestCaseData.sName), ) sTmp += '</ul>' else: sTmp = 'No items' return sTmp def getGrDepsHtmlList(aoGlobalResourceData): """Get HTML <ul> list of Global Resource name items""" if len(aoGlobalResourceData) > 0: sTmp = '<ul>' for oGlobalResourceData in aoGlobalResourceData: sTmp += '<li>%s</li>' % (webutils.escapeElem( oGlobalResourceData.sName), ) sTmp += '</ul>' else: sTmp = 'No items' return sTmp asHtml = [] # Test result + test set details. aoResultRows = [ WuiTmLink( oTestCaseEx.sName, self.oWuiAdmin.ksScriptName, { self.oWuiAdmin.ksParamAction: self.oWuiAdmin.ksActionTestCaseDetails, TestCaseData.ksParam_idTestCase: oTestCaseEx.idTestCase, self.oWuiAdmin.ksParamEffectiveDate: oTestSet.tsConfig, }, fBracketed=False), ] if oTestCaseEx.sDescription is not None and len( oTestCaseEx.sDescription) > 0: aoResultRows.append([ oTestCaseEx.sDescription, ]) aoResultRows.append([ 'Status:', WuiRawHtml('<span class="tmspan-status-%s">%s</span>' % ( oTestResultTree.enmStatus, oTestResultTree.enmStatus, )) ]) if oTestResultTree.cErrors > 0: aoResultRows.append(('Errors:', oTestResultTree.cErrors)) aoResultRows.append(['Elapsed:', oTestResultTree.tsElapsed]) cSecCfgTimeout = oTestCaseEx.cSecTimeout if oTestVarEx.cSecTimeout is None else oTestVarEx.cSecTimeout cSecEffTimeout = cSecCfgTimeout * oTestBox.pctScaleTimeout / 100 aoResultRows.append([ 'Timeout:', '%s (%s sec)' % ( utils.formatIntervalSeconds(cSecEffTimeout), cSecEffTimeout, ) ]) if cSecEffTimeout != cSecCfgTimeout: aoResultRows.append([ 'Cfg Timeout:', '%s (%s sec)' % ( utils.formatIntervalSeconds(cSecCfgTimeout), cSecCfgTimeout, ) ]) aoResultRows += [ ('Started:', WuiTmLink( self.formatTsShort(oTestSet.tsCreated), WuiMain.ksScriptName, { WuiMain.ksParamAction: WuiMain.ksActionResultsUnGrouped, WuiMain.ksParamEffectiveDate: oTestSet.tsCreated, }, fBracketed=False)), ] if oTestSet.tsDone is not None: aoResultRows += [ ('Done:', WuiTmLink(self.formatTsShort(oTestSet.tsDone), WuiMain.ksScriptName, { WuiMain.ksParamAction: WuiMain.ksActionResultsUnGrouped, WuiMain.ksParamEffectiveDate: oTestSet.tsDone, }, fBracketed=False)) ] else: aoResultRows += [('Done:', 'Still running...')] aoResultRows += [('Config:', oTestSet.tsConfig)] if oTestVarEx.cGangMembers > 1: aoResultRows.append([ 'Member No:', '#%s (of %s)' % (oTestSet.iGangMemberNo, oTestVarEx.cGangMembers) ]) aoResultRows += [ ('Test Group:', WuiTmLink( oTestGroup.sName, self.oWuiAdmin.ksScriptName, { self.oWuiAdmin.ksParamAction: self.oWuiAdmin.ksActionTestGroupDetails, TestGroupData.ksParam_idTestGroup: oTestGroup.idTestGroup, self.oWuiAdmin.ksParamEffectiveDate: oTestSet.tsConfig, }, fBracketed=False)), ] if oTestVarEx.sTestBoxReqExpr is not None: aoResultRows.append(['TestBox reqs:', oTestVarEx.sTestBoxReqExpr]) elif oTestCaseEx.sTestBoxReqExpr is not None or oTestVarEx.sTestBoxReqExpr is not None: aoResultRows.append(['TestBox reqs:', oTestCaseEx.sTestBoxReqExpr]) if oTestVarEx.sBuildReqExpr is not None: aoResultRows.append(['Build reqs:', oTestVarEx.sBuildReqExpr]) elif oTestCaseEx.sBuildReqExpr is not None or oTestVarEx.sBuildReqExpr is not None: aoResultRows.append(['Build reqs:', oTestCaseEx.sBuildReqExpr]) if oTestCaseEx.sValidationKitZips is not None and oTestCaseEx.sValidationKitZips != '@VALIDATIONKIT_ZIP@': aoResultRows.append( ['Validation Kit:', oTestCaseEx.sValidationKitZips]) if oTestCaseEx.aoDepTestCases is not None and len( oTestCaseEx.aoDepTestCases) > 0: aoResultRows.append([ 'Prereq. Test Cases:', oTestCaseEx.aoDepTestCases, getTcDepsHtmlList ]) if oTestCaseEx.aoDepGlobalResources is not None and len( oTestCaseEx.aoDepGlobalResources) > 0: aoResultRows.append([ 'Global Resources:', oTestCaseEx.aoDepGlobalResources, getGrDepsHtmlList ]) # Builds. aoBuildRows = [] if oBuildEx is not None: aoBuildRows += [ WuiTmLink( 'Build', self.oWuiAdmin.ksScriptName, { self.oWuiAdmin.ksParamAction: self.oWuiAdmin.ksActionBuildDetails, BuildData.ksParam_idBuild: oBuildEx.idBuild, self.oWuiAdmin.ksParamEffectiveDate: oTestSet.tsCreated, }, fBracketed=False), ] self._anchorAndAppendBinaries(oBuildEx.sBinaries, aoBuildRows) aoBuildRows += [ ('Revision:', WuiSvnLinkWithTooltip(oBuildEx.iRevision, oBuildEx.oCat.sRepository, fBracketed=False)), ('Product:', oBuildEx.oCat.sProduct), ('Branch:', oBuildEx.oCat.sBranch), ('Type:', oBuildEx.oCat.sType), ('Version:', oBuildEx.sVersion), ('Created:', oBuildEx.tsCreated), ] if oBuildEx.uidAuthor is not None: aoBuildRows += [ ('Author ID:', oBuildEx.uidAuthor), ] if oBuildEx.sLogUrl is not None: aoBuildRows += [ ('Log:', WuiBuildLogLink(oBuildEx.sLogUrl, fBracketed=False)), ] aoValidationKitRows = [] if oValidationKitEx is not None: aoValidationKitRows += [ WuiTmLink( 'Validation Kit', self.oWuiAdmin.ksScriptName, { self.oWuiAdmin.ksParamAction: self.oWuiAdmin.ksActionBuildDetails, BuildData.ksParam_idBuild: oValidationKitEx.idBuild, self.oWuiAdmin.ksParamEffectiveDate: oTestSet.tsCreated, }, fBracketed=False), ] self._anchorAndAppendBinaries(oValidationKitEx.sBinaries, aoValidationKitRows) aoValidationKitRows += [('Revision:', WuiSvnLink(oValidationKitEx.iRevision, fBracketed=False))] if oValidationKitEx.oCat.sProduct != 'VBox TestSuite': aoValidationKitRows += [ ('Product:', oValidationKitEx.oCat.sProduct), ] if oValidationKitEx.oCat.sBranch != 'trunk': aoValidationKitRows += [ ('Product:', oValidationKitEx.oCat.sBranch), ] if oValidationKitEx.oCat.sType != 'release': aoValidationKitRows += [ ('Type:', oValidationKitEx.oCat.sType), ] if oValidationKitEx.sVersion != '0.0.0': aoValidationKitRows += [ ('Version:', oValidationKitEx.sVersion), ] aoValidationKitRows += [ ('Created:', oValidationKitEx.tsCreated), ] if oValidationKitEx.uidAuthor is not None: aoValidationKitRows += [ ('Author ID:', oValidationKitEx.uidAuthor), ] if oValidationKitEx.sLogUrl is not None: aoValidationKitRows += [ ('Log:', WuiBuildLogLink(oValidationKitEx.sLogUrl, fBracketed=False)), ] # TestBox. aoTestBoxRows = [ WuiTmLink( oTestBox.sName, self.oWuiAdmin.ksScriptName, { self.oWuiAdmin.ksParamAction: self.oWuiAdmin.ksActionTestBoxDetails, TestBoxData.ksParam_idGenTestBox: oTestSet.idGenTestBox, }, fBracketed=False), ] if oTestBox.sDescription is not None and len( oTestBox.sDescription) > 0: aoTestBoxRows.append([ oTestBox.sDescription, ]) aoTestBoxRows += [ ('IP:', oTestBox.ip), #( 'UUID:', oTestBox.uuidSystem ), #( 'Enabled:', oTestBox.fEnabled ), #( 'Lom Kind:', oTestBox.enmLomKind ), #( 'Lom IP:', oTestBox.ipLom ), ('OS/Arch:', '%s.%s' % (oTestBox.sOs, oTestBox.sCpuArch)), ('OS Version:', oTestBox.sOsVersion), ('CPUs:', oTestBox.cCpus), ] if oTestBox.sCpuName is not None: aoTestBoxRows.append( ['CPU Name', oTestBox.sCpuName.replace(' ', ' ')]) if oTestBox.lCpuRevision is not None: # ASSUMING x86+AMD64 versioning scheme here. uFamily = (oTestBox.lCpuRevision >> 24) & 0xff uModel = (oTestBox.lCpuRevision >> 8) & 0xffff uStepping = oTestBox.lCpuRevision & 0xff aoTestBoxRows += [ ('CPU Family', '%u (%#x)' % ( uFamily, uFamily, )), ('CPU Model', '%u (%#x)' % ( uModel, uModel, )), ('CPU Stepping', '%u (%#x)' % ( uStepping, uStepping, )), ] asFeatures = [ oTestBox.sCpuVendor, ] if oTestBox.fCpuHwVirt is True: asFeatures.append(u'HW\u2011Virt') if oTestBox.fCpuNestedPaging is True: asFeatures.append(u'Nested\u2011Paging') if oTestBox.fCpu64BitGuest is True: asFeatures.append(u'64\u2011bit\u2011Guest') if oTestBox.fChipsetIoMmu is True: asFeatures.append(u'I/O\u2011MMU') aoTestBoxRows += [ ('Features:', u' '.join(asFeatures)), ('RAM size:', '%s MB' % (oTestBox.cMbMemory, )), ('Scratch Size:', '%s MB' % (oTestBox.cMbScratch, )), ('Scale Timeout:', '%s%%' % (oTestBox.pctScaleTimeout, )), ('Script Rev:', WuiSvnLink(oTestBox.iTestBoxScriptRev, fBracketed=False)), ('Python:', oTestBox.formatPythonVersion()), ('Pending Command:', oTestBox.enmPendingCmd), ] aoRows = [ aoResultRows, aoBuildRows, aoValidationKitRows, aoTestBoxRows, ] asHtml.append(self._htmlTable(aoRows)) # # Convert the tree to a list of events, values, message and files. # sHtmlEvents = '' sHtmlEvents += '<table class="tmtbl-events" id="tmtbl-events" width="100%">\n' sHtmlEvents += ' <tr class="tmheader">\n' \ ' <th>When</th>\n' \ ' <th></th>\n' \ ' <th>Elapsed</th>\n' \ ' <th>Event name</th>\n' \ ' <th colspan="2">Value (status)</th>' \ ' <th></th>\n' \ ' </tr>\n' sPrettyCmdLine = ' \\<br> \n'.join( webutils.escapeElem(oTestCaseEx.sBaseCmd + ' ' + oTestVarEx.sArgs).split()) (sTmp, _, cFailures) = self._recursivelyGenerateEvents(oTestResultTree, sPrettyCmdLine, '', 1, 0, oTestSet, 0) sHtmlEvents += sTmp sHtmlEvents += '</table>\n' # # Put it all together. # sHtml = '<table class="tmtbl-testresult-details-base" width="100%">\n' sHtml += ' <tr>\n' sHtml += ' <td valign="top" width="20%%">\n%s\n</td>\n' % ' <br>\n'.join( asHtml) sHtml += ' <td valign="top" width="80%" style="padding-left:6px">\n' sHtml += ' <h2>Events:</h2>\n' sHtml += ' <form action="#" method="get" id="graph-form">\n' \ ' <input type="hidden" name="%s" value="%s"/>\n' \ ' <input type="hidden" name="%s" value="%u"/>\n' \ ' <input type="hidden" name="%s" value="%u"/>\n' \ ' <input type="hidden" name="%s" value="%u"/>\n' \ ' <input type="hidden" name="%s" value="%u"/>\n' \ % ( WuiMain.ksParamAction, WuiMain.ksActionGraphWiz, WuiMain.ksParamGraphWizTestBoxIds, oTestBox.idTestBox, WuiMain.ksParamGraphWizBuildCatIds, oBuildEx.idBuildCategory, WuiMain.ksParamGraphWizTestCaseIds, oTestSet.idTestCase, WuiMain.ksParamGraphWizSrcTestSetId, oTestSet.idTestSet, ) if oTestSet.tsDone is not None: sHtml += ' <input type="hidden" name="%s" value="%s"/>\n' \ % ( WuiMain.ksParamEffectiveDate, oTestSet.tsDone, ) sHtml += ' <p>\n' sFormButton = '<button type="submit" onclick="%s">Show graphs</button>' \ % ( webutils.escapeAttr('addDynamicGraphInputs("graph-form", "main", "%s", "%s");' % (WuiMain.ksParamGraphWizWidth, WuiMain.ksParamGraphWizDpi, )) ) sHtml += ' ' + sFormButton + '\n' sHtml += ' %s %s %s\n' \ % ( WuiTmLink('Log File', '', { WuiMain.ksParamAction: WuiMain.ksActionViewLog, WuiMain.ksParamLogSetId: oTestSet.idTestSet, }), WuiTmLink('Raw Log', '', { WuiMain.ksParamAction: WuiMain.ksActionGetFile, WuiMain.ksParamGetFileSetId: oTestSet.idTestSet, WuiMain.ksParamGetFileDownloadIt: False, }), WuiTmLink('Download Log', '', { WuiMain.ksParamAction: WuiMain.ksActionGetFile, WuiMain.ksParamGetFileSetId: oTestSet.idTestSet, WuiMain.ksParamGetFileDownloadIt: True, }), ) sHtml += ' </p>\n' if cFailures == 1: sHtml += ' <p>%s</p>\n' % (WuiTmLink('Jump to failure', '#failure-0'), ) elif cFailures > 1: sHtml += ' <p>Jump to failure: ' if cFailures <= 13: for iFailure in range(0, cFailures): sHtml += ' ' + WuiTmLink('#%u' % (iFailure, ), '#failure-%u' % (iFailure, )).toHtml() else: for iFailure in range(0, 6): sHtml += ' ' + WuiTmLink('#%u' % (iFailure, ), '#failure-%u' % (iFailure, )).toHtml() sHtml += ' ... ' for iFailure in range(cFailures - 6, cFailures): sHtml += ' ' + WuiTmLink('#%u' % (iFailure, ), '#failure-%u' % (iFailure, )).toHtml() sHtml += ' </p>\n' sHtml += sHtmlEvents sHtml += ' <p>' + sFormButton + '</p>\n' sHtml += ' </form>\n' sHtml += ' </td>\n' sHtml += ' </tr>\n' sHtml += '</table>\n' return ('Test Case result details', sHtml)
def _formatListEntry(self, iEntry): oEntry = self._aoEntries[iEntry]; from testmanager.webui.wuiadmin import WuiAdmin; aoRet = \ [ oEntry.sName.replace('-', u'\u2011'), 'Enabled' if oEntry.fEnabled else 'Disabled', utils.formatIntervalSeconds(oEntry.cSecTimeout), ]; # Base command and variations. fNoGang = True; for oVar in oEntry.aoTestCaseArgs: if oVar.cGangMembers > 1: fNoGang = False; break; sHtml = ' <table class="tminnertbl" width=100%>\n' \ ' <tr>\n' \ ' <th>'; if not fNoGang: sHtml += '<th>Gang Size</th>'; sHtml += 'Timeout</th><th>Additional Arguments</b></th>\n' \ ' </tr>\n' for oTmp in oEntry.aoTestCaseArgs: sHtml += '<tr>'; if not fNoGang: sHtml += '<td>%d</td>' % (oTmp.cGangMembers,) sHtml += '<td>%s</td><td>%s</td></tr>\n' \ % ( utils.formatIntervalSeconds(oTmp.cSecTimeout) if oTmp.cSecTimeout is not None else 'Default', webutils.escapeElem(oTmp.sArgs.replace('-', u'\u2011')),) sHtml += ' </table>' aoRet.append([oEntry.sBaseCmd.replace('-', u'\u2011'), WuiRawHtml(sHtml)]); # Next. aoRet += [ oEntry.sValidationKitZips if oEntry.sValidationKitZips is not None else '', ]; # Show dependency on other testcases if oEntry.aoDepTestCases not in (None, []): sHtml = ' <ul class="tmshowall">\n' for sTmp in oEntry.aoDepTestCases: sHtml += ' <li class="tmshowall"><a href="%s?%s=%s&%s=%s">%s</a></li>\n' \ % (WuiAdmin.ksScriptName, WuiAdmin.ksParamAction, WuiAdmin.ksActionTestCaseEdit, TestCaseData.ksParam_idTestCase, sTmp.idTestCase, sTmp.sName) sHtml += ' </ul>\n' else: sHtml = '<ul class="tmshowall"><li class="tmshowall">None</li></ul>\n' aoRet.append(WuiRawHtml(sHtml)); # Show dependency on global resources if oEntry.aoDepGlobalResources not in (None, []): sHtml = ' <ul class="tmshowall">\n' for sTmp in oEntry.aoDepGlobalResources: sHtml += ' <li class="tmshowall"><a href="%s?%s=%s&%s=%s">%s</a></li>\n' \ % (WuiAdmin.ksScriptName, WuiAdmin.ksParamAction, WuiAdmin.ksActionGlobalRsrcShowEdit, GlobalResourceData.ksParam_idGlobalRsrc, sTmp.idGlobalRsrc, sTmp.sName) sHtml += ' </ul>\n' else: sHtml = '<ul class="tmshowall"><li class="tmshowall">None</li></ul>\n' aoRet.append(WuiRawHtml(sHtml)); # Show actions that can be taken. aoActions = [ WuiTmLink('Details', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseDetails, TestCaseData.ksParam_idGenTestCase: oEntry.idGenTestCase }), ]; if isDbTimestampInfinity(oEntry.tsExpire): aoActions.append(WuiTmLink('Modify', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseEdit, TestCaseData.ksParam_idTestCase: oEntry.idTestCase })); aoActions.append(WuiTmLink('Clone', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseClone, TestCaseData.ksParam_idGenTestCase: oEntry.idGenTestCase })); if isDbTimestampInfinity(oEntry.tsExpire): aoActions.append(WuiTmLink('Remove', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseDoRemove, TestCaseData.ksParam_idTestCase: oEntry.idTestCase }, sConfirm = 'Are you sure you want to remove test case #%d?' % (oEntry.idTestCase,))); aoRet.append(aoActions); return aoRet;
def _formatListEntry(self, iEntry): oEntry = self._aoEntries[iEntry]; from testmanager.webui.wuiadmin import WuiAdmin; # # Test case list. # sHtml = ''; if len(oEntry.aoMembers) > 0: for oMember in oEntry.aoMembers: sHtml += '<dl>\n' \ ' <dd><strong>%s</strong> (priority: %d) %s %s</dd>\n' \ % ( webutils.escapeElem(oMember.oTestCase.sName), oMember.iSchedPriority, WuiTmLink('Details', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseDetails, TestCaseData.ksParam_idGenTestCase: oMember.oTestCase.idGenTestCase, } ).toHtml(), WuiTmLink('Edit', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseEdit, TestCaseData.ksParam_idTestCase: oMember.oTestCase.idTestCase, } ).toHtml() if isDbTimestampInfinity(oMember.oTestCase.tsExpire) else '', ); sHtml += ' <dt>\n'; fNoGang = True; for oVar in oMember.oTestCase.aoTestCaseArgs: if oVar.cGangMembers > 1: fNoGang = False break; sHtml += ' <table class="tminnertbl" width="100%">\n' if fNoGang: sHtml += ' <tr><th>Timeout</th><th>Arguments</th></tr>\n'; else: sHtml += ' <tr><th>Gang Size</th><th>Timeout</th><th style="text-align:left;">Arguments</th></tr>\n'; cArgsIncluded = 0; for oVar in oMember.oTestCase.aoTestCaseArgs: if oMember.aidTestCaseArgs is None or oVar.idTestCaseArgs in oMember.aidTestCaseArgs: cArgsIncluded += 1; if fNoGang: sHtml += ' <tr>'; else: sHtml += ' <tr><td>%s</td>' % (oVar.cGangMembers,); sHtml += '<td>%s</td><td>%s</td></tr>\n' \ % ( utils.formatIntervalSeconds(oMember.oTestCase.cSecTimeout if oVar.cSecTimeout is None else oVar.cSecTimeout), webutils.escapeElem(oVar.sArgs), ); if cArgsIncluded == 0: sHtml += ' <tr><td colspan="%u">No arguments selected.</td></tr>\n' % ( 2 if fNoGang else 3, ); sHtml += ' </table>\n' \ ' </dl>\n'; oTestCases = WuiRawHtml(sHtml); # # Actions. # aoActions = [ WuiTmLink('Details', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupDetails, TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup, WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }) ]; if isDbTimestampInfinity(oEntry.tsExpire): aoActions.append(WuiTmLink('Modify', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupEdit, TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup })); aoActions.append(WuiTmLink('Clone', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupClone, TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup, WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, })); aoActions.append(WuiTmLink('Remove', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupDoRemove, TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup }, sConfirm = 'Do you really want to remove test group #%d?' % (oEntry.idTestGroup,))); else: aoActions.append(WuiTmLink('Clone', WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupClone, TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup, WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, })); return [ oEntry.idTestGroup, oEntry.sName, oEntry.sDescription if oEntry.sDescription is not None else '', oTestCases, aoActions ];
def showTestCaseResultDetails(self, # pylint: disable=R0914,R0915 oTestResultTree, oTestSet, oBuildEx, oValidationKitEx, oTestBox, oTestGroup, oTestCaseEx, oTestVarEx): """Show detailed result""" def getTcDepsHtmlList(aoTestCaseData): """Get HTML <ul> list of Test Case name items""" if len(aoTestCaseData) > 0: sTmp = '<ul>' for oTestCaseData in aoTestCaseData: sTmp += '<li>%s</li>' % (webutils.escapeElem(oTestCaseData.sName),); sTmp += '</ul>' else: sTmp = 'No items' return sTmp def getGrDepsHtmlList(aoGlobalResourceData): """Get HTML <ul> list of Global Resource name items""" if len(aoGlobalResourceData) > 0: sTmp = '<ul>' for oGlobalResourceData in aoGlobalResourceData: sTmp += '<li>%s</li>' % (webutils.escapeElem(oGlobalResourceData.sName),); sTmp += '</ul>' else: sTmp = 'No items' return sTmp asHtml = [] # Test result + test set details. aoResultRows = [ WuiTmLink(oTestCaseEx.sName, self.oWuiAdmin.ksScriptName, { self.oWuiAdmin.ksParamAction: self.oWuiAdmin.ksActionTestCaseDetails, TestCaseData.ksParam_idTestCase: oTestCaseEx.idTestCase, self.oWuiAdmin.ksParamEffectiveDate: oTestSet.tsConfig, }, fBracketed = False), ]; if oTestCaseEx.sDescription is not None and len(oTestCaseEx.sDescription) > 0: aoResultRows.append([oTestCaseEx.sDescription,]); aoResultRows.append([ 'Status:', WuiRawHtml('<span class="tmspan-status-%s">%s</span>' % (oTestResultTree.enmStatus, oTestResultTree.enmStatus,))]); if oTestResultTree.cErrors > 0: aoResultRows.append(( 'Errors:', oTestResultTree.cErrors )); aoResultRows.append([ 'Elapsed:', oTestResultTree.tsElapsed ]); cSecCfgTimeout = oTestCaseEx.cSecTimeout if oTestVarEx.cSecTimeout is None else oTestVarEx.cSecTimeout; cSecEffTimeout = cSecCfgTimeout * oTestBox.pctScaleTimeout / 100; aoResultRows.append([ 'Timeout:', '%s (%s sec)' % (utils.formatIntervalSeconds(cSecEffTimeout), cSecEffTimeout,) ]); if cSecEffTimeout != cSecCfgTimeout: aoResultRows.append([ 'Cfg Timeout:', '%s (%s sec)' % (utils.formatIntervalSeconds(cSecCfgTimeout), cSecCfgTimeout,) ]); aoResultRows += [ ( 'Started:', WuiTmLink(self.formatTsShort(oTestSet.tsCreated), WuiMain.ksScriptName, { WuiMain.ksParamAction: WuiMain.ksActionResultsUnGrouped, WuiMain.ksParamEffectiveDate: oTestSet.tsCreated, }, fBracketed = False) ), ]; if oTestSet.tsDone is not None: aoResultRows += [ ( 'Done:', WuiTmLink(self.formatTsShort(oTestSet.tsDone), WuiMain.ksScriptName, { WuiMain.ksParamAction: WuiMain.ksActionResultsUnGrouped, WuiMain.ksParamEffectiveDate: oTestSet.tsDone, }, fBracketed = False) ) ]; else: aoResultRows += [( 'Done:', 'Still running...')]; aoResultRows += [( 'Config:', oTestSet.tsConfig )]; if oTestVarEx.cGangMembers > 1: aoResultRows.append([ 'Member No:', '#%s (of %s)' % (oTestSet.iGangMemberNo, oTestVarEx.cGangMembers) ]); aoResultRows += [ ( 'Test Group:', WuiTmLink(oTestGroup.sName, self.oWuiAdmin.ksScriptName, { self.oWuiAdmin.ksParamAction: self.oWuiAdmin.ksActionTestGroupDetails, TestGroupData.ksParam_idTestGroup: oTestGroup.idTestGroup, self.oWuiAdmin.ksParamEffectiveDate: oTestSet.tsConfig, }, fBracketed = False) ), ]; if oTestVarEx.sTestBoxReqExpr is not None: aoResultRows.append([ 'TestBox reqs:', oTestVarEx.sTestBoxReqExpr ]); elif oTestCaseEx.sTestBoxReqExpr is not None or oTestVarEx.sTestBoxReqExpr is not None: aoResultRows.append([ 'TestBox reqs:', oTestCaseEx.sTestBoxReqExpr ]); if oTestVarEx.sBuildReqExpr is not None: aoResultRows.append([ 'Build reqs:', oTestVarEx.sBuildReqExpr ]); elif oTestCaseEx.sBuildReqExpr is not None or oTestVarEx.sBuildReqExpr is not None: aoResultRows.append([ 'Build reqs:', oTestCaseEx.sBuildReqExpr ]); if oTestCaseEx.sValidationKitZips is not None and oTestCaseEx.sValidationKitZips != '@VALIDATIONKIT_ZIP@': aoResultRows.append([ 'Validation Kit:', oTestCaseEx.sValidationKitZips ]); if oTestCaseEx.aoDepTestCases is not None and len(oTestCaseEx.aoDepTestCases) > 0: aoResultRows.append([ 'Prereq. Test Cases:', oTestCaseEx.aoDepTestCases, getTcDepsHtmlList ]); if oTestCaseEx.aoDepGlobalResources is not None and len(oTestCaseEx.aoDepGlobalResources) > 0: aoResultRows.append([ 'Global Resources:', oTestCaseEx.aoDepGlobalResources, getGrDepsHtmlList ]); # Builds. aoBuildRows = []; if oBuildEx is not None: aoBuildRows += [ WuiTmLink('Build', self.oWuiAdmin.ksScriptName, { self.oWuiAdmin.ksParamAction: self.oWuiAdmin.ksActionBuildDetails, BuildData.ksParam_idBuild: oBuildEx.idBuild, self.oWuiAdmin.ksParamEffectiveDate: oTestSet.tsCreated, }, fBracketed = False), ]; self._anchorAndAppendBinaries(oBuildEx.sBinaries, aoBuildRows); aoBuildRows += [ ( 'Revision:', WuiSvnLinkWithTooltip(oBuildEx.iRevision, oBuildEx.oCat.sRepository, fBracketed = False) ), ( 'Product:', oBuildEx.oCat.sProduct ), ( 'Branch:', oBuildEx.oCat.sBranch ), ( 'Type:', oBuildEx.oCat.sType ), ( 'Version:', oBuildEx.sVersion ), ( 'Created:', oBuildEx.tsCreated ), ]; if oBuildEx.uidAuthor is not None: aoBuildRows += [ ( 'Author ID:', oBuildEx.uidAuthor ), ]; if oBuildEx.sLogUrl is not None: aoBuildRows += [ ( 'Log:', WuiBuildLogLink(oBuildEx.sLogUrl, fBracketed = False) ), ]; aoValidationKitRows = []; if oValidationKitEx is not None: aoValidationKitRows += [ WuiTmLink('Validation Kit', self.oWuiAdmin.ksScriptName, { self.oWuiAdmin.ksParamAction: self.oWuiAdmin.ksActionBuildDetails, BuildData.ksParam_idBuild: oValidationKitEx.idBuild, self.oWuiAdmin.ksParamEffectiveDate: oTestSet.tsCreated, }, fBracketed = False), ]; self._anchorAndAppendBinaries(oValidationKitEx.sBinaries, aoValidationKitRows); aoValidationKitRows += [ ( 'Revision:', WuiSvnLink(oValidationKitEx.iRevision, fBracketed = False) ) ]; if oValidationKitEx.oCat.sProduct != 'VBox TestSuite': aoValidationKitRows += [ ( 'Product:', oValidationKitEx.oCat.sProduct ), ]; if oValidationKitEx.oCat.sBranch != 'trunk': aoValidationKitRows += [ ( 'Product:', oValidationKitEx.oCat.sBranch ), ]; if oValidationKitEx.oCat.sType != 'release': aoValidationKitRows += [ ( 'Type:', oValidationKitEx.oCat.sType), ]; if oValidationKitEx.sVersion != '0.0.0': aoValidationKitRows += [ ( 'Version:', oValidationKitEx.sVersion ), ]; aoValidationKitRows += [ ( 'Created:', oValidationKitEx.tsCreated ), ]; if oValidationKitEx.uidAuthor is not None: aoValidationKitRows += [ ( 'Author ID:', oValidationKitEx.uidAuthor ), ]; if oValidationKitEx.sLogUrl is not None: aoValidationKitRows += [ ( 'Log:', WuiBuildLogLink(oValidationKitEx.sLogUrl, fBracketed = False) ), ]; # TestBox. aoTestBoxRows = [ WuiTmLink(oTestBox.sName, self.oWuiAdmin.ksScriptName, { self.oWuiAdmin.ksParamAction: self.oWuiAdmin.ksActionTestBoxDetails, TestBoxData.ksParam_idGenTestBox: oTestSet.idGenTestBox, }, fBracketed = False), ]; if oTestBox.sDescription is not None and len(oTestBox.sDescription) > 0: aoTestBoxRows.append([oTestBox.sDescription, ]); aoTestBoxRows += [ ( 'IP:', oTestBox.ip ), #( 'UUID:', oTestBox.uuidSystem ), #( 'Enabled:', oTestBox.fEnabled ), #( 'Lom Kind:', oTestBox.enmLomKind ), #( 'Lom IP:', oTestBox.ipLom ), ( 'OS/Arch:', '%s.%s' % (oTestBox.sOs, oTestBox.sCpuArch) ), ( 'OS Version:', oTestBox.sOsVersion ), ( 'CPUs:', oTestBox.cCpus ), ]; if oTestBox.sCpuName is not None: aoTestBoxRows.append(['CPU Name', oTestBox.sCpuName.replace(' ', ' ')]); if oTestBox.lCpuRevision is not None: # ASSUMING x86+AMD64 versioning scheme here. uFamily = (oTestBox.lCpuRevision >> 24) & 0xff; uModel = (oTestBox.lCpuRevision >> 8) & 0xffff; uStepping = oTestBox.lCpuRevision & 0xff; aoTestBoxRows += [ ( 'CPU Family', '%u (%#x)' % ( uFamily, uFamily, ) ), ( 'CPU Model', '%u (%#x)' % ( uModel, uModel, ) ), ( 'CPU Stepping', '%u (%#x)' % ( uStepping, uStepping, ) ), ]; asFeatures = [ oTestBox.sCpuVendor, ]; if oTestBox.fCpuHwVirt is True: asFeatures.append(u'HW\u2011Virt'); if oTestBox.fCpuNestedPaging is True: asFeatures.append(u'Nested\u2011Paging'); if oTestBox.fCpu64BitGuest is True: asFeatures.append(u'64\u2011bit\u2011Guest'); if oTestBox.fChipsetIoMmu is True: asFeatures.append(u'I/O\u2011MMU'); aoTestBoxRows += [ ( 'Features:', u' '.join(asFeatures) ), ( 'RAM size:', '%s MB' % (oTestBox.cMbMemory,) ), ( 'Scratch Size:', '%s MB' % (oTestBox.cMbScratch,) ), ( 'Scale Timeout:', '%s%%' % (oTestBox.pctScaleTimeout,) ), ( 'Script Rev:', WuiSvnLink(oTestBox.iTestBoxScriptRev, fBracketed = False) ), ( 'Python:', oTestBox.formatPythonVersion() ), ( 'Pending Command:', oTestBox.enmPendingCmd ), ]; aoRows = [ aoResultRows, aoBuildRows, aoValidationKitRows, aoTestBoxRows, ]; asHtml.append(self._htmlTable(aoRows)); # # Convert the tree to a list of events, values, message and files. # sHtmlEvents = ''; sHtmlEvents += '<table class="tmtbl-events" id="tmtbl-events" width="100%">\n'; sHtmlEvents += ' <tr class="tmheader">\n' \ ' <th>When</th>\n' \ ' <th></th>\n' \ ' <th>Elapsed</th>\n' \ ' <th>Event name</th>\n' \ ' <th colspan="2">Value (status)</th>' \ ' <th></th>\n' \ ' </tr>\n'; sPrettyCmdLine = ' \\<br> \n'.join(webutils.escapeElem(oTestCaseEx.sBaseCmd + ' ' + oTestVarEx.sArgs).split() ); (sTmp, _, cFailures) = self._recursivelyGenerateEvents(oTestResultTree, sPrettyCmdLine, '', 1, 0, oTestSet, 0); sHtmlEvents += sTmp; sHtmlEvents += '</table>\n' # # Put it all together. # sHtml = '<table class="tmtbl-testresult-details-base" width="100%">\n'; sHtml += ' <tr>\n' sHtml += ' <td valign="top" width="20%%">\n%s\n</td>\n' % ' <br>\n'.join(asHtml); sHtml += ' <td valign="top" width="80%" style="padding-left:6px">\n'; sHtml += ' <h2>Events:</h2>\n'; sHtml += ' <form action="#" method="get" id="graph-form">\n' \ ' <input type="hidden" name="%s" value="%s"/>\n' \ ' <input type="hidden" name="%s" value="%u"/>\n' \ ' <input type="hidden" name="%s" value="%u"/>\n' \ ' <input type="hidden" name="%s" value="%u"/>\n' \ ' <input type="hidden" name="%s" value="%u"/>\n' \ % ( WuiMain.ksParamAction, WuiMain.ksActionGraphWiz, WuiMain.ksParamGraphWizTestBoxIds, oTestBox.idTestBox, WuiMain.ksParamGraphWizBuildCatIds, oBuildEx.idBuildCategory, WuiMain.ksParamGraphWizTestCaseIds, oTestSet.idTestCase, WuiMain.ksParamGraphWizSrcTestSetId, oTestSet.idTestSet, ); if oTestSet.tsDone is not None: sHtml += ' <input type="hidden" name="%s" value="%s"/>\n' \ % ( WuiMain.ksParamEffectiveDate, oTestSet.tsDone, ); sHtml += ' <p>\n'; sFormButton = '<button type="submit" onclick="%s">Show graphs</button>' \ % ( webutils.escapeAttr('addDynamicGraphInputs("graph-form", "main", "%s", "%s");' % (WuiMain.ksParamGraphWizWidth, WuiMain.ksParamGraphWizDpi, )) ); sHtml += ' ' + sFormButton + '\n'; sHtml += ' %s %s %s\n' \ % ( WuiTmLink('Log File', '', { WuiMain.ksParamAction: WuiMain.ksActionViewLog, WuiMain.ksParamLogSetId: oTestSet.idTestSet, }), WuiTmLink('Raw Log', '', { WuiMain.ksParamAction: WuiMain.ksActionGetFile, WuiMain.ksParamGetFileSetId: oTestSet.idTestSet, WuiMain.ksParamGetFileDownloadIt: False, }), WuiTmLink('Download Log', '', { WuiMain.ksParamAction: WuiMain.ksActionGetFile, WuiMain.ksParamGetFileSetId: oTestSet.idTestSet, WuiMain.ksParamGetFileDownloadIt: True, }), ); sHtml += ' </p>\n'; if cFailures == 1: sHtml += ' <p>%s</p>\n' % ( WuiTmLink('Jump to failure', '#failure-0'), ) elif cFailures > 1: sHtml += ' <p>Jump to failure: '; if cFailures <= 13: for iFailure in range(0, cFailures): sHtml += ' ' + WuiTmLink('#%u' % (iFailure,), '#failure-%u' % (iFailure,)).toHtml(); else: for iFailure in range(0, 6): sHtml += ' ' + WuiTmLink('#%u' % (iFailure,), '#failure-%u' % (iFailure,)).toHtml(); sHtml += ' ... '; for iFailure in range(cFailures - 6, cFailures): sHtml += ' ' + WuiTmLink('#%u' % (iFailure,), '#failure-%u' % (iFailure,)).toHtml(); sHtml += ' </p>\n'; sHtml += sHtmlEvents; sHtml += ' <p>' + sFormButton + '</p>\n'; sHtml += ' </form>\n'; sHtml += ' </td>\n'; sHtml += ' </tr>\n'; sHtml += '</table>\n'; return ('Test Case result details', sHtml)
def _formatListEntry(self, iEntry): oEntry = self._aoEntries[iEntry] from testmanager.webui.wuiadmin import WuiAdmin aoRet = [ oEntry.sName.replace("-", u"\u2011"), "Enabled" if oEntry.fEnabled else "Disabled", utils.formatIntervalSeconds(oEntry.cSecTimeout), ] # Base command and variations. fNoGang = True fNoSubName = True fAllDefaultTimeouts = True for oVar in oEntry.aoTestCaseArgs: if fNoSubName and oVar.sSubName is not None and len(oVar.sSubName.strip()) > 0: fNoSubName = False if oVar.cGangMembers > 1: fNoGang = False if oVar.cSecTimeout is not None: fAllDefaultTimeouts = False sHtml = ' <table class="tminnertbl" width=100%>\n' " <tr>\n" " " if not fNoSubName: sHtml += '<th class="tmtcasubname">Sub-name</th>' if not fNoGang: sHtml += '<th class="tmtcagangsize">Gang Size</th>' if not fAllDefaultTimeouts: sHtml += '<th class="tmtcatimeout">Timeout</th>' sHtml += "<th>Additional Arguments</b></th>\n" " </tr>\n" for oTmp in oEntry.aoTestCaseArgs: sHtml += "<tr>" if not fNoSubName: sHtml += "<td>%s</td>" % (webutils.escapeElem(oTmp.sSubName) if oTmp.sSubName is not None else "") if not fNoGang: sHtml += "<td>%d</td>" % (oTmp.cGangMembers,) if not fAllDefaultTimeouts: sHtml += "<td>%s</td>" % ( utils.formatIntervalSeconds(oTmp.cSecTimeout) if oTmp.cSecTimeout is not None else "Default", ) sHtml += u"<td>%s</td></tr>" % ( webutils.escapeElem(oTmp.sArgs.replace("-", u"\u2011")) if len(oTmp.sArgs) > 0 else u"\u2011", ) sHtml += "</tr>\n" sHtml += " </table>" aoRet.append([oEntry.sBaseCmd.replace("-", u"\u2011"), WuiRawHtml(sHtml)]) # Next. aoRet += [oEntry.sValidationKitZips if oEntry.sValidationKitZips is not None else ""] # Show dependency on other testcases if oEntry.aoDepTestCases not in (None, []): sHtml = ' <ul class="tmshowall">\n' for sTmp in oEntry.aoDepTestCases: sHtml += ' <li class="tmshowall"><a href="%s?%s=%s&%s=%s">%s</a></li>\n' % ( WuiAdmin.ksScriptName, WuiAdmin.ksParamAction, WuiAdmin.ksActionTestCaseEdit, TestCaseData.ksParam_idTestCase, sTmp.idTestCase, sTmp.sName, ) sHtml += " </ul>\n" else: sHtml = '<ul class="tmshowall"><li class="tmshowall">None</li></ul>\n' aoRet.append(WuiRawHtml(sHtml)) # Show dependency on global resources if oEntry.aoDepGlobalResources not in (None, []): sHtml = ' <ul class="tmshowall">\n' for sTmp in oEntry.aoDepGlobalResources: sHtml += ' <li class="tmshowall"><a href="%s?%s=%s&%s=%s">%s</a></li>\n' % ( WuiAdmin.ksScriptName, WuiAdmin.ksParamAction, WuiAdmin.ksActionGlobalRsrcShowEdit, GlobalResourceData.ksParam_idGlobalRsrc, sTmp.idGlobalRsrc, sTmp.sName, ) sHtml += " </ul>\n" else: sHtml = '<ul class="tmshowall"><li class="tmshowall">None</li></ul>\n' aoRet.append(WuiRawHtml(sHtml)) # Comment (note). aoRet.append(self._formatCommentCell(oEntry.sComment)) # Show actions that can be taken. aoActions = [ WuiTmLink( "Details", WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseDetails, TestCaseData.ksParam_idGenTestCase: oEntry.idGenTestCase, }, ) ] if isDbTimestampInfinity(oEntry.tsExpire): aoActions.append( WuiTmLink( "Modify", WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseEdit, TestCaseData.ksParam_idTestCase: oEntry.idTestCase, }, ) ) aoActions.append( WuiTmLink( "Clone", WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseClone, TestCaseData.ksParam_idGenTestCase: oEntry.idGenTestCase, }, ) ) if isDbTimestampInfinity(oEntry.tsExpire): aoActions.append( WuiTmLink( "Remove", WuiAdmin.ksScriptName, { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseDoRemove, TestCaseData.ksParam_idTestCase: oEntry.idTestCase, }, sConfirm="Are you sure you want to remove test case #%d?" % (oEntry.idTestCase,), ) ) aoRet.append(aoActions) return aoRet