Update contrib.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Do benchmarking comparisons in asynchronous and synchronous modes.
18 //! @file f32test\concur\t_cfsbench.cpp
26 // The following #defines are for using older (and less accurate) benchmark
27 // timings. They use multiple threads to get the operations simultaneous
28 // but this is inherrently inaccurate (it depends whether one of them starts
29 // and/or ends before the other how accurate the timings are). If you leave
30 // them both commented out then the tests will be done in a single thread
31 // using asynchronous file operations, thus avoiding the problem.
33 // Uncomment the following if you want to test asynchronous file operations
34 // using two threads rather than in a single thread.
36 // #define TEST_ASYNC_IN_THREAD
38 // Uncomment the following if you want to test using synchronous file
39 // operations, using two threads to do both at once.
41 // #define TEST_SYNC_IN_THREAD
45 // Statistics -- size and time of operations.
50 void Init() { iSize = 0; iTime = 0; }
53 GLDEF_D RTest test(_L("T_CFSBENCH"));
56 LOCAL_D TFullName gFsName;
57 LOCAL_D TFullName gFsName1;
58 LOCAL_D TFullName gFsName2;
59 LOCAL_D TFullName gOldFsName;
60 LOCAL_D TFullName gNewFsName;
61 LOCAL_D TBool gNoMedia = ETrue;
63 #if defined(TEST_SYNC_IN_THREAD) || defined(TEST_ASYNC_IN_THREAD)
64 LOCAL_D TInt gThreadNumber = 0;
67 LOCAL_D RMutex gDataLock;
68 LOCAL_D TStats gWrStats;
69 LOCAL_D TStats gRdStats;
71 _LIT(KFsFile, "CFAFSDLY");
72 _LIT(KFsName, "DelayFS");
74 LOCAL_D const TInt32 KSecond = 1000000;
75 LOCAL_D const TInt32 KTimeBM = 20;
76 LOCAL_D const TInt32 KNumBuf = 100;
77 LOCAL_D const TInt32 KBufLen = 0x100;
78 LOCAL_D const TInt32 KMaxThr = 10;
79 LOCAL_D const TInt32 KMaxLag = 4;
81 LOCAL_D TBuf8<KBufLen> gBufferArr[KMaxThr][KNumBuf];
82 LOCAL_D TRequestStatus gStatusArr[KMaxThr][KNumBuf];
84 LOCAL_C void AddStats(TStats& aStats, TInt64 aSize, TInt64 aTime)
85 /// Add values to the statistics.
88 aStats.iSize += aSize;
89 aStats.iTime += aTime;
93 LOCAL_C TInt GetSpeed(TStats& aStats)
94 /// Calculate and return the data throughput from the statistics, rounded.
97 TInt speed = I64LOW((aStats.iSize + aStats.iTime/2) / aStats.iTime);
102 LOCAL_C TInt32 GetSpeed(TInt aOps, TInt64 aDtime)
103 /// Calculate and return the throughput from the umber of blocks transferred
104 /// and the elapsed time.
106 TInt64 dsize = MAKE_TINT64(0, aOps) * MAKE_TINT64(0, KBufLen) * MAKE_TINT64(0, KSecond);
107 TInt32 speed = I64LOW((dsize + aDtime/2) / aDtime);
111 LOCAL_C TBool DriveIsOK(TChar c)
112 /// Test that a selected drive leter is OK to write files.
116 r=TheFs.CharToDrive(c, drv);
120 r=TheFs.Drive(info,drv);
122 return (info.iDriveAtt != 0 && !(info.iDriveAtt & KDriveAttRom));
125 LOCAL_C TChar MountTestFileSystem(TInt aDrive)
127 // Mount a new CTestFileSystem on the drive under test
133 r=TheFs.DriveToChar(aDrive,c);
135 b.Format(_L("Mount test file system on %c:"),(TUint)c);
138 r=TheFs.AddFileSystem(KFsFile);
139 test(r==KErrNone || r==KErrAlreadyExists);
141 r=TheFs.FileSystemName(gOldFsName,aDrive);
142 test(r==KErrNone || r==KErrNotFound);
145 r = TheFs.Drive(drv, aDrive);
148 gNoMedia = (drv.iType == EMediaUnknown || drv.iType == EMediaNotPresent);
150 if (gOldFsName.Length() > 0)
152 TTest::Printf(_L("Dismount %C: %S"), (TUint)c, &gOldFsName);
153 r=TheFs.DismountFileSystem(gOldFsName,aDrive);
157 r=TheFs.MountFileSystem(KFsName,aDrive);
160 r=TheFs.FileSystemName(gNewFsName,aDrive);
162 test(gNewFsName.CompareF(KFsName)==0);
166 LOCAL_C void UnmountFileSystem(TInt aDrive)
167 /// Unmount a test filesystem and mount the old one.
170 TInt r=TheFs.DriveToChar(aDrive,c);
172 r=TheFs.DismountFileSystem(gNewFsName,aDrive);
174 // if there's no media present, don't try to mount it
177 test.Printf(_L("No media on %C: so don't remount it"), (TUint)c);
179 else if (gOldFsName.Length() > 0)
181 test.Printf(_L("Mount %C: %S"), (TUint)c, &gOldFsName);
182 r=TheFs.MountFileSystem(gOldFsName,aDrive);
186 test.Printf(_L("Error %d remounting %S on %C\n"), r, &gOldFsName, (TUint)c);
189 LOCAL_C void RemountFileSystem(TInt aDrive, TBool aSync)
190 /// Unmount and remount the file system on the specified drive in the
192 /// @param aDrive Drive number (EDriveC etc.).
193 /// @param aSync Mount synchronous if true, asynchronous if not.
196 TInt r=TheFs.DriveToChar(aDrive,c);
197 r=TheFs.FileSystemName(gFsName, aDrive);
198 test(r==KErrNone || r==KErrNotFound);
200 if (gFsName.Length() > 0)
202 r=TheFs.DismountFileSystem(gFsName, aDrive);
205 test.Printf(_L("Error = %d"),r);
210 TBufC<16> type = _L("asynchronous");
212 type = _L("synchronous");
213 test.Printf(_L("Mount filesystem %c: %-8S as %S\n"), (TUint)c, &gFsName, &type);
215 #ifdef __CONCURRENT_FILE_ACCESS__
216 r=TheFs.MountFileSystem(gFsName, aDrive, aSync);
218 r=TheFs.MountFileSystem(gFsName, aDrive);
230 // ---------------------------------------------------------------------------
232 #if defined(TEST_SYNC_IN_THREAD)
234 LOCAL_C TInt testSyncAccess(TAny* aData)
236 /// Test read file handling.
238 /// @param aData pointer to the thread data area
240 TThreadData& data = *(TThreadData*)aData;
241 TFileName fileName = data.iFile;
242 TBool dowrite = (data.iData != NULL);
245 TInt r = myFs.Connect();
248 r = myFs.SetSessionPath(gSessionPath);
250 TTest::Fail(HERE, _L("SetSessionPath returned %d"), r);
254 r = myFs.CharToDrive(fileName[0], drv);
256 TTest::Fail(HERE, _L("CharToDrive(%c) returned %d"), fileName[0], r);
257 r = myFs.Volume(vol, drv);
259 TTest::Fail(HERE, _L("Volume() returned %d"), r);
261 TInt maxwrite = TInt(vol.iFree / 2 - KBufLen);
262 if (maxwrite < KBufLen*2)
263 TTest::Fail(HERE, _L("Not enough space to do test, only %d KB available"),
264 TInt(vol.iFree/1024));
270 TTimeIntervalMicroSeconds timeTaken;
273 TRequestStatus tstat;
284 r = f.Replace(myFs, fileName, EFileStreamText | EFileWrite);
287 // wait for both tasks to have a chance to complete opening the files
290 buff.Fill('_', KBufLen);
292 timer.After(tstat, KTimeBM * KSecond);
294 startTime.HomeTime();
296 while (tstat == KRequestPending)
298 TInt pos = (wrnum * KBufLen) % maxwrite;
299 r = f.Write(pos, buff);
305 timeTaken=endTime.MicroSecondsFrom(startTime);
307 TInt64 dtime = timeTaken.Int64();
308 TInt64 dsize = wrnum * KBufLen * TInt64(KSecond);
309 TInt32 speed = TInt32((dsize + dtime/2) / dtime);
310 AddStats(gWrStats, dsize, dtime);
312 TTest::Printf(_L("%8d writes in %6d mS = %8d bytes per second\n"),
313 wrnum, TInt32(dtime)/1000, speed);
322 r = f.Open(myFs, fileName, EFileStreamText);
325 // wait for both tasks to have a chance to complete opening the files
328 timer.After(tstat, KTimeBM * KSecond);
330 startTime.HomeTime();
332 while (tstat == KRequestPending)
334 TInt pos = (rdnum * KBufLen) % maxwrite;
335 r = f.Read(pos, buff, KBufLen);
341 timeTaken=endTime.MicroSecondsFrom(startTime);
343 TInt64 dtime = timeTaken.Int64();
344 TInt64 dsize = rdnum * KBufLen * TInt64(KSecond);
345 TInt32 speed = TInt32((dsize + dtime/2) / dtime);
346 AddStats(gRdStats, dsize, dtime);
348 // wait to allow the dust to settle
349 User::After(KSecond);
351 TTest::Printf(_L("%8d reads in %6d mS = %8d bytes per second\n"),
352 rdnum, TInt32(dtime)/1000, speed);
358 // delete file after reading it
359 myFs.Delete(fileName);
368 // ---------------------------------------------------------------------------
370 #if defined(TEST_ASYNC_IN_THREAD)
372 LOCAL_C TInt testAsyncAccess(TAny* aData)
374 /// Test read file handling.
376 /// @param aData pointer to the thread data area
378 TThreadData& data = *(TThreadData*)aData;
379 TFileName fileName = data.iFile;
380 TBool dowrite = (data.iData != NULL);
381 TBuf8<KBufLen>* buffer = gBufferArr[data.iNum];
382 TRequestStatus* status = gStatusArr[data.iNum];
385 TInt r = myFs.Connect();
388 r = myFs.SetSessionPath(gSessionPath);
390 TTest::Fail(HERE, _L("SetSessionPath returned %d"), r);
394 r = myFs.CharToDrive(fileName[0], drv);
396 TTest::Fail(HERE, _L("CharToDrive(%c) returned %d"), fileName[0], r);
397 r = myFs.Volume(vol, drv);
399 TTest::Fail(HERE, _L("Volume() returned %d"), r);
401 TInt64 maxwrite = vol.iFree / 2 - KBufLen;
402 if (maxwrite < KBufLen*2)
403 TTest::Fail(HERE, _L("Not enough space to do test, only %d KB available"),
404 TInt(vol.iFree/1024));
408 TRequestStatus tstat;
411 TTimeIntervalMicroSeconds timeTaken;
423 r = f.Replace(myFs, fileName, EFileStreamText | EFileWrite);
426 // wait for both tasks to have a chance to complete opening the files
429 for (i = 0; i < KNumBuf; i++)
430 buffer[i].Fill('_', KBufLen);
432 timer.After(tstat, KTimeBM * KSecond);
434 startTime.HomeTime();
436 while (tstat == KRequestPending)
438 TInt pos = TInt((wrnum * KBufLen) % maxwrite);
439 TInt bnum = opnum++ % KNumBuf;
440 f.Write(pos, buffer[bnum], status[bnum]);
441 if (opnum - opfin > KMaxLag)
443 while (status[opfin % KNumBuf] == KRequestPending)
444 User::WaitForRequest(status[opfin % KNumBuf]);
450 while (opfin < opnum)
452 while (status[opfin % KNumBuf] == KRequestPending)
453 User::WaitForRequest(status[opfin % KNumBuf]);
458 TTimeIntervalMicroSeconds timeTaken=endTime.MicroSecondsFrom(startTime);
460 TInt64 dtime = timeTaken.Int64();
461 TInt64 dsize = wrnum * KBufLen * TInt64(KSecond);
462 TInt32 speed = TInt32((dsize + dtime/2) / dtime);
463 AddStats(gWrStats, dsize, dtime);
465 TTest::Printf(_L("%8d writes in %6d mS = %8d bytes per second\n"),
466 wrnum, TInt32(dtime)/1000, speed);
470 r = f.Open(myFs, fileName, EFileStreamText);
473 timer.After(tstat, KTimeBM * KSecond);
475 startTime.HomeTime();
477 while (tstat == KRequestPending)
479 TInt pos = TInt((rdnum * KBufLen) % maxwrite);
480 TInt bnum = opnum++ % KNumBuf;
481 f.Read(pos, buffer[bnum], status[bnum]);
482 if (opnum - opfin > KMaxLag)
484 User::WaitForRequest(status[opfin++ % KNumBuf]);
489 while (opfin < opnum)
491 if (status[opfin % KNumBuf] == KRequestPending)
492 User::WaitForRequest(status[opfin % KNumBuf]);
497 timeTaken=endTime.MicroSecondsFrom(startTime);
498 TInt64 dtime = timeTaken.Int64();
499 TInt64 dsize = rdnum * KBufLen * TInt64(KSecond);
500 TInt32 speed = TInt32((dsize + dtime/2) / dtime);
501 AddStats(gRdStats, dsize, dtime);
503 // wait to allow the dust to settle
504 User::After(KSecond);
506 TTest::Printf(_L("%8d reads in %6d mS = %8d bytes per second\n"),
507 rdnum, TInt32(dtime)/1000, speed);
509 myFs.Delete(fileName);
521 // ---------------------------------------------------------------------------
524 /// Do operations on a file.
528 TInt Open(TChar dr, TInt n);
538 TBuf8<KBufLen> iBuffer[KMaxLag];
539 TRequestStatus iStatus[KMaxLag];
547 TFileOps::TFileOps() : iPtr(0), iNum(0), iOps(0), iMax(0), iOpen(EFalse)
549 for (TInt i = 0; i < KMaxLag; i++)
551 iStatus[i] = KErrNone;
552 iBuffer[i].Fill(TChar('_'), KBufLen);
556 TInt TFileOps::Open(TChar aDrvCh, TInt aNum)
557 /// Open the file for testing, give error if there is not enough space for it.
558 /// @param aDrvCh Drive letter.
559 /// @param aNum File number suffix.
563 TInt r = TheFs.CharToDrive(aDrvCh, drv);
565 TTest::Fail(HERE, _L("CharToDrive(%c) returned %d"), (TUint)aDrvCh, r);
566 r = TheFs.Volume(vol, drv);
568 TTest::Fail(HERE, _L("Volume(%c:) returned %d"), (TUint)aDrvCh, r);
570 iMax = I64LOW(vol.iFree / MAKE_TINT64(0,KBufLen)) / 2 - 1;
572 TTest::Fail(HERE, _L("Not enough space to do test, only %d KB available"),
573 I64LOW(vol.iFree/1024));
576 iName.Format(_L("%c:\\TEST_%d"), (TUint)aDrvCh, aNum);
577 r = iF.Replace(TheFs, iName, EFileStreamText | EFileWrite);
583 TInt TFileOps::Close()
584 /// Close and delete the file, returning the number of operations done.
594 TInt TFileOps::Reset()
595 /// Reset all of the counts.
603 TInt TFileOps::Write()
604 /// If there is a free buffer available, start a write.
608 while (iNum < iOps && iStatus[iNum%KMaxLag] != KRequestPending)
610 if (iOps < KMaxLag || iStatus[iPtr] != KRequestPending)
612 TInt pos = iNum%iMax * KBufLen;
613 iF.Write(pos, iBuffer[iPtr], iStatus[iPtr]);
622 TInt TFileOps::Read()
623 /// If there is a free buffer available, start a read.
627 while (iNum < iOps && iStatus[iNum%KMaxLag] != KRequestPending)
629 if (iOps < KMaxLag || iStatus[iPtr] != KRequestPending)
631 TInt pos = iNum%iMax * KBufLen;
632 iF.Read(pos, iBuffer[iPtr], iStatus[iPtr]);
642 /// Wait until all outstanding operations have ended, then return the number.
648 if (iStatus[iNum%KMaxLag] == KRequestPending)
649 User::WaitForRequest(iStatus[iNum%KMaxLag]);
658 LOCAL_C TInt testAsyncAccess(TChar dc1, TChar dc2)
660 // Test one drive against the other.
673 TRequestStatus tstat;
676 TTimeIntervalMicroSeconds timeTaken;
680 timer.After(tstat, KTimeBM * KSecond);
682 startTime.HomeTime();
684 while (tstat == KRequestPending)
686 TInt num = f1.Write();
689 User::WaitForAnyRequest();
696 timeTaken=endTime.MicroSecondsFrom(startTime);
698 TInt64 dtime = timeTaken.Int64();
700 TTest::Printf(_L("%c: %8d writes in %6d mS = %8d bytes per second\n"),
701 (TUint)dc1, op1, I64LOW(dtime)/1000, GetSpeed(op1, dtime));
704 TTest::Printf(_L("%c: %8d writes in %6d mS = %8d bytes per second\n"),
705 (TUint)dc2, op2, I64LOW(dtime)/1000, GetSpeed(op2, dtime));
707 AddStats(gWrStats, MAKE_TINT64(0, op1 + op2) * MAKE_TINT64(0, KBufLen) * MAKE_TINT64(0, KSecond), dtime);
714 timer.After(tstat, KTimeBM * KSecond);
716 startTime.HomeTime();
718 while (tstat == KRequestPending)
722 User::WaitForAnyRequest();
729 timeTaken=endTime.MicroSecondsFrom(startTime);
731 dtime = timeTaken.Int64();
733 TTest::Printf(_L("%c: %8d reads in %6d mS = %8d bytes per second\n"),
734 (TUint)dc1, op1, I64LOW(dtime)/1000, GetSpeed(op1, dtime));
737 TTest::Printf(_L("%c: %8d reads in %6d mS = %8d bytes per second\n"),
738 (TUint)dc2, op2, I64LOW(dtime)/1000, GetSpeed(op2, dtime));
740 AddStats(gRdStats, MAKE_TINT64(0, op1 + op2) * MAKE_TINT64(0, KBufLen) * MAKE_TINT64(0, KSecond), dtime);
742 test.Printf(_L("\n"));
743 test.Printf(_L("average write throughput = %d bytes/sec\n"), GetSpeed(gWrStats));
744 test.Printf(_L("average read throughput = %d bytes/sec\n"), GetSpeed(gRdStats));
745 test.Printf(_L("\n"));
753 // delay for a second to allow the close to complete before dismounting.
754 User::After(1000000);
758 #if defined(TEST_SYNC_IN_THREAD) || defined(TEST_ASYNC_IN_THREAD)
760 LOCAL_C TInt CreateThread(TThreadFunction aFunc, TChar c, TOper aOper)
761 /// Create a thread to do the appropriate operation on a drive.
763 TBuf<2> drive(_L("?"));
767 TThreadData& d = TTest::Data(gThreadNumber);
768 d.iFile.Format(_L("%S:\\TEST%d.FILE"), &drive, gThreadNumber);
769 d.iData = (aOper == EWrite ? &aOper : NULL);
770 name.Format(_L("Test_%S_%d"), &drive, gThreadNumber);
771 TInt r = TTest::Create(gThreadNumber, aFunc, name);
776 LOCAL_C TInt RunThreads(TThreadFunction aFunc, TChar aDrive1, TChar aDrive2, TOper aOper)
777 /// Run threads to test one drive against the other at the same time.
778 /// The thread will report any error and return it as a value, the program will
779 /// exit at a higher level after cleaning up.
783 if ((r = CreateThread(aFunc, aDrive1, aOper)) != KErrNone) return r;
784 if ((r = CreateThread(aFunc, aDrive2, aOper)) != KErrNone) return r;
791 LOCAL_C TInt testThreads(TThreadFunction aFunc, TChar c, TChar d)
792 /// Run threads testing read and write of the drives both ways round.
793 /// The thread will report any error and return it as a value, the program will
794 /// exit at a higher level after cleaning up.
797 if ((r = RunThreads(aFunc, c, d, EWrite)) != KErrNone) return r;
798 if ((r = RunThreads(aFunc, c, d, ERead)) != KErrNone) return r;
799 if ((r = RunThreads(aFunc, d, c, EWrite)) != KErrNone) return r;
800 if ((r = RunThreads(aFunc, d, c, ERead)) != KErrNone) return r;
802 test.Printf(_L("average write throughput = %d bytes/sec\n"), GetSpeed(gWrStats));
803 test.Printf(_L("average read throughput = %d bytes/sec\n"), GetSpeed(gRdStats));
804 test.Printf(_L("\n"));
812 LOCAL_C TInt parseCmd(TChar& aDrvCh1, TChar& aDrvCh2)
813 /// Get parameters from the comand line; if there aren't enough then
814 /// prompt the user for them and return KErrAbort if ^C is pressed.
816 while (aDrvCh1 < 'A' || aDrvCh1 > 'Z')
818 test.Printf(_L("Enter drive letter: "));
819 while (aDrvCh1 < 'A' || aDrvCh1 > 'Z')
823 aDrvCh1 = User::UpperCase(test.Getch());
825 if (!DriveIsOK(aDrvCh1))
827 test.Printf(_L("%c: is not a valid drive\n"), (TUint)aDrvCh1);
833 TheFs.CharToDrive(aDrvCh1, drv);
834 TheFs.FileSystemName(gFsName1, drv);
835 test.Printf(_L("%c: (%S)\n"), (TUint)aDrvCh1, &gFsName1);
839 while (aDrvCh2 < 'A' || aDrvCh2 > 'Z')
841 test.Printf(_L("Enter drive letter: "));
842 while (aDrvCh2 < 'A' || aDrvCh2 > 'Z')
846 aDrvCh2 = User::UpperCase(test.Getch());
848 if (!DriveIsOK(aDrvCh2))
850 test.Printf(_L("%c: is not a valid drive\n"), (TUint)aDrvCh2);
856 TheFs.CharToDrive(aDrvCh2, drv);
857 TheFs.FileSystemName(gFsName2, drv);
858 test.Printf(_L("%c: (%S)\n"), (TUint)aDrvCh2, &gFsName2);
864 GLDEF_C void CallTestsL()
869 TInt r = TTest::Init();
872 TChar drvch0 = TTest::DefaultDriveChar();
879 const TInt KMaxArgs = 4;
880 TPtrC argv[KMaxArgs];
881 TInt argc = TTest::ParseCommandArguments(argv, KMaxArgs);
883 drvch0 = User::UpperCase(argv[1][0]);
885 drvch1 = User::UpperCase(argv[2][0]);
887 drvch2 = User::UpperCase(argv[3][0]);
889 r = TheFs.CharToDrive(drvch0, drive0);
892 if (TheFs.IsValidDrive(drive0))
893 MountTestFileSystem(drive0);
895 test.Printf(_L("Unable to mount test file system\n"));
897 r = parseCmd(drvch1, drvch2);
900 UnmountFileSystem(drive0);
901 User::Panic(_L("USER ABORT"), 0);
904 r = TheFs.CharToDrive(drvch1, drive1);
906 r = TheFs.CharToDrive(drvch2, drive2);
909 r = TheFs.FileSystemName(gFsName1, drive1);
910 test(r == KErrNone || r == KErrNotFound);
911 r = TheFs.FileSystemName(gFsName2, drive2);
912 test(r == KErrNone || r == KErrNotFound);
914 gDataLock.CreateLocal();
916 if (drive1 == drive2)
918 // !!! Disable platform security tests until we get the new APIs
919 // if (User::Capability() & KCapabilityRoot)
920 // CheckMountLFFS(TheFs, drvch1);
922 test.Printf(_L("Using drive %c: (%S)\n"),
923 (TUint)drvch1, &gFsName1);
926 test.Next(_L("Test with drive asynchronous"));
927 RemountFileSystem(drive1, EFalse);
928 testAsyncAccess(drvch1, drvch1);
933 test.Next(_L("Test with drive synchronous"));
934 RemountFileSystem(drive1, ETrue);
935 testAsyncAccess(drvch1, drvch1);
940 // !!! Disable platform security tests until we get the new APIs
941 /* if (User::Capability() & KCapabilityRoot)
943 CheckMountLFFS(TheFs, drvch1);
944 CheckMountLFFS(TheFs, drvch2);
947 test.Printf(_L("Using drives %c: (%S) and %c: (%S)\n"),
948 (TUint)drvch1, &gFsName1, (TUint)drvch2, &gFsName2);
950 #if !defined(TEST_ASYNC_IN_THREAD)
954 test.Next(_L("Test async r/w with both drives async"));
955 RemountFileSystem(drive1, EFalse);
956 RemountFileSystem(drive2, EFalse);
957 testAsyncAccess(drvch1, drvch2);
962 test.Next(_L("Test async r/w with 1st drive sync and 2nd async"));
963 RemountFileSystem(drive1, ETrue);
964 RemountFileSystem(drive2, EFalse);
965 testAsyncAccess(drvch1, drvch2);
970 test.Next(_L("Test async r/w with 1st drive async and 2nd sync"));
971 RemountFileSystem(drive1, EFalse);
972 RemountFileSystem(drive2, ETrue);
973 testAsyncAccess(drvch1, drvch2);
978 test.Next(_L("Test async r/w with both drives sync"));
979 RemountFileSystem(drive1, ETrue);
980 RemountFileSystem(drive2, ETrue);
981 testAsyncAccess(drvch1, drvch2);
988 test.Next(_L("Test async r/w with both drives asynchronous"));
989 RemountFileSystem(drive1, EFalse);
990 RemountFileSystem(drive2, EFalse);
991 r = testThreads(testAsyncAccess, drvch1, drvch2);
996 test.Next(_L("Test async r/w with one drive sync and one async"));
997 RemountFileSystem(drive1, ETrue);
998 RemountFileSystem(drive2, EFalse);
999 r = testThreads(testAsyncAccess, drvch1, drvch2);
1004 test.Next(_L("Test async r/w with both drives synchronous"));
1005 RemountFileSystem(drive1, ETrue);
1006 RemountFileSystem(drive2, ETrue);
1007 r = testThreads(testAsyncAccess, drvch1, drvch2);
1011 #if defined(TEST_SYNC_IN_THREAD)
1015 test.Next(_L("Test sync r/w with both drives asynchronous"));
1016 RemountFileSystem(drive1, EFalse);
1017 RemountFileSystem(drive2, EFalse);
1018 r = testThreads(testSyncAccess, drvch1, drvch2);
1023 test.Next(_L("Test sync r/w with one drive sync and one async"));
1024 RemountFileSystem(drive1, ETrue);
1025 RemountFileSystem(drive2, EFalse);
1026 r = testThreads(testSyncAccess, drvch1, drvch2);
1031 test.Next(_L("Test sync r/w with both drives synchronous"));
1032 RemountFileSystem(drive1, ETrue);
1033 RemountFileSystem(drive2, ETrue);
1034 r = testThreads(testSyncAccess, drvch1, drvch2);
1041 UnmountFileSystem(drive0);
1046 GLDEF_C TInt E32Main()
1053 CTrapCleanup* cleanup;
1054 cleanup=CTrapCleanup::New();
1058 test.Start(_L("Starting tests..."));
1063 // TheFs.SetAllocFailure(gAllocFailOn);
1068 TRAP(r,CallTestsL());
1070 // reset the debug register
1071 TheFs.SetDebugRegister(0);
1074 endTimeC.HomeTime();
1075 TTimeIntervalSeconds timeTakenC;
1076 r=endTimeC.SecondsFrom(timerC,timeTakenC);
1078 test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int());
1079 // TheFs.SetAllocFailure(gAllocFailOff);