diff -r c1f20ce4abcf -r 3e88ff8f41d5 kerneltest/f32test/server/t_ext1.cpp --- a/kerneltest/f32test/server/t_ext1.cpp Tue Aug 31 16:34:26 2010 +0300 +++ b/kerneltest/f32test/server/t_ext1.cpp Wed Sep 01 12:34:56 2010 +0100 @@ -15,7 +15,6 @@ // // -#define __E32TEST_EXTENSION__ #include #include #include @@ -47,97 +46,98 @@ test.Next(_L("TestSecondaryExtensions()")); TInt drive; TInt err=RFs::CharToDrive(gDriveToTest,drive); - test_KErrNone(err); + test(err==KErrNone); TPckgBuf drvSyncBuf; err = TheFs.QueryVolumeInfoExt(drive, EIsDriveSync, drvSyncBuf); - test_KErrNone(err); + test(err==KErrNone); const TBool bDrvSync = drvSyncBuf(); TFullName fsName; TInt r=TheFs.FileSystemName(fsName,drive); - test_KErrNone(r); + test(r==KErrNone); test.Printf(_L("fsName=%S\n"),&fsName); - if (Is_SimulatedSystemDrive(TheFs, drive)) +#if defined(__WINS__) + if(drive==EDriveC) { - // check that the extension cannot be mounted since it is not supported by the file system - test.Printf(_L("Test extension cannot be mounted")); + // check that the extension cannot be mounted since not supported by the file system r=TheFs.AddExtension(KExtensionLog); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.MountExtension(KExtensionLogName,drive); - test_Value(r, r == KErrNotSupported); + test(r==KErrNotSupported); r=TheFs.RemoveExtension(KExtensionLogName); - test_KErrNone(r); + test(r==KErrNone); return; } +#endif test.Next(_L("RFs::AddExtension()")); r=TheFs.AddExtension(KExtensionLog); RDebug::Print(_L("addext=%d"),r); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.AddExtension(KExtensionLog); - test_Value(r, r == KErrAlreadyExists); + test(r==KErrAlreadyExists); r=TheFs.AddExtension(KExtensionRubbish); - test_Value(r, r == KErrNotFound); + test(r==KErrNotFound); r=TheFs.AddExtension(KExtensionEmpty); - test_KErrNone(r); + test(r==KErrNone); test.Next(_L("RFs::MountExtension()")); #if !defined(__WINS__) // check that the extension cannot be mounted on file system that does not support extensions r=TheFs.MountExtension(KExtensionLogName,EDriveZ); - test_Value(r, r == KErrNotSupported); + test(r==KErrNotSupported); #endif // test mounting on drive with no file system r=TheFs.DismountFileSystem(fsName,drive); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.MountExtension(KExtensionLogName,drive); - test_Value(r, r == KErrNotReady); + test(r==KErrNotReady); r=TheFs.MountFileSystem(fsName,drive,bDrvSync); - test_KErrNone(r); + test(r==KErrNone); // test with a resource open _LIT(KFileName,"testing.doc"); RFile file; r=file.Replace(TheFs,KFileName,EFileShareExclusive); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.MountExtension(KExtensionLogName,drive); - test_Value(r, r == KErrInUse); + test(r==KErrInUse); file.Close(); r=TheFs.Delete(KFileName); - test_KErrNone(r); + test(r==KErrNone); // test with a format open TBuf<4> driveBuf=_L("?:\\"); driveBuf[0]=(TText)(drive+'A'); RFormat format; TInt count; r=format.Open(TheFs,driveBuf,EHighDensity,count); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.MountExtension(KExtensionLogName,drive); - test_Value(r, r == KErrInUse); + test(r==KErrInUse); format.Close(); // get the extension name TFullName extName; r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNotFound); + test(r==KErrNotFound); // now load the extension r=TheFs.MountExtension(KExtensionLogName,drive); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNone && extName==KExtensionLogName); + test(r==KErrNone && extName==KExtensionLogName); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNotFound); + test(r==KErrNotFound); // try remounting the same extension r=TheFs.MountExtension(KExtensionLogName,drive); - test_Value(r, r == KErrAlreadyExists); + test(r==KErrAlreadyExists); // mount a second extension r=TheFs.MountExtension(KExtensionEmptyName,drive); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNone && extName==KExtensionLogName); + test(r==KErrNone && extName==KExtensionLogName); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNone && extName==KExtensionEmptyName); + test(r==KErrNone && extName==KExtensionEmptyName); // force a remount on a removable media and check that extensions both exist test.Printf(_L("Test forcing remount\n")); @@ -153,7 +153,7 @@ test.Printf(_L("Remounting the drive\n"), r); r = TheFs.RemountDrive(drive, NULL, (TUint) KMediaRemountForceMediaChange); - test_Value(r, r == KErrNotReady || r == KErrNone); + test(r == KErrNotReady || r == KErrNone); do { @@ -181,7 +181,7 @@ RLocalDrive d; TBool flag=EFalse; r=d.Connect(1,flag); - test_KErrNone(r); + test(r==KErrNone); d.ForceMediaChange(); d.Close(); //#if defined(__WINS__) @@ -195,9 +195,9 @@ r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNone && extName==KExtensionLogName); + test(r==KErrNone && extName==KExtensionLogName); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNone && extName==KExtensionEmptyName); + test(r==KErrNone && extName==KExtensionEmptyName); test.Printf(_L("Accessing media...\n")); // and now do some file system operations @@ -207,64 +207,64 @@ test.Printf(_L("res=%d\n"), r); - test_Value(r, r == KErrNone||r==KErrAlreadyExists); + test(r==KErrNone||r==KErrAlreadyExists); RFile file1; r=file1.Replace(TheFs,file1Name,EFileShareExclusive); - test_KErrNone(r); + test(r==KErrNone); r=file1.Write(toWrite); - test_KErrNone(r); + test(r==KErrNone); r=file1.Read(0,readBuf); test(readBuf==toWrite); r=file1.SetSize(0); - test_KErrNone(r); + test(r==KErrNone); file1.Close(); r=TheFs.Delete(file1Name); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.RmDir(dir1); - test_KErrNone(r); + test(r==KErrNone); test.Next(_L("RFs::DismountExtension()")); // test with a resource open r=file.Replace(TheFs,KFileName,EFileShareExclusive); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.DismountExtension(KExtensionLogName,drive); - test_Value(r, r == KErrInUse); + test(r==KErrInUse); file.Close(); r=TheFs.Delete(KFileName); - test_KErrNone(r); + test(r==KErrNone); // test with a format open r=format.Open(TheFs,driveBuf,EHighDensity,count); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.DismountExtension(KExtensionLogName,drive); - test_Value(r, r == KErrInUse); + test(r==KErrInUse); format.Close(); // now dismount an extension r=TheFs.DismountExtension(KExtensionLogName,drive); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNone && extName==KExtensionEmptyName); + test(r==KErrNone && extName==KExtensionEmptyName); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNotFound); + test(r==KErrNotFound); // try to dismount an extension that is not mounted r=TheFs.DismountExtension(KExtensionLogName,drive); - test_Value(r, r == KErrNotFound); + test(r==KErrNotFound); r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNone && extName==KExtensionEmptyName); + test(r==KErrNone && extName==KExtensionEmptyName); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNotFound); + test(r==KErrNotFound); // dismount the remaining extension r=TheFs.DismountExtension(KExtensionEmptyName,drive); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNotFound); + test(r==KErrNotFound); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNotFound); + test(r==KErrNotFound); test.Next(_L("RFs::RemoveExtension()")); r=TheFs.RemoveExtension(KExtensionLogName); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.RemoveExtension(KExtensionEmptyName); - test_KErrNone(r); + test(r==KErrNone); } void TestPrimaryExtensions() @@ -276,17 +276,16 @@ test.Next(_L("TestPrimaryExtensions()")); TInt drive; TInt err=RFs::CharToDrive(gDriveToTest,drive); - test_KErrNone(err); + test(err==KErrNone); - if(Is_SimulatedSystemDrive(TheFs, drive)) - { - test.Printf(_L("Skipping TestPrimaryExtensions on PlatSim/Emulator drive %C:\n"), gSessionPath[0]); +#if defined(__WINS__) + if(drive==EDriveC) return; - } +#endif TPckgBuf drvSyncBuf; err = TheFs.QueryVolumeInfoExt(drive, EIsDriveSync, drvSyncBuf); - test_KErrNone(err); + test(err==KErrNone); const TBool bDrvSync = drvSyncBuf(); // don't test on ram drive since accesses memory directly @@ -297,142 +296,142 @@ TFullName fsName; r=TheFs.FileSystemName(fsName,drive); - test_KErrNone(r); + test(r==KErrNone); test.Printf(_L("fsName=%S\n"),&fsName); test.Next(_L("RFs::AddExtension()")); r=TheFs.AddExtension(KExtensionLog); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.AddExtension(KExtensionEmpty); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.AddExtension(KExtensionBit); - test_KErrNone(r); + test(r==KErrNone); test.Next(_L("RFs::MountFileSystem()")); // test with file system that already exists r=TheFs.MountFileSystem(fsName,KExtensionBitName,drive,bDrvSync); - test_Value(r, r == KErrAccessDenied); + test(r==KErrAccessDenied); // unmount drive and mount primary extension along with file system r=TheFs.DismountFileSystem(fsName,drive); - test_KErrNone(r); + test(r==KErrNone); //-- !! N.B this extension mangles data read/written ftom/to the media, for some file systems it is OK and mounting succeeds //-- for others - this will result in KErrCorrupt r=TheFs.MountFileSystem(fsName,KExtensionBitName,drive,bDrvSync); - test_Value(r, r == KErrNone||r==KErrCorrupt); + test(r==KErrNone||r==KErrCorrupt); // and now format Format(drive); TFullName extName; r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNone && extName==KExtensionBitName); + test(r==KErrNone && extName==KExtensionBitName); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNotFound); + test(r==KErrNotFound); // and now do some file system operations TBuf8<16> readBuf; r=TheFs.MkDir(dir1); - test_Value(r, r == KErrNone||r==KErrAlreadyExists); + test(r==KErrNone||r==KErrAlreadyExists); RFile file1; r=file1.Replace(TheFs,file1Name,EFileShareExclusive); - test_KErrNone(r); + test(r==KErrNone); r=file1.Write(toWrite); - test_KErrNone(r); + test(r==KErrNone); r=file1.Read(0,readBuf); test(readBuf==toWrite); r=file1.SetSize(0); - test_KErrNone(r); + test(r==KErrNone); file1.Close(); r=TheFs.Delete(file1Name); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.RmDir(dir1); - test_KErrNone(r); + test(r==KErrNone); // add a secondary extension test.Printf(_L("RFs::MountExtension()")); r=TheFs.MountExtension(KExtensionLogName,drive); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNone && extName==KExtensionBitName); + test(r==KErrNone && extName==KExtensionBitName); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNone && extName==KExtensionLogName); + test(r==KErrNone && extName==KExtensionLogName); // try to add the same extension r=TheFs.MountExtension(KExtensionBitName,drive); - test_Value(r, r == KErrAlreadyExists); + test(r==KErrAlreadyExists); r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNone && extName==KExtensionBitName); + test(r==KErrNone && extName==KExtensionBitName); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNone && extName==KExtensionLogName); + test(r==KErrNone && extName==KExtensionLogName); // try to add a third extension r=TheFs.MountExtension(KExtensionEmptyName,drive); - test_Value(r, r == KErrAccessDenied); + test(r==KErrAccessDenied); r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNone && extName==KExtensionBitName); + test(r==KErrNone && extName==KExtensionBitName); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNone && extName==KExtensionLogName); + test(r==KErrNone && extName==KExtensionLogName); // and now do some file system operations r=TheFs.MkDir(dir1); - test_Value(r, r == KErrNone||r==KErrAlreadyExists); + test(r==KErrNone||r==KErrAlreadyExists); r=file1.Replace(TheFs,file1Name,EFileShareExclusive); - test_KErrNone(r); + test(r==KErrNone); r=file1.Write(toWrite); - test_KErrNone(r); + test(r==KErrNone); r=file1.Read(0,readBuf); test(readBuf==toWrite); r=file1.SetSize(0); - test_KErrNone(r); + test(r==KErrNone); file1.Close(); r=TheFs.Delete(file1Name); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.RmDir(dir1); - test_KErrNone(r); + test(r==KErrNone); test.Printf(_L("RFs::DismountExtension()")); // test that can't dismount a primary extension via this method r=TheFs.DismountExtension(KExtensionLogName,drive); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNone && extName==KExtensionBitName); + test(r==KErrNone && extName==KExtensionBitName); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNotFound); + test(r==KErrNotFound); r=TheFs.DismountExtension(KExtensionBitName,drive); - test_Value(r, r == KErrAccessDenied); + test(r==KErrAccessDenied); r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNone && extName==KExtensionBitName); + test(r==KErrNone && extName==KExtensionBitName); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNotFound); + test(r==KErrNotFound); test.Printf(_L("RFs::DismountFileSystem()")); r=TheFs.MountExtension(KExtensionLogName,drive); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNone && extName==KExtensionBitName); + test(r==KErrNone && extName==KExtensionBitName); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNone && extName==KExtensionLogName); + test(r==KErrNone && extName==KExtensionLogName); // and now dismount r=TheFs.DismountFileSystem(fsName,drive); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNotReady); + test(r==KErrNotReady); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNotReady); + test(r==KErrNotReady); // remount the file system r=TheFs.MountFileSystem(fsName,drive,bDrvSync); - test_Value(r, r == KErrNone||r==KErrCorrupt); + test(r==KErrNone||r==KErrCorrupt); r=TheFs.ExtensionName(extName,drive,0); - test_Value(r, r == KErrNotFound); + test(r==KErrNotFound); r=TheFs.ExtensionName(extName,drive,1); - test_Value(r, r == KErrNotFound); + test(r==KErrNotFound); Format(drive); test.Next(_L("RFs::RemoveExtension()")); r=TheFs.RemoveExtension(KExtensionLogName); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.RemoveExtension(KExtensionEmptyName); - test_KErrNone(r); + test(r==KErrNone); r=TheFs.RemoveExtension(KExtensionBitName); - test_KErrNone(r); + test(r==KErrNone); } @@ -447,21 +446,8 @@ TInt drive; TInt err=RFs::CharToDrive(gDriveToTest,drive); test.Start(_L("Starting Test - T_EXT1")); - test_KErrNone(err); + test(err==KErrNone); - // Check that the drive supports extensions. - TBool extensionsSupported = EFalse; - TPckg dataBuf(extensionsSupported); - err = TheFs.QueryVolumeInfoExt(drive,EFSysExtensionsSupported,dataBuf); - test_KErrNone(err); - if(!extensionsSupported) - { - test.Printf(_L("Drive %C: does not support file sys extensions. Skipping T_EXT1."), gSessionPath[0]); - test.End(); - test.Close(); - return; - } - PrintDrvInfo(TheFs, drive); //Do not run this test on the NAND drive, as @@ -475,7 +461,6 @@ TheFs.Drive(driveInfo,drive); if (driveInfo.iType == EMediaNANDFlash) { - test.Printf(_L("Skipping T_EXT1 as drive %C: is NAND\n"), gSessionPath[0]); return; } #endif