Index: trunk/src/VBox/ValidationKit/common/utils.py
===================================================================
--- trunk/src/VBox/ValidationKit/common/utils.py	(revision 78462)
+++ trunk/src/VBox/ValidationKit/common/utils.py	(revision 78463)
@@ -570,4 +570,27 @@
     return shutil.copyfile(sFileSrc, sFileDst);
 
+
+def getDiskUsage(sPath):
+    """
+    Get free space of a partition that corresponds to specified sPath in MB.
+
+    Returns partition free space value in MB.
+    """
+    if platform.system() == 'Windows':
+        oCTypeFreeSpace = ctypes.c_ulonglong(0);
+        ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(sPath), None, None,
+                                                   ctypes.pointer(oCTypeFreeSpace));
+        cbFreeSpace = oCTypeFreeSpace.value;
+    else:
+        oStats = os.statvfs(sPath); # pylint: disable=E1101
+        cbFreeSpace = long(oStats.f_frsize) * oStats.f_bfree;
+
+    # Convert to MB
+    cMbFreeSpace = long(cbFreeSpace) / (1024 * 1024);
+
+    return cMbFreeSpace;
+
+
+
 #
 # SubProcess.
@@ -1693,4 +1716,22 @@
 
 
+def chmodPlusX(sFile):
+    """
+    Makes the specified file or directory executable.
+    Returns success indicator, no exceptions.
+
+    Note! Symbolic links are followed and the target will be changed.
+    """
+    try:
+        oStat = os.stat(sFile);
+    except:
+        return False;
+    try:
+        os.chmod(sFile, oStat.st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH);
+    except:
+        return False;
+    return True;
+
+
 #
 # TestSuite stuff.
@@ -1766,8 +1807,4 @@
     return 1;
 
-
-#
-# Misc.
-#
 
 def versionCompare(sVer1, sVer2):
@@ -1834,21 +1871,7 @@
 
 
-def chmodPlusX(sFile):
-    """
-    Makes the specified file or directory executable.
-    Returns success indicator, no exceptions.
-
-    Note! Symbolic links are followed and the target will be changed.
-    """
-    try:
-        oStat = os.stat(sFile);
-    except:
-        return False;
-    try:
-        os.chmod(sFile, oStat.st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH);
-    except:
-        return False;
-    return True;
-
+#
+# Unpacking.
+#
 
 def unpackZipFile(sArchive, sDstDir, fnLog, fnError = None, fnFilter = None):
@@ -2040,23 +2063,59 @@
 
 
-def getDiskUsage(sPath):
-    """
-    Get free space of a partition that corresponds to specified sPath in MB.
-
-    Returns partition free space value in MB.
-    """
-    if platform.system() == 'Windows':
-        oCTypeFreeSpace = ctypes.c_ulonglong(0);
-        ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(sPath), None, None,
-                                                   ctypes.pointer(oCTypeFreeSpace));
-        cbFreeSpace = oCTypeFreeSpace.value;
+#
+# Misc.
+#
+def areBytesEqual(oLeft, oRight):
+    """
+    Compares two byte arrays, strings or whatnot.
+
+    returns true / false accordingly.
+    """
+
+    # If both are None, consider them equal (bogus?):
+    if oLeft is None and oRight is None:
+        return True;
+
+    # If just one is None, they can't match:
+    if oLeft is None or oRight is None:
+        return False;
+
+    # If both have the same type, use the compare operator of the class:
+    if type(oLeft) is type(oRight):
+        return oLeft == oRight;
+
+    # On the offchance that they're both strings, but of different types.
+    if isString(oLeft) and isString(oRight):
+        return oLeft == oRight;
+
+    # Convert strings to byte arrays:
+    if sys.version_info[0] >= 3:
+        if isString(oLeft):
+            try:    oLeft = bytes(oLeft, 'utf-8');
+            except: pass;
+        if isString(oRight):
+            try:    oRight = bytes(oRight, 'utf-8');
+            except: pass;
     else:
-        oStats = os.statvfs(sPath); # pylint: disable=E1101
-        cbFreeSpace = long(oStats.f_frsize) * oStats.f_bfree;
-
-    # Convert to MB
-    cMbFreeSpace = long(cbFreeSpace) / (1024 * 1024);
-
-    return cMbFreeSpace;
+        if isString(oLeft):
+            try:    oLeft = bytearray(oLeft, 'utf-8');
+            except: pass;
+        if isString(oRight):
+            try:    oRight = bytearray(oRight, 'utf-8');
+            except: pass;
+
+    # Check if we now have the same type for both:
+    if type(oLeft) is type(oRight):
+        return oLeft == oRight;
+
+    # Do item by item comparison:
+    if len(oLeft) != len(oRight):
+        return False;
+    i = len(oLeft);
+    while i > 0:
+        i = i - 1;
+        if oLeft[i] != oRight[i]:
+            return False;
+    return True;
 
 
@@ -2092,4 +2151,20 @@
         self.assertEqual(hasNonAsciiCharacters(b'\x20\x81\x20'), True);
 
+    def testAreBytesEqual(self):
+        self.assertEqual(areBytesEqual(None, None), True);
+        self.assertEqual(areBytesEqual(None, ''), False);
+        self.assertEqual(areBytesEqual('', ''), True);
+        self.assertEqual(areBytesEqual('1', '1'), True);
+        self.assertEqual(areBytesEqual('12345', '1234'), False);
+        self.assertEqual(areBytesEqual('1234', '1234'), True);
+        self.assertEqual(areBytesEqual('1234', b'1234'), True);
+        self.assertEqual(areBytesEqual(b'1234', b'1234'), True);
+        self.assertEqual(areBytesEqual(b'1234', '1234'), True);
+        self.assertEqual(areBytesEqual(b'1234', bytearray([0x31,0x32,0x33,0x34])), True);
+        self.assertEqual(areBytesEqual('1234', bytearray([0x31,0x32,0x33,0x34])), True);
+        self.assertEqual(areBytesEqual(bytearray([0x31,0x32,0x33,0x34]), bytearray([0x31,0x32,0x33,0x34])), True);
+        self.assertEqual(areBytesEqual(bytearray([0x31,0x32,0x33,0x34]), '1224'), False);
+        self.assertEqual(areBytesEqual(bytearray([0x31,0x32,0x33,0x34]), bytearray([0x31,0x32,0x32,0x34])), False);
+
 if __name__ == '__main__':
     unittest.main();
Index: trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
===================================================================
--- trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py	(revision 78462)
+++ trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py	(revision 78463)
@@ -66,4 +66,5 @@
 from testdriver import vboxcon;
 from testdriver import vboxwrappers;
+from common     import utils;
 
 # Python 3 hacks:
@@ -383,5 +384,6 @@
         self.sSharingMode = sSharingMode;
         self.lCreationMode = lCreationMode;
-        self.cbOffset = cbOffset;
+        self.cbOffset = cbOffset; ## r=bird: Wrong prefix. Just 'off' will suffice, alternatively 'offFile'.
+                                  ##         'cbOffset' looks like sizeof(offFile), which is probably 8 bytes these days. :-)
         self.cbToReadWrite = cbToReadWrite;
         self.aBuf = aBuf;
@@ -2999,15 +3001,15 @@
                     aBufRead = curFile.read(curTest.cbToReadWrite, 30 * 1000);
                     if  curRes.cbProcessed > 0 \
-                    and curRes.cbProcessed is not len(aBufRead):
-                        reporter.error('Test #%d failed: Read buffer length does not match: Got %d, expected %d' \
+                    and curRes.cbProcessed != len(aBufRead):
+                        reporter.error('Test #%d failed: Read buffer length does not match: Got %d, expected %d'
                                        % (i, len(aBufRead), curRes.cbProcessed));
                         fRc2 = False;
                     if fRc2:
                         if  curRes.aBuf is not None \
-                        and bytes(curRes.aBuf) != bytes(aBufRead):
-                            reporter.error('Test #%d failed: Got buffer:\n"%s" (%d bytes)\nExpected buffer:\n"%s" (%d bytes)' \
+                        and not utils.areBytesEqual(curRes.aBuf, aBufRead):
+                            reporter.error('Test #%d failed: Got buffer:\n"%s" (%d bytes)\nExpected buffer:\n"%s" (%d bytes)'
                                            % (i, map(hex, map(ord, aBufRead)), len(aBufRead),
                                               map(hex, map(ord, curRes.aBuf)), len(curRes.aBuf)));
-                            reporter.error('Test #%d failed: Got buffer:\n"%s"\nExpected buffer:\n"%s"' \
+                            reporter.error('Test #%d failed: Got buffer:\n"%s"\nExpected buffer:\n"%s"'
                                            % (i, aBufRead, curRes.aBuf));
                             fRc2 = False;
