diff -r ef2a444a7410 -r b3a1d9898418 kerneltest/f32test/demandpaging/t_nandpaging.cpp --- a/kerneltest/f32test/demandpaging/t_nandpaging.cpp Mon May 03 13:47:38 2010 +0300 +++ b/kerneltest/f32test/demandpaging/t_nandpaging.cpp Fri May 14 17:13:29 2010 +0300 @@ -28,6 +28,7 @@ //! @SYMTestPriority High //! @SYMTestStatus Implemented +#define __E32TEST_EXTENSION__ #include RTest test(_L("T_NANDPAGING")); @@ -38,6 +39,7 @@ #include #include "testdefs.h" #include +#include "nfe.h" TInt DriveNumber=-1; // Parameter - Which drive? -1 = autodetect. @@ -544,9 +546,53 @@ return; } + // If the NFE test media driver extension is present, ALL the drive is encrypted; + // this means that there will be very few free blocks in the free block reservoir: this effectively + // disables background garbage collection and all block erasing needs to happen on the fly... + TNfeDeviceInfo nfeDeviceinfo; + TPtr8 nfeDeviceInfoBuf((TUint8*) &nfeDeviceinfo, sizeof(nfeDeviceinfo)); + nfeDeviceInfoBuf.FillZ(); + TInt r = Drive.QueryDevice((RLocalDrive::TQueryDevice) EQueryNfeDeviceInfo, nfeDeviceInfoBuf); +/* + if (r == KErrNone) + { + test.Printf(_L("NFE device detected, aborting garbage collection test for now\n")); + return; + } +*/ + // Create some free blocks by creating a huge file and then deleting it.... + if (r == KErrNone) + { + test.Printf(_L("NFE device detected\n")); + RFile file; + + TBuf<256> tempFileName = _L("?:\\f32-tst\\"); + tempFileName[0] = 'A'+DriveNumber; + + r = TheFs.MkDirAll(tempFileName); + test(r==KErrNone || r== KErrAlreadyExists); + + tempFileName+= _L("TEMP.TXT"); + + r = file.Replace(TheFs, tempFileName, EFileWrite); + test_KErrNone(r); + + for (TInt fileSize = KMaxTInt; fileSize > 0; fileSize >>= 1) + { + r = file.SetSize(fileSize); + test.Printf(_L("Setting file size to %d, r %d\n"), fileSize, r); + if (r == KErrNone) + break; + } + file.Close(); + r = TheFs.Delete(tempFileName); + test_KErrNone(r); + } + + + TInt timeout; TInt writesNeeded=100; - TInt r = KErrNone; RFile tempFile; TInt i; TInt ii; @@ -593,6 +639,7 @@ for (ii=0; ii0)); // ie, while garbage collection hasn't happened, or timed out