void TMultipleSessionTest::testInitialisation(RTest& aTest) // // Modified from T_SESSION. Still tests that calls to CheckedClose() are // OK, ie, tests bug fix, but doesn't check returned error values since remote drive // doesn't necessarily return them. // { RFile file; RDir dir; aTest.Next(_L("Test calls to CheckedClose are OK")); TInt r=iFs.SetSessionPath(iSessionPath); TInt count; RFormat format; r=format.Open(iFs,_L("Z:\\"),EFullFormat,count); aTest((r==KErrAccessDenied)||(r==KErrInUse)); r=dir.Open(iFs,_L("\\MULTIPLE_SESSION_TEST\\ERRORTEST\\"),KEntryAttMatchMask); // aTest(r==KErrPathNotFound); if (r==KErrNone) dir.Close(); r=file.Open(iFs,_L("\\MULTIPLE_SESSION_TEST\\SessionTest1.txt"),EFileRead); // aTest(r==KErrNotFound); if (r==KErrNone) file.Close(); r=dir.Open(iFs,_L("\\MULTIPLE_SESSION_TEST\\ERRORTEST2\\"),KEntryAttMatchMask); // aTest(r==KErrPathNotFound); if (r==KErrNone) dir.Close(); r=file.Open(iFs,_L("\\MULTIPLE_SESSION_TEST\\SessionTest2.txt"),EFileRead); // aTest(r==KErrNotFound); if (r==KErrNone) file.Close(); r=dir.Open(iFs,_L("\\MULTIPLE_SESSION_TEST\\ERRORTEST3\\"),KEntryAttMatchMask); // aTest(r==KErrPathNotFound); if (r==KErrNone) dir.Close(); r=file.Open(iFs,_L("\\MULTIPLE_SESSION_TEST\\SessionTest3.txt"),EFileRead); // aTest(r==KErrNotFound); if (r==KErrNone) file.Close(); r=file.Open(iFs,_L("\\MULTIPLE_SESSION_TEST\\SessionTest4.txt"),EFileRead); // aTest(r==KErrNotFound); if (r==KErrNone) file.Close(); }
void TestQuickFormat() { test.Start(_L("Test EQuickFormat")); TInt counter; RFormat format; TInt err = format.Open(fsSession, msDrive->GetSessionPath(), EQuickFormat, counter); test(err == KErrNone); while(counter) { err = format.Next(counter); test(err == KErrNone); } format.Close(); DisplayVolumeInfo(); test.End(); }
GLDEF_C void Format(TInt aDrive) // // Format current drive // { test.Next(_L("Format")); TBuf<4> driveBuf=_L("?:\\"); driveBuf[0]=(TText)(aDrive+'A'); RFormat format; TInt count; TInt r=format.Open(TheFs,driveBuf,EQuickFormat,count); test_KErrNone(r); while(count) { TInt r=format.Next(count); test_KErrNone(r); } format.Close(); }
void TestFullFormat() { test.Start(_L("Test EFullFormat")); TInt counter; RFormat format; TInt err = format.Open(fsSession, msDrive->GetSessionPath(), EFullFormat, counter); test(err == KErrNone); while(counter) { test.Printf(_L(".")); err = format.Next(counter); test(err == KErrNone); } test.Printf(_L("\n\r")); format.Close(); DisplayVolumeInfo(); test.End(); }
void TSessionTest::testInitialisation() // // Tests that calls to CheckedClose() are OK, ie, tests bug fix // { test.Next(_L("Test calls to CheckedClose are OK")); RFile file; RDir dir; TInt count; RFormat format; TInt r=format.Open(iFs,_L("Z:\\"),EFullFormat,count); test_Value(r, r==KErrAccessDenied || r==KErrInUse); r=dir.Open(iFs,_L("\\SESSION_TEST\\ERRORTEST\\"),KEntryAttMatchMask); test_Value(r, r==KErrPathNotFound); r=file.Open(iFs,_L("\\SESSION_TEST\\SessionTest1.txt"),EFileRead); test_Value(r, r==KErrNotFound); r=dir.Open(iFs,_L("\\SESSION_TEST\\ERRORTEST2\\"),KEntryAttMatchMask); test_Value(r, r==KErrPathNotFound); r=file.Open(iFs,_L("\\SESSION_TEST\\SessionTest2.txt"),EFileRead); test_Value(r, r==KErrNotFound); r=dir.Open(iFs,_L("\\SESSION_TEST\\ERRORTEST3\\"),KEntryAttMatchMask); test_Value(r, r==KErrPathNotFound); r=file.Open(iFs,_L("\\SESSION_TEST\\SessionTest3.txt"),EFileRead); test_Value(r, r==KErrNotFound); r=file.Open(iFs,_L("\\SESSION_TEST\\SessionTest4.txt"),EFileRead); test_Value(r, r==KErrNotFound); format.Close(); dir.Close(); file.Close(); }
LOCAL_C void DoFormat() // // Format the ramdisk // { TInt count; RFormat format; #if defined(__WINS__) TInt r=format.Open(TheFs,_L("Y:\\"),EHighDensity,count); #else TInt r=format.Open(TheFs,_L("C:\\"),EHighDensity,count); #endif test_KErrNone(r); while(count) { r=format.Next(count); test_KErrNone(r); } format.Close(); }
/** Formats the drive @param aDrive Drive to be formatted */ void Format(TInt aDrive) { test.Next(_L("Format")); TBuf<4> driveBuf = _L("?:\\"); driveBuf[0] = (TText)(aDrive+'A'); RFormat format; TInt count, prevcount = 0; TInt r = format.Open(TheFs, driveBuf, EQuickFormat, count); TESTERROR(r); while(count) { TInt r = format.Next(count); if(count != prevcount) { test.Printf(_L(".")); prevcount = count; } TESTERROR(r); } format.Close(); }
void CTestUtilSessionSwi::ServiceL(const RMessage2& aMessage) { switch (aMessage.Function()) { case ECopy: { HBufC* source = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0); HBufC* destination = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,1); TInt err = Server().FileMan().Copy(*source, *destination, CFileMan::ERecurse | CFileMan::EOverWrite); if (err == KErrNone) { // Turn off the read only attributes TTime time(0); // must specify 0, or a valid time, otherwise sets time to a random value and causes -6/-21 errors err = Server().FileMan().Attribs(*destination, 0, KEntryAttReadOnly, time, CFileMan::ERecurse); } CleanupStack::PopAndDestroy(destination); CleanupStack::PopAndDestroy(source); aMessage.Complete(err); break; } case EMove: { HBufC* source = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0); HBufC* destination = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,1); TInt err = Server().FS().Rename(*source,*destination); if (err == KErrNone) { // Turn off the read only attributes TTime time(0); // must specify 0, or a valid time, otherwise sets time to a random value and causes -6/-21 errors err = Server().FileMan().Attribs(*destination, 0, KEntryAttReadOnly, time, CFileMan::ERecurse); } CleanupStack::PopAndDestroy(destination); CleanupStack::PopAndDestroy(source); aMessage.Complete(err); break; } case EDelete: { HBufC* fileName = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0); TEntry entry; TInt err = Server().FS().Entry(*fileName, entry); if (err == KErrNone) { if (entry.IsDir()) { TPath pathName(*fileName); if (pathName[pathName.Length() - 1] != KPathDelimiter) { pathName.Append(KPathDelimiter); } err = Server().FileMan().RmDir(pathName); } else { err = Server().FS().Delete(*fileName); } } CleanupStack::PopAndDestroy(fileName); aMessage.Complete(err); break; } case ERmDir: { HBufC* fileName = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0); TParsePtrC parsePtr(*fileName); if(parsePtr.IsRoot()) { User::Leave(KErrAccessDenied); } TInt err = Server().FileMan().RmDir(*fileName); CleanupStack::PopAndDestroy(fileName); aMessage.Complete(err); break; } case EMkDirAll: { HBufC* fileName = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0); TInt err = Server().FS().MkDirAll(*fileName); CleanupStack::PopAndDestroy(fileName); aMessage.Complete(err); break; } case EFileExists: { delete iDetector; iDetector=CTestFileDetector::NewL(aMessage, Server().FS()); iDetector->DetectFile(); break; } case ELock: { HBufC* fileName = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0); RFile lockFile; TInt err = lockFile.Open(Server().FS(), *fileName, EFileWrite); if (err == KErrNone) iLockedFileHandles.Append(lockFile); CleanupStack::PopAndDestroy(fileName); aMessage.Complete(err); break; } case EUnlock: { HBufC* fileName = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0); TInt err = KErrNotFound; TFileName lockedFileName; for (TInt i = 0; i < iLockedFileHandles.Count() && err;i++) { TInt err2 = iLockedFileHandles[i].FullName(lockedFileName); User::LeaveIfError(err2); if (lockedFileName.MatchF(*fileName) != KErrNotFound) { iLockedFileHandles[i].Close(); iLockedFileHandles.Remove(i); err = KErrNone; } } CleanupStack::PopAndDestroy(fileName); aMessage.Complete(err); break; } case EFormat: { TInt drive = aMessage.Int0(); TBool formatFatOnly = aMessage.Int1(); TChar aDriveChar; User::LeaveIfError(Server().FS().DriveToChar(drive, aDriveChar)); TBuf<3> bfDrv; bfDrv.Append(aDriveChar); bfDrv.Append(KBP); RFormat format; TInt count; User::LeaveIfError(format.Open(Server().FS(), bfDrv, EHighDensity, count)); CleanupClosePushL(format); if (formatFatOnly) { User::LeaveIfError(format.Next(count)); } else { while (count > 0) { User::LeaveIfError(format.Next(count)); } } CleanupStack::PopAndDestroy(&format); aMessage.Complete(KErrNone); break; } case EMount: { TInt drive = aMessage.Int0(); User::LeaveIfError(Server().FS().Connect()); //Mount the drive synchronizely to make sure the drive is ready for the next operation User::LeaveIfError(Server().FS().MountFileSystem(KFAT, drive, ETrue)); aMessage.Complete(KErrNone); break; } case EUnMount: { TInt drive = aMessage.Int0(); TFileName fsName; User::LeaveIfError(Server().FS().FileSystemName(fsName, drive)); User::LeaveIfError(Server().FS().DismountFileSystem(fsName, drive)); aMessage.Complete(KErrNone); break; } case ESetReadOnly: { HBufC* fileName = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0); TInt setReadOnly = aMessage.Int1(); TUint setmask; TUint clearmask; if (setReadOnly) { // Setting read only attribute setmask = KEntryAttReadOnly; clearmask = 0; } else { // Clearing read only attribute setmask = 0; clearmask = KEntryAttReadOnly; } // Turn off the read only attributes TTime time(0); TInt err = Server().FileMan().Attribs(*fileName, setmask, clearmask, time); CleanupStack::PopAndDestroy(fileName); aMessage.Complete(err); break; } case EGetFileHandle: { HBufC* fileName = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0); RFile file; CleanupClosePushL(file); User::LeaveIfError(file.Open(Server().FS(), *fileName, EFileRead | EFileShareReadersOnly)); User::LeaveIfError(file.TransferToClient(aMessage, 1)); CleanupStack::PopAndDestroy(2, fileName); // file break; } case EWatchFile: { if (iFileWatcher) { if (iFileWatcher->IsActive()) { aMessage.Complete(KErrServerBusy); break; } else { delete iFileWatcher; iFileWatcher = NULL; } } // Create a new file watcher for this session iFileWatcher = CFileWatcher::NewL(Server().FS(), aMessage); break; } case EWatchFileCancel: { if (iFileWatcher) { iFileWatcher->Cancel(); aMessage.Complete(KErrNone); } else { // No file watch request to cancel! aMessage.Complete(KErrNotReady); } break; } case EGetNumFiles: { HBufC* dirPath = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0); CDir* dirContents = NULL; User::LeaveIfError(Server().FS().GetDir(*dirPath, KEntryAttNormal, ESortNone, dirContents)); TPckg<TInt> numFiles(dirContents->Count()); delete dirContents; aMessage.WriteL(1, numFiles); aMessage.Complete(KErrNone); CleanupStack::PopAndDestroy(dirPath); break; } case ERegenerateCache: { #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK Swi::RSisRegistryWritableSession session; User::LeaveIfError(session.Connect()); CleanupClosePushL(session); session.RegenerateCacheL(); CleanupStack::PopAndDestroy(&session); aMessage.Complete(KErrNone); #else aMessage.Complete(KErrNotSupported); #endif break; } case EGetFileHash: { HBufC* fileNameA = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0); CMessageDigest* digest = CalculateFileHashLC(*fileNameA); aMessage.WriteL(1, digest->Final()); aMessage.Complete(KErrNone); CleanupStack::PopAndDestroy(2, fileNameA); break; } default: { PanicClient(aMessage,EPanicIllegalFunction); break; } } }
LOCAL_C void TestNoCaps() // // test APIs with no capabilities // { r=TheFs.FileSystemName(fsname,gTheDriveNum); test_KErrNone(r); r = DismountFileSystem(TheFs, fsname, gTheDriveNum); test_Value(r, r == KErrPermissionDenied); // r=TheFs.RemoveFileSystem(fsname); //can not test due to bug elsewhere fix exists // test_Value(r, r == KErrPermissionDenied); // r=TheFs.AddFileSystem(fsname); // test_Value(r, r == KErrPermissionDenied); r = MountFileSystem(TheFs, fsname, gTheDriveNum); test_Value(r, r == KErrPermissionDenied); r=TheFs.SetDriveName(gTheDriveNum,KDriveName); test_Value(r, r == KErrPermissionDenied); // r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum); //broken on wins C: // test_Value(r, r == KErrPermissionDenied); systemRFstest(); resourceRFstest(); privateRFstest(); privateSIDRFstest(); privatefalseIDRFstest(); systemRFiletest(); resourceRFiletest(); privateRFiletest(); privateSIDRFiletest(); privatefalseIDRFiletest(); //disk changes to sys and pri paths should have completed these test(aStat4 == KRequestPending); TheFs.NotifyChangeCancel(aStat4); test(aStat4==KErrCancel); User::WaitForRequest(aStat3); test(aStat1==KErrPermissionDenied); test(aStat2==KErrPermissionDenied); test(aStat3==KErrNone); r=TheFs.SetSessionPath(systestname); test_Value(r, r == KErrPermissionDenied); //Test RRawDisk class r=rawdisk.Open(TheFs,gTheDriveNum); test_Value(r, r == KErrPermissionDenied); // rawdisk.Close(); r=format.Open(TheFs,driveBuf,EHighDensity,count); test_Value(r, r == KErrPermissionDenied); RDirtest(); driveBuf[0]=(TText)gDriveToTest; r=TheFs.ScanDrive(driveBuf); test_Value(r, r == KErrPermissionDenied); r=TheFs.CheckDisk(driveBuf); test_Value(r, r == KErrPermissionDenied); }
LOCAL_C void doComponentTest() // // Do the component test // { #ifndef __NO_HEAP_CHECK __UHEAP_MARK; #endif TInt ret; test.Printf(_L("Start MountStart test. Be sure MMC card is inserted.\n")); // Parse the CommandLine argument: removal drive ParseCommandArguments(); // Connect to the server LOG_AND_TEST(KErrNone, fs.Connect()); CleanupClosePushL(fs); // Convert drive letter to its numerical equivalent ret = fs.CharToDrive(driveLetter,removalDrvNo); LOG_AND_TEST(ret, KErrNone); // Load the logical device _LIT(KDriverFileName,"TESTUSBC.LDD"); ret = User::LoadLogicalDevice(KDriverFileName); LOG_AND_TEST(KErrNone, ret); // Add MS file system _LIT(KMsFsFsy, "MSFS.FSY"); LOG_AND_TEST(KErrNone, fs.AddFileSystem(KMsFsFsy)); // Start Ms file system RUsbMassStorage usbMs; CleanupClosePushL(usbMs); TMassStorageConfig config; config.iVendorId.Copy(_L("vendorId")); config.iProductId.Copy(_L("productId")); config.iProductRev.Copy(_L("rev")); ret = usbMs.Connect(); LOG_AND_TEST(KErrNone, ret); // Start usb mass storage device LOG_AND_TEST(KErrNone , usbMs.Start(config)); // Format removable drive using FAT FS RFormat format; TBuf<2> removalDrive; removalDrive.Append(driveLetter); removalDrive.Append(':'); TInt tracksRemaining; test.Printf(_L("Start MMC card formatting\n")); LOG_AND_TEST(KErrNone, format.Open(fs, removalDrive, EHighDensity|EQuickFormat, tracksRemaining)); while (tracksRemaining) { test.Printf(_L(".")); LOG_AND_TEST(KErrNone, format.Next(tracksRemaining)); } format.Close(); test.Printf(_L("\nDone!\n")); // Open a session to LDD test.Printf(_L("Open LDD\n")); LOG_AND_TEST(KErrNone, usbcClient.Open(0)); test.Printf(_L("Creating CActiveScheduler\n")); CActiveScheduler* sched = new(ELeave) CActiveScheduler; CleanupStack::PushL(sched); CActiveScheduler::Install(sched); // Create a state machine CStateMachine* sm = CStateMachine::NewL(); CleanupStack::PushL(sm); sm->AddState(EUsbMsDriveState_Disconnected); sm->AddState(EUsbMsDriveState_Connecting); sm->AddState(EUsbMsDriveState_Connected); sm->AddState(EUsbMsDriveState_Disconnecting); sm->AddState(EUsbMsDriveState_Active); sm->AddState(EUsbMsDriveState_Locked); sm->AddState(EUsbMsState_Written); sm->AddState(EUsbMsState_Read); sm->SetInitState(EUsbMsDriveState_Disconnected); CPropertyHandler* driveStatusHandler = CMsDriveStatusHandler::NewLC(removalDrvNo, *sm); CPropertyHandler* readStatusHandler = CMsReadStatusHandler::NewLC(removalDrvNo, *sm); CPropertyHandler* writtenStatusHandler = CMsWrittenStatusHandler::NewLC(removalDrvNo, *sm); CPropertyWatch::NewLC(EUsbMsDriveState_DriveStatus, *driveStatusHandler); CPropertyWatch::NewLC(EUsbMsDriveState_KBytesRead, *readStatusHandler); CPropertyWatch::NewLC(EUsbMsDriveState_KBytesWritten, *writtenStatusHandler); CActiveScheduler::Start(); ret = usbMs.Stop(); test.Printf(_L("usbMs.Stop returned %d\n"), ret); test(ret == KErrNone); usbMs.Close(); // 1 sec delay for MSFS to stop User::After(1000000); ret = fs.RemoveFileSystem(KMsFs); test(ret == KErrNone || ret == KErrNotFound); test.Printf(_L("RemoveFileSystem returned %d\n"), ret); usbcClient.Close(); ret = User::FreeLogicalDevice(_L("USBC")); test.Printf(_L("FreeLogicalDevice returned %d\n"), ret); test(ret == KErrNone); CleanupStack::PopAndDestroy(3); // 3 CPropertyWatches CleanupStack::PopAndDestroy(3); // 3 property status change handlers CleanupStack::PopAndDestroy(sm); CleanupStack::PopAndDestroy(sched); CleanupStack::PopAndDestroy(&usbMs); CleanupStack::PopAndDestroy(&fs); #ifndef __NO_HEAP_CHECK __UHEAP_MARKEND; #endif }
LOCAL_C void DiskAdminTest() // // test diskadministration capabilitiy // { r=TheFs.FileSystemName(fsname,gTheDriveNum); test_KErrNone(r); r = DismountFileSystem(TheFs, fsname, gTheDriveNum); test_KErrNone(r); // r=TheFs.RemoveFileSystem(fsname); //can not test due to bug else where fix exists // test_Value(r, r == KErrPermissionDenied); // r=TheFs.AddFileSystem(fsname); // test_Value(r, r == KErrPermissionDenied); r = MountFileSystem(TheFs, fsname, gTheDriveNum); test_KErrNone(r); r=TheFs.SetDriveName(gTheDriveNum,KDriveName); test_KErrNone(r); r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum); test_Value(r, r == KErrNone || r==KErrNotSupported); systemRFstest(); resourceRFstest(); privateRFstest(); privateSIDRFstest(); privateFalseIDRFstest(); systemRFiletest(); resourceRFiletest(); privateRFiletest(); privateSIDRFiletest(); privatefalseIDRFiletest(); //disk changes to sys and pri paths should have completed these test(aStat4 == KRequestPending); TheFs.NotifyChangeCancel(aStat4); test(aStat4==KErrCancel); User::WaitForRequest(aStat3); test(aStat1==KErrPermissionDenied); test(aStat2==KErrPermissionDenied); test(aStat3==KErrNone); r=TheFs.SetSessionPath(systestname); test_Value(r, r == KErrPermissionDenied); //Test RRawDisk class r=rawdisk.Open(TheFs,gTheDriveNum); test_Value(r, r == KErrPermissionDenied); rawdisk.Close(); RDirtest(); #ifdef __WINS__ if (User::UpperCase(driveBuf[0]) != 'C') #endif { //Test RFormat class r=format.Open(TheFs,driveBuf,EHighDensity,count); test_KErrNone(r); while(count) { TInt r=format.Next(count); test_KErrNone(r); } format.Close(); } driveBuf[0]=(TText)gDriveToTest; r=TheFs.ScanDrive(driveBuf); test_Value(r, r == KErrNone || r==KErrNotSupported); r=TheFs.CheckDisk(driveBuf); test_Value(r, r == KErrNone || r==KErrNotSupported); }
void TSessionTest::testSubst() // // Test the substitute functions. // { test.Printf(_L("Test subst")); TVolumeInfo v; TInt r=iFs.Volume(v); test_KErrNone(r); TDriveInfo origDI; r=iFs.Drive(origDI); test_KErrNone(r); TDriveInfo driveInfo; r=iFs.Drive(driveInfo,EDriveO); test_KErrNone(r); testSetVolume(); if (driveInfo.iDriveAtt==KDriveAttLocal) { return; // Subst local drives fails } TFileName n; r=iFs.Subst(n,EDriveO); test_KErrNone(r); test(n.Length()==0); r=iFs.SetSubst(gTestSessionPath,EDriveO); test_KErrNone(r); r=iFs.Subst(n,EDriveO); test_KErrNone(r); test(n==gTestSessionPath); TVolumeInfo w; r=iFs.Volume(w,EDriveO); test_KErrNone(r); test(w.iDrive.iType==v.iDrive.iType); test(w.iDrive.iConnectionBusType==v.iDrive.iConnectionBusType); test(w.iDrive.iDriveAtt==KDriveAttSubsted); test(w.iDrive.iMediaAtt==v.iDrive.iMediaAtt); test(w.iUniqueID==v.iUniqueID); if(v.iDrive.iType != EMediaRam) // We can't assume that RAM disk will be the same size since last recorded... { test(w.iSize==v.iSize); // If this test is being run under windows using drive C then skip free space comparison // as it is likely to fail as the windows file system is unlike to have static freespace #ifdef __WINS__ if(User::UpperCase(gTestSessionPath[0]) != 'C') { #endif test(w.iFree==v.iFree); #ifdef __WINS__ } #endif } test(w.iName==v.iName); TDriveList driveList; r=iFs.DriveList(driveList); test_KErrNone(r); test(driveList[EDriveO]==KDriveAttSubsted); TDriveInfo d; r=iFs.Drive(d,EDriveO); test_KErrNone(r); test(d.iDriveAtt==KDriveAttSubsted); test(d.iMediaAtt==origDI.iMediaAtt); test(d.iType==origDI.iType); test(d.iConnectionBusType==origDI.iConnectionBusType); test.Next(_L("Test real name")); r=iFs.RealName(_L("O:\\FILE.XXX"),n); test_KErrNone(r); TFileName substedPath=gTestSessionPath; substedPath.Append(_L("FILE.XXX")); test(n.CompareF(substedPath)==KErrNone); // test.Next(_L("Test MkDir, Rename and RmDir on Substed drive")); _LIT(KTurgid,"turgid\\"); TFileName dir=gTestSessionPath; dir+=KTurgid; r=iFs.MkDirAll(dir); test_KErrNone(r); dir+=_L("subdir\\"); r=iFs.MkDir(dir); test_KErrNone(r); r=iFs.RmDir(_L("O:\\turgid\\subdir\\")); test_KErrNone(r); r=iFs.Rename(_L("O:\\turgid"), _L("O:\\facile")); test_KErrNone(r); r=iFs.MkDir(_L("O:\\insipid\\")); test_KErrNone(r); r=iFs.Rename(_L("O:\\insipid"), _L("O:\\glib")); test_KErrNone(r); r=iFs.RmDir(_L("O:\\facile\\")); test_KErrNone(r); _LIT(KGlib,"glib\\"); dir=gTestSessionPath; dir+=KGlib; r=iFs.RmDir(dir); test_KErrNone(r); test.Next(_L("Test file operations on Substed drive")); _LIT(File1,"File1.txt"); _LIT(File2,"File2.txt"); _LIT(SubstRoot,"O:\\"); _LIT(Subdir,"subdir\\"); TFileName name1,name2; name1=gTestSessionPath; name1+=File1; RFile f1; r=f1.Create(iFs,name1,EFileShareExclusive|EFileWrite); test_KErrNone(r); name2=SubstRoot; name2+=File2; TBool isValid=iFs.IsValidName(name2); test(isValid); r=f1.Rename(name2); test_KErrNone(r); f1.Close(); r=f1.Create(iFs,name1,EFileShareExclusive|EFileWrite); test_KErrNone(r); f1.Close(); r=iFs.Replace(name2,name1); test_KErrNone(r); r=iFs.Delete(name1); test_KErrNone(r); test.Next(_L("Test notifications on Substed drive")); name1=gTestSessionPath; name1+=Subdir; name2=SubstRoot; name2+=Subdir; // set up some extended notifications TRequestStatus status1; TRequestStatus status2; TRequestStatus status3; iFs.NotifyChange(ENotifyDir,status1,name1); test(status1==KRequestPending); iFs.NotifyChange(ENotifyDir,status2,name2); test(status2==KRequestPending); r=iFs.MkDirAll(name1); test_KErrNone(r); User::WaitForRequest(status1); User::WaitForRequest(status2); test(status1==KErrNone && status2==KErrNone); iFs.NotifyChange(ENotifyDir,status1,name1); test(status1==KRequestPending); iFs.NotifyChange(ENotifyDir,status2,name2); test(status2==KRequestPending); iFs.NotifyChange(ENotifyAll,status3,name2); test(status3==KRequestPending); r=f1.Temp(iFs,name2,n,EFileShareAny|EFileWrite); test_KErrNone(r); User::WaitForRequest(status3); test(status3==KErrNone && status1==KRequestPending && status2==KRequestPending); f1.Close(); iFs.NotifyChangeCancel(); test(status1==KErrCancel && status2==KErrCancel); User::WaitForRequest(status1); User::WaitForRequest(status2); r=iFs.Delete(n); test_KErrNone(r); r=iFs.RmDir(name1); test_KErrNone(r); // test.Next(_L("Test file systems on Substed drive")); // test cannot mount file system on substituted drive TInt sessionDrv; r=iFs.CharToDrive(gTestSessionPath[0],sessionDrv); test_KErrNone(r); r=iFs.FileSystemName(n,sessionDrv); test_Value(r, r==KErrNone || r==KErrNotFound); r=iFs.MountFileSystem(n,EDriveO); test_Value(r, r==KErrAccessDenied); // test file system name on substitued drive is null r=iFs.FileSystemName(n,EDriveO); test_Value(r, r==KErrNotFound && n==KNullDesC); // test cannot format a substitued drive RFormat format; TInt count; r=format.Open(iFs,SubstRoot,EHighDensity,count); test_Value(r, r==KErrAccessDenied); r=iFs.SetSubst(_L(""),EDriveO); test_KErrNone(r); r=iFs.Subst(n,EDriveO); test_KErrNone(r); test(n==_L("")); r=iFs.Drive(d,EDriveO); test_KErrNone(r); test(d.iDriveAtt==0); }