Index: /trunk/src/VBox/ValidationKit/testmanager/batch/virtual_test_sheriff.py
===================================================================
--- /trunk/src/VBox/ValidationKit/testmanager/batch/virtual_test_sheriff.py	(revision 61939)
+++ /trunk/src/VBox/ValidationKit/testmanager/batch/virtual_test_sheriff.py	(revision 61940)
@@ -109,5 +109,5 @@
     def noteReason(self, tReason):
         """ Notes down a possible reason. """
-        self.oSheriff.dprint('noteReason: %s -> %s' % (self.tReason, tReason,));
+        self.oSheriff.dprint(u'noteReason: %s -> %s' % (self.tReason, tReason,));
         self.tReason = tReason;
         return True;
@@ -115,7 +115,7 @@
     def noteReasonForId(self, tReason, idTestResult, sComment = None):
         """ Notes down a possible reason for a specific test result. """
-        self.oSheriff.dprint('noteReasonForId: %u: %s -> %s%s'
+        self.oSheriff.dprint(u'noteReasonForId: %u: %s -> %s%s'
                              % (idTestResult, self.dReasonForResultId.get(idTestResult, None), tReason,
-                                (' (%s)' % (sComment,)) if sComment is not None else ''));
+                                (u' (%s)' % (sComment,)) if sComment is not None else ''));
         self.dReasonForResultId[idTestResult] = tReason;
         if sComment is not None:
@@ -163,8 +163,8 @@
                 self.sMainLog = oFile.read(min(self.kcbMaxLogRead, oSizeOrError)).decode('utf-8', 'replace');
             except Exception as oXcpt:
-                self.oSheriff.vprint('Error reading main log file: %s' % (oXcpt,))
+                self.oSheriff.vprint(u'Error reading main log file: %s' % (oXcpt,))
                 self.sMainLog = '';
         else:
-            self.oSheriff.vprint('Error opening main log file: %s' % (oSizeOrError,));
+            self.oSheriff.vprint(u'Error opening main log file: %s' % (oSizeOrError,));
         return self.sMainLog;
 
@@ -181,7 +181,7 @@
                 sContent = oFile.read(min(self.kcbMaxLogRead, oSizeOrError)).decode('utf-8', 'replace');
             except Exception as oXcpt:
-                self.oSheriff.vprint('Error reading the "%s" log file: %s' % (oFile.sFile, oXcpt,))
+                self.oSheriff.vprint(u'Error reading the "%s" log file: %s' % (oFile.sFile, oXcpt,))
         else:
-            self.oSheriff.vprint('Error opening the "%s" log file: %s' % (oFile.sFile, oSizeOrError,));
+            self.oSheriff.vprint(u'Error opening the "%s" log file: %s' % (oFile.sFile, oSizeOrError,));
         return sContent;
 
@@ -196,10 +196,10 @@
             abImageFile = oFile.read();
         except Exception as oXcpt:
-            self.oSheriff.vprint('Error reading the "%s" image file: %s' % (oFile.sFile, oXcpt,))
+            self.oSheriff.vprint(u'Error reading the "%s" image file: %s' % (oFile.sFile, oXcpt,))
         else:
             try:
                 oImage = Image.open(StringIO.StringIO(abImageFile));
             except Exception as oXcpt:
-                self.oSheriff.vprint('Error opening the "%s" image bytes using PIL.Image.open: %s' % (oFile.sFile, oXcpt,))
+                self.oSheriff.vprint(u'Error opening the "%s" image bytes using PIL.Image.open: %s' % (oFile.sFile, oXcpt,))
             else:
                 try:
@@ -207,5 +207,5 @@
                     oHash.update(oImage.tostring());
                 except Exception as oXcpt:
-                    self.oSheriff.vprint('Error hashing the uncompressed image bytes for "%s": %s' % (oFile.sFile, oXcpt,))
+                    self.oSheriff.vprint(u'Error hashing the uncompressed image bytes for "%s": %s' % (oFile.sFile, oXcpt,))
                 else:
                     return oHash.hexdigest();
@@ -279,5 +279,5 @@
         print 'error: %s' % (sText,);
         if self.oLogFile is not None:
-            self.oLogFile.write('error: %s\n' % (sText,));
+            self.oLogFile.write(u'error: %s\n' % (sText,));
         return 1;
 
@@ -290,5 +290,5 @@
                 print 'debug: %s' % (sText, );
             if self.oLogFile is not None:
-                self.oLogFile.write('debug: %s\n' % (sText,));
+                self.oLogFile.write(u'debug: %s\n' % (sText,));
         return 0;
 
@@ -300,5 +300,5 @@
             print 'info: %s' % (sText,);
         if self.oLogFile is not None:
-            self.oLogFile.write('info: %s\n' % (sText,));
+            self.oLogFile.write(u'info: %s\n' % (sText,));
         return 0;
 
@@ -312,5 +312,5 @@
                 oFailureReason = self.oFailureReasonLogic.cachedLookupByNameAndCategory(tReason[1], tReason[0]);
                 if oFailureReason is None:
-                    rcExit = self.eprint('Failured to find failure reason "%s" in category "%s" in the database!'
+                    rcExit = self.eprint(u'Failed to find failure reason "%s" in category "%s" in the database!'
                                          % (tReason[1], tReason[0],));
 
@@ -319,5 +319,5 @@
             oLogin = UserAccountLogic(self.oDb).tryFetchAccountByLoginName(VirtualTestSheriff.ksLoginName);
             if oLogin is None:
-                rcExit = self.eprint('Cannot find my user account "%s"!' % (VirtualTestSheriff.ksLoginName,));
+                rcExit = self.eprint(u'Cannot find my user account "%s"!' % (VirtualTestSheriff.ksLoginName,));
         return rcExit;
 
@@ -352,9 +352,9 @@
                 continue;
             if not oTestBox.fEnabled:
-                self.dprint('badTestBoxManagement: Skipping test box #%u (%s) as it has been disabled already.'
+                self.dprint(u'badTestBoxManagement: Skipping test box #%u (%s) as it has been disabled already.'
                             % ( idTestBox, oTestBox.sName, ));
                 continue;
             if oTestBox.enmPendingCmd != TestBoxData.ksTestBoxCmd_None:
-                self.dprint('badTestBoxManagement: Skipping test box #%u (%s) as it has a command pending: %s'
+                self.dprint(u'badTestBoxManagement: Skipping test box #%u (%s) as it has a command pending: %s'
                             % ( idTestBox, oTestBox.sName, oTestBox.enmPendingCmd));
                 continue;
@@ -380,5 +380,5 @@
             if iFirstOkay >= 2 and cBad > 2:
                 if oTestBoxLogic.hasTestBoxRecentlyBeenRebooted(idTestBox, cHoursBack = cHoursBack, tsNow = tsNow):
-                    self.vprint('Disabling testbox #%u (%s) - iFirstOkay=%u cBad=%u cOkay=%u'
+                    self.vprint(u'Disabling testbox #%u (%s) - iFirstOkay=%u cBad=%u cOkay=%u'
                                 % ( idTestBox, oTestBox.sName, iFirstOkay, cBad, cOkay));
                     if self.oConfig.fRealRun is True:
@@ -388,7 +388,7 @@
                                                                   % (iFirstOkay, cBad, cOkay),);
                         except Exception as oXcpt:
-                            rcExit = self.eprint('Error disabling testbox #%u (%u): %s\n' % (idTestBox, oTestBox.sName, oXcpt,));
+                            rcExit = self.eprint(u'Error disabling testbox #%u (%u): %s\n' % (idTestBox, oTestBox.sName, oXcpt,));
                 else:
-                    self.vprint('Rebooting testbox #%u (%s) - iFirstOkay=%u cBad=%u cOkay=%u'
+                    self.vprint(u'Rebooting testbox #%u (%s) - iFirstOkay=%u cBad=%u cOkay=%u'
                                 % ( idTestBox, oTestBox.sName, iFirstOkay, cBad, cOkay));
                     if self.oConfig.fRealRun is True:
@@ -398,7 +398,7 @@
                                                                  % (iFirstOkay, cBad, cOkay),);
                         except Exception as oXcpt:
-                            rcExit = self.eprint('Error rebooting testbox #%u (%u): %s\n' % (idTestBox, oTestBox.sName, oXcpt,));
+                            rcExit = self.eprint(u'Error rebooting testbox #%u (%u): %s\n' % (idTestBox, oTestBox.sName, oXcpt,));
             else:
-                self.dprint('badTestBoxManagement: #%u (%s) looks ok:  iFirstOkay=%u cBad=%u cOkay=%u'
+                self.dprint(u'badTestBoxManagement: #%u (%s) looks ok:  iFirstOkay=%u cBad=%u cOkay=%u'
                             % ( idTestBox, oTestBox.sName, iFirstOkay, cBad, cOkay));
         return rcExit;
@@ -458,5 +458,6 @@
                     dReasonForResultId[idKey] = tReason;
             if len(dReasonForResultId) == 0:
-                self.vprint('TODO: Closing %s without a real reason, only %s.' % (oCaseFile.sName, oCaseFile.dReasonForResultId));
+                self.vprint(u'TODO: Closing %s without a real reason, only %s.'
+                            % (oCaseFile.sName, oCaseFile.dReasonForResultId));
                 return False;
 
@@ -465,7 +466,7 @@
             fSingleReason = True;
             if len(dReasonForResultId) == 1 and dReasonForResultId.keys()[0] != oCaseFile.oTestSet.idTestResult:
-                self.dprint('Promoting single reason to whole set: %s' % (atValues[0],));
+                self.dprint(u'Promoting single reason to whole set: %s' % (atValues[0],));
             elif len(dReasonForResultId) > 1 and len(atValues) == atValues.count(atValues[0]):
-                self.dprint('Merged %d reasons to a single one: %s' % (len(atValues), atValues[0]));
+                self.dprint(u'Merged %d reasons to a single one: %s' % (len(atValues), atValues[0]));
             else:
                 fSingleReason = False;
@@ -477,8 +478,8 @@
             dReasonForResultId = { oCaseFile.oTestSet.idTestResult: oCaseFile.tReason, };
         else:
-            self.vprint('Closing %s without a reason - this should not happen!' % (oCaseFile.sName,));
+            self.vprint(u'Closing %s without a reason - this should not happen!' % (oCaseFile.sName,));
             return False;
 
-        self.vprint('Closing %s with following reason%s: %s'
+        self.vprint(u'Closing %s with following reason%s: %s'
                     % ( oCaseFile.sName, 's' if dReasonForResultId > 0 else '', dReasonForResultId, ));
 
@@ -503,8 +504,8 @@
                         self.oTestResultFailureLogic.addEntry(oAdd, self.uidSelf, fCommit = True);
                     except Exception as oXcpt:
-                        self.eprint('caseClosed: Exception "%s" while adding reason %s for %s'
+                        self.eprint(u'caseClosed: Exception "%s" while adding reason %s for %s'
                                     % (oXcpt, oAdd, oCaseFile.sLongName,));
             else:
-                self.eprint('caseClosed: Cannot locate failure reason: %s / %s' % ( tReason[0], tReason[1],));
+                self.eprint(u'caseClosed: Cannot locate failure reason: %s / %s' % ( tReason[0], tReason[1],));
         return True;
 
@@ -627,10 +628,10 @@
                         oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
                     else:
-                        self.dprint('Unit test failure "%s" not found in %s;' % (sKey, self.asUnitTestReasons));
+                        self.dprint(u'Unit test failure "%s" not found in %s;' % (sKey, self.asUnitTestReasons));
                         tReason = ( self.ksUnitTestCategory, self.ksUnitTestAddNew );
                         oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult, sComment = sKey);
                     cRelevantOnes += 1
             else:
-                self.vprint('Internal error: expected oParent to NOT be None for %s' % (oFailedResult,));
+                self.vprint(u'Internal error: expected oParent to NOT be None for %s' % (oFailedResult,));
 
         #
@@ -692,9 +693,9 @@
                             len(sVgaText)   if sVgaText is not None else 0,
                             len(sInfoText)  if sInfoText is not None else 0, ));
-            #self.dprint('main.log<<<\n%s\n<<<\n' % (sResultLog,));
-            #self.dprint('vbox.log<<<\n%s\n<<<\n' % (sVMLog,));
-            #self.dprint('krnl.log<<<\n%s\n<<<\n' % (sKrnlLog,));
-            #self.dprint('vgatext.txt<<<\n%s\n<<<\n' % (sVgaText,));
-            #self.dprint('info.txt<<<\n%s\n<<<\n' % (sInfoText,));
+            #self.dprint(u'main.log<<<\n%s\n<<<\n' % (sResultLog,));
+            #self.dprint(u'vbox.log<<<\n%s\n<<<\n' % (sVMLog,));
+            #self.dprint(u'krnl.log<<<\n%s\n<<<\n' % (sKrnlLog,));
+            #self.dprint(u'vgatext.txt<<<\n%s\n<<<\n' % (sVgaText,));
+            #self.dprint(u'info.txt<<<\n%s\n<<<\n' % (sInfoText,));
 
             # TODO: more
@@ -715,5 +716,5 @@
                     tReason = ( self.ksBsodCategory, sKey.lower() );
                 else:
-                    self.dprint('BSOD "%s" not found in %s;' % (sKey, self.asBsodReasons));
+                    self.dprint(u'BSOD "%s" not found in %s;' % (sKey, self.asBsodReasons));
                     tReason = ( self.ksBsodCategory, self.ksBsodAddNew );
                 return oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult, sComment = sDetails.strip());
@@ -795,5 +796,5 @@
                 if sScreenHash is not None:
                     sScreenHash = sScreenHash.lower();
-                    self.vprint('%s  %s' % ( sScreenHash, oFile.sFile,));
+                    self.vprint(u'%s  %s' % ( sScreenHash, oFile.sFile,));
         if sVMLog is not None and investigateLogSet() is True:
             return True;
@@ -866,5 +867,5 @@
         #
         for oFailedResult in aoFailedResults:
-            self.dprint('Looking at test result #%u - %s' % (oFailedResult.idTestResult, oFailedResult.getFullName(),));
+            self.dprint(u'Looking at test result #%u - %s' % (oFailedResult.idTestResult, oFailedResult.getFullName(),));
             sResultLog = TestSetData.extractLogSectionElapsed(sMainLog, oFailedResult.tsCreated, oFailedResult.tsElapsed);
             if oFailedResult.sName == 'Installing VirtualBox':
@@ -880,6 +881,6 @@
                 oCaseFile.noteReasonForId(self.ktHarmless, oFailedResult.idTestResult);
             else:
-                self.vprint('TODO: Cannot place idTestResult=%u - %s' % (oFailedResult.idTestResult, oFailedResult.sName,));
-                self.dprint('%s + %s <<\n%s\n<<' % (oFailedResult.tsCreated, oFailedResult.tsElapsed, sResultLog,));
+                self.vprint(u'TODO: Cannot place idTestResult=%u - %s' % (oFailedResult.idTestResult, oFailedResult.sName,));
+                self.dprint(u'%s + %s <<\n%s\n<<' % (oFailedResult.tsCreated, oFailedResult.tsElapsed, sResultLog,));
 
         #
@@ -890,8 +891,8 @@
 
         if len(oCaseFile.dReasonForResultId) > 0:
-            self.vprint('TODO: Got %u out of %u - close, but no cigar. :-/'
+            self.vprint(u'TODO: Got %u out of %u - close, but no cigar. :-/'
                         % (len(oCaseFile.dReasonForResultId), len(aoFailedResults)));
         else:
-            self.vprint('XXX: Could not figure out anything at all! :-(');
+            self.vprint(u'XXX: Could not figure out anything at all! :-(');
         return False;
 
@@ -907,6 +908,6 @@
         aoTestSets = self.oTestSetLogic.fetchFailedSetsWithoutReason(cHoursBack = self.oConfig.cHoursBack, tsNow = self.tsNow);
         for oTestSet in aoTestSets:
-            self.dprint('');
-            self.dprint('reasoningFailures: Checking out test set #%u, status %s'  % ( oTestSet.idTestSet, oTestSet.enmStatus,))
+            self.dprint(u'');
+            self.dprint(u'reasoningFailures: Checking out test set #%u, status %s'  % ( oTestSet.idTestSet, oTestSet.enmStatus,))
 
             #
@@ -922,20 +923,20 @@
 
             if oTestSet.enmStatus == TestSetData.ksTestStatus_BadTestBox:
-                self.dprint('investigateBadTestBox is taking over %s.' % (oCaseFile.sLongName,));
+                self.dprint(u'investigateBadTestBox is taking over %s.' % (oCaseFile.sLongName,));
                 fRc = self.investigateBadTestBox(oCaseFile);
             elif oCaseFile.isVBoxUnitTest():
-                self.dprint('investigateVBoxUnitTest is taking over %s.' % (oCaseFile.sLongName,));
+                self.dprint(u'investigateVBoxUnitTest is taking over %s.' % (oCaseFile.sLongName,));
                 fRc = self.investigateVBoxUnitTest(oCaseFile);
             elif oCaseFile.isVBoxInstallTest():
-                self.dprint('investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
+                self.dprint(u'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
                 fRc = self.investigateVBoxVMTest(oCaseFile, fSingleVM = True);
             elif oCaseFile.isVBoxSmokeTest():
-                self.dprint('investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
+                self.dprint(u'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
                 fRc = self.investigateVBoxVMTest(oCaseFile, fSingleVM = False);
             else:
-                self.vprint('reasoningFailures: Unable to classify test set: %s' % (oCaseFile.sLongName,));
+                self.vprint(u'reasoningFailures: Unable to classify test set: %s' % (oCaseFile.sLongName,));
                 fRc = False;
             cGot += fRc is True;
-        self.vprint('reasoningFailures: Got %u out of %u' % (cGot, len(aoTestSets), ));
+        self.vprint(u'reasoningFailures: Got %u out of %u' % (cGot, len(aoTestSets), ));
         return 0;
 
