Changeset 61284 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- May 30, 2016 3:26:03 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 107576
- Location:
- trunk/src/VBox/ValidationKit/testmanager/core
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/core/db.py
r61272 r61284 332 332 but collect data for traceback. 333 333 """ 334 if aoArgs is None: 335 aoArgs = list(); 336 337 sBound = oCursor.mogrify(unicode(sOperation), aoArgs); 334 if aoArgs is not None: 335 sBound = oCursor.mogrify(unicode(sOperation), aoArgs); 336 elif sOperation.find('%') < 0: 337 sBound = oCursor.mogrify(unicode(sOperation), list()); 338 else: 339 sBound = unicode(sOperation); 340 338 341 if sys.version_info[0] >= 3 and not isinstance(sBound, str): 339 342 sBound = sBound.decode('utf-8'); -
trunk/src/VBox/ValidationKit/testmanager/core/failurereason.py
r61270 r61284 145 145 ModelLogicBase.__init__(self, oDb) 146 146 self.ahCache = None; 147 self.ahCacheNameAndCat = None; 147 148 self.oCategoryLogic = None; 148 149 self.oUserAccountLogic = None; … … 436 437 return oEntry; 437 438 439 440 def cachedLookupByNameAndCategory(self, sName, sCategory): 441 """ 442 Looks up a failure reason by it's name and category. 443 444 Should the request be ambigiuos, we'll return the oldest one. 445 446 Returns a shared FailureReasonData object. None if not found. 447 Raises exception on DB error. 448 """ 449 if self.ahCacheNameAndCat is None: 450 self.ahCacheNameAndCat = self._oDb.getCache('FailureReasonDataEx-By-Name-And-Category'); 451 sKey = '%s:::%s' % (sName, sCategory,); 452 oEntry = self.ahCacheNameAndCat.get(sKey, None); 453 if oEntry is None: 454 self._oDb.execute('SELECT *\n' 455 'FROM FailureReasons,\n' 456 ' FailureCategories\n' 457 'WHERE FailureReasons.sShort = %s\n' 458 ' AND FailureReasons.tsExpire = \'infinity\'::TIMESTAMP\n' 459 ' AND FailureReasons.idFailureCategory = FailureCategories.idFailureCategory ' 460 ' AND FailureCategories.sShort = %s\n' 461 ' AND FailureCategories.tsExpire = \'infinity\'::TIMESTAMP\n' 462 'ORDER BY FailureReasons.tsEffective\n' 463 , ( sName, sCategory)); 464 if self._oDb.getRowCount() == 0: 465 sLikeSucks = self._oDb.formatBindArgs( 466 'SELECT *\n' 467 'FROM FailureReasons,\n' 468 ' FailureCategories\n' 469 'WHERE ( FailureReasons.sShort ILIKE @@@@@@@! %s !@@@@@@@\n' 470 ' OR FailureReasons.sFull ILIKE @@@@@@@! %s !@@@@@@@)\n' 471 ' AND FailureCategories.tsExpire = \'infinity\'::TIMESTAMP\n' 472 ' AND FailureReasons.idFailureCategory = FailureCategories.idFailureCategory\n' 473 ' AND ( FailureCategories.sShort = %s\n' 474 ' OR FailureCategories.sFull = %s)\n' 475 ' AND FailureReasons.tsExpire = \'infinity\'::TIMESTAMP\n' 476 'ORDER BY FailureReasons.tsEffective\n' 477 , ( sName, sName, sCategory, sCategory )); 478 sLikeSucks = sLikeSucks.replace('LIKE @@@@@@@! \'', 'LIKE \'%').replace('\' !@@@@@@@', '%\''); 479 self._oDb.execute(sLikeSucks); 480 if self._oDb.getRowCount() > 0: 481 self._ensureCachesPresent(); 482 oEntry = FailureReasonDataEx().initFromDbRowEx(self._oDb.fetchOne(), self.oCategoryLogic, 483 self.oUserAccountLogic); 484 self.ahCacheNameAndCat[sKey] = oEntry; 485 if sName != oEntry.sShort or sCategory != oEntry.oCategory.sShort: 486 sKey2 = '%s:::%s' % (oEntry.sShort, oEntry.oCategory.sShort,); 487 self.ahCacheNameAndCat[sKey2] = oEntry; 488 return oEntry; 489 490 438 491 # 439 492 # Helpers. -
trunk/src/VBox/ValidationKit/testmanager/core/testcase.py
r61270 r61284 929 929 dErrors[self.ksParam_aoDepTestCases] = 'Depending on itself!'; 930 930 return dErrors; 931 932 933 934 931 935 932 936 class TestCaseLogic(ModelLogicBase): -
trunk/src/VBox/ValidationKit/testmanager/core/testresultfailures.py
r61278 r61284 103 103 assert len(aoRow) == self.kcDbColumns; 104 104 return self.initFromDbRow(aoRow); 105 106 def initFromValues(self, idTestResult, idFailureReason, uidAuthor, 107 tsExpire = None, tsEffective = None, idTestSet = None, sComment = None): 108 """ 109 Initialize from values. 110 """ 111 self.idTestResult = idTestResult; 112 self.tsEffective = tsEffective; 113 self.tsExpire = tsExpire; 114 self.uidAuthor = uidAuthor; 115 self.idTestSet = idTestSet; 116 self.idFailureReason = idFailureReason; 117 self.sComment = sComment; 118 return self; 119 105 120 106 121 -
trunk/src/VBox/ValidationKit/testmanager/core/testresults.py
r61282 r61284 189 189 self.sName = aoRow[9]; 190 190 return self; 191 192 def deepCountErrorContributers(self): 193 """ 194 Counts how many test result instances actually contributed to cErrors. 195 """ 196 197 # Check each child (if any). 198 cChanges = 0; 199 cChildErrors = 0; 200 for oChild in self.aoChildren: 201 cChanges += oChild.deepCountErrorContributers(); 202 cChildErrors += oChild.cErrors; 203 204 # Did we contribute as well? 205 if self.cErrors != cChildErrors: 206 assert self.cErrors >= cChildErrors; 207 cChanges += 1; 208 return cChanges; 191 209 192 210 -
trunk/src/VBox/ValidationKit/testmanager/core/testset.py
r61282 r61284 207 207 return (None, 'Error opening "%s" inside "%s": %s' % (sFilename, sFile2, oXcpt2), None); 208 208 except Exception as oXcpt3: 209 return (None, ' Aa! Megami-sama! %s; %s; %s' % (oXcpt1, oXcpt2, oXcpt3,), None);209 return (None, 'OMG! %s; %s; %s' % (oXcpt1, oXcpt2, oXcpt3,), None); 210 210 return (None, 'Code not reachable!', None); 211 211 … … 658 658 return [aoRow[0] for aoRow in self._oDb.fetchAll()]; 659 659 660 def fetch ResultForTestBox(self, idTestBox, cHoursBack = 2, tsNow = None):660 def fetchSetsForTestBox(self, idTestBox, cHoursBack = 2, tsNow = None): 661 661 """ 662 662 Fetches the TestSet rows for idTestBox for the given period (tsDone), w/o running ones. … … 676 676 return self._dbRowsToModelDataList(TestSetData); 677 677 678 def fetchFailedSetsWithoutReason(self, cHoursBack = 2, tsNow = None): 679 """ 680 Fetches the TestSet failure rows without any currently (CURRENT_TIMESTAMP 681 not tsNow) assigned failure reason. 682 683 Returns list of TestSetData sorted by tsDone in descending order. 684 685 Note! Includes bad-testbox sets too as it can be useful to analyze these 686 too even if we normally count them in the 'skipped' category. 687 """ 688 if tsNow is None: 689 tsNow = self._oDb.getCurrentTimestamp(); 690 self._oDb.execute('SELECT TestSets.*\n' 691 'FROM TestSets\n' 692 ' LEFT OUTER JOIN TestResultFailures\n' 693 ' ON TestResultFailures.idTestSet = TestSets.idTestSet\n' 694 ' AND TestResultFailures.tsExpire = \'infinity\'::TIMESTAMP\n' 695 'WHERE TestSets.tsDone IS NOT NULL\n' 696 ' AND TestSets.enmStatus IN ( %s, %s, %s, %s )\n' 697 ' AND TestSets.tsDone <= %s\n' 698 ' AND TestSets.tsDone > (%s - interval \'%s hours\')\n' 699 ' AND TestResultFailures.idTestSet IS NULL\n' 700 'ORDER by tsDone DESC\n' 701 , ( TestSetData.ksTestStatus_Failure, TestSetData.ksTestStatus_TimedOut, 702 TestSetData.ksTestStatus_Rebooted, TestSetData.ksTestStatus_BadTestBox, 703 tsNow, 704 tsNow, cHoursBack,)); 705 return self._dbRowsToModelDataList(TestSetData); 706 678 707 679 708
Note:
See TracChangeset
for help on using the changeset viewer.