VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testmanager/batch/virtual_test_sheriff.py@ 76794

Last change on this file since 76794 was 76625, checked in by vboxsync, 6 years ago

vsheriff: Quick review of sendEmailAlert (formerly emailAlert) to make recent pylint happy. Fixed inconsistent return value, with rcExit being undefined in the success code path.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 69.7 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: virtual_test_sheriff.py 76625 2019-01-03 17:24:36Z vboxsync $
4# pylint: disable=C0301
5
6"""
7Virtual Test Sheriff.
8
9Duties:
10 - Try to a assign failure reasons to recently failed tests.
11 - Reboot or disable bad test boxes.
12
13"""
14
15from __future__ import print_function;
16
17__copyright__ = \
18"""
19Copyright (C) 2012-2019 Oracle Corporation
20
21This file is part of VirtualBox Open Source Edition (OSE), as
22available from http://www.virtualbox.org. This file is free software;
23you can redistribute it and/or modify it under the terms of the GNU
24General Public License (GPL) as published by the Free Software
25Foundation, in version 2 as it comes in the "COPYING" file of the
26VirtualBox OSE distribution. VirtualBox OSE is distributed in the
27hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
28
29The contents of this file may alternatively be used under the terms
30of the Common Development and Distribution License Version 1.0
31(CDDL) only, as it comes in the "COPYING.CDDL" file of the
32VirtualBox OSE distribution, in which case the provisions of the
33CDDL are applicable instead of those of the GPL.
34
35You may elect to license modified versions of this file under the
36terms and conditions of either the GPL or the CDDL or both.
37"""
38__version__ = "$Revision: 76625 $"
39
40
41# Standard python imports
42import sys;
43import os;
44import hashlib;
45import subprocess;
46import smtplib
47from email.mime.multipart import MIMEMultipart
48from email.mime.text import MIMEText
49from email.utils import COMMASPACE
50
51if sys.version_info[0] >= 3:
52 from io import StringIO as StringIO; # pylint: disable=import-error,no-name-in-module
53else:
54 from StringIO import StringIO as StringIO; # pylint: disable=import-error,no-name-in-module
55from optparse import OptionParser; # pylint: disable=deprecated-module
56from PIL import Image; # pylint: disable=import-error
57
58# Add Test Manager's modules path
59g_ksTestManagerDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
60sys.path.append(g_ksTestManagerDir);
61
62# Test Manager imports
63from testmanager.core.db import TMDatabaseConnection;
64from testmanager.core.build import BuildDataEx;
65from testmanager.core.failurereason import FailureReasonLogic;
66from testmanager.core.testbox import TestBoxLogic, TestBoxData;
67from testmanager.core.testcase import TestCaseDataEx;
68from testmanager.core.testgroup import TestGroupData;
69from testmanager.core.testset import TestSetLogic, TestSetData;
70from testmanager.core.testresults import TestResultLogic, TestResultFileData;
71from testmanager.core.testresultfailures import TestResultFailureLogic, TestResultFailureData;
72from testmanager.core.useraccount import UserAccountLogic;
73from testmanager.config import g_ksSmtpHost, g_kcSmtpPort, g_ksAlertFrom, \
74 g_ksAlertSubject, g_asAlertList, g_ksLomPassword;
75
76# Python 3 hacks:
77if sys.version_info[0] >= 3:
78 xrange = range; # pylint: disable=redefined-builtin,invalid-name
79
80
81class VirtualTestSheriffCaseFile(object):
82 """
83 A failure investigation case file.
84
85 """
86
87
88 ## Max log file we'll read into memory. (256 MB)
89 kcbMaxLogRead = 0x10000000;
90
91 def __init__(self, oSheriff, oTestSet, oTree, oBuild, oTestBox, oTestGroup, oTestCase):
92 self.oSheriff = oSheriff;
93 self.oTestSet = oTestSet; # TestSetData
94 self.oTree = oTree; # TestResultDataEx
95 self.oBuild = oBuild; # BuildDataEx
96 self.oTestBox = oTestBox; # TestBoxData
97 self.oTestGroup = oTestGroup; # TestGroupData
98 self.oTestCase = oTestCase; # TestCaseDataEx
99 self.sMainLog = ''; # The main log file. Empty string if not accessible.
100
101 # Generate a case file name.
102 self.sName = '#%u: %s' % (self.oTestSet.idTestSet, self.oTestCase.sName,)
103 self.sLongName = '#%u: "%s" on "%s" running %s %s (%s), "%s" by %s, using %s %s %s r%u' \
104 % ( self.oTestSet.idTestSet,
105 self.oTestCase.sName,
106 self.oTestBox.sName,
107 self.oTestBox.sOs,
108 self.oTestBox.sOsVersion,
109 self.oTestBox.sCpuArch,
110 self.oTestBox.sCpuName,
111 self.oTestBox.sCpuVendor,
112 self.oBuild.oCat.sProduct,
113 self.oBuild.oCat.sBranch,
114 self.oBuild.oCat.sType,
115 self.oBuild.iRevision, );
116
117 # Investigation notes.
118 self.tReason = None; # None or one of the ktReason_XXX constants.
119 self.dReasonForResultId = {}; # Reason assignments indexed by idTestResult.
120 self.dCommentForResultId = {}; # Comment assignments indexed by idTestResult.
121
122 #
123 # Reason.
124 #
125
126 def noteReason(self, tReason):
127 """ Notes down a possible reason. """
128 self.oSheriff.dprint(u'noteReason: %s -> %s' % (self.tReason, tReason,));
129 self.tReason = tReason;
130 return True;
131
132 def noteReasonForId(self, tReason, idTestResult, sComment = None):
133 """ Notes down a possible reason for a specific test result. """
134 self.oSheriff.dprint(u'noteReasonForId: %u: %s -> %s%s'
135 % (idTestResult, self.dReasonForResultId.get(idTestResult, None), tReason,
136 (u' (%s)' % (sComment,)) if sComment is not None else ''));
137 self.dReasonForResultId[idTestResult] = tReason;
138 if sComment is not None:
139 self.dCommentForResultId[idTestResult] = sComment;
140 return True;
141
142
143 #
144 # Test classification.
145 #
146
147 def isVBoxTest(self):
148 """ Test classification: VirtualBox (using the build) """
149 return self.oBuild.oCat.sProduct.lower() in [ 'virtualbox', 'vbox' ];
150
151 def isVBoxUnitTest(self):
152 """ Test case classification: The unit test doing all our testcase/*.cpp stuff. """
153 return self.isVBoxTest() \
154 and (self.oTestCase.sName.lower() == 'unit tests' or self.oTestCase.sName.lower() == 'misc: unit tests');
155
156 def isVBoxInstallTest(self):
157 """ Test case classification: VirtualBox Guest installation test. """
158 return self.isVBoxTest() \
159 and self.oTestCase.sName.lower().startswith('install:');
160
161 def isVBoxUSBTest(self):
162 """ Test case classification: VirtualBox USB test. """
163 return self.isVBoxTest() \
164 and self.oTestCase.sName.lower().startswith('usb:');
165
166 def isVBoxStorageTest(self):
167 """ Test case classification: VirtualBox Storage test. """
168 return self.isVBoxTest() \
169 and self.oTestCase.sName.lower().startswith('storage:');
170
171 def isVBoxGAsTest(self):
172 """ Test case classification: VirtualBox Guest Additions test. """
173 return self.isVBoxTest() \
174 and self.oTestCase.sName.lower().startswith('ga\'s tests');
175
176 def isVBoxAPITest(self):
177 """ Test case classification: VirtualBox API test. """
178 return self.isVBoxTest() \
179 and self.oTestCase.sName.lower().startswith('api:');
180
181 def isVBoxBenchmarkTest(self):
182 """ Test case classification: VirtualBox Benchmark test. """
183 return self.isVBoxTest() \
184 and self.oTestCase.sName.lower().startswith('benchmark:');
185
186 def isVBoxSmokeTest(self):
187 """ Test case classification: Smoke test. """
188 return self.isVBoxTest() \
189 and self.oTestCase.sName.lower().startswith('smoketest');
190
191
192 #
193 # Utility methods.
194 #
195
196 def getMainLog(self):
197 """
198 Tries to read the main log file since this will be the first source of information.
199 """
200 if self.sMainLog:
201 return self.sMainLog;
202 (oFile, oSizeOrError, _) = self.oTestSet.openFile('main.log', 'rb');
203 if oFile is not None:
204 try:
205 self.sMainLog = oFile.read(min(self.kcbMaxLogRead, oSizeOrError)).decode('utf-8', 'replace');
206 except Exception as oXcpt:
207 self.oSheriff.vprint(u'Error reading main log file: %s' % (oXcpt,))
208 self.sMainLog = '';
209 else:
210 self.oSheriff.vprint(u'Error opening main log file: %s' % (oSizeOrError,));
211 return self.sMainLog;
212
213 def getLogFile(self, oFile):
214 """
215 Tries to read the given file as a utf-8 log file.
216 oFile is a TestFileDataEx instance.
217 Returns empty string if problems opening or reading the file.
218 """
219 sContent = '';
220 (oFile, oSizeOrError, _) = self.oTestSet.openFile(oFile.sFile, 'rb');
221 if oFile is not None:
222 try:
223 sContent = oFile.read(min(self.kcbMaxLogRead, oSizeOrError)).decode('utf-8', 'replace');
224 except Exception as oXcpt:
225 self.oSheriff.vprint(u'Error reading the "%s" log file: %s' % (oFile.sFile, oXcpt,))
226 else:
227 self.oSheriff.vprint(u'Error opening the "%s" log file: %s' % (oFile.sFile, oSizeOrError,));
228 return sContent;
229
230 def getScreenshotSha256(self, oFile):
231 """
232 Tries to read the given screenshot file, uncompress it, and do SHA-2
233 on the raw pixels.
234 Returns SHA-2 digest string on success, None on failure.
235 """
236 (oImgFile, _, _) = self.oTestSet.openFile(oFile.sFile, 'rb');
237 try:
238 abImageFile = oImgFile.read();
239 except Exception as oXcpt:
240 self.oSheriff.vprint(u'Error reading the "%s" image file: %s' % (oFile.sFile, oXcpt,))
241 else:
242 try:
243 oImage = Image.open(StringIO(abImageFile));
244 except Exception as oXcpt:
245 self.oSheriff.vprint(u'Error opening the "%s" image bytes using PIL.Image.open: %s' % (oFile.sFile, oXcpt,))
246 else:
247 try:
248 oHash = hashlib.sha256();
249 oHash.update(oImage.tostring());
250 except Exception as oXcpt:
251 self.oSheriff.vprint(u'Error hashing the uncompressed image bytes for "%s": %s' % (oFile.sFile, oXcpt,))
252 else:
253 return oHash.hexdigest();
254 return None;
255
256
257
258 def isSingleTestFailure(self):
259 """
260 Figure out if this is a single test failing or if it's one of the
261 more complicated ones.
262 """
263 if self.oTree.cErrors == 1:
264 return True;
265 if self.oTree.deepCountErrorContributers() <= 1:
266 return True;
267 return False;
268
269
270
271class VirtualTestSheriff(object): # pylint: disable=R0903
272 """
273 Add build info into Test Manager database.
274 """
275
276 ## The user account for the virtual sheriff.
277 ksLoginName = 'vsheriff';
278
279 def __init__(self):
280 """
281 Parse command line.
282 """
283 self.oDb = None;
284 self.tsNow = None;
285 self.oTestResultLogic = None;
286 self.oTestSetLogic = None;
287 self.oFailureReasonLogic = None; # FailureReasonLogic;
288 self.oTestResultFailureLogic = None; # TestResultFailureLogic
289 self.oLogin = None;
290 self.uidSelf = -1;
291 self.oLogFile = None;
292 self.asBsodReasons = [];
293 self.asUnitTestReasons = [];
294
295 oParser = OptionParser();
296 oParser.add_option('--start-hours-ago', dest = 'cStartHoursAgo', metavar = '<hours>', default = 0, type = 'int',
297 help = 'When to start specified as hours relative to current time. Defauls is right now.', );
298 oParser.add_option('--hours-period', dest = 'cHoursBack', metavar = '<period-in-hours>', default = 2, type = 'int',
299 help = 'Work period specified in hours. Defauls is 2 hours.');
300 oParser.add_option('--real-run-back', dest = 'fRealRun', action = 'store_true', default = False,
301 help = 'Whether to commit the findings to the database. Default is a dry run.');
302 oParser.add_option('-q', '--quiet', dest = 'fQuiet', action = 'store_true', default = False,
303 help = 'Quiet execution');
304 oParser.add_option('-l', '--log', dest = 'sLogFile', metavar = '<logfile>', default = None,
305 help = 'Where to log messages.');
306 oParser.add_option('--debug', dest = 'fDebug', action = 'store_true', default = False,
307 help = 'Enables debug mode.');
308
309 (self.oConfig, _) = oParser.parse_args();
310
311 if self.oConfig.sLogFile:
312 self.oLogFile = open(self.oConfig.sLogFile, "a");
313 self.oLogFile.write('VirtualTestSheriff: $Revision: 76625 $ \n');
314
315
316 def eprint(self, sText):
317 """
318 Prints error messages.
319 Returns 1 (for exit code usage.)
320 """
321 print('error: %s' % (sText,));
322 if self.oLogFile is not None:
323 self.oLogFile.write((u'error: %s\n' % (sText,)).encode('utf-8'));
324 return 1;
325
326 def dprint(self, sText):
327 """
328 Prints debug info.
329 """
330 if self.oConfig.fDebug:
331 if not self.oConfig.fQuiet:
332 print('debug: %s' % (sText, ));
333 if self.oLogFile is not None:
334 self.oLogFile.write((u'debug: %s\n' % (sText,)).encode('utf-8'));
335 return 0;
336
337 def vprint(self, sText):
338 """
339 Prints verbose info.
340 """
341 if not self.oConfig.fQuiet:
342 print('info: %s' % (sText,));
343 if self.oLogFile is not None:
344 self.oLogFile.write((u'info: %s\n' % (sText,)).encode('utf-8'));
345 return 0;
346
347 def getFailureReason(self, tReason):
348 """ Gets the failure reason object for tReason. """
349 return self.oFailureReasonLogic.cachedLookupByNameAndCategory(tReason[1], tReason[0]);
350
351 def selfCheck(self):
352 """ Does some self checks, looking up things we expect to be in the database and such. """
353 rcExit = 0;
354 for sAttr in dir(self.__class__):
355 if sAttr.startswith('ktReason_'):
356 tReason = getattr(self.__class__, sAttr);
357 oFailureReason = self.getFailureReason(tReason);
358 if oFailureReason is None:
359 rcExit = self.eprint(u'Failed to find failure reason "%s" in category "%s" in the database!'
360 % (tReason[1], tReason[0],));
361
362 # Check the user account as well.
363 if self.oLogin is None:
364 oLogin = UserAccountLogic(self.oDb).tryFetchAccountByLoginName(VirtualTestSheriff.ksLoginName);
365 if oLogin is None:
366 rcExit = self.eprint(u'Cannot find my user account "%s"!' % (VirtualTestSheriff.ksLoginName,));
367 return rcExit;
368
369 def sendEmailAlert(self, uidAuthor, sBodyText):
370 """
371 Sends email alert.
372 """
373
374 # Get author email
375 self.oDb.execute('SELECT sEmail FROM Users WHERE uid=%s', (uidAuthor,));
376 sFrom = self.oDb.fetchOne();
377 if sFrom is not None:
378 sFrom = sFrom[0];
379 else:
380 sFrom = g_ksAlertFrom;
381
382 # Gather recipient list.
383 asEmailList = [];
384 for sUser in g_asAlertList:
385 self.oDb.execute('SELECT sEmail FROM Users WHERE sUsername=%s', (sUser,));
386 sEmail = self.oDb.fetchOne();
387 if sEmail:
388 asEmailList.append(sEmail[0]);
389 if not asEmailList:
390 return self.eprint('No email addresses to send alter to!');
391
392 # Compose the message.
393 oMsg = MIMEMultipart();
394 oMsg['From'] = sFrom;
395 oMsg['To'] = COMMASPACE.join(asEmailList);
396 oMsg['Subject'] = g_ksAlertSubject;
397 oMsg.attach(MIMEText(sBodyText, 'plain'))
398
399 # Try send it.
400 try:
401 oSMTP = smtplib.SMTP(g_ksSmtpHost, g_kcSmtpPort);
402 oSMTP.sendmail(sFrom, asEmailList, oMsg.as_string())
403 oSMTP.quit()
404 except smtplib.SMTPException as oXcpt:
405 return self.eprint('Failed to send mail: %s' % (oXcpt,));
406
407 return 0;
408
409 def badTestBoxManagement(self):
410 """
411 Looks for bad test boxes and first tries once to reboot them then disables them.
412 """
413 rcExit = 0;
414
415 #
416 # We skip this entirely if we're running in the past and not in harmless debug mode.
417 #
418 if self.oConfig.cStartHoursAgo != 0 \
419 and (not self.oConfig.fDebug or self.oConfig.fRealRun):
420 return rcExit;
421 tsNow = self.tsNow if self.oConfig.fDebug else None;
422 cHoursBack = self.oConfig.cHoursBack if self.oConfig.fDebug else 2;
423 oTestBoxLogic = TestBoxLogic(self.oDb);
424
425 #
426 # Generate a list of failures reasons we consider bad-testbox behavior.
427 #
428 aidFailureReasons = [
429 self.getFailureReason(self.ktReason_Host_DriverNotUnloading).idFailureReason,
430 self.getFailureReason(self.ktReason_Host_DriverNotCompilable).idFailureReason,
431 self.getFailureReason(self.ktReason_Host_InstallationFailed).idFailureReason,
432 ];
433
434 #
435 # Get list of bad test boxes for given period and check them out individually.
436 #
437 aidBadTestBoxes = self.oTestSetLogic.fetchBadTestBoxIds(cHoursBack = cHoursBack, tsNow = tsNow,
438 aidFailureReasons = aidFailureReasons);
439 for idTestBox in aidBadTestBoxes:
440 # Skip if the testbox is already disabled or has a pending reboot command.
441 try:
442 oTestBox = TestBoxData().initFromDbWithId(self.oDb, idTestBox);
443 except Exception as oXcpt:
444 rcExit = self.eprint('Failed to get data for test box #%u in badTestBoxManagement: %s' % (idTestBox, oXcpt,));
445 continue;
446 if not oTestBox.fEnabled:
447 self.dprint(u'badTestBoxManagement: Skipping test box #%u (%s) as it has been disabled already.'
448 % ( idTestBox, oTestBox.sName, ));
449 continue;
450 if oTestBox.enmPendingCmd != TestBoxData.ksTestBoxCmd_None:
451 self.dprint(u'badTestBoxManagement: Skipping test box #%u (%s) as it has a command pending: %s'
452 % ( idTestBox, oTestBox.sName, oTestBox.enmPendingCmd));
453 continue;
454
455 # Get the most recent testsets for this box (descending on tsDone) and see how bad it is.
456 aoSets = self.oTestSetLogic.fetchSetsForTestBox(idTestBox, cHoursBack = cHoursBack, tsNow = tsNow);
457 cOkay = 0;
458 cBad = 0;
459 iFirstOkay = len(aoSets);
460 for iSet, oSet in enumerate(aoSets):
461 if oSet.enmStatus == TestSetData.ksTestStatus_BadTestBox:
462 cBad += 1;
463 else:
464 # Check for bad failure reasons.
465 oFailure = None;
466 if oSet.enmStatus in TestSetData.kasBadTestStatuses:
467 oFailure = self.oTestResultFailureLogic.getById(oSet.idTestResult);
468 if oFailure is not None and oFailure.idFailureReason in aidFailureReasons:
469 cBad += 1;
470 else:
471 # This is an okay test result then.
472 ## @todo maybe check the elapsed time here, it could still be a bad run?
473 cOkay += 1;
474 if iFirstOkay > iSet:
475 iFirstOkay = iSet;
476 if iSet > 10:
477 break;
478
479 # We react if there are two or more bad-testbox statuses at the head of the
480 # history and at least three in the last 10 results.
481 if iFirstOkay >= 2 and cBad > 2:
482 # Frank: For now don't reboot boxes automatically
483 if True or oTestBoxLogic.hasTestBoxRecentlyBeenRebooted(idTestBox, cHoursBack = cHoursBack, tsNow = tsNow):
484 self.vprint(u'Disabling testbox #%u (%s) - iFirstOkay=%u cBad=%u cOkay=%u'
485 % ( idTestBox, oTestBox.sName, iFirstOkay, cBad, cOkay));
486 if self.oConfig.fRealRun is True:
487 try:
488 oTestBoxLogic.disableTestBox(idTestBox, self.uidSelf, fCommit = True,
489 sComment = 'Automatically disabled (iFirstOkay=%u cBad=%u cOkay=%u)'
490 % (iFirstOkay, cBad, cOkay),);
491 except Exception as oXcpt:
492 rcExit = self.eprint(u'Error disabling testbox #%u (%u): %s\n' % (idTestBox, oTestBox.sName, oXcpt,));
493 else:
494 self.vprint(u'Rebooting testbox #%u (%s) - iFirstOkay=%u cBad=%u cOkay=%u'
495 % ( idTestBox, oTestBox.sName, iFirstOkay, cBad, cOkay));
496 if self.oConfig.fRealRun is True:
497 try:
498 oTestBoxLogic.rebootTestBox(idTestBox, self.uidSelf, fCommit = True,
499 sComment = 'Automatically rebooted (iFirstOkay=%u cBad=%u cOkay=%u)'
500 % (iFirstOkay, cBad, cOkay),);
501 except Exception as oXcpt:
502 rcExit = self.eprint(u'Error rebooting testbox #%u (%s): %s\n' % (idTestBox, oTestBox.sName, oXcpt,));
503 else:
504 self.dprint(u'badTestBoxManagement: #%u (%s) looks ok: iFirstOkay=%u cBad=%u cOkay=%u'
505 % ( idTestBox, oTestBox.sName, iFirstOkay, cBad, cOkay));
506 #
507 # Reset hanged testboxes
508 #
509 cStatusTimeoutMins = 10;
510
511 self.oDb.execute('SELECT idTestBox FROM TestBoxStatuses WHERE tsUpdated < (CURRENT_TIMESTAMP - interval \'%s minutes\')', (cStatusTimeoutMins,));
512 for idTestBox in self.oDb.fetchAll():
513 idTestBox = idTestBox[0];
514 try:
515 oTestBox = TestBoxData().initFromDbWithId(self.oDb, idTestBox);
516 except Exception as oXcpt:
517 rcExit = self.eprint('Failed to get data for test box #%u in badTestBoxManagement: %s' % (idTestBox, oXcpt,));
518 continue;
519 # Skip if the testbox is already disabled, already reset or there's no iLOM
520 if not oTestBox.fEnabled or oTestBox.ipLom is None or oTestBox.sComment is not None and oTestBox.sComment.find('Automatically reset') >= 0:
521 self.dprint(u'badTestBoxManagement: Skipping test box #%u (%s) as it has been disabled already.'
522 % ( idTestBox, oTestBox.sName, ));
523 continue;
524 ## @todo get iLOM credentials from a table?
525 sCmd = 'sshpass -p%s ssh -oStrictHostKeyChecking=no root@%s show /SP && reset /SYS' % (g_ksLomPassword, oTestBox.ipLom,);
526 try:
527 oPs = subprocess.Popen(sCmd, stdout=subprocess.PIPE, shell=True);
528 sStdout = oPs.communicate()[0];
529 iRC = oPs.wait();
530
531 oTestBox.sComment = 'Automatically reset (iRC=%u sStdout=%s)' % (iRC, sStdout,);
532 oTestBoxLogic.editEntry(oTestBox, self.uidSelf, fCommit = True);
533
534 sComment = u'Reset testbox #%u (%s) - iRC=%u sStduot=%s' % ( idTestBox, oTestBox.sName, iRC, sStdout);
535 self.vprint(sComment);
536 self.sendEmailAlert(self.uidSelf, sComment);
537
538 except Exception as oXcpt:
539 rcExit = self.eprint(u'Error reseting testbox #%u (%s): %s\n' % (idTestBox, oTestBox.sName, oXcpt,));
540
541 return rcExit;
542
543
544 ## @name Failure reasons we know.
545 ## @{
546 ktReason_BSOD_Recovery = ( 'BSOD', 'Recovery' );
547 ktReason_BSOD_Automatic_Repair = ( 'BSOD', 'Automatic Repair' );
548 ktReason_BSOD_0000007F = ( 'BSOD', '0x0000007F' );
549 ktReason_BSOD_000000D1 = ( 'BSOD', '0x000000D1' );
550 ktReason_BSOD_C0000225 = ( 'BSOD', '0xC0000225 (boot)' );
551 ktReason_Guru_Generic = ( 'Guru Meditations', 'Generic Guru Meditation' );
552 ktReason_Guru_VERR_IEM_INSTR_NOT_IMPLEMENTED = ( 'Guru Meditations', 'VERR_IEM_INSTR_NOT_IMPLEMENTED' );
553 ktReason_Guru_VERR_IEM_ASPECT_NOT_IMPLEMENTED = ( 'Guru Meditations', 'VERR_IEM_ASPECT_NOT_IMPLEMENTED' );
554 ktReason_Guru_VERR_TRPM_DONT_PANIC = ( 'Guru Meditations', 'VERR_TRPM_DONT_PANIC' );
555 ktReason_Guru_VERR_PGM_PHYS_PAGE_RESERVED = ( 'Guru Meditations', 'VERR_PGM_PHYS_PAGE_RESERVED' );
556 ktReason_Guru_VERR_VMX_INVALID_GUEST_STATE = ( 'Guru Meditations', 'VERR_VMX_INVALID_GUEST_STATE' );
557 ktReason_Guru_VINF_EM_TRIPLE_FAULT = ( 'Guru Meditations', 'VINF_EM_TRIPLE_FAULT' );
558 ktReason_Host_HostMemoryLow = ( 'Host', 'HostMemoryLow' );
559 ktReason_Host_DriverNotLoaded = ( 'Host', 'Driver not loaded' );
560 ktReason_Host_DriverNotUnloading = ( 'Host', 'Driver not unloading' );
561 ktReason_Host_DriverNotCompilable = ( 'Host', 'Driver not compilable' );
562 ktReason_Host_InstallationFailed = ( 'Host', 'Installation failed' );
563 ktReason_Host_NotSignedWithBuildCert = ( 'Host', 'Not signed with build cert' );
564 ktReason_Host_DoubleFreeHeap = ( 'Host', 'Double free or corruption' );
565 ktReason_Host_LeftoverService = ( 'Host', 'Leftover service' );
566 ktReason_Host_Reboot_OSX_Watchdog_Timeout = ( 'Host Reboot', 'OSX Watchdog Timeout' );
567 ktReason_Host_Modprobe_Failed = ( 'Host', 'Modprobe failed' );
568 ktReason_Host_Install_Hang = ( 'Host', 'Install hang' );
569 ktReason_Host_NetworkMisconfiguration = ( 'Host', 'Network misconfiguration' );
570 ktReason_Networking_Nonexistent_host_nic = ( 'Networking', 'Nonexistent host networking interface' );
571 ktReason_OSInstall_GRUB_hang = ( 'O/S Install', 'GRUB hang' );
572 ktReason_OSInstall_Udev_hang = ( 'O/S Install', 'udev hang' );
573 ktReason_OSInstall_Sata_no_BM = ( 'O/S Install', 'SATA busmaster bit not set' );
574 ktReason_Panic_BootManagerC000000F = ( 'Panic', 'Hardware Changed' );
575 ktReason_BootManager_Image_corrupt = ( 'Unknown', 'BOOTMGR Image corrupt' );
576 ktReason_Panic_MP_BIOS_IO_APIC = ( 'Panic', 'MP-BIOS/IO-APIC' );
577 ktReason_Panic_HugeMemory = ( 'Panic', 'Huge memory assertion' );
578 ktReason_Panic_IOAPICDoesntWork = ( 'Panic', 'IO-APIC and timer does not work' );
579 ktReason_Panic_TxUnitHang = ( 'Panic', 'Tx Unit Hang' );
580 ktReason_XPCOM_Exit_Minus_11 = ( 'API / (XP)COM', 'exit -11' );
581 ktReason_XPCOM_VBoxSVC_Hang = ( 'API / (XP)COM', 'VBoxSVC hang' );
582 ktReason_XPCOM_VBoxSVC_Hang_Plus_Heap_Corruption = ( 'API / (XP)COM', 'VBoxSVC hang + heap corruption' );
583 ktReason_XPCOM_NS_ERROR_CALL_FAILED = ( 'API / (XP)COM', 'NS_ERROR_CALL_FAILED' );
584 ktReason_Unknown_Heap_Corruption = ( 'Unknown', 'Heap corruption' );
585 ktReason_Unknown_Reboot_Loop = ( 'Unknown', 'Reboot loop' );
586 ktReason_Unknown_File_Not_Found = ( 'Unknown', 'File not found' );
587 ktReason_Unknown_VM_Crash = ( 'Unknown', 'VM crash' );
588 ktReason_Unknown_HalReturnToFirmware = ( 'Unknown', 'HalReturnToFirmware' );
589 ktReason_VMM_kvm_lock_spinning = ( 'VMM', 'kvm_lock_spinning' );
590 ktReason_Ignore_Buggy_Test_Driver = ( 'Ignore', 'Buggy test driver' );
591 ktReason_Ignore_Stale_Files = ( 'Ignore', 'Stale files' );
592 ktReason_Buggy_Build_Broken_Build = ( 'Broken Build', 'Buggy build' );
593 ktReason_Unknown_VM_Start_Error = ( 'Unknown', 'VM Start Error' );
594 ktReason_Unknown_VM_Runtime_Error = ( 'Unknown', 'VM Runtime Error' );
595 ktReason_GuestBug_CompizVBoxQt = ( 'Guest Bug', 'Compiz + VirtualBox Qt GUI crash' );
596 ## @}
597
598 ## BSOD category.
599 ksBsodCategory = 'BSOD';
600 ## Special reason indicating that the flesh and blood sheriff has work to do.
601 ksBsodAddNew = 'Add new BSOD';
602
603 ## Unit test category.
604 ksUnitTestCategory = 'Unit';
605 ## Special reason indicating that the flesh and blood sheriff has work to do.
606 ksUnitTestAddNew = 'Add new';
607
608 ## Used for indica that we shouldn't report anything for this test result ID and
609 ## consider promoting the previous error to test set level if it's the only one.
610 ktHarmless = ( 'Probably', 'Caused by previous error' );
611
612
613 def caseClosed(self, oCaseFile):
614 """
615 Reports the findings in the case and closes it.
616 """
617 #
618 # Log it and create a dReasonForReasultId we can use below.
619 #
620 dCommentForResultId = oCaseFile.dCommentForResultId;
621 if oCaseFile.dReasonForResultId:
622 # Must weed out ktHarmless.
623 dReasonForResultId = {};
624 for idKey, tReason in oCaseFile.dReasonForResultId.items():
625 if tReason is not self.ktHarmless:
626 dReasonForResultId[idKey] = tReason;
627 if not dReasonForResultId:
628 self.vprint(u'TODO: Closing %s without a real reason, only %s.'
629 % (oCaseFile.sName, oCaseFile.dReasonForResultId));
630 return False;
631
632 # Try promote to single reason.
633 atValues = dReasonForResultId.values();
634 fSingleReason = True;
635 if len(dReasonForResultId) == 1 and dReasonForResultId.keys()[0] != oCaseFile.oTestSet.idTestResult:
636 self.dprint(u'Promoting single reason to whole set: %s' % (atValues[0],));
637 elif len(dReasonForResultId) > 1 and len(atValues) == atValues.count(atValues[0]):
638 self.dprint(u'Merged %d reasons to a single one: %s' % (len(atValues), atValues[0]));
639 else:
640 fSingleReason = False;
641 if fSingleReason:
642 dReasonForResultId = { oCaseFile.oTestSet.idTestResult: atValues[0], };
643 if dCommentForResultId:
644 dCommentForResultId = { oCaseFile.oTestSet.idTestResult: dCommentForResultId.values()[0], };
645 elif oCaseFile.tReason is not None:
646 dReasonForResultId = { oCaseFile.oTestSet.idTestResult: oCaseFile.tReason, };
647 else:
648 self.vprint(u'Closing %s without a reason - this should not happen!' % (oCaseFile.sName,));
649 return False;
650
651 self.vprint(u'Closing %s with following reason%s: %s'
652 % ( oCaseFile.sName, 's' if dReasonForResultId > 0 else '', dReasonForResultId, ));
653
654 #
655 # Add the test failure reason record(s).
656 #
657 for idTestResult, tReason in dReasonForResultId.items():
658 oFailureReason = self.getFailureReason(tReason);
659 if oFailureReason is not None:
660 sComment = 'Set by $Revision: 76625 $' # Handy for reverting later.
661 if idTestResult in dCommentForResultId:
662 sComment += ': ' + dCommentForResultId[idTestResult];
663
664 oAdd = TestResultFailureData();
665 oAdd.initFromValues(idTestResult = idTestResult,
666 idFailureReason = oFailureReason.idFailureReason,
667 uidAuthor = self.uidSelf,
668 idTestSet = oCaseFile.oTestSet.idTestSet,
669 sComment = sComment,);
670 if self.oConfig.fRealRun:
671 try:
672 self.oTestResultFailureLogic.addEntry(oAdd, self.uidSelf, fCommit = True);
673 except Exception as oXcpt:
674 self.eprint(u'caseClosed: Exception "%s" while adding reason %s for %s'
675 % (oXcpt, oAdd, oCaseFile.sLongName,));
676 else:
677 self.eprint(u'caseClosed: Cannot locate failure reason: %s / %s' % ( tReason[0], tReason[1],));
678 return True;
679
680 #
681 # Tools for assiting log parsing.
682 #
683
684 @staticmethod
685 def matchFollowedByLines(sStr, off, asFollowingLines):
686 """ Worker for isThisFollowedByTheseLines. """
687
688 # Advance off to the end of the line.
689 off = sStr.find('\n', off);
690 if off < 0:
691 return False;
692 off += 1;
693
694 # Match each string with the subsequent lines.
695 for iLine, sLine in enumerate(asFollowingLines):
696 offEnd = sStr.find('\n', off);
697 if offEnd < 0:
698 return iLine + 1 == len(asFollowingLines) and sStr.find(sLine, off) < 0;
699 if sLine and sStr.find(sLine, off, offEnd) < 0:
700 return False;
701
702 # next line.
703 off = offEnd + 1;
704
705 return True;
706
707 @staticmethod
708 def isThisFollowedByTheseLines(sStr, sFirst, asFollowingLines):
709 """
710 Looks for a line contining sFirst which is then followed by lines
711 with the strings in asFollowingLines. (No newline chars anywhere!)
712 Returns True / False.
713 """
714 off = sStr.find(sFirst, 0);
715 while off >= 0:
716 if VirtualTestSheriff.matchFollowedByLines(sStr, off, asFollowingLines):
717 return True;
718 off = sStr.find(sFirst, off + 1);
719 return False;
720
721 @staticmethod
722 def findAndReturnRestOfLine(sHaystack, sNeedle):
723 """
724 Looks for sNeedle in sHaystack.
725 Returns The text following the needle up to the end of the line.
726 Returns None if not found.
727 """
728 if sHaystack is None:
729 return None;
730 off = sHaystack.find(sNeedle);
731 if off < 0:
732 return None;
733 off += len(sNeedle)
734 offEol = sHaystack.find('\n', off);
735 if offEol < 0:
736 offEol = len(sHaystack);
737 return sHaystack[off:offEol]
738
739 @staticmethod
740 def findInAnyAndReturnRestOfLine(asHaystacks, sNeedle):
741 """
742 Looks for sNeedle in zeroe or more haystacks (asHaystack).
743 Returns The text following the first needed found up to the end of the line.
744 Returns None if not found.
745 """
746 for sHaystack in asHaystacks:
747 sRet = VirtualTestSheriff.findAndReturnRestOfLine(sHaystack, sNeedle);
748 if sRet is not None:
749 return sRet;
750 return None;
751
752
753 #
754 # The investigative units.
755 #
756
757 katSimpleInstallUninstallMainLogReasons = [
758 # ( Whether to stop on hit, reason tuple, needle text. )
759 ( False, ktReason_Host_LeftoverService,
760 'SERVICE_NAME: vbox' ),
761 ];
762
763 kdatSimpleInstallUninstallMainLogReasonsPerOs = {
764 'darwin': [
765 # ( Whether to stop on hit, reason tuple, needle text. )
766 ( True, ktReason_Host_DriverNotUnloading,
767 'Can\'t remove kext org.virtualbox.kext.VBoxDrv; services failed to terminate - 0xe00002c7' ),
768 ],
769 'linux': [
770 # ( Whether to stop on hit, reason tuple, needle text. )
771 ( True, ktReason_Host_DriverNotCompilable,
772 'This system is not currently set up to build kernel modules' ),
773 ( True, ktReason_Host_DriverNotCompilable,
774 'This system is currently not set up to build kernel modules' ),
775 ( True, ktReason_Host_InstallationFailed,
776 'vboxdrv.sh: failed: Look at /var/log/vbox-install.log to find out what went wrong.' ),
777 ( True, ktReason_Host_DriverNotUnloading,
778 'Cannot unload module vboxdrv'),
779 ],
780 };
781
782
783 def investigateInstallUninstallFailure(self, oCaseFile, oFailedResult, sResultLog, fInstall):
784 """
785 Investigates an install or uninstall failure.
786
787 We lump the two together since the installation typically also performs
788 an uninstall first and will be seeing similar issues to the uninstall.
789 """
790
791 if fInstall and oFailedResult.enmStatus == TestSetData.ksTestStatus_TimedOut:
792 oCaseFile.noteReasonForId(self.ktReason_Host_Install_Hang, oFailedResult.idTestResult)
793 return True;
794
795 atSimple = self.katSimpleInstallUninstallMainLogReasons;
796 if oCaseFile.oTestBox.sOs in self.kdatSimpleInstallUninstallMainLogReasonsPerOs:
797 atSimple = self.kdatSimpleInstallUninstallMainLogReasonsPerOs[oCaseFile.oTestBox.sOs] + atSimple;
798
799 fFoundSomething = False;
800 for fStopOnHit, tReason, sNeedle in atSimple:
801 if sResultLog.find(sNeedle) > 0:
802 oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
803 if fStopOnHit:
804 return True;
805 fFoundSomething = True;
806
807 return fFoundSomething if fFoundSomething else None;
808
809
810 def investigateBadTestBox(self, oCaseFile):
811 """
812 Checks out bad-testbox statuses.
813 """
814 _ = oCaseFile;
815 return False;
816
817
818 def investigateVBoxUnitTest(self, oCaseFile):
819 """
820 Checks out a VBox unittest problem.
821 """
822
823 #
824 # Process simple test case failures first, using their name as reason.
825 # We do the reason management just like for BSODs.
826 #
827 cRelevantOnes = 0;
828 sMainLog = oCaseFile.getMainLog();
829 aoFailedResults = oCaseFile.oTree.getListOfFailures();
830 for oFailedResult in aoFailedResults:
831 if oFailedResult is oCaseFile.oTree:
832 self.vprint('TODO: toplevel failure');
833 cRelevantOnes += 1
834
835 elif oFailedResult.sName == 'Installing VirtualBox':
836 sResultLog = TestSetData.extractLogSectionElapsed(sMainLog, oFailedResult.tsCreated, oFailedResult.tsElapsed);
837 self.investigateInstallUninstallFailure(oCaseFile, oFailedResult, sResultLog, fInstall = True)
838 cRelevantOnes += 1
839
840 elif oFailedResult.sName == 'Uninstalling VirtualBox':
841 sResultLog = TestSetData.extractLogSectionElapsed(sMainLog, oFailedResult.tsCreated, oFailedResult.tsElapsed);
842 self.investigateInstallUninstallFailure(oCaseFile, oFailedResult, sResultLog, fInstall = False)
843 cRelevantOnes += 1
844
845 elif oFailedResult.oParent is not None:
846 # Get the 2nd level node because that's where we'll find the unit test name.
847 while oFailedResult.oParent.oParent is not None:
848 oFailedResult = oFailedResult.oParent;
849
850 # Only report a failure once.
851 if oFailedResult.idTestResult not in oCaseFile.dReasonForResultId:
852 sKey = oFailedResult.sName;
853 if sKey.startswith('testcase/'):
854 sKey = sKey[9:];
855 if sKey in self.asUnitTestReasons:
856 tReason = ( self.ksUnitTestCategory, sKey );
857 oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
858 else:
859 self.dprint(u'Unit test failure "%s" not found in %s;' % (sKey, self.asUnitTestReasons));
860 tReason = ( self.ksUnitTestCategory, self.ksUnitTestAddNew );
861 oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult, sComment = sKey);
862 cRelevantOnes += 1
863 else:
864 self.vprint(u'Internal error: expected oParent to NOT be None for %s' % (oFailedResult,));
865
866 #
867 # If we've caught all the relevant ones by now, report the result.
868 #
869 if len(oCaseFile.dReasonForResultId) >= cRelevantOnes:
870 return self.caseClosed(oCaseFile);
871 return False;
872
873 def extractGuestCpuStack(self, sInfoText):
874 """
875 Extracts the guest CPU stacks from the input file.
876
877 Returns a dictionary keyed by the CPU number, value being a list of
878 raw stack lines (no header).
879 Returns empty dictionary if no stacks where found.
880 """
881 dRet = {};
882 off = 0;
883 while True:
884 # Find the stack.
885 offStart = sInfoText.find('=== start guest stack VCPU ', off);
886 if offStart < 0:
887 break;
888 offEnd = sInfoText.find('=== end guest stack', offStart + 20);
889 if offEnd >= 0:
890 offEnd += 3;
891 else:
892 offEnd = sInfoText.find('=== start guest stack VCPU', offStart + 20);
893 if offEnd < 0:
894 offEnd = len(sInfoText);
895
896 sStack = sInfoText[offStart : offEnd];
897 sStack = sStack.replace('\r',''); # paranoia
898 asLines = sStack.split('\n');
899
900 # Figure the CPU.
901 asWords = asLines[0].split();
902 if len(asWords) < 6 or not asWords[5].isdigit():
903 break;
904 iCpu = int(asWords[5]);
905
906 # Add it and advance.
907 dRet[iCpu] = [sLine.rstrip() for sLine in asLines[2:-1]]
908 off = offEnd;
909 return dRet;
910
911 def investigateInfoKvmLockSpinning(self, oCaseFile, sInfoText, dLogs):
912 """ Investigates kvm_lock_spinning deadlocks """
913 #
914 # Extract the stacks. We need more than one CPU to create a deadlock.
915 #
916 dStacks = self.extractGuestCpuStack(sInfoText);
917 self.dprint('kvm_lock_spinning: found %s stacks' % (len(dStacks),));
918 if len(dStacks) >= 2:
919 #
920 # Examin each of the stacks. Each must have kvm_lock_spinning in
921 # one of the first three entries.
922 #
923 cHits = 0;
924 for iCpu in dStacks:
925 asBacktrace = dStacks[iCpu];
926 for iFrame in xrange(min(3, len(asBacktrace))):
927 if asBacktrace[iFrame].find('kvm_lock_spinning') >= 0:
928 cHits += 1;
929 break;
930 self.dprint('kvm_lock_spinning: %s/%s hits' % (cHits, len(dStacks),));
931 if cHits == len(dStacks):
932 return (True, self.ktReason_VMM_kvm_lock_spinning);
933
934 _ = dLogs; _ = oCaseFile;
935 return (False, None);
936
937 def investigateInfoHalReturnToFirmware(self, oCaseFile, sInfoText, dLogs):
938 """ Investigates HalReturnToFirmware hangs """
939 del oCaseFile
940 del sInfoText
941 del dLogs
942 # hope that's sufficient
943 return (True, self.ktReason_Unknown_HalReturnToFirmware);
944
945 ## Things we search a main or VM log for to figure out why something went bust.
946 katSimpleMainAndVmLogReasons = [
947 # ( Whether to stop on hit, reason tuple, needle text. )
948 ( False, ktReason_Guru_Generic, 'GuruMeditation' ),
949 ( False, ktReason_Guru_Generic, 'Guru Meditation' ),
950 ( True, ktReason_Guru_VERR_IEM_INSTR_NOT_IMPLEMENTED, 'VERR_IEM_INSTR_NOT_IMPLEMENTED' ),
951 ( True, ktReason_Guru_VERR_IEM_ASPECT_NOT_IMPLEMENTED, 'VERR_IEM_ASPECT_NOT_IMPLEMENTED' ),
952 ( True, ktReason_Guru_VERR_TRPM_DONT_PANIC, 'VERR_TRPM_DONT_PANIC' ),
953 ( True, ktReason_Guru_VERR_PGM_PHYS_PAGE_RESERVED, 'VERR_PGM_PHYS_PAGE_RESERVED' ),
954 ( True, ktReason_Guru_VERR_VMX_INVALID_GUEST_STATE, 'VERR_VMX_INVALID_GUEST_STATE' ),
955 ( True, ktReason_Guru_VINF_EM_TRIPLE_FAULT, 'VINF_EM_TRIPLE_FAULT' ),
956 ( True, ktReason_Networking_Nonexistent_host_nic,
957 'rc=E_FAIL text="Nonexistent host networking interface, name \'eth0\' (VERR_INTERNAL_ERROR)"' ),
958 ( True, ktReason_Host_Reboot_OSX_Watchdog_Timeout, ': "OSX Watchdog Timeout: ' ),
959 ( False, ktReason_XPCOM_NS_ERROR_CALL_FAILED,
960 'Exception: 0x800706be (Call to remote object failed (NS_ERROR_CALL_FAILED))' ),
961 ( True, ktReason_Host_HostMemoryLow, 'HostMemoryLow' ),
962 ( True, ktReason_Host_HostMemoryLow, 'Failed to procure handy pages; rc=VERR_NO_MEMORY' ),
963 ( True, ktReason_Unknown_File_Not_Found,
964 'Error: failed to start machine. Error message: File not found. (VERR_FILE_NOT_FOUND)' ),
965 ( True, ktReason_Unknown_File_Not_Found, # lump it in with file-not-found for now.
966 'Error: failed to start machine. Error message: Not supported. (VERR_NOT_SUPPORTED)' ),
967 ( False, ktReason_Unknown_VM_Crash, 'txsDoConnectViaTcp: Machine state: Aborted' ),
968 ( True, ktReason_Host_Modprobe_Failed, 'Kernel driver not installed' ),
969 ( True, ktReason_OSInstall_Sata_no_BM, 'PCHS=14128/14134/8224' ),
970 ( True, ktReason_Host_DoubleFreeHeap, 'double free or corruption' ),
971 ( False, ktReason_Unknown_VM_Start_Error, 'VMSetError: ' ),
972 ( False, ktReason_Unknown_VM_Runtime_Error, 'Console: VM runtime error: fatal=true' ),
973 ];
974
975 ## Things we search a VBoxHardening.log file for to figure out why something went bust.
976 katSimpleVBoxHardeningLogReasons = [
977 # ( Whether to stop on hit, reason tuple, needle text. )
978 ( True, ktReason_Host_DriverNotLoaded, 'Error opening VBoxDrvStub: STATUS_OBJECT_NAME_NOT_FOUND' ),
979 ( True, ktReason_Host_NotSignedWithBuildCert, 'Not signed with the build certificate' ),
980 ];
981
982 ## Things we search a kernel.log file for to figure out why something went bust.
983 katSimpleKernelLogReasons = [
984 # ( Whether to stop on hit, reason tuple, needle text. )
985 ( True, ktReason_Panic_HugeMemory, 'mm/huge_memory.c:1988' ),
986 ( True, ktReason_Panic_IOAPICDoesntWork, 'IO-APIC + timer doesn''t work' ),
987 ( True, ktReason_Panic_TxUnitHang, 'Detected Tx Unit Hang' ),
988 ( True, ktReason_GuestBug_CompizVBoxQt, 'error 4 in libQt5CoreVBox' ),
989 ( True, ktReason_GuestBug_CompizVBoxQt, 'error 4 in libgtk-3' ),
990 ];
991
992 ## Things we search the _RIGHT_ _STRIPPED_ vgatext for.
993 katSimpleVgaTextReasons = [
994 # ( Whether to stop on hit, reason tuple, needle text. )
995 ( True, ktReason_Panic_MP_BIOS_IO_APIC,
996 "..MP-BIOS bug: 8254 timer not connected to IO-APIC\n\n" ),
997 ( True, ktReason_Panic_MP_BIOS_IO_APIC,
998 "..MP-BIOS bug: 8254 timer not connected to IO-APIC\n"
999 "...trying to set up timer (IRQ0) through the 8259A ... failed.\n"
1000 "...trying to set up timer as Virtual Wire IRQ... failed.\n"
1001 "...trying to set up timer as ExtINT IRQ... failed :(.\n"
1002 "Kernel panic - not syncing: IO-APIC + timer doesn't work! Boot with apic=debug\n"
1003 "and send a report. Then try booting with the 'noapic' option\n"
1004 "\n" ),
1005 ( True, ktReason_OSInstall_GRUB_hang,
1006 "-----\nGRUB Loading stage2..\n\n\n\n" ),
1007 ( True, ktReason_OSInstall_GRUB_hang,
1008 "-----\nGRUB Loading stage2...\n\n\n\n" ), # the 3 dot hang appears to be less frequent
1009 ( True, ktReason_OSInstall_GRUB_hang,
1010 "-----\nGRUB Loading stage2....\n\n\n\n" ), # the 4 dot hang appears to be very infrequent
1011 ( True, ktReason_OSInstall_GRUB_hang,
1012 "-----\nGRUB Loading stage2.....\n\n\n\n" ), # the 5 dot hang appears to be more frequent again
1013 ( True, ktReason_OSInstall_Udev_hang,
1014 "\nStarting udev:\n\n\n\n" ),
1015 ( True, ktReason_OSInstall_Udev_hang,
1016 "\nStarting udev:\n------" ),
1017 ( True, ktReason_Panic_BootManagerC000000F,
1018 "Windows failed to start. A recent hardware or software change might be the" ),
1019 ( True, ktReason_BootManager_Image_corrupt,
1020 "BOOTMGR image is corrupt. The system cannot boot." ),
1021 ];
1022
1023 ## Things we search for in the info.txt file. Require handlers for now.
1024 katInfoTextHandlers = [
1025 # ( Trigger text, handler method )
1026 ( "kvm_lock_spinning", investigateInfoKvmLockSpinning ),
1027 ( "HalReturnToFirmware", investigateInfoHalReturnToFirmware ),
1028 ];
1029
1030 ## Mapping screenshot/failure SHA-256 hashes to failure reasons.
1031 katSimpleScreenshotHashReasons = [
1032 # ( Whether to stop on hit, reason tuple, lowercased sha-256 of PIL.Image.tostring output )
1033 ( True, ktReason_BSOD_Recovery, '576f8e38d62b311cac7e3dc3436a0d0b9bd8cfd7fa9c43aafa95631520a45eac' ),
1034 ( True, ktReason_BSOD_Automatic_Repair, 'c6a72076cc619937a7a39cfe9915b36d94cee0d4e3ce5ce061485792dcee2749' ),
1035 ( True, ktReason_BSOD_Automatic_Repair, '26c4d8a724ff2c5e1051f3d5b650dbda7b5fdee0aa3e3c6059797f7484a515df' ),
1036 ( True, ktReason_BSOD_0000007F, '57e1880619e13042a87100e7a38c8974b85ce3866501be621bea0cc696bb2c63' ),
1037 ( True, ktReason_BSOD_000000D1, '134621281f00a3f8aeeb7660064bffbf6187ed56d5852142328d0bcb18ef0ede' ),
1038 ( True, ktReason_BSOD_000000D1, '279f11258150c9d2fef041eca65501f3141da8df39256d8f6377e897e3b45a93' ),
1039 ( True, ktReason_BSOD_C0000225, 'bd13a144be9dcdfb16bc863ff4c8f02a86e263c174f2cd5ffd27ca5f3aa31789' ),
1040 ( True, ktReason_BSOD_C0000225, '8348b465e7ee9e59dd4e785880c57fd8677de05d11ac21e786bfde935307b42f' ),
1041 ( True, ktReason_BSOD_C0000225, '1316e1fc818a73348412788e6910b8c016f237d8b4e15b20caf4a866f7a7840e' ),
1042 ( True, ktReason_BSOD_C0000225, '54e0acbff365ce20a85abbe42bcd53647b8b9e80c68e45b2cd30e86bf177a0b5' ),
1043 ( True, ktReason_BSOD_C0000225, '50fec50b5199923fa48b3f3e782687cc381e1c8a788ebda14e6a355fbe3bb1b3' ),
1044 ];
1045
1046 def investigateVMResult(self, oCaseFile, oFailedResult, sResultLog):
1047 """
1048 Investigates a failed VM run.
1049 """
1050
1051 def investigateLogSet():
1052 """
1053 Investigates the current set of VM related logs.
1054 """
1055 self.dprint('investigateLogSet: lengths: result log %u, VM log %u, kernel log %u, vga text %u, info text %u'
1056 % ( len(sResultLog if sResultLog else ''),
1057 len(sVMLog if sVMLog else ''),
1058 len(sKrnlLog if sKrnlLog else ''),
1059 len(sVgaText if sVgaText else ''),
1060 len(sInfoText if sInfoText else ''), ));
1061
1062 #self.dprint(u'main.log<<<\n%s\n<<<\n' % (sResultLog,));
1063 #self.dprint(u'vbox.log<<<\n%s\n<<<\n' % (sVMLog,));
1064 #self.dprint(u'krnl.log<<<\n%s\n<<<\n' % (sKrnlLog,));
1065 #self.dprint(u'vgatext.txt<<<\n%s\n<<<\n' % (sVgaText,));
1066 #self.dprint(u'info.txt<<<\n%s\n<<<\n' % (sInfoText,));
1067
1068 # TODO: more
1069
1070 #
1071 # Look for BSODs. Some stupid stupid inconsistencies in reason and log messages here, so don't try prettify this.
1072 #
1073 sDetails = self.findInAnyAndReturnRestOfLine([ sVMLog, sResultLog ],
1074 'GIM: HyperV: Guest indicates a fatal condition! P0=');
1075 if sDetails is not None:
1076 # P0=%#RX64 P1=%#RX64 P2=%#RX64 P3=%#RX64 P4=%#RX64 "
1077 sKey = sDetails.split(' ', 1)[0];
1078 try: sKey = '0x%08X' % (int(sKey, 16),);
1079 except: pass;
1080 if sKey in self.asBsodReasons:
1081 tReason = ( self.ksBsodCategory, sKey );
1082 elif sKey.lower() in self.asBsodReasons: # just in case.
1083 tReason = ( self.ksBsodCategory, sKey.lower() );
1084 else:
1085 self.dprint(u'BSOD "%s" not found in %s;' % (sKey, self.asBsodReasons));
1086 tReason = ( self.ksBsodCategory, self.ksBsodAddNew );
1087 return oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult, sComment = sDetails.strip());
1088
1089 #
1090 # Look for linux panic.
1091 #
1092 if sKrnlLog is not None:
1093 for fStopOnHit, tReason, sNeedle in self.katSimpleKernelLogReasons:
1094 if sKrnlLog.find(sNeedle) > 0:
1095 oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
1096 if fStopOnHit:
1097 return True;
1098 fFoundSomething = True;
1099
1100 #
1101 # Loop thru the simple stuff.
1102 #
1103 fFoundSomething = False;
1104 for fStopOnHit, tReason, sNeedle in self.katSimpleMainAndVmLogReasons:
1105 if sResultLog.find(sNeedle) > 0 or (sVMLog is not None and sVMLog.find(sNeedle) > 0):
1106 oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
1107 if fStopOnHit:
1108 return True;
1109 fFoundSomething = True;
1110
1111 # Continue with vga text.
1112 if sVgaText:
1113 for fStopOnHit, tReason, sNeedle in self.katSimpleVgaTextReasons:
1114 if sVgaText.find(sNeedle) > 0:
1115 oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
1116 if fStopOnHit:
1117 return True;
1118 fFoundSomething = True;
1119 _ = sInfoText;
1120
1121 # Continue with screen hashes.
1122 if sScreenHash is not None:
1123 for fStopOnHit, tReason, sHash in self.katSimpleScreenshotHashReasons:
1124 if sScreenHash == sHash:
1125 oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
1126 if fStopOnHit:
1127 return True;
1128 fFoundSomething = True;
1129
1130 # Check VBoxHardening.log.
1131 if sNtHardLog is not None:
1132 for fStopOnHit, tReason, sNeedle in self.katSimpleVBoxHardeningLogReasons:
1133 if sNtHardLog.find(sNeedle) > 0:
1134 oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
1135 if fStopOnHit:
1136 return True;
1137 fFoundSomething = True;
1138
1139 #
1140 # Complicated stuff.
1141 #
1142 dLogs = {
1143 'sVMLog': sVMLog,
1144 'sNtHardLog': sNtHardLog,
1145 'sScreenHash': sScreenHash,
1146 'sKrnlLog': sKrnlLog,
1147 'sVgaText': sVgaText,
1148 'sInfoText': sInfoText,
1149 };
1150
1151 # info.txt.
1152 if sInfoText:
1153 for sNeedle, fnHandler in self.katInfoTextHandlers:
1154 if sInfoText.find(sNeedle) > 0:
1155 (fStop, tReason) = fnHandler(self, oCaseFile, sInfoText, dLogs);
1156 if tReason is not None:
1157 oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
1158 if fStop:
1159 return True;
1160 fFoundSomething = True;
1161
1162 #
1163 # Check for repeated reboots...
1164 #
1165 if sVMLog is not None:
1166 cResets = sVMLog.count('Changing the VM state from \'RUNNING\' to \'RESETTING\'');
1167 if cResets > 10:
1168 return oCaseFile.noteReasonForId(self.ktReason_Unknown_Reboot_Loop, oFailedResult.idTestResult,
1169 sComment = 'Counted %s reboots' % (cResets,));
1170
1171 return fFoundSomething;
1172
1173 #
1174 # Check if we got any VM or/and kernel logs. Treat them as sets in
1175 # case we run multiple VMs here (this is of course ASSUMING they
1176 # appear in the order that terminateVmBySession uploads them).
1177 #
1178 cTimes = 0;
1179 sVMLog = None;
1180 sNtHardLog = None;
1181 sScreenHash = None;
1182 sKrnlLog = None;
1183 sVgaText = None;
1184 sInfoText = None;
1185 for oFile in oFailedResult.aoFiles:
1186 if oFile.sKind == TestResultFileData.ksKind_LogReleaseVm:
1187 if 'VBoxHardening.log' not in oFile.sFile:
1188 if sVMLog is not None:
1189 if investigateLogSet() is True:
1190 return True;
1191 cTimes += 1;
1192 sInfoText = None;
1193 sVgaText = None;
1194 sKrnlLog = None;
1195 sScreenHash = None;
1196 sNtHardLog = None;
1197 sVMLog = oCaseFile.getLogFile(oFile);
1198 else:
1199 sNtHardLog = oCaseFile.getLogFile(oFile);
1200 elif oFile.sKind == TestResultFileData.ksKind_LogGuestKernel:
1201 sKrnlLog = oCaseFile.getLogFile(oFile);
1202 elif oFile.sKind == TestResultFileData.ksKind_InfoVgaText:
1203 sVgaText = '\n'.join([sLine.rstrip() for sLine in oCaseFile.getLogFile(oFile).split('\n')]);
1204 elif oFile.sKind == TestResultFileData.ksKind_InfoCollection:
1205 sInfoText = oCaseFile.getLogFile(oFile);
1206 elif oFile.sKind == TestResultFileData.ksKind_ScreenshotFailure:
1207 sScreenHash = oCaseFile.getScreenshotSha256(oFile);
1208 if sScreenHash is not None:
1209 sScreenHash = sScreenHash.lower();
1210 self.vprint(u'%s %s' % ( sScreenHash, oFile.sFile,));
1211
1212 if ( sVMLog is not None \
1213 or sNtHardLog is not None \
1214 or cTimes == 0) \
1215 and investigateLogSet() is True:
1216 return True;
1217
1218 return None;
1219
1220
1221 def isResultFromVMRun(self, oFailedResult, sResultLog):
1222 """
1223 Checks if this result and corresponding log snippet looks like a VM run.
1224 """
1225
1226 # Look for startVmEx/ startVmAndConnectToTxsViaTcp and similar output in the log.
1227 if sResultLog.find(' startVm') > 0:
1228 return True;
1229
1230 # Any other indicators? No?
1231 _ = oFailedResult;
1232 return False;
1233
1234 def investigateVBoxVMTest(self, oCaseFile, fSingleVM):
1235 """
1236 Checks out a VBox VM test.
1237
1238 This is generic investigation of a test running one or more VMs, like
1239 for example a smoke test or a guest installation test.
1240
1241 The fSingleVM parameter is a hint, which probably won't come in useful.
1242 """
1243 _ = fSingleVM;
1244
1245 #
1246 # Get a list of test result failures we should be looking into and the main log.
1247 #
1248 aoFailedResults = oCaseFile.oTree.getListOfFailures();
1249 sMainLog = oCaseFile.getMainLog();
1250
1251 #
1252 # There are a set of errors ending up on the top level result record.
1253 # Should deal with these first.
1254 #
1255 if len(aoFailedResults) == 1 and aoFailedResults[0] == oCaseFile.oTree:
1256 # Check if we've just got that XPCOM client smoke test shutdown issue. This will currently always
1257 # be reported on the top result because vboxinstall.py doesn't add an error for it. It is easy to
1258 # ignore other failures in the test if we're not a little bit careful here.
1259 if sMainLog.find('vboxinstaller: Exit code: -11 (') > 0:
1260 oCaseFile.noteReason(self.ktReason_XPCOM_Exit_Minus_11);
1261 return self.caseClosed(oCaseFile);
1262
1263 # Hang after starting VBoxSVC (e.g. idTestSet=136307258)
1264 if self.isThisFollowedByTheseLines(sMainLog, 'oVBoxMgr=<vboxapi.VirtualBoxManager object at',
1265 (' Timeout: ', ' Attempting to abort child...',) ):
1266 if sMainLog.find('*** glibc detected *** /') > 0:
1267 oCaseFile.noteReason(self.ktReason_XPCOM_VBoxSVC_Hang_Plus_Heap_Corruption);
1268 else:
1269 oCaseFile.noteReason(self.ktReason_XPCOM_VBoxSVC_Hang);
1270 return self.caseClosed(oCaseFile);
1271
1272 # Look for heap corruption without visible hang.
1273 if sMainLog.find('*** glibc detected *** /') > 0 \
1274 or sMainLog.find("-1073740940") > 0: # STATUS_HEAP_CORRUPTION / 0xc0000374
1275 oCaseFile.noteReason(self.ktReason_Unknown_Heap_Corruption);
1276 return self.caseClosed(oCaseFile);
1277
1278 # Out of memory w/ timeout.
1279 if sMainLog.find('sErrId=HostMemoryLow') > 0:
1280 oCaseFile.noteReason(self.ktReason_Host_HostMemoryLow);
1281 return self.caseClosed(oCaseFile);
1282
1283 # Stale files like vts_rm.exe (windows).
1284 offEnd = sMainLog.rfind('*** The test driver exits successfully. ***');
1285 if offEnd > 0 and sMainLog.find('[Error 145] The directory is not empty: ', offEnd) > 0:
1286 oCaseFile.noteReason(self.ktReason_Ignore_Stale_Files);
1287 return self.caseClosed(oCaseFile);
1288
1289 #
1290 # XPCOM screwup
1291 #
1292 if sMainLog.find('AttributeError: \'NoneType\' object has no attribute \'addObserver\'') > 0:
1293 oCaseFile.noteReason(self.ktReason_Buggy_Build_Broken_Build);
1294 return self.caseClosed(oCaseFile);
1295
1296 #
1297 # Go thru each failed result.
1298 #
1299 for oFailedResult in aoFailedResults:
1300 self.dprint(u'Looking at test result #%u - %s' % (oFailedResult.idTestResult, oFailedResult.getFullName(),));
1301 sResultLog = TestSetData.extractLogSectionElapsed(sMainLog, oFailedResult.tsCreated, oFailedResult.tsElapsed);
1302 if oFailedResult.sName == 'Installing VirtualBox':
1303 self.investigateInstallUninstallFailure(oCaseFile, oFailedResult, sResultLog, fInstall = True)
1304
1305 elif oFailedResult.sName == 'Uninstalling VirtualBox':
1306 self.investigateInstallUninstallFailure(oCaseFile, oFailedResult, sResultLog, fInstall = False)
1307
1308 elif self.isResultFromVMRun(oFailedResult, sResultLog):
1309 self.investigateVMResult(oCaseFile, oFailedResult, sResultLog);
1310
1311 elif sResultLog.find('most likely not unique') > 0:
1312 oCaseFile.noteReasonForId(self.ktReason_Host_NetworkMisconfiguration, oFailedResult.idTestResult)
1313 elif sResultLog.find('Exception: 0x800706be (Call to remote object failed (NS_ERROR_CALL_FAILED))') > 0:
1314 oCaseFile.noteReasonForId(self.ktReason_XPCOM_NS_ERROR_CALL_FAILED, oFailedResult.idTestResult);
1315
1316 elif sResultLog.find('The machine is not mutable (state is ') > 0:
1317 self.vprint('Ignoring "machine not mutable" error as it is probably due to an earlier problem');
1318 oCaseFile.noteReasonForId(self.ktHarmless, oFailedResult.idTestResult);
1319
1320 elif sResultLog.find('** error: no action was specified') > 0 \
1321 or sResultLog.find('(len(self._asXml, asText))') > 0:
1322 oCaseFile.noteReasonForId(self.ktReason_Ignore_Buggy_Test_Driver, oFailedResult.idTestResult);
1323
1324 else:
1325 self.vprint(u'TODO: Cannot place idTestResult=%u - %s' % (oFailedResult.idTestResult, oFailedResult.sName,));
1326 self.dprint(u'%s + %s <<\n%s\n<<' % (oFailedResult.tsCreated, oFailedResult.tsElapsed, sResultLog,));
1327
1328 #
1329 # Report home and close the case if we got them all, otherwise log it.
1330 #
1331 if len(oCaseFile.dReasonForResultId) >= len(aoFailedResults):
1332 return self.caseClosed(oCaseFile);
1333
1334 if oCaseFile.dReasonForResultId:
1335 self.vprint(u'TODO: Got %u out of %u - close, but no cigar. :-/'
1336 % (len(oCaseFile.dReasonForResultId), len(aoFailedResults)));
1337 else:
1338 self.vprint(u'XXX: Could not figure out anything at all! :-(');
1339 return False;
1340
1341
1342 def reasoningFailures(self):
1343 """
1344 Guess the reason for failures.
1345 """
1346 #
1347 # Get a list of failed test sets without any assigned failure reason.
1348 #
1349 cGot = 0;
1350 aoTestSets = self.oTestSetLogic.fetchFailedSetsWithoutReason(cHoursBack = self.oConfig.cHoursBack, tsNow = self.tsNow);
1351 for oTestSet in aoTestSets:
1352 self.dprint(u'');
1353 self.dprint(u'reasoningFailures: Checking out test set #%u, status %s' % ( oTestSet.idTestSet, oTestSet.enmStatus,))
1354
1355 #
1356 # Open a case file and assign it to the right investigator.
1357 #
1358 (oTree, _ ) = self.oTestResultLogic.fetchResultTree(oTestSet.idTestSet);
1359 oBuild = BuildDataEx().initFromDbWithId( self.oDb, oTestSet.idBuild, oTestSet.tsCreated);
1360 oTestBox = TestBoxData().initFromDbWithGenId( self.oDb, oTestSet.idGenTestBox);
1361 oTestGroup = TestGroupData().initFromDbWithId( self.oDb, oTestSet.idTestGroup, oTestSet.tsCreated);
1362 oTestCase = TestCaseDataEx().initFromDbWithGenId( self.oDb, oTestSet.idGenTestCase, oTestSet.tsConfig);
1363
1364 oCaseFile = VirtualTestSheriffCaseFile(self, oTestSet, oTree, oBuild, oTestBox, oTestGroup, oTestCase);
1365
1366 if oTestSet.enmStatus == TestSetData.ksTestStatus_BadTestBox:
1367 self.dprint(u'investigateBadTestBox is taking over %s.' % (oCaseFile.sLongName,));
1368 fRc = self.investigateBadTestBox(oCaseFile);
1369
1370 elif oCaseFile.isVBoxUnitTest():
1371 self.dprint(u'investigateVBoxUnitTest is taking over %s.' % (oCaseFile.sLongName,));
1372 fRc = self.investigateVBoxUnitTest(oCaseFile);
1373
1374 elif oCaseFile.isVBoxInstallTest():
1375 self.dprint(u'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
1376 fRc = self.investigateVBoxVMTest(oCaseFile, fSingleVM = True);
1377
1378 elif oCaseFile.isVBoxUSBTest():
1379 self.dprint(u'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
1380 fRc = self.investigateVBoxVMTest(oCaseFile, fSingleVM = True);
1381
1382 elif oCaseFile.isVBoxStorageTest():
1383 self.dprint(u'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
1384 fRc = self.investigateVBoxVMTest(oCaseFile, fSingleVM = True);
1385
1386 elif oCaseFile.isVBoxGAsTest():
1387 self.dprint(u'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
1388 fRc = self.investigateVBoxVMTest(oCaseFile, fSingleVM = True);
1389
1390 elif oCaseFile.isVBoxAPITest():
1391 self.dprint(u'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
1392 fRc = self.investigateVBoxVMTest(oCaseFile, fSingleVM = True);
1393
1394 elif oCaseFile.isVBoxBenchmarkTest():
1395 self.dprint(u'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
1396 fRc = self.investigateVBoxVMTest(oCaseFile, fSingleVM = False);
1397
1398 elif oCaseFile.isVBoxSmokeTest():
1399 self.dprint(u'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
1400 fRc = self.investigateVBoxVMTest(oCaseFile, fSingleVM = False);
1401
1402 else:
1403 self.vprint(u'reasoningFailures: Unable to classify test set: %s' % (oCaseFile.sLongName,));
1404 fRc = False;
1405 cGot += fRc is True;
1406
1407 self.vprint(u'reasoningFailures: Got %u out of %u' % (cGot, len(aoTestSets), ));
1408 return 0;
1409
1410
1411 def main(self):
1412 """
1413 The 'main' function.
1414 Return exit code (0, 1, etc).
1415 """
1416 # Database stuff.
1417 self.oDb = TMDatabaseConnection()
1418 self.oTestResultLogic = TestResultLogic(self.oDb);
1419 self.oTestSetLogic = TestSetLogic(self.oDb);
1420 self.oFailureReasonLogic = FailureReasonLogic(self.oDb);
1421 self.oTestResultFailureLogic = TestResultFailureLogic(self.oDb);
1422 self.asBsodReasons = self.oFailureReasonLogic.fetchForSheriffByNamedCategory(self.ksBsodCategory);
1423 self.asUnitTestReasons = self.oFailureReasonLogic.fetchForSheriffByNamedCategory(self.ksUnitTestCategory);
1424
1425 # Get a fix on our 'now' before we do anything..
1426 self.oDb.execute('SELECT CURRENT_TIMESTAMP - interval \'%s hours\'', (self.oConfig.cStartHoursAgo,));
1427 self.tsNow = self.oDb.fetchOne();
1428
1429 # If we're suppost to commit anything we need to get our user ID.
1430 rcExit = 0;
1431 if self.oConfig.fRealRun:
1432 self.oLogin = UserAccountLogic(self.oDb).tryFetchAccountByLoginName(VirtualTestSheriff.ksLoginName);
1433 if self.oLogin is None:
1434 rcExit = self.eprint('Cannot find my user account "%s"!' % (VirtualTestSheriff.ksLoginName,));
1435 else:
1436 self.uidSelf = self.oLogin.uid;
1437
1438 #
1439 # Do the stuff.
1440 #
1441 if rcExit == 0:
1442 rcExit = self.selfCheck();
1443 if rcExit == 0:
1444 rcExit = self.badTestBoxManagement();
1445 rcExit2 = self.reasoningFailures();
1446 if rcExit == 0:
1447 rcExit = rcExit2;
1448 # Redo the bad testbox management after failure reasons have been assigned (got timing issues).
1449 if rcExit == 0:
1450 rcExit = self.badTestBoxManagement();
1451
1452 # Cleanup.
1453 self.oFailureReasonLogic = None;
1454 self.oTestResultFailureLogic = None;
1455 self.oTestSetLogic = None;
1456 self.oTestResultLogic = None;
1457 self.oDb.close();
1458 self.oDb = None;
1459 if self.oLogFile is not None:
1460 self.oLogFile.close();
1461 self.oLogFile = None;
1462 return rcExit;
1463
1464if __name__ == '__main__':
1465 sys.exit(VirtualTestSheriff().main());
1466
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette