Index: trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
===================================================================
--- trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py	(revision 79261)
+++ trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py	(revision 79262)
@@ -83,6 +83,6 @@
         ## IGuest reference.
         self.oGuest      = oSession.o.console.guest; ## @todo may throw shit
-        self.oSesison    = oSession;
-        self.oTxsSesison = oTxsSession;
+        self.oSession    = oSession;
+        self.oTxsSession = oTxsSession;
         self.oTestVm     = oTestVm;
 
@@ -426,7 +426,7 @@
         return True;
 
-    def doStepsOnOpenedFile(self, fExpectSuccess):
+    def doStepsOnOpenedFile(self, fExpectSuccess, fpApiVer):
         """ Overridden by children to do more testing. """
-        _ = fExpectSuccess;
+        _ = fExpectSuccess; _ = fpApiVer;
         return True;
 
@@ -443,9 +443,9 @@
         return True;
 
-    def doSteps(self, fExpectSuccess):
+    def doSteps(self, fExpectSuccess, fpApiVer):
         """ Do the tests. """
         fRc = self.doOpenStep(fExpectSuccess);
         if fRc is True:
-            fRc = self.doStepsOnOpenedFile(fExpectSuccess);
+            fRc = self.doStepsOnOpenedFile(fExpectSuccess, fpApiVer);
         if self.oOpenedFile:
             fRc = self.doCloseStep() and fRc;
@@ -462,38 +462,39 @@
         self.cbOpenExpected = cbOpenExpected;
 
-    def doStepsOnOpenedFile(self, fExpectSuccess):
+    def doStepsOnOpenedFile(self, fExpectSuccess, fpApiVer):
         #
         # Call parent.
         #
-        fRc = tdTestFileOpen.doStepsOnOpenedFile(self, fExpectSuccess);
-
-        #
-        # Check the size.
-        #
-        try:
-            oFsObjInfo = self.oOpenedFile.queryInfo();
-        except:
-            return reporter.errorXcpt('queryInfo([%s, %s, %s, %s, %s, %s])'
-                                      % (self.sFile, self.eAccessMode, self.eAction, self.eSharing,
-                                         self.fCreationMode, self.afOpenFlags,));
-        if oFsObjInfo is None:
-            return reporter.error('IGuestFile::queryInfo returned None');
-        try:
-            cbFile = oFsObjInfo.objectSize;
-        except:
-            return reporter.errorXcpt();
-        if cbFile != self.cbOpenExpected:
-            return reporter.error('Wrong file size after open (%d): %s, expected %s (file %s) (#1)'
-                                  % (self.eAction, cbFile, self.cbOpenExpected, self.sFile));
-
-        try:
-            cbFile = self.oOpenedFile.querySize();
-        except:
-            return reporter.errorXcpt('querySize([%s, %s, %s, %s, %s, %s])'
-                                      % (self.sFile, self.eAccessMode, self.eAction, self.eSharing,
-                                         self.fCreationMode, self.afOpenFlags,));
-        if cbFile != self.cbOpenExpected:
-            return reporter.error('Wrong file size after open (%d): %s, expected %s (file %s) (#2)'
-                                  % (self.eAction, cbFile, self.cbOpenExpected, self.sFile));
+        fRc = tdTestFileOpen.doStepsOnOpenedFile(self, fExpectSuccess, fpApiVer);
+
+        #
+        # Check the size.  Requires 6.0 or later (E_NOTIMPL in 5.2).
+        #
+        if fpApiVer >= 6.0:
+            try:
+                oFsObjInfo = self.oOpenedFile.queryInfo();
+            except:
+                return reporter.errorXcpt('queryInfo([%s, %s, %s, %s, %s, %s])'
+                                          % (self.sFile, self.eAccessMode, self.eAction, self.eSharing,
+                                             self.fCreationMode, self.afOpenFlags,));
+            if oFsObjInfo is None:
+                return reporter.error('IGuestFile::queryInfo returned None');
+            try:
+                cbFile = oFsObjInfo.objectSize;
+            except:
+                return reporter.errorXcpt();
+            if cbFile != self.cbOpenExpected:
+                return reporter.error('Wrong file size after open (%d): %s, expected %s (file %s) (#1)'
+                                      % (self.eAction, cbFile, self.cbOpenExpected, self.sFile));
+
+            try:
+                cbFile = self.oOpenedFile.querySize();
+            except:
+                return reporter.errorXcpt('querySize([%s, %s, %s, %s, %s, %s])'
+                                          % (self.sFile, self.eAccessMode, self.eAction, self.eSharing,
+                                             self.fCreationMode, self.afOpenFlags,));
+            if cbFile != self.cbOpenExpected:
+                return reporter.error('Wrong file size after open (%d): %s, expected %s (file %s) (#2)'
+                                      % (self.eAction, cbFile, self.cbOpenExpected, self.sFile));
 
         return fRc;
@@ -3496,5 +3497,5 @@
                 break;
 
-            fRc2 = oCurTest.doSteps(oCurRes.fRc);
+            fRc2 = oCurTest.doSteps(oCurRes.fRc, self.oTstDrv.fpApiVer);
             if fRc2 != oCurRes.fRc:
                 fRc = reporter.error('Test #%d result mismatch: Got %s, expected %s' % (i, fRc2, oCurRes.fRc,));
@@ -3718,29 +3719,54 @@
             # Check stat info on the file as well as querySize.
             #
+            if self.oTstDrv.fpApiVer > 5.2:
+                try:
+                    oFsObjInfo = oFile.queryInfo();
+                except:
+                    fRc = reporter.errorXcpt('%s: queryInfo()' % (oTestFile.sPath,));
+                else:
+                    if oFsObjInfo is None:
+                        fRc = reporter.error('IGuestFile::queryInfo returned None');
+                    else:
+                        try:
+                            cbFile = oFsObjInfo.objectSize;
+                        except:
+                            fRc = reporter.errorXcpt();
+                        else:
+                            if cbFile != oTestFile.cbContent:
+                                fRc = reporter.error('%s: queryInfo returned incorrect file size: %s, expected %s'
+                                                     % (oTestFile.sPath, cbFile, oTestFile.cbContent));
+
+                try:
+                    cbFile = oFile.querySize();
+                except:
+                    fRc = reporter.errorXcpt('%s: querySize()' % (oTestFile.sPath,));
+                else:
+                    if cbFile != oTestFile.cbContent:
+                        fRc = reporter.error('%s: querySize returned incorrect file size: %s, expected %s'
+                                             % (oTestFile.sPath, cbFile, oTestFile.cbContent));
+
+            #
+            # Use seek to test the file size and do a few other end-relative seeks.
+            #
             try:
-                oFsObjInfo = oFile.queryInfo();
+                cbFile = oFile.seek(0, vboxcon.FileSeekOrigin_End);
             except:
-                fRc = reporter.errorXcpt('%s: queryInfo()' % (oTestFile.sPath,));
-            else:
-                if oFsObjInfo is None:
-                    fRc = reporter.error('IGuestFile::queryInfo returned None');
-                else:
-                    try:
-                        cbFile = oFsObjInfo.objectSize;
-                    except:
-                        fRc = reporter.errorXcpt();
-                    else:
-                        if cbFile != oTestFile.cbContent:
-                            fRc = reporter.error('%s: queryInfo returned incorrect file size: %s, expected %s'
-                                                 % (oTestFile.sPath, cbFile, oTestFile.cbContent));
-
-            try:
-                cbFile = oFile.querySize();
-            except:
-                fRc = reporter.errorXcpt('%s: querySize()' % (oTestFile.sPath,));
+                fRc = reporter.errorXcpt('%s: seek(0,End)' % (oTestFile.sPath,));
             else:
                 if cbFile != oTestFile.cbContent:
-                    fRc = reporter.error('%s: querySize returned incorrect file size: %s, expected %s'
+                    fRc = reporter.error('%s: seek(0,End) returned incorrect file size: %s, expected %s'
                                          % (oTestFile.sPath, cbFile, oTestFile.cbContent));
+            if oTestFile.cbContent > 0:
+                for _ in xrange(12):
+                    offSeek = self.oTestFiles.oRandom.randrange(oTestFile.cbContent + 1);
+                    try:
+                        offFile = oFile.seek(-offSeek, vboxcon.FileSeekOrigin_End);
+                    except:
+                        fRc = reporter.errorXcpt('%s: seek(%s,End)' % (oTestFile.sPath, -offSeek,));
+                    else:
+                        if offFile != oTestFile.cbContent - offSeek:
+                            fRc = reporter.error('%s: seek(%s,End) returned incorrect offset: %s, expected %s (cbContent=%s)'
+                                                 % (oTestFile.sPath, -offSeek, offSeek, oTestFile.cbContent - offSeek,
+                                                    oTestFile.cbContent,));
 
             #
