Changeset 82939 in vbox
- Timestamp:
- Jan 31, 2020 11:13:38 AM (5 years ago)
- Location:
- trunk/src/VBox/ValidationKit/testmanager
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/core/base.py
r82641 r82939 1191 1191 ksType_UIntNil = 'uint-nil'; ##< unsigned integer value, with nil. 1192 1192 ksType_String = 'string'; ##< string value. 1193 ksType_Ranges = 'ranges'; ##< List of (unsigned) integer ranges. 1193 1194 ## @} 1194 1195 … … 1243 1244 self.aCriteria = [] # type: list[FilterCriterion] 1244 1245 1245 def _initFromParamsWorker(self, oDisp, oCriterion): 1246 def _initFromParamsWorker(self, oDisp, oCriterion): # (,FilterCriterion) 1246 1247 """ Worker for initFromParams. """ 1247 1248 if oCriterion.sType == FilterCriterion.ksType_UInt: … … 1259 1260 or sValue[-1] == '\\': 1260 1261 raise TMExceptionBase('Variable %s has an illegal value "%s"!' % (oCriterion.sVarNm, sValue)); 1262 elif oCriterion.sType == FilterCriterion.ksType_Ranges: 1263 def convertRangeNumber(sValue): 1264 """ Helper """ 1265 sValue = sValue.strip(); 1266 if sValue and sValue not in ('inf', 'Inf', 'INf', 'INF', 'InF', 'iNf', 'iNF', 'inF',): 1267 try: return int(sValue); 1268 except: pass; 1269 return None; 1270 1271 for sRange in oDisp.getStringParam(oCriterion.sVarNm, sDefault = '').split(','): 1272 sRange = sRange.strip(); 1273 if sRange and sRange != '-' and any(ch.isdigit() for ch in sRange): 1274 asValues = sRange.split('-'); 1275 if len(asValues) == 1: 1276 asValues = [asValues[0], asValues[0]]; 1277 elif len(asValues) > 2: 1278 asValues = [asValues[0], asValues[-1]]; 1279 tTuple = (convertRangeNumber(asValues[0]), convertRangeNumber(asValues[1])); 1280 if tTuple[0] is not None and tTuple[1] is not None and tTuple[0] > tTuple[1]: 1281 tTuple = (tTuple[1], tTuple[0]); 1282 oCriterion.aoSelected.append(tTuple); 1261 1283 else: 1262 1284 assert False; -
trunk/src/VBox/ValidationKit/testmanager/core/testresults.py
r80128 r82939 703 703 kiBuildTypes = 3; 704 704 kiRevisions = 4; 705 kiFailReasons = 5; 706 kiTestCases = 6; 707 kiTestCaseMisc = 7; 708 kiTestBoxes = 8 709 kiOses = 9; 710 kiCpuArches = 10; 711 kiCpuVendors = 11; 712 kiCpuCounts = 12; 713 kiMemory = 13; 714 kiTestboxMisc = 14; 715 kiPythonVersions = 15; 716 kiSchedGroups = 16; 705 kiRevisionRange = 5; 706 kiFailReasons = 6; 707 kiTestCases = 7; 708 kiTestCaseMisc = 8; 709 kiTestBoxes = 9; 710 kiOses = 10; 711 kiCpuArches = 11; 712 kiCpuVendors = 12; 713 kiCpuCounts = 13; 714 kiMemory = 14; 715 kiTestboxMisc = 15; 716 kiPythonVersions = 16; 717 kiSchedGroups = 17; 717 718 718 719 ## Misc test case / variation name filters. … … 783 784 assert self.aCriteria[self.kiRevisions] is oCrit; 784 785 786 # Revision Range 787 oCrit = FilterCriterion('Revision Range', sVarNm = 'rr', sType = FilterCriterion.ksType_Ranges, 788 sKind = FilterCriterion.ksKind_ElementOfOrNot, sTable = 'Builds', sColumn = 'iRevision'); 789 self.aCriteria.append(oCrit); 790 assert self.aCriteria[self.kiRevisionRange] is oCrit; 791 785 792 # Failure reasons 786 793 oCrit = FilterCriterion('Failure reasons', sVarNm = 'fr', sType = FilterCriterion.ksType_UIntNil, … … 907 914 if iValue in dConditions: 908 915 sQuery += '%s AND %s\n' % (sExtraIndent, dConditions[iValue],); 916 elif oCrit.sType == FilterCriterion.ksType_Ranges: 917 assert len(oCrit.aoPossible) == 0; 918 if oCrit.aoSelected: 919 asConditions = []; 920 for tRange in oCrit.aoSelected: 921 if tRange[0] == tRange[1]: 922 asConditions.append('%s.%s = %s' % (oCrit.asTables[0], oCrit.sColumn, tRange[0])); 923 elif tRange[1] is None: # 9999- 924 asConditions.append('%s.%s >= %s' % (oCrit.asTables[0], oCrit.sColumn, tRange[0])); 925 elif tRange[0] is None: # -9999 926 asConditions.append('%s.%s <= %s' % (oCrit.asTables[0], oCrit.sColumn, tRange[1])); 927 else: 928 asConditions.append('%s.%s BETWEEN %s AND %s' % (oCrit.asTables[0], oCrit.sColumn, 929 tRange[0], tRange[1])); 930 if not oCrit.fInverted: 931 sQuery += '%s AND (%s)\n' % (sExtraIndent, ' OR '.join(asConditions)); 932 else: 933 sQuery += '%s AND NOT (%s)\n' % (sExtraIndent, ' OR '.join(asConditions)); 909 934 else: 910 935 assert len(oCrit.asTables) == 1; -
trunk/src/VBox/ValidationKit/testmanager/webui/wuimain.py
r82638 r82939 932 932 sHtml += u' <dl>\n'; 933 933 for oCrit in oFilter.aCriteria: 934 if oCrit.aoPossible :934 if oCrit.aoPossible or oCrit.sType == oCrit.ksType_Ranges: 935 935 if ( oCrit.oSub is None \ 936 936 and ( oCrit.sState == oCrit.ksState_Selected \ 937 or len(oCrit.aoPossible) <= 2)) \937 or (len(oCrit.aoPossible) <= 2 and oCrit.sType != oCrit.ksType_Ranges))) \ 938 938 or ( oCrit.oSub is not None \ 939 939 and ( oCrit.sState == oCrit.ksState_Selected \ … … 962 962 % (sClass); 963 963 964 for oDesc in oCrit.aoPossible: 965 fChecked = oDesc.oValue in oCrit.aoSelected; 966 sHtml += u' <li%s%s><label><input type="checkbox" name="%s" value="%s"%s%s/>%s%s</label>\n' \ 967 % ( ' class="side-filter-irrelevant"' if oDesc.fIrrelevant else '', 968 (' title="%s"' % (webutils.escapeAttr(oDesc.sHover,)) if oDesc.sHover is not None else ''), 969 oCrit.sVarNm, 970 oDesc.oValue, 971 ' checked' if fChecked else '', 972 ' onclick="toggleCollapsibleCheckbox(this);"' if oDesc.aoSubs is not None else '', 973 webutils.escapeElem(oDesc.sDesc), 974 '<span class="side-filter-count"> [%u]</span>' % (oDesc.cTimes) if oDesc.cTimes is not None 975 else '', ); 976 if oDesc.aoSubs is not None: 977 sHtml += u' <ul class="sf-checkbox-%s">\n' % ('collapsible' if fChecked else 'expandable', ); 978 for oSubDesc in oDesc.aoSubs: 979 fSubChecked = oSubDesc.oValue in oCrit.oSub.aoSelected; 980 sHtml += u' <li%s%s><label><input type="checkbox" name="%s" value="%s"%s/>%s%s</label>\n' \ 981 % ( ' class="side-filter-irrelevant"' if oSubDesc.fIrrelevant else '', 982 ' title="%s"' % ( webutils.escapeAttr(oSubDesc.sHover,) if oSubDesc.sHover is not None 983 else ''), 984 oCrit.oSub.sVarNm, oSubDesc.oValue, ' checked' if fSubChecked else '', 985 webutils.escapeElem(oSubDesc.sDesc), 986 '<span class="side-filter-count"> [%u]</span>' % (oSubDesc.cTimes) 987 if oSubDesc.cTimes is not None else '', ); 988 989 sHtml += u' </ul>\n'; 990 sHtml += u' </li>'; 964 if oCrit.sType == oCrit.ksType_Ranges: 965 assert not oCrit.oSub; 966 assert not oCrit.aoPossible; 967 asValues = []; 968 for tRange in oCrit.aoSelected: 969 if tRange[0] == tRange[1]: 970 asValues.append('%s' % (tRange[0],)); 971 else: 972 asValues.append('%s-%s' % (tRange[0] if tRange[0] is not None else 'inf', 973 tRange[1] if tRange[1] is not None else 'inf')); 974 sHtml += u' <li title="%s"><input type="text" name="%s" value="%s"/></li>\n' \ 975 % ( webutils.escapeAttr('comma separate list of numerical ranges'), oCrit.sVarNm, 976 ', '.join(asValues), ); 977 else: 978 for oDesc in oCrit.aoPossible: 979 fChecked = oDesc.oValue in oCrit.aoSelected; 980 sHtml += u' <li%s%s><label><input type="checkbox" name="%s" value="%s"%s%s/>%s%s</label>\n' \ 981 % ( ' class="side-filter-irrelevant"' if oDesc.fIrrelevant else '', 982 (' title="%s"' % (webutils.escapeAttr(oDesc.sHover,)) if oDesc.sHover is not None else ''), 983 oCrit.sVarNm, 984 oDesc.oValue, 985 ' checked' if fChecked else '', 986 ' onclick="toggleCollapsibleCheckbox(this);"' if oDesc.aoSubs is not None else '', 987 webutils.escapeElem(oDesc.sDesc), 988 '<span class="side-filter-count"> [%u]</span>' % (oDesc.cTimes) if oDesc.cTimes is not None 989 else '', ); 990 if oDesc.aoSubs is not None: 991 sHtml += u' <ul class="sf-checkbox-%s">\n' % ('collapsible' if fChecked else 'expandable', ); 992 for oSubDesc in oDesc.aoSubs: 993 fSubChecked = oSubDesc.oValue in oCrit.oSub.aoSelected; 994 sHtml += u' <li%s%s><label><input type="checkbox" name="%s" value="%s"%s/>%s%s</label>\n' \ 995 % ( ' class="side-filter-irrelevant"' if oSubDesc.fIrrelevant else '', 996 ' title="%s"' % ( webutils.escapeAttr(oSubDesc.sHover,) if oSubDesc.sHover is not None 997 else ''), 998 oCrit.oSub.sVarNm, oSubDesc.oValue, ' checked' if fSubChecked else '', 999 webutils.escapeElem(oSubDesc.sDesc), 1000 '<span class="side-filter-count"> [%u]</span>' % (oSubDesc.cTimes) 1001 if oSubDesc.cTimes is not None else '', ); 1002 1003 sHtml += u' </ul>\n'; 1004 sHtml += u' </li>'; 1005 991 1006 sHtml += u' </ul>\n' \ 992 1007 u' </dd>\n';
Note:
See TracChangeset
for help on using the changeset viewer.