Index: /trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
===================================================================
--- /trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py	(revision 71667)
+++ /trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py	(revision 71668)
@@ -928,6 +928,5 @@
             'dir_create', 'dir_create_temp', 'dir_read',
             'file_remove', 'file_stat', 'file_read', 'file_write',
-            #'copy_to',
-            #'copy_from',
+            'copy_to', 'copy_from',
             'update_additions'
         ];
@@ -1101,5 +1100,5 @@
                 except:
                     reporter.logXcpt('Waiting exception for sSrc="%s", sDst="%s":' % (sSrc, sDst));
-                fRc = False;
+                    fRc = False;
             else:
                 reporter.error('No progress object returned');
@@ -3165,14 +3164,25 @@
                                aFlags = [ 1234 ] ),
                   tdTestResult(fRc = False) ],
+                # Testing DirectoryCopyFlag flags.
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO,
+                  sDst = 'Whatever', aFlags = [ 1234 ] ),
+                  tdTestResult(fRc = False) ],
+                # Testing FileCopyFlag flags.
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO,
+                  sDst = 'Whatever', aFlags = [ 1234 ] ),
+                  tdTestResult(fRc = False) ],
                 # Nothing to copy (source and/or destination is empty).
                 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = 'z:\\'),
                   tdTestResult(fRc = False) ],
                 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = '\\\\uncrulez\\foo'),
-
                   tdTestResult(fRc = False) ],
                 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = 'non-exist',
                                sDst = os.path.join(sScratch, 'non-exist.dll')),
                   tdTestResult(fRc = False) ],
-                # Copying single files.
+
+                #
+                # Single file handling.
+                #
+
                 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO,
                                sDst = os.path.join(sScratch, 'C:\\non-exist\\')),
@@ -3198,7 +3208,9 @@
                                sDst = sScratch),
                   tdTestResult(fRc = True) ],
-                ## @todo Add testing the CopyTo flags here!
-                ]);
-
+            ]);
+
+            #
+            # Directory handling.
+            #
             if self.oTstDrv.fpApiVer > 5.2: # Copying directories via Main is supported only in versions > 5.2.
                 if self.oTstDrv.sHost == "win":
@@ -3283,4 +3295,6 @@
         reporter.log('Scratch path is: %s' % (sScratch,));
 
+        sScratchNotExist = "/does-not-exist";
+
         aaTests = [];
         if oTestVm.isWindows():
@@ -3289,5 +3303,5 @@
                 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = ''),
                   tdTestResult(fRc = False) ],
-                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows',
+                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'Something',
                                  aFlags = [ 1234 ] ),
                   tdTestResult(fRc = False) ],
@@ -3295,6 +3309,14 @@
                 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sDst = ''),
                   tdTestResult(fRc = False) ],
-                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sDst = 'C:\\Windows',
+                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sDst = 'Something',
                                  aFlags = [ 1234 ] ),
+                  tdTestResult(fRc = False) ],
+                # Testing DirectoryCopyFlag flags.
+                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32',
+                  sDst = 'Whatever', aFlags = [ 1234 ] ),
+                  tdTestResult(fRc = False) ],
+                # Testing FileCopyFlag flags.
+                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
+                  sDst = 'Whatever', aFlags = [ 1234 ] ),
                   tdTestResult(fRc = False) ],
                 # Nothing to copy (sDst is empty / unreachable).
@@ -3306,30 +3328,59 @@
                                  sDst = os.path.join(sScratch, 'non-exist.dll')),
                   tdTestResult(fRc = False) ],
+
+                #
+                # Single file handling.
+                #
+
                 # Copying single files.
                 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
-                                 sDst = 'C:\\non-exist\\'),
+                                 sDst = sScratchNotExist),
                   tdTestResult(fRc = False) ],
                 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
-                                 sDst = 'C:\\non\\exist\\'),
-                  tdTestResult(fRc = False) ],
-                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
-                                 sDst = 'C:\\non\\exist\\renamedfile.dll'),
-                  tdTestResult(fRc = False) ],
+                                 sDst = os.path.join(sScratchNotExist, 'renamedfile.dll')),
+                  tdTestResult(fRc = False) ],
+                # Copy over file using a different destination name.
                 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
                                  sDst = os.path.join(sScratch, 'renamedfile.dll')),
                   tdTestResult(fRc = True) ],
+                # Copy over same file (and overwrite existing one).
                 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
                                  sDst = os.path.join(sScratch, 'renamedfile.dll')),
                   tdTestResult(fRc = True) ],
-                #  Destination is a directory, should fail.
+                # Destination is a directory with a trailing slash (should work).
+                # See "cp" syntax.
+                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
+                                 sDst = sScratch + "/"),
+                  tdTestResult(fRc = True) ],
+                # Destination is a directory (should fail).
+                # See "cp" syntax.
                 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
                                  sDst = sScratch),
-                  tdTestResult(fRc = False) ],
-                # Copying directories.
-                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\Web',
-                                 sDst = sScratch),
-                  tdTestResult(fRc = True) ]
-                ## @todo Add testing the CopyFrom aFlags here!
+                  tdTestResult(fRc = False) ]
             ]);
+
+            #
+            # Directory handling.
+            #
+            if self.oTstDrv.fpApiVer > 5.2: # Copying directories via Main is supported only in versions > 5.2.
+                aaTests.extend([
+                    # Copying entire directories (destination is "<sScratch>", which exists, which should fail).
+                    [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\Web',
+                                    sDst = sScratch),
+                    tdTestResult(fRc = False) ],
+                    # Copying entire directories (destination is "<sScratch>\Web").
+                    # Should fail, as the corresponding flag is missing.
+                    [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\Web',
+                                    sDst = sScratch + "/"),
+                    tdTestResult(fRc = False) ],
+                    # Next try with correct flag being set.
+                    [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\Web',
+                                    sDst = sScratch + "/", aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]),
+                    tdTestResult(fRc = True) ],
+                    # Copying contents of directories (destination is "<sScratch>/").
+                    [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\Web\\',
+                                    sDst = sScratch + "/", aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]),
+                    tdTestResult(fRc = True) ]
+                ]);
         else:
             reporter.log('No OS-specific tests for non-Windows yet!');
@@ -3347,4 +3398,6 @@
                 break;
 
+            fRc2 = True;
+
             try:
                 if self.oTstDrv.fpApiVer >= 5.0:
@@ -3354,5 +3407,5 @@
 
                 if oFsInfo.type is vboxcon.FsObjType_Directory:
-                    curProgress = curGuestSession.directoryCopyFrom(curTest.sSrc, curTest.sDst, curTest.aFlags);
+                    curProgress = curGuestSession.directoryCopyFromGuest(curTest.sSrc, curTest.sDst, curTest.aFlags);
                     if curProgress is not None:
                         oProgress = vboxwrappers.ProgressWrapper(curProgress, self.oTstDrv.oVBoxMgr, self.oTstDrv, \
