- Timestamp:
- Apr 11, 2018 4:24:42 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
r71681 r71828 3120 3120 if oTestVm.isWindows(): 3121 3121 sUser = "Administrator"; 3122 sScratch = "C:\\Temp\\vboxtest\\testGuestCtrlCopyTo\\"; 3122 sScratchGst = "C:\\Temp\\vboxtest\\testGuestCtrlCopyTo/"; 3123 sScratchGstNotExist = "C:\\does-not-exist\\"; 3124 sScratchGstInvalid = "[]?:"; 3123 3125 else: 3124 3126 sUser = "vbox"; 3127 sScratchGst = "/tmp/testGuestCtrlCopyTo/"; 3128 sScratchGstNotExist = "/tmp/does-not-exist/"; 3129 sScratchGstInvalid = "/"; 3125 3130 sPassword = "password"; 3126 3131 … … 3156 3161 tdTestResult(fRc = False) ], 3157 3162 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows', 3158 aFlags = [ 1234] ),3163 aFlags = [ 80 ] ), 3159 3164 tdTestResult(fRc = False) ], 3160 3165 # Source missing. … … 3162 3167 tdTestResult(fRc = False) ], 3163 3168 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sDst = 'C:\\Windows', 3164 aFlags = [ 1234] ),3169 aFlags = [ 80 ] ), 3165 3170 tdTestResult(fRc = False) ], 3166 3171 # Testing DirectoryCopyFlag flags. 3167 3172 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO, 3168 sDst = 'Whatever', aFlags = [ 1234] ),3173 sDst = sScratchGstInvalid, aFlags = [ 80 ] ), 3169 3174 tdTestResult(fRc = False) ], 3170 3175 # Testing FileCopyFlag flags. 3171 3176 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO, 3172 sDst = 'Whatever', aFlags = [ 1234] ),3177 sDst = sScratchGstInvalid, aFlags = [ 80 ] ), 3173 3178 tdTestResult(fRc = False) ], 3174 3179 # Nothing to copy (source and/or destination is empty). … … 3178 3183 tdTestResult(fRc = False) ], 3179 3184 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = 'non-exist', 3180 sDst = os.path.join(sScratch , 'non-exist.dll')),3185 sDst = os.path.join(sScratchGst, 'non-exist.dll')), 3181 3186 tdTestResult(fRc = False) ] 3182 3187 ]); … … 3188 3193 aaTests.extend([ 3189 3194 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO, 3190 sDst = os.path.join(sScratch, 'C:\\non-exist\\')),3195 sDst = sScratchGstInvalid), 3191 3196 tdTestResult(fRc = False) ], 3192 3197 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO, 3193 sDst = os.path.join(sScratch, 'C:\\non\\exist\\')),3198 sDst = sScratchGstNotExist), 3194 3199 tdTestResult(fRc = False) ], 3195 3200 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO, 3196 sDst = os.path.join(sScratch, 'C:\\non\\exist\\renamedfile.dll')),3201 sDst = sScratchGstNotExist), 3197 3202 tdTestResult(fRc = False) ], 3198 3203 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO, 3199 sDst = os.path.join(sScratch, 'HostGuestAdditions.iso')), 3204 sDst = os.path.join(sScratchGstNotExist, 'renamedfile.dll')), 3205 tdTestResult(fRc = False) ], 3206 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO, 3207 sDst = os.path.join(sScratchGst, 'HostGuestAdditions.iso')), 3200 3208 tdTestResult(fRc = True) ], 3201 3209 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO, 3202 sDst = os.path.join(sScratch, 'HostGuestAdditions.iso')),3210 sDst = os.path.join(sScratchGst, 'HostGuestAdditions.iso')), 3203 3211 tdTestResult(fRc = True) ], 3204 3212 # Note: Copying files into directories via Main is supported only in versions > 5.2. 3205 3213 # Destination is a directory. 3206 3214 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO, 3207 sDst = sScratch),3215 sDst = sScratchGst), 3208 3216 tdTestResult(fRc = True) ], 3209 3217 # Copy over file again into same directory (overwrite). 3210 3218 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO, 3211 sDst = sScratch),3219 sDst = sScratchGst), 3212 3220 tdTestResult(fRc = True) ] 3213 3221 ]); … … 3221 3229 # Copying directories with contain files we don't have read access to. 3222 3230 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\security', 3223 sDst = sScratch ),3224 3231 sDst = sScratchGst), 3232 tdTestResult(fRc = False) ], 3225 3233 # Copying directories with regular files. 3226 3234 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\Help', 3227 sDst = sScratch ),3228 3235 sDst = sScratchGst), 3236 tdTestResult(fRc = True) ] 3229 3237 ]); 3230 3238 else: … … 3289 3297 sPassword = "password"; 3290 3298 3291 sScratch = os.path.join(self.oTstDrv.sScratchPath, "testGctrlCopyFrom"); 3299 if self.oTstDrv.sHost == "win": 3300 sScratchHstInvalid = "[]?:"; 3301 else: 3302 sScratchHstInvalid = "/"; 3303 3304 sScratchHst = os.path.join(self.oTstDrv.sScratchPath, "testGctrlCopyFrom"); 3292 3305 try: 3293 os.makedirs(sScratch );3306 os.makedirs(sScratchHst); 3294 3307 except OSError as e: 3295 3308 if e.errno != errno.EEXIST: 3296 reporter.error('Failed: Unable to create scratch directory \"%s\"' % (sScratch ,));3309 reporter.error('Failed: Unable to create scratch directory \"%s\"' % (sScratchHst,)); 3297 3310 return (False, oTxsSession); 3298 reporter.log('Scratch path is: %s' % (sScratch,)); 3299 3300 sScratchNotExist = "/does-not-exist"; 3311 reporter.log('Scratch path is: %s' % (sScratchHst,)); 3301 3312 3302 3313 aaTests = []; … … 3307 3318 tdTestResult(fRc = False) ], 3308 3319 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'Something', 3309 aFlags = [ 1234] ),3320 aFlags = [ 80 ] ), 3310 3321 tdTestResult(fRc = False) ], 3311 3322 # Source missing. … … 3313 3324 tdTestResult(fRc = False) ], 3314 3325 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sDst = 'Something', 3315 aFlags = [ 1234] ),3326 aFlags = [ 80 ] ), 3316 3327 tdTestResult(fRc = False) ], 3317 3328 # Testing DirectoryCopyFlag flags. 3318 3329 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32', 3319 sDst = 'Whatever', aFlags = [ 1234] ),3330 sDst = sScratchHstInvalid, aFlags = [ 80 ] ), 3320 3331 tdTestResult(fRc = False) ], 3321 3332 # Testing FileCopyFlag flags. 3322 3333 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll', 3323 sDst = 'Whatever', aFlags = [ 1234] ),3334 sDst = sScratchHstInvalid, aFlags = [ 80 ] ), 3324 3335 tdTestResult(fRc = False) ], 3325 3336 # Nothing to copy (sDst is empty / unreachable). … … 3329 3340 tdTestResult(fRc = False) ], 3330 3341 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'non-exist', 3331 sDst = os.path.join(sScratch , 'non-exist.dll')),3342 sDst = os.path.join(sScratchHst, 'non-exist.dll')), 3332 3343 tdTestResult(fRc = False) ] 3333 3344 ]); … … 3340 3351 # Copying single files. 3341 3352 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll', 3342 sDst = sScratchNotExist),3343 tdTestResult(fRc = False) ],3353 sDst = sScratchHstInvalid), 3354 tdTestResult(fRc = False) ], 3344 3355 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll', 3345 sDst = os.path.join(sScratchNotExist, 'renamedfile.dll')),3346 tdTestResult(fRc = False) ],3356 sDst = os.path.join(sScratchHstInvalid, 'renamedfile.dll')), 3357 tdTestResult(fRc = False) ], 3347 3358 # Copy over file using a different destination name. 3348 3359 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll', 3349 sDst = os.path.join(sScratch, 'renamedfile.dll')),3350 tdTestResult(fRc = True) ],3360 sDst = os.path.join(sScratchHst, 'renamedfile.dll')), 3361 tdTestResult(fRc = True) ], 3351 3362 # Copy over same file (and overwrite existing one). 3352 3363 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll', 3353 sDst = os.path.join(sScratch, 'renamedfile.dll')),3354 tdTestResult(fRc = True) ],3364 sDst = os.path.join(sScratchHst, 'renamedfile.dll')), 3365 tdTestResult(fRc = True) ], 3355 3366 # Note: Copying files into directories via Main is supported only in versions > 5.2. 3356 3367 # Destination is a directory with a trailing slash (should work). 3357 3368 # See "cp" syntax. 3358 3369 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll', 3359 sDst = sScratch+ "/"),3370 sDst = sScratchHst + "/"), 3360 3371 tdTestResult(fRc = True) ], 3361 3372 # Destination is a directory (should fail). 3362 3373 # See "cp" syntax. 3363 3374 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll', 3364 sDst = sScratch),3375 sDst = sScratchHst), 3365 3376 tdTestResult(fRc = False) ] 3366 3377 ]); … … 3373 3384 # Copying entire directories (destination is "<sScratch>", which exists, which should fail). 3374 3385 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\Web', 3375 sDst = sScratch ),3376 tdTestResult(fRc = False) ],3386 sDst = sScratchHst), 3387 tdTestResult(fRc = False) ], 3377 3388 # Copying entire directories (destination is "<sScratch>\Web"). 3378 3389 # Should fail, as the corresponding flag is missing. 3379 3390 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\Web', 3380 sDst = sScratch + "/"),3381 tdTestResult(fRc = False) ],3391 sDst = sScratchHst + "/"), 3392 tdTestResult(fRc = False) ], 3382 3393 # Next try with correct flag being set. 3383 3394 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\Web', 3384 sDst = sScratch + "/", aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]),3385 tdTestResult(fRc = True) ],3395 sDst = sScratchHst + "/", aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]), 3396 tdTestResult(fRc = True) ], 3386 3397 # Copying contents of directories (destination is "<sScratch>/"). 3387 3398 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\Web\\', 3388 sDst = sScratch + "/", aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]),3389 tdTestResult(fRc = True) ]3399 sDst = sScratchHst + "/", aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]), 3400 tdTestResult(fRc = True) ] 3390 3401 ]); 3391 3402 else:
Note:
See TracChangeset
for help on using the changeset viewer.