--- a/kerneltest/f32test/fileshare/handshare.cpp Thu Aug 19 11:14:22 2010 +0300
+++ b/kerneltest/f32test/fileshare/handshare.cpp Tue Aug 31 16:34:26 2010 +0300
@@ -16,6 +16,7 @@
//
#include <e32svr.h>
+#define __E32TEST_EXTENSION__
#include <e32test.h>
#include "handshare.h"
@@ -151,9 +152,9 @@
// stop server2
RFileHandleSharer2 handsvr2;
TInt r=handsvr2.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r = handsvr2.Exit();
- test(r==KErrNone || r == KErrServerTerminated);
+ test_Value(r, r ==KErrNone || r == KErrServerTerminated);
handsvr2.Close();
aMessage.Complete(KErrNone);
@@ -190,29 +191,29 @@
RFs fs;
TInt r=fs.Connect();
r=fs.CreatePrivatePath(gTestDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs.SetSessionToPrivate(gTestDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs.ShareProtected();
- test(r==KErrNone);
+ test_KErrNone(r);
RFile file1;
r=file1.Create(fs,KSvrFileName,EFileWrite);
- test(r==KErrNone || r==KErrAlreadyExists);
+ test_Value(r, r ==KErrNone || r==KErrAlreadyExists);
if (r==KErrAlreadyExists)
{
r=file1.Open(fs,KSvrFileName, EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
}
r=file1.Write(KTestData1());
- test(r==KErrNone);
+ test_KErrNone(r);
file1.Close();
r=file1.Open(fs,KSvrFileName, fileMode);
- test(r==KErrNone);
+ test_KErrNone(r);
TInt fssh=file1.SubSessionHandle();
r=aMsg.Write(0, TPckgC<TInt>(fssh));
- test(r==KErrNone);
+ test_KErrNone(r);
aMsg.Complete(fs);
fs.Close();
}
@@ -232,32 +233,32 @@
RFileHandleSharer2 handsvr2;
TInt r = handsvr2.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
TInt ssh;
TInt fsh = handsvr2.GetFileHandle(ssh, TFileMode(fileMode));
- test(fsh >= 0);
+ test_Value(fsh, fsh >= 0);
// adopt the file from FHServer2
RFile file;
r=file.AdoptFromServer(fsh, ssh);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("RFile::TransferToClient()"));
// transfer the file to the client
r = file.TransferToClient(aMsg, 0);
- test(r==KErrNone);
+ test_KErrNone(r);
// test we can still use the file
TInt pos = 0;
r = file.Seek(ESeekStart, pos);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf8<100> rbuf;
r=file.Read(0,rbuf);
- test(r==KErrNone);
+ test_KErrNone(r);
r=rbuf.CompareF(KTestData1());
- test(r==KErrNone);
+ test_KErrNone(r);
handsvr2.Close();
@@ -277,28 +278,28 @@
// connect to FHServer2
RFileHandleSharer2 handsvr2;
TInt r = handsvr2.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
RFile file;
// Message slot 0 is a RFs handle
// Message slot 1 is a RFile Subsession handle (RFile::SubSessionHandle())
r = file.AdoptFromClient(aMsg, 0, 1);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf8<100> rbuf;
r=file.Read(0,rbuf);
- test(r==KErrNone);
+ test_KErrNone(r);
r=rbuf.CompareF(KTestData());
- test(r==KErrNone);
+ test_KErrNone(r);
r=file.Write(KTestData1());
- test(r==KErrAccessDenied);
+ test_Value(r, r ==KErrAccessDenied);
r=file.ChangeMode(EFileWrite);
- test(r==KErrArgument);
+ test_Value(r, r ==KErrArgument);
r=file.Rename(_L("\\newname.txt"));
- test(r==KErrPermissionDenied || r==KErrAccessDenied);
+ test_Value(r, r ==KErrPermissionDenied || r==KErrAccessDenied);
// should try a delete
// pass the file handle to FHServer2
@@ -307,15 +308,15 @@
TIpcArgs ipcArgs;
file.TransferToServer(ipcArgs, 0, 1);
r = handsvr2.PassFileHandle(ipcArgs);
- test(r==KErrNone);
+ test_KErrNone(r);
TInt pos = 0;
r = file.Seek(ESeekStart, pos);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file.Read(0,rbuf);
- test(r==KErrNone);
+ test_KErrNone(r);
r=rbuf.CompareF(KTestData());
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
@@ -334,33 +335,33 @@
RFile file;
TInt r = file.AdoptFromCreator(1, 2);
- test(r == KErrNone);
+ test_KErrNone(r);
TBuf8<100> rbuf;
r=file.Read(0,rbuf);
- test(r==KErrNone);
+ test_KErrNone(r);
r=rbuf.CompareF(KTestData());
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("RFile::Rename()"));
// define a filename in our private path
RFs fs;
r=fs.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
TFileName sessionp;
fs.SessionPath(sessionp);
r = fs.MkDirAll(sessionp);
- test(r==KErrNone || r==KErrAlreadyExists);
+ test_Value(r, r ==KErrNone || r==KErrAlreadyExists);
r=fs.ShareProtected();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs.CreatePrivatePath(gTestDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs.SetSessionToPrivate(gTestDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
TPath newPath;
fs.PrivatePath(newPath);
@@ -370,10 +371,10 @@
// delete the file before we try to rename anything to it
r = fs.Delete(newFileName);
- test(r == KErrNone || r == KErrNotFound);
+ test_Value(r, r == KErrNone || r == KErrNotFound);
r=file.Rename(newFileName);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
@@ -381,7 +382,7 @@
// have been moved to our private directory)
test.Next(_L("RFs::Delete()"));
r = fs.Delete(newFileName);
- test(r == KErrNone);
+ test_KErrNone(r);
fs.Close();
@@ -402,7 +403,7 @@
// Message slot 0 is a RFs handle
// Message slot 1 is a RFile Subsession handle (RFile::SubSessionHandle())
TInt r = file.AdoptFromClient(aMsg, 0, 1);
- test(r==KErrBadHandle);
+ test_Value(r, r ==KErrBadHandle);
aMsg.Complete(r);
@@ -647,10 +648,10 @@
// Sanity check for open handles
TInt end_thc, end_phc;
RThread().HandleCount(end_phc, end_thc);
- test(start_thc == end_thc);
+ test_Value(start_thc, start_thc == end_thc);
// test(start_phc == end_phc);
// and also for pending requests ...
- test(RThread().RequestCount() == 0);
+ test_Value(RThread().RequestCount(), RThread().RequestCount() == 0);
return KErrNone;
@@ -689,7 +690,7 @@
// start server2 in a seperate thread
RThread server2Thread;
TInt r = server2Thread.Create(_L("FHServer2"), FHServer2, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
- test(r==KErrNone);
+ test_KErrNone(r);
TRequestStatus statq;
server2Thread.Logon(statq);
server2Thread.Resume();
@@ -699,17 +700,17 @@
// wait for server2's thread to end gracefully
User::WaitForRequest(statq);
- test(statq == KErrNone);
+ test_KErrNone(statq.Int());
server2Thread.Close();
RFs cleanupfs;
r = cleanupfs.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=cleanupfs.SetSessionToPrivate(gTestDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=cleanupfs.Delete(KSvrFileName);
- test(r==KErrNone || r==KErrNotFound);
+ test_Value(r, r ==KErrNone || r==KErrNotFound);
cleanupfs.Close();
@@ -722,9 +723,9 @@
// Sanity check for open handles and pending requests
TInt end_thc, end_phc;
RThread().HandleCount(end_phc, end_thc);
- test(start_thc == end_thc);
- test(start_phc == end_phc);
- test(RThread().RequestCount() == 0);
+ test_Value(start_thc, start_thc == end_thc);
+ test_Value(start_phc, start_phc == end_phc);
+ test_Value(RThread().RequestCount(), RThread().RequestCount() == 0);
return 0;
}