--- a/kerneltest/f32test/server/t_hungfs.cpp Thu Aug 19 11:14:22 2010 +0300
+++ b/kerneltest/f32test/server/t_hungfs.cpp Tue Aug 31 16:34:26 2010 +0300
@@ -18,6 +18,7 @@
//
+#define __E32TEST_EXTENSION__
#include <f32file.h>
#include <e32test.h>
#include "t_server.h"
@@ -149,7 +150,7 @@
{
RFs fs;
TInt r=fs.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
TInt drive;
#if defined(__WINS__)
@@ -193,7 +194,7 @@
//
{
TInt r=aThread.Create(_L("ThreadNC"),ThreadFunctionNC,KDefaultStackSize,KMinHeapSize,KMinHeapSize,aInfo);
- test(r==KErrNone);
+ test_KErrNone(r);
aThread.SetPriority(EPriorityMore);
aThread.Resume();
HungSemaphoreNC.Wait();
@@ -207,7 +208,7 @@
//
{
TInt r=aThread.Create(_L("ThreadC"),ThreadFunctionC,KDefaultStackSize,KMinHeapSize,KMinHeapSize,&aBool);
- test(r==KErrNone);
+ test_KErrNone(r);
aThread.SetPriority(EPriorityMore);
aThread.Resume();
User::After(1000000);
@@ -253,18 +254,18 @@
// used for EFsSubClose
RFile file;
TInt r=file.Create(TheFs,File1,EFileShareAny|EFileWrite);
- test(r==KErrNone||KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r == KErrAlreadyExists);
if(r==KErrAlreadyExists)
{
r=file.Open(TheFs,File1,EFileShareAny|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
}
TBuf8<16> buf=_L8("abcdefghijklmnop");
r=file.Write(buf);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.MkDir(NotifyDir);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread thread;
PutCriticalNotifier(ETrue,thread);
@@ -300,17 +301,17 @@
// EFsFileOpen
test.Next(_L("test functions that are not supported with critical notifier"));
r=file.Open(TheFs,File2,EFileShareAny);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// EFsFileCreate
r=file.Create(TheFs,File2,EFileShareAny);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// EFsMkDir
r=TheFs.MkDir(Dir1);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// EFsVolume
TVolumeInfo info;
r=TheFs.Volume(info,gSessionDrive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// get rid of critical notifier
test.Printf(_L("Press escape on the critical notifier\n"));
@@ -329,16 +330,16 @@
TFileName notDir=gLockedBase;
notDir+=NotifyDir;
r=TheFs.MkDir(notDir);
- test(r==KErrNone);
+ test_KErrNone(r);
test(status==KRequestPending&&status2==KErrNone);
TheFs.NotifyChangeCancel();
test(status==KErrCancel);
r=TheFs.Delete(File1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(notDir);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(NotifyDir);
- test(r==KErrNone);
+ test_KErrNone(r);
}
void TestParsingFunctions()
@@ -357,50 +358,50 @@
TFileName dir=gLockedBase;
dir+=Dir1;
TInt r=TheFs.MkDir(dir);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
TFileName file=gLockedPath;
file+=File1;
RFile f;
r=f.Create(TheFs,file,EFileShareAny);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// Using ParsePathPtr0
r=TheFs.SetSubst(gLockedPath,EDriveO);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// ValidateDrive
TVolumeInfo info;
r=TheFs.Volume(info,gLockedDrive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
TFileName origSessPath;
r=TheFs.SessionPath(origSessPath);
- test(r==KErrNone);
+ test_KErrNone(r);
// test these work ok
r=TheFs.SetSessionPath(gLockedPath);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.SetSessionPath(origSessPath);
- test(r==KErrNone);
+ test_KErrNone(r);
// test on different drive from notifier - the session path
test.Next(_L("test parsing functions on a different drive"));
// Using ParseSubst
r=TheFs.MkDir(Dir1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(Dir1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Create(TheFs,File1,EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
r=TheFs.Delete(File1);
- test(r==KErrNone);
+ test_KErrNone(r);
// Using ParsePathPtr0
r=TheFs.SetSubst(gSessionPath,EDriveO);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.SetSubst(_L(""),EDriveO);
- test(r==KErrNone);
+ test_KErrNone(r);
// ValidateDrive
r=TheFs.Volume(info,gSessionDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
// get rid of non-critical notifier
test.Printf(_L("Enter %S on the notifier\n"),&KPassword);
@@ -423,9 +424,9 @@
test.Next(_L("TestTFsFunctions"));
TFileName sessName,lockedName;
TInt r=TheFs.FileSystemName(sessName,gSessionDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.FileSystemName(lockedName,gLockedDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread thread;
PutNonCriticalNotifier(NULL,thread);
@@ -434,13 +435,13 @@
test.Next(_L("test TFs functions on hung drive"));
// TFsDismountFileSystem
r=TheFs.DismountFileSystem(lockedName,gLockedDrive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// TFsMountFileSystem
r=TheFs.MountFileSystem(lockedName,gLockedDrive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// TFsFileSystemName
r=TheFs.FileSystemName(lockedName,gLockedDrive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// test functions on drive other than hung drive
test.Next(_L("test TFs functions on drive that is not hung"));
@@ -451,17 +452,17 @@
{
#endif
r=TheFs.DismountFileSystem(sessName,gSessionDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
// TFsMountFileSystem
r=TheFs.MountFileSystem(sessName,gSessionDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
#if defined(__WINS__)
}
#endif
// TFsFileSystemName
TFileName fsName;
r=TheFs.FileSystemName(fsName,gSessionDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fsName==sessName);
// test functions that fail on all drives
@@ -470,16 +471,16 @@
CFileList* list=NULL;
TOpenFileScan fileScan(TheFs);
TRAP(r,fileScan.NextL(list));
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// test functions that should pass on any drive
test.Next(_L("test TFs functions that pass on all drives"));
// TFsSetDefaultPath
// TFsSetSessionPath
r=TheFs.SetSessionPath(gLockedPath);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
// get rid of non-critical notifier
test.Printf(_L("Enter %S on the notifier\n"),&KPassword);
@@ -509,20 +510,20 @@
TFileName fileName=gLockedPath;
fileName+=File1;
TInt r=file.Create(TheFs,fileName,EFileShareAny);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// EFsFormatOpen
RFormat format;
TInt count;
r=format.Open(TheFs,gLockedPath,EHighDensity,count);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// EFsDirOpen
RDir dir;
r=dir.Open(TheFs,gLockedPath,KEntryAttMaskSupported);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// EFsRawDiskOpen
RRawDisk raw;
r=raw.Open(TheFs,gLockedDrive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// get rid of non-critical notifier
test.Printf(_L("Enter %S on the notifier\n"),&KPassword);
@@ -535,14 +536,14 @@
// now open the subsessions
r=file.Create(TheFs,fileName,EFileShareAny);
- test(r==KErrNone||KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r == KErrAlreadyExists);
if(r==KErrAlreadyExists)
{
r=file.Open(TheFs,fileName,EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
}
r=dir.Open(TheFs,gLockedPath,KEntryAttMaskSupported);
- test(r==KErrNone);
+ test_KErrNone(r);
// put notifier back up
PutNonCriticalNotifier(NULL,thread);
@@ -552,16 +553,16 @@
// EFsFileRead
TBuf8<16> readBuf;
r=file.Read(readBuf);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// subsession should be able to be closed ok
file.Close();
// EFsDelete
r=TheFs.Delete(fileName);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// EFsDirRead
TEntry entry;
r=dir.Read(entry);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// subsession should be able to be closed ok
dir.Close();
@@ -577,7 +578,7 @@
thread.Close();
r=TheFs.Delete(fileName);
- test(r==KErrNone);
+ test_KErrNone(r);
// test.End();
}
@@ -590,7 +591,7 @@
RFile file;
TInt r=file.Create(TheFs,File1,EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
// put notifier up using TheFs session
SNonCriticalInfo info={ETrue,0};
@@ -622,12 +623,12 @@
TFileName defPath;
// EFsCheckDisk
r=TheFs.CheckDisk(gSessionPath);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// EFsFileWrite
_LIT8(buffer,"abc");
TBuf8<8> buf(buffer);
r=file.Write(buf);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// this file should be able to be closed
file.Close();
@@ -643,7 +644,7 @@
thread.Close();
r=TheFs.Delete(File1);
- test(r==KErrNone);
+ test_KErrNone(r);
// test.End();
}
@@ -658,7 +659,7 @@
_LIT(file4Name,"\\SubFile4");
TFileName origSession;
TInt r=TheFs.SessionPath(origSession);
- test(r==KErrNone);
+ test_KErrNone(r);
TFileName file1Path(gLockedBase);
file1Path+=file1Name;
TFileName file2Path(file2Name);
@@ -667,24 +668,24 @@
TFileName file4Path(file4Name);
// create file that will be used to hang file server
r=SubFile1.Create(TheFs,file1Path,EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
// create file with same session but on different drive
RFile subfile2;
r=subfile2.Create(TheFs,file2Path,EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
// create file on unhung drive and with different session
RFs fs2;
r=fs2.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs2.SetSessionPath(origSession);
- test(r==KErrNone);
+ test_KErrNone(r);
RFile subfile3;
r=subfile3.Create(fs2,file3Path,EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
// create file on unhung drive and with different session
RFile subfile4;
r=subfile4.Create(fs2,file4Path,EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
// in a different thread cause the server to hang using one of the File1 subsession
// put notifier up using TheFs session
SNonCriticalInfo info={ETrue,ETrue};
@@ -696,16 +697,16 @@
TBuf8<8> buf(buffer);
// File1 caused hung file server
r=SubFile1.Write(buf);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// file2 is same session as subsession that caused hung file server
r=subfile2.Write(buf);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// file3 is opened on hung drive
r=subfile3.Write(buf);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// file4 should be ok
r=subfile4.Write(buf);
- test(r==KErrNone);
+ test_KErrNone(r);
// hard to test EFsSubClose since does not return an error value
test.Next(_L("test closing down the subsessions"));
subfile4.Close();
@@ -727,13 +728,13 @@
// clean up
fs2.Close();
r=TheFs.Delete(file1Path);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(file2Path);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(file3Path);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(file4Path);
- test(r==KErrNone);
+ test_KErrNone(r);
}
void TestExtendedNotifier()
@@ -751,9 +752,9 @@
test(status==KRequestPending);
// now do an operation on c: and test no notification
TInt r=TheFs.MkDir(NotifyDir);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(NotifyDir);
- test(r==KErrNone);
+ test_KErrNone(r);
User::After(1000000);
test(status==KRequestPending);
TheFs.NotifyChangeCancel(status);
@@ -771,15 +772,15 @@
test(status==KRequestPending);
// test notification does not go off with wrong path
r=TheFs.MkDir(NotifyDir2);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(NotifyDir2);
- test(r==KErrNone);
+ test_KErrNone(r);
test(status==KRequestPending);
// now do an operation on c: and test there has been a notification
r=TheFs.MkDir(NotifyDir);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(NotifyDir);
- test(r==KErrNone);
+ test_KErrNone(r);
User::After(1000000);
// request should be completed this time
test(status==KErrNone);
@@ -792,17 +793,17 @@
TRequestStatus status2;
TFileName origSession;
r=TheFs.SessionPath(origSession);
- test(r==KErrNone);
+ test_KErrNone(r);
RFs fs2;
r=fs2.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs2.SetSessionPath(origSession);
- test(r==KErrNone);
+ test_KErrNone(r);
_LIT(notifyDirZ,"z:\\test\\");
_LIT(notifyDirSess,"\\test\\");
// notifyDirZ already exists, create test dir in session path
r=fs2.MkDir(notifyDirSess);
- test(r==KErrNone);
+ test_KErrNone(r);
fs2.NotifyChange(ENotifyDir,status2,notifyDirZ);
test(status2==KRequestPending);
TRequestStatus status3;
@@ -810,7 +811,7 @@
test(status3==KRequestPending);
// now delete session dir and test no notification
r=TheFs.RmDir(notifyDirSess);
- test(r==KErrNone);
+ test_KErrNone(r);
test(status2==KRequestPending && status3==KErrNone);
// get rid of non-critical notifier
@@ -841,11 +842,11 @@
test(status==KRequestPending);
// create directory on locked drive
r=TheFs.MkDir(notDir);
- test(r==KErrNone);
+ test_KErrNone(r);
// test notifier goes off
test(status==KErrNone);
r=TheFs.RmDir(notDir);
- test(r==KErrNone);
+ test_KErrNone(r);
// get rid of critical notifier
}
@@ -856,15 +857,15 @@
{
#if defined(__WINS__)
TInt r=TheFs.CharToDrive(gSessionPath[0],gSessionDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
if(gSessionDrive==EDriveX)
return(EFalse);
#else
TInt r=TheFs.CharToDrive(gSessionPath[0],gSessionDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
TDriveList list;
r=TheFs.DriveList(list);
- test(r==KErrNone);
+ test_KErrNone(r);
if((list[gSessionDrive])&KDriveAttRemovable)
return(EFalse);
#endif
@@ -905,9 +906,9 @@
isSecureMmc=EFalse;
TInt r=HungSemaphoreC.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
r=HungSemaphoreNC.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
// create sharable session
TheFs.ShareAuto();