Changeset 65317 in vbox
- Timestamp:
- Jan 16, 2017 11:37:48 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 112891
- Location:
- trunk/src/VBox/ValidationKit/testmanager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/batch/virtual_test_sheriff.py
r65306 r65317 328 328 return 0; 329 329 330 def getFailureReason(self, tReason): 331 """ Gets the failure reason object for tReason. """ 332 return self.oFailureReasonLogic.cachedLookupByNameAndCategory(tReason[1], tReason[0]); 330 333 331 334 def selfCheck(self): … … 335 338 if sAttr.startswith('ktReason_'): 336 339 tReason = getattr(self.__class__, sAttr); 337 oFailureReason = self. oFailureReasonLogic.cachedLookupByNameAndCategory(tReason[1], tReason[0]);340 oFailureReason = self.getFailureReason(tReason); 338 341 if oFailureReason is None: 339 342 rcExit = self.eprint(u'Failed to find failure reason "%s" in category "%s" in the database!' … … 366 369 367 370 # 371 # Generate a list of failures reasons we consider bad-testbox behavior. 372 # 373 aidFailureReasons = [ 374 self.getFailureReason(self.ktReason_Host_DriverNotUnloading).idFailureReason, 375 ]; 376 377 # 368 378 # Get list of bad test boxes for given period and check them out individually. 369 379 # 370 aidBadTestBoxes = self.oTestSetLogic.fetchBadTestBoxIds(cHoursBack = cHoursBack, tsNow = tsNow); 380 aidBadTestBoxes = self.oTestSetLogic.fetchBadTestBoxIds(cHoursBack = cHoursBack, tsNow = tsNow, 381 aidFailureReasons = aidFailureReasons); 371 382 for idTestBox in aidBadTestBoxes: 372 383 # Skip if the testbox is already disabled or has a pending reboot command. … … 394 405 cBad += 1; 395 406 else: 396 ## @todo maybe check the elapsed time here, it could still be a bad run. 397 cOkay += 1; 398 if iFirstOkay > iSet: 399 iFirstOkay = iSet; 407 # Check for bad failure reasons. 408 oFailure = None; 409 if oSet.enmStatus in TestSetData.kasBadTestStatuses: 410 oFailure = self.oTestResultFailureLogic.getById(oSet.idTestResult); 411 if oFailure is not None and oFailure.idFailureReason in aidFailureReasons: 412 cBad += 1; 413 else: 414 # This is an okay test result then. 415 ## @todo maybe check the elapsed time here, it could still be a bad run? 416 cOkay += 1; 417 if iFirstOkay > iSet: 418 iFirstOkay = iSet; 400 419 if iSet > 10: 401 420 break; … … 522 541 # 523 542 for idTestResult, tReason in dReasonForResultId.items(): 524 oFailureReason = self. oFailureReasonLogic.cachedLookupByNameAndCategory(tReason[1], tReason[0]);543 oFailureReason = self.getFailureReason(tReason); 525 544 if oFailureReason is not None: 526 545 sComment = 'Set by $Revision$' # Handy for reverting later. … … 641 660 an uninstall first and will be seeing similar issues to the uninstall. 642 661 """ 662 _ = fInstall; 663 643 664 atSimple = self.katSimpleInstallUninstallMainLogReasons; 644 665 if oCaseFile.oTestBox.sOs in self.kdatSimpleInstallUninstallMainLogReasonsPerOs: … … 1138 1159 self.uidSelf = self.oLogin.uid; 1139 1160 1161 # 1140 1162 # Do the stuff. 1163 # 1141 1164 if rcExit == 0: 1142 1165 rcExit = self.selfCheck(); … … 1146 1169 if rcExit == 0: 1147 1170 rcExit = rcExit2; 1171 # Redo the bad testbox management after failure reasons have been assigned (got timing issues). 1172 if rcExit == 0: 1173 rcExit = self.badTestBoxManagement(); 1148 1174 1149 1175 # Cleanup. -
trunk/src/VBox/ValidationKit/testmanager/core/testset.py
r62484 r65317 742 742 # 743 743 744 def fetchBadTestBoxIds(self, cHoursBack = 2, tsNow = None ):744 def fetchBadTestBoxIds(self, cHoursBack = 2, tsNow = None, aidFailureReasons = None): 745 745 """ 746 746 Fetches a list of test box IDs which returned bad-testbox statuses in the … … 749 749 if tsNow is None: 750 750 tsNow = self._oDb.getCurrentTimestamp(); 751 self._oDb.execute('SELECT DISTINCT idTestBox\n' 752 'FROM TestSets\n' 753 'WHERE TestSets.enmStatus = \'bad-testbox\'\n' 754 ' AND tsDone <= %s\n' 755 ' AND tsDone > (%s - interval \'%s hours\')\n' 756 , ( tsNow, tsNow, cHoursBack,)); 751 if aidFailureReasons is None: 752 aidFailureReasons = [ -1, ]; 753 self._oDb.execute('(SELECT idTestBox\n' 754 ' FROM TestSets\n' 755 ' WHERE TestSets.enmStatus = \'bad-testbox\'\n' 756 ' AND tsDone <= %s\n' 757 ' AND tsDone > (%s - interval \'%s hours\')\n' 758 ') UNION (\n' 759 ' SELECT TestSets.idTestBox\n' 760 ' FROM TestSets,\n' 761 ' TestResultFailures\n' 762 ' WHERE TestSets.tsDone <= %s\n' 763 ' AND TestSets.tsDone > (%s - interval \'%s hours\')\n' 764 ' AND TestSets.enmStatus >= \'failure\'::TestStatus_T\n' 765 ' AND TestSets.idTestSet = TestResultFailures.idTestSet\n' 766 ' AND TestResultFailures.tsExpire = \'infinity\'::TIMESTAMP\n' 767 ' AND TestResultFailures.idFailureReason IN (' 768 + ', '.join([str(i) for i in aidFailureReasons]) + ')\n' 769 ')\n' 770 , ( tsNow, tsNow, cHoursBack, 771 tsNow, tsNow, cHoursBack, )); 757 772 return [aoRow[0] for aoRow in self._oDb.fetchAll()]; 758 773
Note:
See TracChangeset
for help on using the changeset viewer.