--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/common/heap_hybrid.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -0,0 +1,3319 @@
+// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// kernel\eka\common\heap_hybrid.cpp
+//
+// Uses malloc (aka dlmalloc) written by Doug Lea version 2.8.4
+//
+
+#include "common.h"
+#ifdef __KERNEL_MODE__
+#include <kernel/kern_priv.h>
+#endif
+#include "dla.h"
+#ifndef __KERNEL_MODE__
+#include "slab.h"
+#include "page_alloc.h"
+#endif
+#include "heap_hybrid.h"
+
+// enables btrace code compiling into
+#define ENABLE_BTRACE
+
+// if non zero this causes the iSlabs to be configured only when the chunk size exceeds this level
+#define DELAYED_SLAB_THRESHOLD (64*1024) // 64KB seems about right based on trace data
+#define SLAB_CONFIG 0xabe // Use slabs of size 48, 40, 32, 24, 20, 16, 12, and 8 bytes
+
+#ifdef _DEBUG
+#define __SIMULATE_ALLOC_FAIL(s) if (CheckForSimulatedAllocFail()) {s}
+#define __ALLOC_DEBUG_HEADER(s) (s += EDebugHdrSize)
+#define __SET_DEBUG_DATA(p,n,c) (((SDebugCell*)(p))->nestingLevel = (n), ((SDebugCell*)(p))->allocCount = (c))
+#define __GET_USER_DATA_BFR(p) ((p!=0) ? (TUint8*)(p) + EDebugHdrSize : NULL)
+#define __GET_DEBUG_DATA_BFR(p) ((p!=0) ? (TUint8*)(p) - EDebugHdrSize : NULL)
+#define __ZAP_CELL(p) memset( (TUint8*)p, 0xde, (AllocLen(__GET_USER_DATA_BFR(p))+EDebugHdrSize))
+#define __DEBUG_SAVE(p) TInt dbgNestLevel = ((SDebugCell*)p)->nestingLevel
+#define __DEBUG_RESTORE(p) if (p) {((SDebugCell*)p)->nestingLevel = dbgNestLevel;}
+#define __DEBUG_HDR_SIZE EDebugHdrSize
+#define __REMOVE_DBG_HDR(n) (n*EDebugHdrSize)
+#define __GET_AVAIL_BLOCK_SIZE(s) ( (s<EDebugHdrSize) ? 0 : s-EDebugHdrSize )
+#define __UPDATE_ALLOC_COUNT(o,n,c) if (o!=n && n) {((SDebugCell*)n)->allocCount = (c);}
+#define __INIT_COUNTERS(i) iCellCount=i,iTotalAllocSize=i
+#define __INCREMENT_COUNTERS(p) iCellCount++, iTotalAllocSize += AllocLen(p)
+#define __DECREMENT_COUNTERS(p) iCellCount--, iTotalAllocSize -= AllocLen(p)
+#define __UPDATE_TOTAL_ALLOC(p,s) iTotalAllocSize += (AllocLen(__GET_USER_DATA_BFR(p)) - s)
+
+#else
+#define __SIMULATE_ALLOC_FAIL(s)
+#define __ALLOC_DEBUG_HEADER(s)
+#define __SET_DEBUG_DATA(p,n,c)
+#define __GET_USER_DATA_BFR(p) (p)
+#define __GET_DEBUG_DATA_BFR(p) (p)
+#define __ZAP_CELL(p)
+#define __DEBUG_SAVE(p)
+#define __DEBUG_RESTORE(p)
+#define __DEBUG_HDR_SIZE 0
+#define __REMOVE_DBG_HDR(n) 0
+#define __GET_AVAIL_BLOCK_SIZE(s) (s)
+#define __UPDATE_ALLOC_COUNT(o,n,c)
+#define __INIT_COUNTERS(i) iCellCount=i,iTotalAllocSize=i
+#define __INCREMENT_COUNTERS(p)
+#define __DECREMENT_COUNTERS(p)
+#define __UPDATE_TOTAL_ALLOC(p,s)
+
+#endif
+
+
+#define MEMORY_MONITORED (iFlags & EMonitorMemory)
+#define GM (&iGlobalMallocState)
+#define IS_FIXED_HEAP (iFlags & EFixedSize)
+#define __INIT_COUNTERS(i) iCellCount=i,iTotalAllocSize=i
+#define __POWER_OF_2(x) (!((x)&((x)-1)))
+
+#define __DL_BFR_CHECK(M,P) \
+ if ( MEMORY_MONITORED ) \
+ if ( !IS_ALIGNED(P) || ((TUint8*)(P)<M->iSeg.iBase) || ((TUint8*)(P)>(M->iSeg.iBase+M->iSeg.iSize))) \
+ BTraceContext12(BTrace::EHeap, BTrace::EHeapCorruption, (TUint32)this, (TUint32)P, (TUint32)0), HEAP_PANIC(ETHeapBadCellAddress); \
+ else DoCheckInuseChunk(M, MEM2CHUNK(P))
+
+#ifndef __KERNEL_MODE__
+
+#define __SLAB_BFR_CHECK(S,P,B) \
+ if ( MEMORY_MONITORED ) \
+ if ( ((TUint32)P & 0x3) || ((TUint8*)P<iMemBase) || ((TUint8*)(P)>(TUint8*)this)) \
+ BTraceContext12(BTrace::EHeap, BTrace::EHeapCorruption, (TUint32)this, (TUint32)P, (TUint32)S), HEAP_PANIC(ETHeapBadCellAddress); \
+ else DoCheckSlab(S, EPartialFullSlab, P), BuildPartialSlabBitmap(B,S,P)
+#define __PAGE_BFR_CHECK(P) \
+ if ( MEMORY_MONITORED ) \
+ if ( ((TUint32)P & ((1 << iPageSize)-1)) || ((TUint8*)P<iMemBase) || ((TUint8*)(P)>(TUint8*)this)) \
+ BTraceContext12(BTrace::EHeap, BTrace::EHeapCorruption, (TUint32)this, (TUint32)P, (TUint32)0), HEAP_PANIC(ETHeapBadCellAddress)
+
+#endif
+
+#ifdef _MSC_VER
+// This is required while we are still using VC6 to compile, so as to avoid warnings that cannot be fixed
+// without having to edit the original Doug Lea source. The 4146 warnings are due to the original code having
+// a liking for negating unsigned numbers and the 4127 warnings are due to the original code using the RTCHECK
+// macro with values that are always defined as 1. It is better to turn these warnings off than to introduce
+// diffs between the original Doug Lea implementation and our adaptation of it
+#pragma warning( disable : 4146 ) /* unary minus operator applied to unsigned type, result still unsigned */
+#pragma warning( disable : 4127 ) /* conditional expression is constant */
+#endif // _MSC_VER
+
+
+/**
+@SYMPatchable
+@publishedPartner
+@released
+
+Defines the minimum cell size of a heap.
+
+The constant can be changed at ROM build time using patchdata OBY keyword.
+
+@deprecated Patching this constant no longer has any effect.
+*/
+#ifdef __X86GCC__ // For X86GCC we dont use the proper data import attribute
+#undef IMPORT_D // since the constants are not really imported. GCC doesn't
+#define IMPORT_D // allow imports from self.
+#endif
+IMPORT_D extern const TInt KHeapMinCellSize;
+
+/**
+@SYMPatchable
+@publishedPartner
+@released
+
+This constant defines the ratio that determines the amount of hysteresis between heap growing and heap
+shrinking.
+It is a 32-bit fixed point number where the radix point is defined to be
+between bits 7 and 8 (where the LSB is bit 0) i.e. using standard notation, a Q8 or a fx24.8
+fixed point number. For example, for a ratio of 2.0, set KHeapShrinkHysRatio=0x200.
+
+The heap shrinking hysteresis value is calculated to be:
+@code
+KHeapShrinkHysRatio*(iGrowBy>>8)
+@endcode
+where iGrowBy is a page aligned value set by the argument, aGrowBy, to the RHeap constructor.
+The default hysteresis value is iGrowBy bytes i.e. KHeapShrinkHysRatio=2.0.
+
+Memory usage may be improved by reducing the heap shrinking hysteresis
+by setting 1.0 < KHeapShrinkHysRatio < 2.0. Heap shrinking hysteresis is disabled/removed
+when KHeapShrinkHysRatio <= 1.0.
+
+The constant can be changed at ROM build time using patchdata OBY keyword.
+*/
+IMPORT_D extern const TInt KHeapShrinkHysRatio;
+
+UEXPORT_C TInt RHeap::AllocLen(const TAny* aCell) const
+{
+ const MAllocator* m = this;
+ return m->AllocLen(aCell);
+}
+
+UEXPORT_C TAny* RHeap::Alloc(TInt aSize)
+{
+ const MAllocator* m = this;
+ return ((MAllocator*)m)->Alloc(aSize);
+}
+
+UEXPORT_C void RHeap::Free(TAny* aCell)
+{
+ const MAllocator* m = this;
+ ((MAllocator*)m)->Free(aCell);
+}
+
+UEXPORT_C TAny* RHeap::ReAlloc(TAny* aCell, TInt aSize, TInt aMode)
+{
+ const MAllocator* m = this;
+ return ((MAllocator*)m)->ReAlloc(aCell, aSize, aMode);
+}
+
+UEXPORT_C TInt RHeap::DebugFunction(TInt aFunc, TAny* a1, TAny* a2)
+{
+ const MAllocator* m = this;
+ return ((MAllocator*)m)->DebugFunction(aFunc, a1, a2);
+}
+
+UEXPORT_C TInt RHeap::Extension_(TUint aExtensionId, TAny*& a0, TAny* a1)
+{
+ const MAllocator* m = this;
+ return ((MAllocator*)m)->Extension_(aExtensionId, a0, a1);
+}
+
+#ifndef __KERNEL_MODE__
+
+EXPORT_C TInt RHeap::AllocSize(TInt& aTotalAllocSize) const
+{
+ const MAllocator* m = this;
+ return m->AllocSize(aTotalAllocSize);
+}
+
+EXPORT_C TInt RHeap::Available(TInt& aBiggestBlock) const
+{
+ const MAllocator* m = this;
+ return m->Available(aBiggestBlock);
+}
+
+EXPORT_C void RHeap::Reset()
+{
+ const MAllocator* m = this;
+ ((MAllocator*)m)->Reset();
+}
+
+EXPORT_C TInt RHeap::Compress()
+{
+ const MAllocator* m = this;
+ return ((MAllocator*)m)->Compress();
+}
+#endif
+
+RHybridHeap::RHybridHeap()
+ {
+ // This initialisation cannot be done in RHeap() for compatibility reasons
+ iMaxLength = iChunkHandle = iNestingLevel = 0;
+ iTop = NULL;
+ iFailType = ENone;
+ iTestData = NULL;
+ }
+
+void RHybridHeap::operator delete(TAny*, TAny*)
+/**
+Called if constructor issued by operator new(TUint aSize, TAny* aBase) throws exception.
+This is dummy as corresponding new operator does not allocate memory.
+*/
+{}
+
+
+#ifndef __KERNEL_MODE__
+void RHybridHeap::Lock() const
+ /**
+ @internalComponent
+*/
+ {((RFastLock&)iLock).Wait();}
+
+
+void RHybridHeap::Unlock() const
+ /**
+ @internalComponent
+*/
+ {((RFastLock&)iLock).Signal();}
+
+
+TInt RHybridHeap::ChunkHandle() const
+ /**
+ @internalComponent
+*/
+{
+ return iChunkHandle;
+}
+
+#else
+//
+// This method is implemented in kheap.cpp
+//
+//void RHybridHeap::Lock() const
+ /**
+ @internalComponent
+*/
+// {;}
+
+
+
+//
+// This method is implemented in kheap.cpp
+//
+//void RHybridHeap::Unlock() const
+ /**
+ @internalComponent
+*/
+// {;}
+
+
+TInt RHybridHeap::ChunkHandle() const
+ /**
+ @internalComponent
+*/
+{
+ return 0;
+}
+#endif
+
+RHybridHeap::RHybridHeap(TInt aChunkHandle, TInt aOffset, TInt aMinLength, TInt aMaxLength, TInt aGrowBy, TInt aAlign, TBool aSingleThread, TBool aDLOnly, TBool aUseAdjust)
+/**
+Constructor for a non fixed heap. Unlike the fixed heap, this heap is quite flexible in terms of its minimum and
+maximum lengths and in that it can use the hybrid allocator if all of its requirements are met.
+*/
+ : iOffset(aOffset), iChunkSize(aMinLength)
+ {
+ __ASSERT_ALWAYS(iOffset>=0, HEAP_PANIC(ETHeapNewBadOffset));
+
+ iChunkHandle = aChunkHandle;
+ iMinLength = aMinLength;
+ iMaxLength = aMaxLength;
+
+ // If the user has explicitly specified 0 as the aGrowBy value, set it to 1 so that it will be rounded up to the nearst page size
+ if (aGrowBy == 0)
+ aGrowBy = 1;
+ GET_PAGE_SIZE(iPageSize);
+ iGrowBy = _ALIGN_UP(aGrowBy, iPageSize);
+
+ Construct(aSingleThread, aDLOnly, aUseAdjust, aAlign);
+ }
+
+RHybridHeap::RHybridHeap(TInt aMaxLength, TInt aAlign, TBool aSingleThread)
+/**
+Constructor for a fixed heap. We have restrictions in that we have fixed minimum and maximum lengths and cannot grow
+and we only use DL allocator.
+*/
+ : iOffset(0), iChunkSize(aMaxLength)
+ {
+ iChunkHandle = NULL;
+ iMinLength = aMaxLength;
+ iMaxLength = aMaxLength;
+ iGrowBy = 0;
+
+ Construct(aSingleThread, ETrue, ETrue, aAlign);
+ }
+
+TAny* RHybridHeap::operator new(TUint aSize, TAny* aBase) __NO_THROW
+{
+ __ASSERT_ALWAYS(aSize>=sizeof(RHybridHeap), HEAP_PANIC(ETHeapNewBadSize));
+ RHybridHeap* h = (RHybridHeap*)aBase;
+ h->iBase = ((TUint8*)aBase) + aSize;
+ return aBase;
+}
+
+void RHybridHeap::Construct(TBool aSingleThread, TBool aDLOnly, TBool aUseAdjust, TInt aAlign)
+{
+ iAlign = aAlign ? aAlign : RHybridHeap::ECellAlignment;
+ __ASSERT_ALWAYS((TUint32)iAlign>=sizeof(TAny*) && __POWER_OF_2(iAlign), HEAP_PANIC(ETHeapNewBadAlignment));
+
+ // This initialisation cannot be done in RHeap() for compatibility reasons
+ iTop = NULL;
+ iFailType = ENone;
+ iNestingLevel = 0;
+ iTestData = NULL;
+
+ iHighWaterMark = iMinLength;
+ iAllocCount = 0;
+ iFlags = aSingleThread ? ESingleThreaded : 0;
+ iGrowBy = _ALIGN_UP(iGrowBy, iPageSize);
+
+ if ( iMinLength == iMaxLength )
+ {
+ iFlags |= EFixedSize;
+ aDLOnly = ETrue;
+ }
+#ifndef __KERNEL_MODE__
+#ifdef DELAYED_SLAB_THRESHOLD
+ iSlabInitThreshold = DELAYED_SLAB_THRESHOLD;
+#else
+ iSlabInitThreshold = 0;
+#endif // DELAYED_SLAB_THRESHOLD
+ iUseAdjust = aUseAdjust;
+ iDLOnly = aDLOnly;
+#else
+ (void)aUseAdjust;
+#endif
+ // Initialise suballocators
+ // if DL only is required then it cannot allocate slab or page memory
+ // so these sub-allocators should be disabled. Otherwise initialise with default values
+ if ( aDLOnly )
+ {
+ Init(0, 0);
+ }
+ else
+ {
+ Init(SLAB_CONFIG, 16);
+ }
+
+#ifdef ENABLE_BTRACE
+
+ TUint32 traceData[4];
+ traceData[0] = iMinLength;
+ traceData[1] = iMaxLength;
+ traceData[2] = iGrowBy;
+ traceData[3] = iAlign;
+ BTraceContextN(BTrace::ETest1, 90, (TUint32)this, 11, traceData, sizeof(traceData));
+#endif
+
+}
+
+#ifndef __KERNEL_MODE__
+TInt RHybridHeap::ConstructLock(TUint32 aMode)
+{
+ TBool duplicateLock = EFalse;
+ TInt r = KErrNone;
+ if (!(iFlags & ESingleThreaded))
+ {
+ duplicateLock = aMode & UserHeap::EChunkHeapSwitchTo;
+ r = iLock.CreateLocal(duplicateLock ? EOwnerThread : EOwnerProcess);
+ if( r != KErrNone)
+ {
+ iChunkHandle = 0;
+ return r;
+ }
+ }
+
+ if ( aMode & UserHeap::EChunkHeapSwitchTo )
+ User::SwitchHeap(this);
+
+ iHandles = &iChunkHandle;
+ if (!(iFlags & ESingleThreaded))
+ {
+ // now change the thread-relative chunk/semaphore handles into process-relative handles
+ iHandleCount = 2;
+ if(duplicateLock)
+ {
+ RHandleBase s = iLock;
+ r = iLock.Duplicate(RThread());
+ s.Close();
+ }
+ if (r==KErrNone && (aMode & UserHeap::EChunkHeapDuplicate))
+ {
+ r = ((RChunk*)&iChunkHandle)->Duplicate(RThread());
+ if (r!=KErrNone)
+ iLock.Close(), iChunkHandle=0;
+ }
+ }
+ else
+ {
+ iHandleCount = 1;
+ if (aMode & UserHeap::EChunkHeapDuplicate)
+ r = ((RChunk*)&iChunkHandle)->Duplicate(RThread(), EOwnerThread);
+ }
+
+ return r;
+}
+#endif
+
+void RHybridHeap::Init(TInt aBitmapSlab, TInt aPagePower)
+{
+ /*Moved code which does initilization */
+ iTop = (TUint8*)this + iMinLength;
+ iBase = Ceiling(iBase, ECellAlignment); // Align iBase address
+
+ __INIT_COUNTERS(0);
+ // memset(&mparams,0,sizeof(mparams));
+
+ InitDlMalloc(iTop - iBase, 0);
+
+#ifndef __KERNEL_MODE__
+ SlabInit();
+ iSlabConfigBits = aBitmapSlab;
+ if ( iChunkSize > iSlabInitThreshold )
+ {
+ iSlabInitThreshold = KMaxTInt32;
+ SlabConfig(aBitmapSlab); // Delayed slab configuration done
+ }
+ if ( aPagePower )
+ {
+ RChunk chunk;
+ chunk.SetHandle(iChunkHandle);
+ iMemBase = chunk.Base(); // Store base address for paged allocator
+ }
+
+ /*10-1K,11-2K,12-4k,13-8K,14-16K,15-32K,16-64K*/
+ PagedInit(aPagePower);
+
+#ifdef ENABLE_BTRACE
+ TUint32 traceData[3];
+ traceData[0] = aBitmapSlab;
+ traceData[1] = aPagePower;
+ traceData[2] = GM->iTrimCheck;
+ BTraceContextN(BTrace::ETest1, 90, (TUint32)this, 0, traceData, sizeof(traceData));
+#endif
+#else
+ (void)aBitmapSlab;
+ (void)aPagePower;
+#endif // __KERNEL_MODE__
+
+}
+
+
+TInt RHybridHeap::AllocLen(const TAny* aCell) const
+{
+ aCell = __GET_DEBUG_DATA_BFR(aCell);
+
+ if (PtrDiff(aCell, this) >= 0)
+ {
+ mchunkptr m = MEM2CHUNK(aCell);
+ return CHUNKSIZE(m) - OVERHEAD_FOR(m) - __DEBUG_HDR_SIZE;
+ }
+#ifndef __KERNEL_MODE__
+ if ( aCell )
+ {
+ if (LowBits(aCell, iPageSize) )
+ return SlabHeaderSize(slab::SlabFor(aCell)->iHeader) - __DEBUG_HDR_SIZE;
+
+ return PagedSize((void*)aCell) - __DEBUG_HDR_SIZE;
+ }
+#endif
+ return 0; // NULL pointer situation, should PANIC !!
+}
+
+#ifdef __KERNEL_MODE__
+TAny* RHybridHeap::Alloc(TInt aSize)
+{
+ __CHECK_THREAD_STATE;
+ __ASSERT_ALWAYS((TUint)aSize<(KMaxTInt/2),HEAP_PANIC(ETHeapBadAllocatedCellSize));
+ __SIMULATE_ALLOC_FAIL(return NULL;)
+ Lock();
+ __ALLOC_DEBUG_HEADER(aSize);
+ TAny* addr = DlMalloc(aSize);
+ if ( addr )
+ {
+// iCellCount++;
+ __SET_DEBUG_DATA(addr, iNestingLevel, ++iAllocCount);
+ addr = __GET_USER_DATA_BFR(addr);
+ __INCREMENT_COUNTERS(addr);
+ memclr(addr, AllocLen(addr));
+ }
+ Unlock();
+#ifdef ENABLE_BTRACE
+ if (iFlags & ETraceAllocs)
+ {
+ if ( addr )
+ {
+ TUint32 traceData[3];
+ traceData[0] = AllocLen(addr);
+ traceData[1] = aSize - __DEBUG_HDR_SIZE;
+ traceData[2] = 0;
+ BTraceContextN(BTrace::EHeap, BTrace::EHeapAlloc, (TUint32)this, (TUint32)addr, traceData, sizeof(traceData));
+ }
+ else
+ BTraceContext8(BTrace::EHeap, BTrace::EHeapAllocFail, (TUint32)this, (TUint32)(aSize - __DEBUG_HDR_SIZE));
+ }
+#endif
+ return addr;
+}
+#else
+
+TAny* RHybridHeap::Alloc(TInt aSize)
+{
+ __ASSERT_ALWAYS((TUint)aSize<(KMaxTInt/2),HEAP_PANIC(ETHeapBadAllocatedCellSize));
+ __SIMULATE_ALLOC_FAIL(return NULL;)
+
+ TAny* addr;
+#ifdef ENABLE_BTRACE
+ TInt aSubAllocator=0;
+#endif
+
+ Lock();
+
+ __ALLOC_DEBUG_HEADER(aSize);
+
+ if (aSize < iSlabThreshold)
+ {
+ TInt ix = iSizeMap[(aSize+3)>>2];
+ HEAP_ASSERT(ix != 0xff);
+ addr = SlabAllocate(iSlabAlloc[ix]);
+ if ( !addr )
+ { // Slab allocation has failed, try to allocate from DL
+ addr = DlMalloc(aSize);
+ }
+#ifdef ENABLE_BTRACE
+ else
+ aSubAllocator=1;
+#endif
+ }else if((aSize >> iPageThreshold)==0)
+ {
+ addr = DlMalloc(aSize);
+ }
+ else
+ {
+ addr = PagedAllocate(aSize);
+ if ( !addr )
+ { // Page allocation has failed, try to allocate from DL
+ addr = DlMalloc(aSize);
+ }
+#ifdef ENABLE_BTRACE
+ else
+ aSubAllocator=2;
+#endif
+ }
+
+ if ( addr )
+ {
+// iCellCount++;
+ __SET_DEBUG_DATA(addr, iNestingLevel, ++iAllocCount);
+ addr = __GET_USER_DATA_BFR(addr);
+ __INCREMENT_COUNTERS(addr);
+ }
+ Unlock();
+
+#ifdef ENABLE_BTRACE
+ if (iFlags & ETraceAllocs)
+ {
+ if ( addr )
+ {
+ TUint32 traceData[3];
+ traceData[0] = AllocLen(addr);
+ traceData[1] = aSize - __DEBUG_HDR_SIZE;
+ traceData[2] = aSubAllocator;
+ BTraceContextN(BTrace::EHeap, BTrace::EHeapAlloc, (TUint32)this, (TUint32)addr, traceData, sizeof(traceData));
+ }
+ else
+ BTraceContext8(BTrace::EHeap, BTrace::EHeapAllocFail, (TUint32)this, (TUint32)(aSize - __DEBUG_HDR_SIZE));
+ }
+#endif
+
+ return addr;
+}
+#endif // __KERNEL_MODE__
+
+#ifndef __KERNEL_MODE__
+TInt RHybridHeap::Compress()
+{
+ if ( IS_FIXED_HEAP )
+ return 0;
+
+ Lock();
+ TInt Reduced = SysTrim(GM, 0);
+ if (iSparePage)
+ {
+ Unmap(iSparePage, iPageSize);
+ iSparePage = 0;
+ Reduced += iPageSize;
+ }
+ Unlock();
+ return Reduced;
+}
+#endif
+
+void RHybridHeap::Free(TAny* aPtr)
+{
+ __CHECK_THREAD_STATE;
+ if ( !aPtr )
+ return;
+#ifdef ENABLE_BTRACE
+ TInt aSubAllocator=0;
+#endif
+ Lock();
+
+ aPtr = __GET_DEBUG_DATA_BFR(aPtr);
+
+#ifndef __KERNEL_MODE__
+ if (PtrDiff(aPtr, this) >= 0)
+ {
+#endif
+ __DL_BFR_CHECK(GM, aPtr);
+ __DECREMENT_COUNTERS(__GET_USER_DATA_BFR(aPtr));
+ __ZAP_CELL(aPtr);
+ DlFree( aPtr);
+#ifndef __KERNEL_MODE__
+ }
+
+ else if ( LowBits(aPtr, iPageSize) == 0 )
+ {
+#ifdef ENABLE_BTRACE
+ aSubAllocator = 2;
+#endif
+ __PAGE_BFR_CHECK(aPtr);
+ __DECREMENT_COUNTERS(__GET_USER_DATA_BFR(aPtr));
+ PagedFree(aPtr);
+ }
+ else
+ {
+#ifdef ENABLE_BTRACE
+ aSubAllocator = 1;
+#endif
+ TUint32 bm[4];
+ __SLAB_BFR_CHECK(slab::SlabFor(aPtr),aPtr,bm);
+ __DECREMENT_COUNTERS(__GET_USER_DATA_BFR(aPtr));
+ __ZAP_CELL(aPtr);
+ SlabFree(aPtr);
+ }
+#endif // __KERNEL_MODE__
+// iCellCount--;
+ Unlock();
+#ifdef ENABLE_BTRACE
+ if (iFlags & ETraceAllocs)
+ {
+ TUint32 traceData;
+ traceData = aSubAllocator;
+ BTraceContextN(BTrace::EHeap, BTrace::EHeapFree, (TUint32)this, (TUint32)__GET_USER_DATA_BFR(aPtr), &traceData, sizeof(traceData));
+ }
+#endif
+}
+
+#ifndef __KERNEL_MODE__
+void RHybridHeap::Reset()
+/**
+Frees all allocated cells on this heap.
+*/
+{
+ Lock();
+ if ( !IS_FIXED_HEAP )
+ {
+ if ( GM->iSeg.iSize > (iMinLength - sizeof(*this)) )
+ Unmap(GM->iSeg.iBase + (iMinLength - sizeof(*this)), (GM->iSeg.iSize - (iMinLength - sizeof(*this))));
+ ResetBitmap();
+ if ( !iDLOnly )
+ Init(iSlabConfigBits, iPageThreshold);
+ else
+ Init(0,0);
+ }
+ else Init(0,0);
+ Unlock();
+}
+#endif
+
+TAny* RHybridHeap::ReAllocImpl(TAny* aPtr, TInt aSize, TInt aMode)
+{
+ // First handle special case of calling reallocate with NULL aPtr
+ if (!aPtr)
+ {
+ if (( aMode & ENeverMove ) == 0 )
+ {
+ aPtr = Alloc(aSize - __DEBUG_HDR_SIZE);
+ aPtr = __GET_DEBUG_DATA_BFR(aPtr);
+ }
+ return aPtr;
+ }
+
+ TInt oldsize = AllocLen(__GET_USER_DATA_BFR(aPtr)) + __DEBUG_HDR_SIZE;
+
+ // Insist on geometric growth when reallocating memory, this reduces copying and fragmentation
+ // generated during arithmetic growth of buffer/array/vector memory
+ // Experiments have shown that 25% is a good threshold for this policy
+ if (aSize <= oldsize)
+ {
+ if (aSize >= oldsize - (oldsize>>2))
+ return aPtr; // don't change if >75% original size
+ }
+ else
+ {
+ __SIMULATE_ALLOC_FAIL(return NULL;)
+ if (aSize < oldsize + (oldsize>>2))
+ {
+ aSize = _ALIGN_UP(oldsize + (oldsize>>2), 4); // grow to at least 125% original size
+ }
+ }
+ __DEBUG_SAVE(aPtr);
+
+ TAny* newp;
+#ifdef __KERNEL_MODE__
+ Lock();
+ __DL_BFR_CHECK(GM, aPtr);
+ newp = DlRealloc(aPtr, aSize, aMode);
+ Unlock();
+ if ( newp )
+ {
+ if ( aSize > oldsize )
+ memclr(((TUint8*)newp) + oldsize, (aSize-oldsize)); // Buffer has grown in place, clear extra
+ __DEBUG_RESTORE(newp);
+ __UPDATE_ALLOC_COUNT(aPtr, newp, ++iAllocCount);
+ __UPDATE_TOTAL_ALLOC(newp, oldsize);
+ }
+#else
+ // Decide how to reallocate based on (a) the current cell location, (b) the mode requested and (c) the new size
+ if ( PtrDiff(aPtr, this) >= 0 )
+ { // current cell in Doug Lea iArena
+ if ( (aMode & ENeverMove)
+ ||
+ (!(aMode & EAllowMoveOnShrink) && (aSize < oldsize))
+ ||
+ ((aSize >= iSlabThreshold) && ((aSize >> iPageThreshold) == 0)) )
+ {
+ Lock();
+ __DL_BFR_CHECK(GM, aPtr);
+ newp = DlRealloc(aPtr, aSize, aMode); // old and new in DL allocator
+ Unlock();
+ __DEBUG_RESTORE(newp);
+ __UPDATE_ALLOC_COUNT(aPtr,newp, ++iAllocCount);
+ __UPDATE_TOTAL_ALLOC(newp, oldsize);
+ return newp;
+ }
+ }
+ else if (LowBits(aPtr, iPageSize) == 0)
+ { // current cell in paged iArena
+ if ( (aMode & ENeverMove)
+ ||
+ (!(aMode & EAllowMoveOnShrink) && (aSize < oldsize))
+ ||
+ ((aSize >> iPageThreshold) != 0) )
+ {
+ Lock();
+ __PAGE_BFR_CHECK(aPtr);
+ newp = PagedReallocate(aPtr, aSize, aMode); // old and new in paged allocator
+ Unlock();
+ __DEBUG_RESTORE(newp);
+ __UPDATE_ALLOC_COUNT(aPtr,newp, ++iAllocCount);
+ __UPDATE_TOTAL_ALLOC(newp, oldsize);
+ return newp;
+ }
+ }
+ else
+ { // current cell in slab iArena
+ TUint32 bm[4];
+ Lock();
+ __SLAB_BFR_CHECK(slab::SlabFor(aPtr), aPtr, bm);
+ Unlock();
+ if ( aSize <= oldsize)
+ return aPtr;
+ if (aMode & ENeverMove)
+ return NULL; // cannot grow in slab iArena
+ // just use alloc/copy/free...
+ }
+
+ // fallback to allocate and copy
+ // shouldn't get here if we cannot move the cell
+ // __ASSERT(mode == emobile || (mode==efixshrink && size>oldsize));
+
+ newp = Alloc(aSize - __DEBUG_HDR_SIZE);
+ newp = __GET_DEBUG_DATA_BFR(newp);
+ if (newp)
+ {
+ memcpy(newp, aPtr, oldsize<aSize ? oldsize : aSize);
+ __DEBUG_RESTORE(newp);
+ Free(__GET_USER_DATA_BFR(aPtr));
+ }
+
+#endif // __KERNEL_MODE__
+ return newp;
+}
+
+
+TAny* RHybridHeap::ReAlloc(TAny* aPtr, TInt aSize, TInt aMode )
+{
+
+ aPtr = __GET_DEBUG_DATA_BFR(aPtr);
+ __ALLOC_DEBUG_HEADER(aSize);
+
+ TAny* retval = ReAllocImpl(aPtr, aSize, aMode);
+
+ retval = __GET_USER_DATA_BFR(retval);
+
+#ifdef ENABLE_BTRACE
+ if (iFlags & ETraceAllocs)
+ {
+ if ( retval )
+ {
+ TUint32 traceData[3];
+ traceData[0] = AllocLen(retval);
+ traceData[1] = aSize - __DEBUG_HDR_SIZE;
+ traceData[2] = (TUint32)aPtr;
+ BTraceContextN(BTrace::EHeap, BTrace::EHeapReAlloc,(TUint32)this, (TUint32)retval, traceData, sizeof(traceData));
+ }
+ else
+ BTraceContext12(BTrace::EHeap, BTrace::EHeapReAllocFail, (TUint32)this, (TUint32)aPtr, (TUint32)(aSize - __DEBUG_HDR_SIZE));
+ }
+#endif
+ return retval;
+}
+
+#ifndef __KERNEL_MODE__
+TInt RHybridHeap::Available(TInt& aBiggestBlock) const
+/**
+Gets the total free space currently available on the heap and the space
+available in the largest free block.
+
+Note that this function exists mainly for compatibility reasons. In a modern
+heap implementation such as that present in Symbian it is not appropriate to
+concern oneself with details such as the amount of free memory available on a
+heap and its largeset free block, because the way that a modern heap implmentation
+works is not simple. The amount of available virtual memory != physical memory
+and there are multiple allocation strategies used internally, which makes all
+memory usage figures "fuzzy" at best.
+
+In short, if you want to see if there is enough memory available to allocate a
+block of memory, call Alloc() and if it succeeds then there is enough memory!
+Messing around with functions like this is somewhat pointless with modern heap
+allocators.
+
+@param aBiggestBlock On return, contains the space available in the largest
+ free block on the heap. Due to the internals of modern
+ heap implementations, you can probably still allocate a
+ block larger than this!
+
+@return The total free space currently available on the heap. Again, you can
+ probably still allocate more than this!
+*/
+{
+ struct HeapInfo info;
+ Lock();
+ TInt Biggest = GetInfo(&info);
+ aBiggestBlock = __GET_AVAIL_BLOCK_SIZE(Biggest);
+ Unlock();
+ return __GET_AVAIL_BLOCK_SIZE(info.iFreeBytes);
+
+}
+
+TInt RHybridHeap::AllocSize(TInt& aTotalAllocSize) const
+ /**
+ Gets the number of cells allocated on this heap, and the total space
+ allocated to them.
+
+ @param aTotalAllocSize On return, contains the total space allocated
+ to the cells.
+
+ @return The number of cells allocated on this heap.
+*/
+{
+ struct HeapInfo info;
+ Lock();
+ GetInfo(&info);
+ aTotalAllocSize = info.iAllocBytes - __REMOVE_DBG_HDR(info.iAllocN);
+ Unlock();
+ return info.iAllocN;
+}
+
+#endif
+
+TInt RHybridHeap::Extension_(TUint /* aExtensionId */, TAny*& /* a0 */, TAny* /* a1 */)
+{
+ return KErrNotSupported;
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// imported from dla.cpp
+///////////////////////////////////////////////////////////////////////////////
+
+//#include <unistd.h>
+//#define DEBUG_REALLOC
+#ifdef DEBUG_REALLOC
+#include <e32debug.h>
+#endif
+
+inline void RHybridHeap::InitBins(mstate m)
+{
+ /* Establish circular links for iSmallBins */
+ bindex_t i;
+ for (i = 0; i < NSMALLBINS; ++i) {
+ sbinptr bin = SMALLBIN_AT(m,i);
+ bin->iFd = bin->iBk = bin;
+ }
+ }
+/* ---------------------------- malloc support --------------------------- */
+
+/* allocate a large request from the best fitting chunk in a treebin */
+void* RHybridHeap::TmallocLarge(mstate m, size_t nb) {
+ tchunkptr v = 0;
+ size_t rsize = -nb; /* Unsigned negation */
+ tchunkptr t;
+ bindex_t idx;
+ ComputeTreeIndex(nb, idx);
+
+ if ((t = *TREEBIN_AT(m, idx)) != 0)
+ {
+ /* Traverse tree for this bin looking for node with size == nb */
+ size_t sizebits = nb << LEFTSHIFT_FOR_TREE_INDEX(idx);
+ tchunkptr rst = 0; /* The deepest untaken right subtree */
+ for (;;)
+ {
+ tchunkptr rt;
+ size_t trem = CHUNKSIZE(t) - nb;
+ if (trem < rsize)
+ {
+ v = t;
+ if ((rsize = trem) == 0)
+ break;
+ }
+ rt = t->iChild[1];
+ t = t->iChild[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1];
+ if (rt != 0 && rt != t)
+ rst = rt;
+ if (t == 0)
+ {
+ t = rst; /* set t to least subtree holding sizes > nb */
+ break;
+ }
+ sizebits <<= 1;
+ }
+ }
+ if (t == 0 && v == 0)
+ { /* set t to root of next non-empty treebin */
+ binmap_t leftbits = LEFT_BITS(IDX2BIT(idx)) & m->iTreeMap;
+ if (leftbits != 0)
+ {
+ bindex_t i;
+ binmap_t leastbit = LEAST_BIT(leftbits);
+ ComputeBit2idx(leastbit, i);
+ t = *TREEBIN_AT(m, i);
+ }
+ }
+ while (t != 0)
+ { /* Find smallest of tree or subtree */
+ size_t trem = CHUNKSIZE(t) - nb;
+ if (trem < rsize) {
+ rsize = trem;
+ v = t;
+ }
+ t = LEFTMOST_CHILD(t);
+ }
+ /* If iDv is a better fit, return 0 so malloc will use it */
+ if (v != 0 && rsize < (size_t)(m->iDvSize - nb))
+ {
+ if (RTCHECK(OK_ADDRESS(m, v)))
+ { /* split */
+ mchunkptr r = CHUNK_PLUS_OFFSET(v, nb);
+ HEAP_ASSERT(CHUNKSIZE(v) == rsize + nb);
+ if (RTCHECK(OK_NEXT(v, r)))
+ {
+ UnlinkLargeChunk(m, v);
+ if (rsize < MIN_CHUNK_SIZE)
+ SET_INUSE_AND_PINUSE(m, v, (rsize + nb));
+ else
+ {
+ SET_SIZE_AND_PINUSE_OF_INUSE_CHUNK(m, v, nb);
+ SET_SIZE_AND_PINUSE_OF_FREE_CHUNK(r, rsize);
+ InsertChunk(m, r, rsize);
+ }
+ return CHUNK2MEM(v);
+ }
+ }
+ // CORRUPTION_ERROR_ACTION(m);
+ }
+ return 0;
+ }
+
+/* allocate a small request from the best fitting chunk in a treebin */
+void* RHybridHeap::TmallocSmall(mstate m, size_t nb)
+{
+ tchunkptr t, v;
+ size_t rsize;
+ bindex_t i;
+ binmap_t leastbit = LEAST_BIT(m->iTreeMap);
+ ComputeBit2idx(leastbit, i);
+
+ v = t = *TREEBIN_AT(m, i);
+ rsize = CHUNKSIZE(t) - nb;
+
+ while ((t = LEFTMOST_CHILD(t)) != 0)
+ {
+ size_t trem = CHUNKSIZE(t) - nb;
+ if (trem < rsize)
+ {
+ rsize = trem;
+ v = t;
+ }
+ }
+
+ if (RTCHECK(OK_ADDRESS(m, v)))
+ {
+ mchunkptr r = CHUNK_PLUS_OFFSET(v, nb);
+ HEAP_ASSERT(CHUNKSIZE(v) == rsize + nb);
+ if (RTCHECK(OK_NEXT(v, r)))
+ {
+ UnlinkLargeChunk(m, v);
+ if (rsize < MIN_CHUNK_SIZE)
+ SET_INUSE_AND_PINUSE(m, v, (rsize + nb));
+ else
+ {
+ SET_SIZE_AND_PINUSE_OF_INUSE_CHUNK(m, v, nb);
+ SET_SIZE_AND_PINUSE_OF_FREE_CHUNK(r, rsize);
+ ReplaceDv(m, r, rsize);
+ }
+ return CHUNK2MEM(v);
+ }
+ }
+ // CORRUPTION_ERROR_ACTION(m);
+ // return 0;
+ }
+
+inline void RHybridHeap::InitTop(mstate m, mchunkptr p, size_t psize)
+{
+ /* Ensure alignment */
+ size_t offset = ALIGN_OFFSET(CHUNK2MEM(p));
+ p = (mchunkptr)((TUint8*)p + offset);
+ psize -= offset;
+ m->iTop = p;
+ m->iTopSize = psize;
+ p->iHead = psize | PINUSE_BIT;
+ /* set size of fake trailing chunk holding overhead space only once */
+ mchunkptr chunkPlusOff = CHUNK_PLUS_OFFSET(p, psize);
+ chunkPlusOff->iHead = TOP_FOOT_SIZE;
+ m->iTrimCheck = KHeapShrinkHysRatio*(iGrowBy>>8);
+}
+
+
+/* Unlink the first chunk from a smallbin */
+inline void RHybridHeap::UnlinkFirstSmallChunk(mstate M,mchunkptr B,mchunkptr P,bindex_t& I)
+{
+ mchunkptr F = P->iFd;
+ HEAP_ASSERT(P != B);
+ HEAP_ASSERT(P != F);
+ HEAP_ASSERT(CHUNKSIZE(P) == SMALL_INDEX2SIZE(I));
+ if (B == F)
+ CLEAR_SMALLMAP(M, I);
+ else if (RTCHECK(OK_ADDRESS(M, F)))
+ {
+ B->iFd = F;
+ F->iBk = B;
+ }
+ else
+ {
+ CORRUPTION_ERROR_ACTION(M);
+ }
+}
+/* Link a free chunk into a smallbin */
+inline void RHybridHeap::InsertSmallChunk(mstate M,mchunkptr P, size_t S)
+{
+ bindex_t I = SMALL_INDEX(S);
+ mchunkptr B = SMALLBIN_AT(M, I);
+ mchunkptr F = B;
+ HEAP_ASSERT(S >= MIN_CHUNK_SIZE);
+ if (!SMALLMAP_IS_MARKED(M, I))
+ MARK_SMALLMAP(M, I);
+ else if (RTCHECK(OK_ADDRESS(M, B->iFd)))
+ F = B->iFd;
+ else
+ {
+ CORRUPTION_ERROR_ACTION(M);
+ }
+ B->iFd = P;
+ F->iBk = P;
+ P->iFd = F;
+ P->iBk = B;
+}
+
+
+inline void RHybridHeap::InsertChunk(mstate M,mchunkptr P,size_t S)
+{
+ if (IS_SMALL(S))
+ InsertSmallChunk(M, P, S);
+ else
+ {
+ tchunkptr TP = (tchunkptr)(P); InsertLargeChunk(M, TP, S);
+ }
+}
+
+inline void RHybridHeap::UnlinkLargeChunk(mstate M,tchunkptr X)
+{
+ tchunkptr XP = X->iParent;
+ tchunkptr R;
+ if (X->iBk != X)
+ {
+ tchunkptr F = X->iFd;
+ R = X->iBk;
+ if (RTCHECK(OK_ADDRESS(M, F)))
+ {
+ F->iBk = R;
+ R->iFd = F;
+ }
+ else
+ {
+ CORRUPTION_ERROR_ACTION(M);
+ }
+ }
+ else
+ {
+ tchunkptr* RP;
+ if (((R = *(RP = &(X->iChild[1]))) != 0) ||
+ ((R = *(RP = &(X->iChild[0]))) != 0))
+ {
+ tchunkptr* CP;
+ while ((*(CP = &(R->iChild[1])) != 0) ||
+ (*(CP = &(R->iChild[0])) != 0))
+ {
+ R = *(RP = CP);
+ }
+ if (RTCHECK(OK_ADDRESS(M, RP)))
+ *RP = 0;
+ else
+ {
+ CORRUPTION_ERROR_ACTION(M);
+ }
+ }
+ }
+ if (XP != 0)
+ {
+ tbinptr* H = TREEBIN_AT(M, X->iIndex);
+ if (X == *H)
+ {
+ if ((*H = R) == 0)
+ CLEAR_TREEMAP(M, X->iIndex);
+ }
+ else if (RTCHECK(OK_ADDRESS(M, XP)))
+ {
+ if (XP->iChild[0] == X)
+ XP->iChild[0] = R;
+ else
+ XP->iChild[1] = R;
+ }
+ else
+ CORRUPTION_ERROR_ACTION(M);
+ if (R != 0)
+ {
+ if (RTCHECK(OK_ADDRESS(M, R)))
+ {
+ tchunkptr C0, C1;
+ R->iParent = XP;
+ if ((C0 = X->iChild[0]) != 0)
+ {
+ if (RTCHECK(OK_ADDRESS(M, C0)))
+ {
+ R->iChild[0] = C0;
+ C0->iParent = R;
+ }
+ else
+ CORRUPTION_ERROR_ACTION(M);
+ }
+ if ((C1 = X->iChild[1]) != 0)
+ {
+ if (RTCHECK(OK_ADDRESS(M, C1)))
+ {
+ R->iChild[1] = C1;
+ C1->iParent = R;
+ }
+ else
+ CORRUPTION_ERROR_ACTION(M);
+ }
+ }
+ else
+ CORRUPTION_ERROR_ACTION(M);
+ }
+ }
+}
+
+/* Unlink a chunk from a smallbin */
+inline void RHybridHeap::UnlinkSmallChunk(mstate M, mchunkptr P,size_t S)
+{
+ mchunkptr F = P->iFd;
+ mchunkptr B = P->iBk;
+ bindex_t I = SMALL_INDEX(S);
+ HEAP_ASSERT(P != B);
+ HEAP_ASSERT(P != F);
+ HEAP_ASSERT(CHUNKSIZE(P) == SMALL_INDEX2SIZE(I));
+ if (F == B)
+ CLEAR_SMALLMAP(M, I);
+ else if (RTCHECK((F == SMALLBIN_AT(M,I) || OK_ADDRESS(M, F)) &&
+ (B == SMALLBIN_AT(M,I) || OK_ADDRESS(M, B))))
+ {
+ F->iBk = B;
+ B->iFd = F;
+ }
+ else
+ {
+ CORRUPTION_ERROR_ACTION(M);
+ }
+}
+
+inline void RHybridHeap::UnlinkChunk(mstate M, mchunkptr P, size_t S)
+{
+ if (IS_SMALL(S))
+ UnlinkSmallChunk(M, P, S);
+ else
+ {
+ tchunkptr TP = (tchunkptr)(P); UnlinkLargeChunk(M, TP);
+ }
+}
+
+// For DL debug functions
+void RHybridHeap::DoComputeTreeIndex(size_t S, bindex_t& I)
+{
+ ComputeTreeIndex(S, I);
+}
+
+inline void RHybridHeap::ComputeTreeIndex(size_t S, bindex_t& I)
+{
+ size_t X = S >> TREEBIN_SHIFT;
+ if (X == 0)
+ I = 0;
+ else if (X > 0xFFFF)
+ I = NTREEBINS-1;
+ else
+ {
+ unsigned int Y = (unsigned int)X;
+ unsigned int N = ((Y - 0x100) >> 16) & 8;
+ unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;
+ N += K;
+ N += K = (((Y <<= K) - 0x4000) >> 16) & 2;
+ K = 14 - N + ((Y <<= K) >> 15);
+ I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));
+ }
+}
+
+/* ------------------------- Operations on trees ------------------------- */
+
+/* Insert chunk into tree */
+inline void RHybridHeap::InsertLargeChunk(mstate M,tchunkptr X,size_t S)
+{
+ tbinptr* H;
+ bindex_t I;
+ ComputeTreeIndex(S, I);
+ H = TREEBIN_AT(M, I);
+ X->iIndex = I;
+ X->iChild[0] = X->iChild[1] = 0;
+ if (!TREEMAP_IS_MARKED(M, I))
+ {
+ MARK_TREEMAP(M, I);
+ *H = X;
+ X->iParent = (tchunkptr)H;
+ X->iFd = X->iBk = X;
+ }
+ else
+ {
+ tchunkptr T = *H;
+ size_t K = S << LEFTSHIFT_FOR_TREE_INDEX(I);
+ for (;;)
+ {
+ if (CHUNKSIZE(T) != S) {
+ tchunkptr* C = &(T->iChild[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);
+ K <<= 1;
+ if (*C != 0)
+ T = *C;
+ else if (RTCHECK(OK_ADDRESS(M, C)))
+ {
+ *C = X;
+ X->iParent = T;
+ X->iFd = X->iBk = X;
+ break;
+ }
+ else
+ {
+ CORRUPTION_ERROR_ACTION(M);
+ break;
+ }
+ }
+ else
+ {
+ tchunkptr F = T->iFd;
+ if (RTCHECK(OK_ADDRESS(M, T) && OK_ADDRESS(M, F)))
+ {
+ T->iFd = F->iBk = X;
+ X->iFd = F;
+ X->iBk = T;
+ X->iParent = 0;
+ break;
+ }
+ else
+ {
+ CORRUPTION_ERROR_ACTION(M);
+ break;
+ }
+ }
+ }
+ }
+}
+
+/*
+Unlink steps:
+
+1. If x is a chained node, unlink it from its same-sized iFd/iBk links
+and choose its iBk node as its replacement.
+2. If x was the last node of its size, but not a leaf node, it must
+be replaced with a leaf node (not merely one with an open left or
+right), to make sure that lefts and rights of descendents
+correspond properly to bit masks. We use the rightmost descendent
+of x. We could use any other leaf, but this is easy to locate and
+tends to counteract removal of leftmosts elsewhere, and so keeps
+paths shorter than minimally guaranteed. This doesn't loop much
+because on average a node in a tree is near the bottom.
+3. If x is the base of a chain (i.e., has iParent links) relink
+x's iParent and children to x's replacement (or null if none).
+*/
+
+/* Replace iDv node, binning the old one */
+/* Used only when iDvSize known to be small */
+inline void RHybridHeap::ReplaceDv(mstate M, mchunkptr P, size_t S)
+{
+ size_t DVS = M->iDvSize;
+ if (DVS != 0)
+ {
+ mchunkptr DV = M->iDv;
+ HEAP_ASSERT(IS_SMALL(DVS));
+ InsertSmallChunk(M, DV, DVS);
+ }
+ M->iDvSize = S;
+ M->iDv = P;
+}
+
+
+inline void RHybridHeap::ComputeBit2idx(binmap_t X,bindex_t& I)
+{
+ unsigned int Y = X - 1;
+ unsigned int K = Y >> (16-4) & 16;
+ unsigned int N = K; Y >>= K;
+ N += K = Y >> (8-3) & 8; Y >>= K;
+ N += K = Y >> (4-2) & 4; Y >>= K;
+ N += K = Y >> (2-1) & 2; Y >>= K;
+ N += K = Y >> (1-0) & 1; Y >>= K;
+ I = (bindex_t)(N + Y);
+}
+
+
+
+int RHybridHeap::SysTrim(mstate m, size_t pad)
+{
+ size_t extra = 0;
+
+ if ( IS_INITIALIZED(m) )
+ {
+ pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */
+
+ if (m->iTopSize > pad)
+ {
+ extra = Floor(m->iTopSize - pad, iPageSize);
+ if ( (m->iSeg.iSize - extra) < (iMinLength - sizeof(*this)) )
+ {
+ if ( m->iSeg.iSize > (iMinLength - sizeof(*this)) )
+ extra = Floor(m->iSeg.iSize - (iMinLength - sizeof(*this)), iPageSize); /* do not shrink heap below min length */
+ else extra = 0;
+ }
+
+ if ( extra )
+ {
+ Unmap(m->iSeg.iBase + m->iSeg.iSize - extra, extra);
+
+ m->iSeg.iSize -= extra;
+ InitTop(m, m->iTop, m->iTopSize - extra);
+ CHECK_TOP_CHUNK(m, m->iTop);
+ }
+ }
+
+ }
+
+ return extra;
+}
+
+/* Get memory from system using MORECORE */
+
+void* RHybridHeap::SysAlloc(mstate m, size_t nb)
+{
+ HEAP_ASSERT(m->iTop);
+ /* Subtract out existing available iTop space from MORECORE request. */
+// size_t asize = _ALIGN_UP(nb - m->iTopSize + TOP_FOOT_SIZE + SIZE_T_ONE, iGrowBy);
+ TInt asize = _ALIGN_UP(nb - m->iTopSize + SYS_ALLOC_PADDING, iGrowBy); // From DLA version 2.8.4
+
+ char* br = (char*)Map(m->iSeg.iBase+m->iSeg.iSize, asize);
+ if (!br)
+ return 0;
+ HEAP_ASSERT(br == (char*)m->iSeg.iBase+m->iSeg.iSize);
+
+ /* Merge with an existing segment */
+ m->iSeg.iSize += asize;
+ InitTop(m, m->iTop, m->iTopSize + asize);
+
+ if (nb < m->iTopSize)
+ { /* Allocate from new or extended iTop space */
+ size_t rsize = m->iTopSize -= nb;
+ mchunkptr p = m->iTop;
+ mchunkptr r = m->iTop = CHUNK_PLUS_OFFSET(p, nb);
+ r->iHead = rsize | PINUSE_BIT;
+ SET_SIZE_AND_PINUSE_OF_INUSE_CHUNK(m, p, nb);
+ CHECK_TOP_CHUNK(m, m->iTop);
+ CHECK_MALLOCED_CHUNK(m, CHUNK2MEM(p), nb);
+ return CHUNK2MEM(p);
+ }
+
+ return 0;
+}
+
+
+void RHybridHeap::InitDlMalloc(size_t capacity, int /*locked*/)
+{
+ memset(GM,0,sizeof(malloc_state));
+ // The maximum amount that can be allocated can be calculated as:-
+ // 2^sizeof(size_t) - sizeof(malloc_state) - TOP_FOOT_SIZE - page Size(all accordingly padded)
+ // If the capacity exceeds this, no allocation will be done.
+ GM->iSeg.iBase = iBase;
+ GM->iSeg.iSize = capacity;
+ InitBins(GM);
+ InitTop(GM, (mchunkptr)iBase, capacity - TOP_FOOT_SIZE);
+}
+
+void* RHybridHeap::DlMalloc(size_t bytes)
+{
+ /*
+ Basic algorithm:
+ If a small request (< 256 bytes minus per-chunk overhead):
+ 1. If one exists, use a remainderless chunk in associated smallbin.
+ (Remainderless means that there are too few excess bytes to
+ represent as a chunk.)
+ 2. If it is big enough, use the iDv chunk, which is normally the
+ chunk adjacent to the one used for the most recent small request.
+ 3. If one exists, split the smallest available chunk in a bin,
+ saving remainder in iDv.
+ 4. If it is big enough, use the iTop chunk.
+ 5. If available, get memory from system and use it
+ Otherwise, for a large request:
+ 1. Find the smallest available binned chunk that fits, and use it
+ if it is better fitting than iDv chunk, splitting if necessary.
+ 2. If better fitting than any binned chunk, use the iDv chunk.
+ 3. If it is big enough, use the iTop chunk.
+ 4. If request size >= mmap threshold, try to directly mmap this chunk.
+ 5. If available, get memory from system and use it
+*/
+ void* mem;
+ size_t nb;
+ if (bytes <= MAX_SMALL_REQUEST)
+ {
+ bindex_t idx;
+ binmap_t smallbits;
+ nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : PAD_REQUEST(bytes);
+ idx = SMALL_INDEX(nb);
+ smallbits = GM->iSmallMap >> idx;
+
+ if ((smallbits & 0x3U) != 0)
+ { /* Remainderless fit to a smallbin. */
+ mchunkptr b, p;
+ idx += ~smallbits & 1; /* Uses next bin if idx empty */
+ b = SMALLBIN_AT(GM, idx);
+ p = b->iFd;
+ HEAP_ASSERT(CHUNKSIZE(p) == SMALL_INDEX2SIZE(idx));
+ UnlinkFirstSmallChunk(GM, b, p, idx);
+ SET_INUSE_AND_PINUSE(GM, p, SMALL_INDEX2SIZE(idx));
+ mem = CHUNK2MEM(p);
+ CHECK_MALLOCED_CHUNK(GM, mem, nb);
+ return mem;
+ }
+
+ else if (nb > GM->iDvSize)
+ {
+ if (smallbits != 0)
+ { /* Use chunk in next nonempty smallbin */
+ mchunkptr b, p, r;
+ size_t rsize;
+ bindex_t i;
+ binmap_t leftbits = (smallbits << idx) & LEFT_BITS(IDX2BIT(idx));
+ binmap_t leastbit = LEAST_BIT(leftbits);
+ ComputeBit2idx(leastbit, i);
+ b = SMALLBIN_AT(GM, i);
+ p = b->iFd;
+ HEAP_ASSERT(CHUNKSIZE(p) == SMALL_INDEX2SIZE(i));
+ UnlinkFirstSmallChunk(GM, b, p, i);
+ rsize = SMALL_INDEX2SIZE(i) - nb;
+ /* Fit here cannot be remainderless if 4byte sizes */
+ if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE)
+ SET_INUSE_AND_PINUSE(GM, p, SMALL_INDEX2SIZE(i));
+ else
+ {
+ SET_SIZE_AND_PINUSE_OF_INUSE_CHUNK(GM, p, nb);
+ r = CHUNK_PLUS_OFFSET(p, nb);
+ SET_SIZE_AND_PINUSE_OF_FREE_CHUNK(r, rsize);
+ ReplaceDv(GM, r, rsize);
+ }
+ mem = CHUNK2MEM(p);
+ CHECK_MALLOCED_CHUNK(GM, mem, nb);
+ return mem;
+ }
+
+ else if (GM->iTreeMap != 0 && (mem = TmallocSmall(GM, nb)) != 0)
+ {
+ CHECK_MALLOCED_CHUNK(GM, mem, nb);
+ return mem;
+ }
+ }
+ }
+ else if (bytes >= MAX_REQUEST)
+ nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */
+ else
+ {
+ nb = PAD_REQUEST(bytes);
+ if (GM->iTreeMap != 0 && (mem = TmallocLarge(GM, nb)) != 0)
+ {
+ CHECK_MALLOCED_CHUNK(GM, mem, nb);
+ return mem;
+ }
+ }
+
+ if (nb <= GM->iDvSize)
+ {
+ size_t rsize = GM->iDvSize - nb;
+ mchunkptr p = GM->iDv;
+ if (rsize >= MIN_CHUNK_SIZE)
+ { /* split iDv */
+ mchunkptr r = GM->iDv = CHUNK_PLUS_OFFSET(p, nb);
+ GM->iDvSize = rsize;
+ SET_SIZE_AND_PINUSE_OF_FREE_CHUNK(r, rsize);
+ SET_SIZE_AND_PINUSE_OF_INUSE_CHUNK(GM, p, nb);
+ }
+ else
+ { /* exhaust iDv */
+ size_t dvs = GM->iDvSize;
+ GM->iDvSize = 0;
+ GM->iDv = 0;
+ SET_INUSE_AND_PINUSE(GM, p, dvs);
+ }
+ mem = CHUNK2MEM(p);
+ CHECK_MALLOCED_CHUNK(GM, mem, nb);
+ return mem;
+ }
+
+ else if (nb < GM->iTopSize)
+ { /* Split iTop */
+ size_t rsize = GM->iTopSize -= nb;
+ mchunkptr p = GM->iTop;
+ mchunkptr r = GM->iTop = CHUNK_PLUS_OFFSET(p, nb);
+ r->iHead = rsize | PINUSE_BIT;
+ SET_SIZE_AND_PINUSE_OF_INUSE_CHUNK(GM, p, nb);
+ mem = CHUNK2MEM(p);
+ CHECK_TOP_CHUNK(GM, GM->iTop);
+ CHECK_MALLOCED_CHUNK(GM, mem, nb);
+ return mem;
+ }
+
+ return SysAlloc(GM, nb);
+}
+
+
+void RHybridHeap::DlFree(void* mem)
+{
+ /*
+ Consolidate freed chunks with preceeding or succeeding bordering
+ free chunks, if they exist, and then place in a bin. Intermixed
+ with special cases for iTop, iDv, mmapped chunks, and usage errors.
+*/
+ mchunkptr p = MEM2CHUNK(mem);
+ CHECK_INUSE_CHUNK(GM, p);
+ if (RTCHECK(OK_ADDRESS(GM, p) && OK_CINUSE(p)))
+ {
+ size_t psize = CHUNKSIZE(p);
+ mchunkptr next = CHUNK_PLUS_OFFSET(p, psize);
+ if (!PINUSE(p))
+ {
+ size_t prevsize = p->iPrevFoot;
+ mchunkptr prev = CHUNK_MINUS_OFFSET(p, prevsize);
+ psize += prevsize;
+ p = prev;
+ if (RTCHECK(OK_ADDRESS(GM, prev)))
+ { /* consolidate backward */
+ if (p != GM->iDv)
+ {
+ UnlinkChunk(GM, p, prevsize);
+ }
+ else if ((next->iHead & INUSE_BITS) == INUSE_BITS)
+ {
+ GM->iDvSize = psize;
+ SET_FREE_WITH_PINUSE(p, psize, next);
+ return;
+ }
+ }
+ else
+ {
+ USAGE_ERROR_ACTION(GM, p);
+ return;
+ }
+ }
+
+ if (RTCHECK(OK_NEXT(p, next) && OK_PINUSE(next)))
+ {
+ if (!CINUSE(next))
+ { /* consolidate forward */
+ if (next == GM->iTop)
+ {
+ size_t tsize = GM->iTopSize += psize;
+ GM->iTop = p;
+ p->iHead = tsize | PINUSE_BIT;
+ if (p == GM->iDv)
+ {
+ GM->iDv = 0;
+ GM->iDvSize = 0;
+ }
+ if ( !IS_FIXED_HEAP && SHOULD_TRIM(GM, tsize) )
+ SysTrim(GM, 0);
+ return;
+ }
+ else if (next == GM->iDv)
+ {
+ size_t dsize = GM->iDvSize += psize;
+ GM->iDv = p;
+ SET_SIZE_AND_PINUSE_OF_FREE_CHUNK(p, dsize);
+ return;
+ }
+ else
+ {
+ size_t nsize = CHUNKSIZE(next);
+ psize += nsize;
+ UnlinkChunk(GM, next, nsize);
+ SET_SIZE_AND_PINUSE_OF_FREE_CHUNK(p, psize);
+ if (p == GM->iDv)
+ {
+ GM->iDvSize = psize;
+ return;
+ }
+ }
+ }
+ else
+ SET_FREE_WITH_PINUSE(p, psize, next);
+ InsertChunk(GM, p, psize);
+ CHECK_FREE_CHUNK(GM, p);
+ return;
+ }
+ }
+}
+
+
+void* RHybridHeap::DlRealloc(void* oldmem, size_t bytes, TInt mode)
+{
+ mchunkptr oldp = MEM2CHUNK(oldmem);
+ size_t oldsize = CHUNKSIZE(oldp);
+ mchunkptr next = CHUNK_PLUS_OFFSET(oldp, oldsize);
+ mchunkptr newp = 0;
+ void* extra = 0;
+
+ /* Try to either shrink or extend into iTop. Else malloc-copy-free */
+
+ if (RTCHECK(OK_ADDRESS(GM, oldp) && OK_CINUSE(oldp) &&
+ OK_NEXT(oldp, next) && OK_PINUSE(next)))
+ {
+ size_t nb = REQUEST2SIZE(bytes);
+ if (oldsize >= nb) { /* already big enough */
+ size_t rsize = oldsize - nb;
+ newp = oldp;
+ if (rsize >= MIN_CHUNK_SIZE)
+ {
+ mchunkptr remainder = CHUNK_PLUS_OFFSET(newp, nb);
+ SET_INUSE(GM, newp, nb);
+// SET_INUSE(GM, remainder, rsize);
+ SET_INUSE_AND_PINUSE(GM, remainder, rsize); // corrected in original DLA version V2.8.4
+ extra = CHUNK2MEM(remainder);
+ }
+ }
+ else if (next == GM->iTop && oldsize + GM->iTopSize > nb)
+ {
+ /* Expand into iTop */
+ size_t newsize = oldsize + GM->iTopSize;
+ size_t newtopsize = newsize - nb;
+ mchunkptr newtop = CHUNK_PLUS_OFFSET(oldp, nb);
+ SET_INUSE(GM, oldp, nb);
+ newtop->iHead = newtopsize |PINUSE_BIT;
+ GM->iTop = newtop;
+ GM->iTopSize = newtopsize;
+ newp = oldp;
+ }
+ }
+ else
+ {
+ USAGE_ERROR_ACTION(GM, oldmem);
+ }
+
+ if (newp != 0)
+ {
+ if (extra != 0)
+ {
+ DlFree(extra);
+ }
+ CHECK_INUSE_CHUNK(GM, newp);
+ return CHUNK2MEM(newp);
+ }
+ else
+ {
+ if ( mode & ENeverMove )
+ return 0; // cannot move
+ void* newmem = DlMalloc(bytes);
+ if (newmem != 0)
+ {
+ size_t oc = oldsize - OVERHEAD_FOR(oldp);
+ memcpy(newmem, oldmem, (oc < bytes)? oc : bytes);
+ DlFree(oldmem);
+ }
+ return newmem;
+ }
+ // return 0;
+}
+
+size_t RHybridHeap::DlInfo(struct HeapInfo* i, SWalkInfo* wi) const
+{
+ TInt max = ((GM->iTopSize-1) & ~CHUNK_ALIGN_MASK) - CHUNK_OVERHEAD;
+ if ( max < 0 )
+ max = 0;
+ else ++i->iFreeN; // iTop always free
+ i->iFreeBytes += max;
+
+ Walk(wi, GM->iTop, max, EGoodFreeCell, EDougLeaAllocator); // Introduce DL iTop buffer to the walk function
+
+ for (mchunkptr q = ALIGN_AS_CHUNK(GM->iSeg.iBase); q != GM->iTop; q = NEXT_CHUNK(q))
+ {
+ TInt sz = CHUNKSIZE(q);
+ if (!CINUSE(q))
+ {
+ if ( sz > max )
+ max = sz;
+ i->iFreeBytes += sz;
+ ++i->iFreeN;
+ Walk(wi, CHUNK2MEM(q), sz, EGoodFreeCell, EDougLeaAllocator); // Introduce DL free buffer to the walk function
+ }
+ else
+ {
+ i->iAllocBytes += sz - CHUNK_OVERHEAD;
+ ++i->iAllocN;
+ Walk(wi, CHUNK2MEM(q), (sz- CHUNK_OVERHEAD), EGoodAllocatedCell, EDougLeaAllocator); // Introduce DL allocated buffer to the walk function
+ }
+ }
+ return max; // return largest available chunk size
+}
+
+//
+// get statistics about the state of the allocator
+//
+TInt RHybridHeap::GetInfo(struct HeapInfo* i, SWalkInfo* wi) const
+{
+ memset(i,0,sizeof(HeapInfo));
+ i->iFootprint = iChunkSize;
+ i->iMaxSize = iMaxLength;
+#ifndef __KERNEL_MODE__
+ PagedInfo(i, wi);
+ SlabInfo(i, wi);
+#endif
+ return DlInfo(i,wi);
+}
+
+//
+// Methods to commit/decommit memory pages from chunk
+//
+
+
+void* RHybridHeap::Map(void* p, TInt sz)
+//
+// allocate pages in the chunk
+// if p is NULL, Find an allocate the required number of pages (which must lie in the lower half)
+// otherwise commit the pages specified
+//
+{
+ HEAP_ASSERT(sz > 0);
+
+ if ( iChunkSize + sz > iMaxLength)
+ return 0;
+
+#ifdef __KERNEL_MODE__
+
+ TInt r = ((DChunk*)iChunkHandle)->Adjust(iChunkSize + iOffset + sz);
+ if (r < 0)
+ return 0;
+
+ iChunkSize += sz;
+
+#else
+
+ RChunk chunk;
+ chunk.SetHandle(iChunkHandle);
+ if ( p )
+ {
+ TInt r;
+ if ( iUseAdjust )
+ r = chunk.Adjust(iChunkSize + sz);
+ else
+ {
+ HEAP_ASSERT(sz == Ceiling(sz, iPageSize));
+ HEAP_ASSERT(p == Floor(p, iPageSize));
+ r = chunk.Commit(iOffset + PtrDiff(p, this),sz);
+ }
+ if (r < 0)
+ return 0;
+ }
+ else
+ {
+ TInt r = chunk.Allocate(sz);
+ if (r < 0)
+ return 0;
+ if (r > iOffset)
+ {
+ // can't allow page allocations in DL zone
+ chunk.Decommit(r, sz);
+ return 0;
+ }
+ p = Offset(this, r - iOffset);
+ }
+ iChunkSize += sz;
+
+ if (iChunkSize >= iSlabInitThreshold)
+ { // set up slab system now that heap is large enough
+ SlabConfig(iSlabConfigBits);
+ iSlabInitThreshold = KMaxTInt32;
+ }
+
+#endif // __KERNEL_MODE__
+
+#ifdef ENABLE_BTRACE
+ if(iChunkSize > iHighWaterMark)
+ {
+ iHighWaterMark = Ceiling(iChunkSize,16*iPageSize);
+ TUint32 traceData[6];
+ traceData[0] = iChunkHandle;
+ traceData[1] = iMinLength;
+ traceData[2] = iMaxLength;
+ traceData[3] = sz;
+ traceData[4] = iChunkSize;
+ traceData[5] = iHighWaterMark;
+ BTraceContextN(BTrace::ETest1, 90, (TUint32)this, 33, traceData, sizeof(traceData));
+ }
+#endif
+
+ return p;
+}
+
+void RHybridHeap::Unmap(void* p, TInt sz)
+{
+ HEAP_ASSERT(sz > 0);
+
+#ifdef __KERNEL_MODE__
+
+ (void)p;
+ HEAP_ASSERT(sz == Ceiling(sz, iPageSize));
+#if defined(_DEBUG)
+ TInt r =
+#endif
+ ((DChunk*)iChunkHandle)->Adjust(iChunkSize + iOffset - sz);
+ HEAP_ASSERT(r >= 0);
+
+#else
+
+ RChunk chunk;
+ chunk.SetHandle(iChunkHandle);
+ if ( iUseAdjust )
+ {
+ HEAP_ASSERT(sz == Ceiling(sz, iPageSize));
+#if defined(_DEBUG)
+ TInt r =
+#endif
+ chunk.Adjust(iChunkSize - sz);
+ HEAP_ASSERT(r >= 0);
+ }
+ else
+ {
+ HEAP_ASSERT(sz == Ceiling(sz, iPageSize));
+ HEAP_ASSERT(p == Floor(p, iPageSize));
+#if defined(_DEBUG)
+ TInt r =
+#endif
+ chunk.Decommit(PtrDiff(p, Offset(this,-iOffset)), sz);
+ HEAP_ASSERT(r >= 0);
+ }
+#endif // __KERNEL_MODE__
+
+ iChunkSize -= sz;
+}
+
+
+#ifndef __KERNEL_MODE__
+//
+// Slab allocator code
+//
+
+//inline slab* slab::SlabFor(void* p)
+slab* slab::SlabFor( const void* p)
+{
+ return (slab*)(Floor(p, SLABSIZE));
+}
+
+//
+// Remove slab s from its tree/heap (not necessarily the root), preserving the address order
+// invariant of the heap
+//
+void RHybridHeap::TreeRemove(slab* s)
+{
+ slab** r = s->iParent;
+ slab* c1 = s->iChild1;
+ slab* c2 = s->iChild2;
+ for (;;)
+ {
+ if (!c2)
+ {
+ *r = c1;
+ if (c1)
+ c1->iParent = r;
+ return;
+ }
+ if (!c1)
+ {
+ *r = c2;
+ c2->iParent = r;
+ return;
+ }
+ if (c1 > c2)
+ {
+ slab* c3 = c1;
+ c1 = c2;
+ c2 = c3;
+ }
+ slab* newc2 = c1->iChild2;
+ *r = c1;
+ c1->iParent = r;
+ c1->iChild2 = c2;
+ c2->iParent = &c1->iChild2;
+ s = c1;
+ c1 = s->iChild1;
+ c2 = newc2;
+ r = &s->iChild1;
+ }
+}
+//
+// Insert slab s into the tree/heap rooted at r, preserving the address ordering
+// invariant of the heap
+//
+void RHybridHeap::TreeInsert(slab* s,slab** r)
+{
+ slab* n = *r;
+ for (;;)
+ {
+ if (!n)
+ { // tree empty
+ *r = s;
+ s->iParent = r;
+ s->iChild1 = s->iChild2 = 0;
+ break;
+ }
+ if (s < n)
+ { // insert between iParent and n
+ *r = s;
+ s->iParent = r;
+ s->iChild1 = n;
+ s->iChild2 = 0;
+ n->iParent = &s->iChild1;
+ break;
+ }
+ slab* c1 = n->iChild1;
+ slab* c2 = n->iChild2;
+ if ((c1 - 1) > (c2 - 1))
+ {
+ r = &n->iChild1;
+ n = c1;
+ }
+ else
+ {
+ r = &n->iChild2;
+ n = c2;
+ }
+ }
+}
+
+void* RHybridHeap::AllocNewSlab(slabset& allocator)
+//
+// Acquire and initialise a new slab, returning a cell from the slab
+// The strategy is:
+// 1. Use the lowest address free slab, if available. This is done by using the lowest slab
+// in the page at the root of the iPartialPage heap (which is address ordered). If the
+// is now fully used, remove it from the iPartialPage heap.
+// 2. Allocate a new page for iSlabs if no empty iSlabs are available
+//
+{
+ page* p = page::PageFor(iPartialPage);
+ if (!p)
+ return AllocNewPage(allocator);
+
+ unsigned h = p->iSlabs[0].iHeader;
+ unsigned pagemap = SlabHeaderPagemap(h);
+ HEAP_ASSERT(&p->iSlabs[HIBIT(pagemap)] == iPartialPage);
+
+ unsigned slabix = LOWBIT(pagemap);
+ p->iSlabs[0].iHeader = h &~ (0x100<<slabix);
+ if (!(pagemap &~ (1<<slabix)))
+ {
+ TreeRemove(iPartialPage); // last free slab in page
+ }
+
+ return InitNewSlab(allocator, &p->iSlabs[slabix]);
+}
+
+/**Defination of this functionis not there in proto code***/
+#if 0
+void RHybridHeap::partial_insert(slab* s)
+{
+ // slab has had first cell freed and needs to be linked back into iPartial tree
+ slabset& ss = iSlabAlloc[iSizeMap[s->clz]];
+
+ HEAP_ASSERT(s->used == slabfull);
+ s->used = ss.fulluse - s->clz; // full-1 loading
+ TreeInsert(s,&ss.iPartial);
+ CHECKTREE(&ss.iPartial);
+}
+/**Defination of this functionis not there in proto code***/
+#endif
+
+void* RHybridHeap::AllocNewPage(slabset& allocator)
+//
+// Acquire and initialise a new page, returning a cell from a new slab
+// The iPartialPage tree is empty (otherwise we'd have used a slab from there)
+// The iPartialPage link is put in the highest addressed slab in the page, and the
+// lowest addressed slab is used to fulfill the allocation request
+//
+{
+ page* p = iSparePage;
+ if (p)
+ iSparePage = 0;
+ else
+ {
+ p = static_cast<page*>(Map(0, iPageSize));
+ if (!p)
+ return 0;
+ }
+ HEAP_ASSERT(p == Floor(p, iPageSize));
+ // Store page allocated for slab into paged_bitmap (for RHybridHeap::Reset())
+ if (!PagedSetSize(p, iPageSize))
+ {
+ Unmap(p, iPageSize);
+ return 0;
+ }
+ p->iSlabs[0].iHeader = ((1<<3) + (1<<2) + (1<<1))<<8; // set pagemap
+ p->iSlabs[3].iParent = &iPartialPage;
+ p->iSlabs[3].iChild1 = p->iSlabs[3].iChild2 = 0;
+ iPartialPage = &p->iSlabs[3];
+ return InitNewSlab(allocator,&p->iSlabs[0]);
+}
+
+void RHybridHeap::FreePage(page* p)
+//
+// Release an unused page to the OS
+// A single page is cached for reuse to reduce thrashing
+// the OS allocator.
+//
+{
+ HEAP_ASSERT(Ceiling(p, iPageSize) == p);
+ if (!iSparePage)
+ {
+ iSparePage = p;
+ return;
+ }
+
+ // unmapped slab page must be cleared from paged_bitmap, too
+ PagedZapSize(p, iPageSize); // clear page map
+
+ Unmap(p, iPageSize);
+}
+
+void RHybridHeap::FreeSlab(slab* s)
+//
+// Release an empty slab to the slab manager
+// The strategy is:
+// 1. The page containing the slab is checked to see the state of the other iSlabs in the page by
+// inspecting the pagemap field in the iHeader of the first slab in the page.
+// 2. The pagemap is updated to indicate the new unused slab
+// 3. If this is the only unused slab in the page then the slab iHeader is used to add the page to
+// the iPartialPage tree/heap
+// 4. If all the iSlabs in the page are now unused the page is release back to the OS
+// 5. If this slab has a higher address than the one currently used to track this page in
+// the iPartialPage heap, the linkage is moved to the new unused slab
+//
+{
+ TreeRemove(s);
+ CHECKTREE(s->iParent);
+ HEAP_ASSERT(SlabHeaderUsedm4(s->iHeader) == SlabHeaderSize(s->iHeader)-4);
+
+ page* p = page::PageFor(s);
+ unsigned h = p->iSlabs[0].iHeader;
+ int slabix = s - &p->iSlabs[0];
+ unsigned pagemap = SlabHeaderPagemap(h);
+ p->iSlabs[0].iHeader = h | (0x100<<slabix);
+ if (pagemap == 0)
+ { // page was full before, use this slab as link in empty heap
+ TreeInsert(s, &iPartialPage);
+ }
+ else
+ { // Find the current empty-link slab
+ slab* sl = &p->iSlabs[HIBIT(pagemap)];
+ pagemap ^= (1<<slabix);
+ if (pagemap == 0xf)
+ { // page is now empty so recycle page to os
+ TreeRemove(sl);
+ FreePage(p);
+ return;
+ }
+ // ensure the free list link is in highest address slab in page
+ if (s > sl)
+ { // replace current link with new one. Address-order tree so position stays the same
+ slab** r = sl->iParent;
+ slab* c1 = sl->iChild1;
+ slab* c2 = sl->iChild2;
+ s->iParent = r;
+ s->iChild1 = c1;
+ s->iChild2 = c2;
+ *r = s;
+ if (c1)
+ c1->iParent = &s->iChild1;
+ if (c2)
+ c2->iParent = &s->iChild2;
+ }
+ CHECK(if (s < sl) s=sl);
+ }
+ HEAP_ASSERT(SlabHeaderPagemap(p->iSlabs[0].iHeader) != 0);
+ HEAP_ASSERT(HIBIT(SlabHeaderPagemap(p->iSlabs[0].iHeader)) == unsigned(s - &p->iSlabs[0]));
+}
+
+
+void RHybridHeap::SlabInit()
+{
+ iSlabThreshold=0;
+ iPartialPage = 0;
+ iFullSlab = 0;
+ iSparePage = 0;
+ memset(&iSizeMap[0],0xff,sizeof(iSizeMap));
+ memset(&iSlabAlloc[0],0,sizeof(iSlabAlloc));
+}
+
+void RHybridHeap::SlabConfig(unsigned slabbitmap)
+{
+ HEAP_ASSERT((slabbitmap & ~EOkBits) == 0);
+ HEAP_ASSERT(MAXSLABSIZE <= 60);
+
+ unsigned int ix = 0xff;
+ unsigned int bit = 1<<((MAXSLABSIZE>>2)-1);
+ for (int sz = MAXSLABSIZE; sz >= 0; sz -= 4, bit >>= 1)
+ {
+ if (slabbitmap & bit)
+ {
+ if (ix == 0xff)
+ iSlabThreshold=sz+1;
+ ix = (sz>>2)-1;
+ }
+ iSizeMap[sz>>2] = (TUint8) ix;
+ }
+}
+
+
+void* RHybridHeap::SlabAllocate(slabset& ss)
+//
+// Allocate a cell from the given slabset
+// Strategy:
+// 1. Take the partially full slab at the iTop of the heap (lowest address).
+// 2. If there is no such slab, allocate from a new slab
+// 3. If the slab has a non-empty freelist, pop the cell from the front of the list and update the slab
+// 4. Otherwise, if the slab is not full, return the cell at the end of the currently used region of
+// the slab, updating the slab
+// 5. Otherwise, release the slab from the iPartial tree/heap, marking it as 'floating' and go back to
+// step 1
+//
+{
+ for (;;)
+ {
+ slab *s = ss.iPartial;
+ if (!s)
+ break;
+ unsigned h = s->iHeader;
+ unsigned free = h & 0xff; // extract free cell positioning
+ if (free)
+ {
+ HEAP_ASSERT(((free<<2)-sizeof(slabhdr))%SlabHeaderSize(h) == 0);
+ void* p = Offset(s,free<<2);
+ free = *(unsigned char*)p; // get next pos in free list
+ h += (h&0x3C000)<<6; // update usedm4
+ h &= ~0xff;
+ h |= free; // update freelist
+ s->iHeader = h;
+ HEAP_ASSERT(SlabHeaderFree(h) == 0 || ((SlabHeaderFree(h)<<2)-sizeof(slabhdr))%SlabHeaderSize(h) == 0);
+ HEAP_ASSERT(SlabHeaderUsedm4(h) <= 0x3F8u);
+ HEAP_ASSERT((SlabHeaderUsedm4(h)+4)%SlabHeaderSize(h) == 0);
+ return p;
+ }
+ unsigned h2 = h + ((h&0x3C000)<<6);
+// if (h2 < 0xfc00000)
+ if (h2 < MAXUSEDM4BITS)
+ {
+ HEAP_ASSERT((SlabHeaderUsedm4(h2)+4)%SlabHeaderSize(h2) == 0);
+ s->iHeader = h2;
+ return Offset(s,(h>>18) + sizeof(unsigned) + sizeof(slabhdr));
+ }
+ h |= FLOATING_BIT; // mark the slab as full-floating
+ s->iHeader = h;
+ TreeRemove(s);
+ slab* c = iFullSlab; // add to full list
+ iFullSlab = s;
+ s->iParent = &iFullSlab;
+ s->iChild1 = c;
+ s->iChild2 = 0;
+ if (c)
+ c->iParent = &s->iChild1;
+
+ CHECKTREE(&ss.iPartial);
+ // go back and try the next slab...
+ }
+ // no iPartial iSlabs found, so allocate from a new slab
+ return AllocNewSlab(ss);
+}
+
+void RHybridHeap::SlabFree(void* p)
+//
+// Free a cell from the slab allocator
+// Strategy:
+// 1. Find the containing slab (round down to nearest 1KB boundary)
+// 2. Push the cell into the slab's freelist, and update the slab usage count
+// 3. If this is the last allocated cell, free the slab to the main slab manager
+// 4. If the slab was full-floating then insert the slab in it's respective iPartial tree
+//
+{
+ HEAP_ASSERT(LowBits(p,3)==0);
+ slab* s = slab::SlabFor(p);
+ CHECKSLAB(s,ESlabAllocator,p);
+ CHECKSLABBFR(s,p);
+
+ unsigned pos = LowBits(p, SLABSIZE);
+ unsigned h = s->iHeader;
+ HEAP_ASSERT(SlabHeaderUsedm4(h) != 0x3fC); // slab is empty already
+ HEAP_ASSERT((pos-sizeof(slabhdr))%SlabHeaderSize(h) == 0);
+ *(unsigned char*)p = (unsigned char)h;
+ h &= ~0xFF;
+ h |= (pos>>2);
+ unsigned size = h & 0x3C000;
+ if (int(h) >= 0)
+ {
+ h -= size<<6;
+ if (int(h)>=0)
+ {
+ s->iHeader = h;
+ return;
+ }
+ FreeSlab(s);
+ return;
+ }
+ h -= size<<6;
+ h &= ~FLOATING_BIT;
+ s->iHeader = h;
+ slab** full = s->iParent; // remove from full list
+ slab* c = s->iChild1;
+ *full = c;
+ if (c)
+ c->iParent = full;
+
+ slabset& ss = iSlabAlloc[iSizeMap[size>>14]];
+ TreeInsert(s,&ss.iPartial);
+ CHECKTREE(&ss.iPartial);
+}
+
+void* RHybridHeap::InitNewSlab(slabset& allocator, slab* s)
+//
+// initialise an empty slab for this allocator and return the fist cell
+// pre-condition: the slabset has no iPartial iSlabs for allocation
+//
+{
+ HEAP_ASSERT(allocator.iPartial==0);
+ TInt size = 4 + ((&allocator-&iSlabAlloc[0])<<2); // infer size from slab allocator address
+ unsigned h = s->iHeader & 0xF00; // preserve pagemap only
+ h |= (size<<12); // set size
+ h |= (size-4)<<18; // set usedminus4 to one object minus 4
+ s->iHeader = h;
+ allocator.iPartial = s;
+ s->iParent = &allocator.iPartial;
+ s->iChild1 = s->iChild2 = 0;
+ return Offset(s,sizeof(slabhdr));
+}
+
+const unsigned char slab_bitcount[16] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4};
+
+const unsigned char slab_ext_frag[16] =
+{
+ 0,
+ 16 + (1008 % 4),
+ 16 + (1008 % 8),
+ 16 + (1008 % 12),
+ 16 + (1008 % 16),
+ 16 + (1008 % 20),
+ 16 + (1008 % 24),
+ 16 + (1008 % 28),
+ 16 + (1008 % 32),
+ 16 + (1008 % 36),
+ 16 + (1008 % 40),
+ 16 + (1008 % 44),
+ 16 + (1008 % 48),
+ 16 + (1008 % 52),
+ 16 + (1008 % 56),
+ 16 + (1008 % 60)
+};
+
+void RHybridHeap::TreeWalk(slab* const* root, void (*f)(slab*, struct HeapInfo*, SWalkInfo*), struct HeapInfo* i, SWalkInfo* wi)
+{
+ // iterative walk around the tree at root
+
+ slab* s = *root;
+ if (!s)
+ return;
+
+ for (;;)
+ {
+ slab* c;
+ while ((c = s->iChild1) != 0)
+ s = c; // walk down left side to end
+ for (;;)
+ {
+ f(s, i, wi);
+ c = s->iChild2;
+ if (c)
+ { // one step down right side, now try and walk down left
+ s = c;
+ break;
+ }
+ for (;;)
+ { // loop to walk up right side
+ slab** pp = s->iParent;
+ if (pp == root)
+ return;
+ s = slab::SlabFor(pp);
+ if (pp == &s->iChild1)
+ break;
+ }
+ }
+ }
+}
+
+void RHybridHeap::SlabEmptyInfo(slab* s, struct HeapInfo* i, SWalkInfo* wi)
+{
+ Walk(wi, s, SLABSIZE, EGoodFreeCell, EEmptySlab); // Introduce an empty slab to the walk function
+ int nslab = slab_bitcount[SlabHeaderPagemap(page::PageFor(s)->iSlabs[0].iHeader)];
+ i->iFreeN += nslab;
+ i->iFreeBytes += nslab << SLABSHIFT;
+}
+
+void RHybridHeap::SlabPartialInfo(slab* s, struct HeapInfo* i, SWalkInfo* wi)
+{
+ Walk(wi, s, SLABSIZE, EGoodAllocatedCell, EPartialFullSlab); // Introduce a full slab to the walk function
+ unsigned h = s->iHeader;
+ unsigned used = SlabHeaderUsedm4(h)+4;
+ unsigned size = SlabHeaderSize(h);
+ unsigned free = 1024 - slab_ext_frag[size>>2] - used;
+ i->iFreeN += (free/size);
+ i->iFreeBytes += free;
+ i->iAllocN += (used/size);
+ i->iAllocBytes += used;
+}
+
+void RHybridHeap::SlabFullInfo(slab* s, struct HeapInfo* i, SWalkInfo* wi)
+{
+ Walk(wi, s, SLABSIZE, EGoodAllocatedCell, EFullSlab); // Introduce a full slab to the walk function
+ unsigned h = s->iHeader;
+ unsigned used = SlabHeaderUsedm4(h)+4;
+ unsigned size = SlabHeaderSize(h);
+ HEAP_ASSERT(1024 - slab_ext_frag[size>>2] - used == 0);
+ i->iAllocN += (used/size);
+ i->iAllocBytes += used;
+}
+
+void RHybridHeap::SlabInfo(struct HeapInfo* i, SWalkInfo* wi) const
+{
+ if (iSparePage)
+ {
+ i->iFreeBytes += iPageSize;
+ i->iFreeN = 4;
+ Walk(wi, iSparePage, iPageSize, EGoodFreeCell, ESlabSpare); // Introduce Slab spare page to the walk function
+ }
+ TreeWalk(&iFullSlab, &SlabFullInfo, i, wi);
+ for (int ix = 0; ix < (MAXSLABSIZE>>2); ++ix)
+ TreeWalk(&iSlabAlloc[ix].iPartial, &SlabPartialInfo, i, wi);
+ TreeWalk(&iPartialPage, &SlabEmptyInfo, i, wi);
+}
+
+
+//
+// Bitmap class implementation for large page allocator
+//
+inline unsigned char* paged_bitmap::Addr() const {return iBase;}
+inline unsigned paged_bitmap::Size() const {return iNbits;}
+//
+
+void paged_bitmap::Init(unsigned char* p, unsigned size, unsigned bit)
+{
+ iBase = p;
+ iNbits=size;
+ int bytes=Ceiling(size,8)>>3;
+ memset(p,bit?0xff:0,bytes);
+}
+
+inline void paged_bitmap::Set(unsigned ix, unsigned bit)
+{
+ if (bit)
+ iBase[ix>>3] |= (1<<(ix&7));
+ else
+ iBase[ix>>3] &= ~(1<<(ix&7));
+}
+
+inline unsigned paged_bitmap::operator[](unsigned ix) const
+{
+ return 1U&(iBase[ix>>3] >> (ix&7));
+}
+
+void paged_bitmap::Setn(unsigned ix, unsigned len, unsigned bit)
+{
+ int l=len;
+ while (--l>=0)
+ Set(ix++,bit);
+}
+
+void paged_bitmap::Set(unsigned ix, unsigned len, unsigned val)
+{
+ int l=len;
+ while (--l>=0)
+ {
+ Set(ix++,val&1);
+ val>>=1;
+ }
+}
+
+unsigned paged_bitmap::Bits(unsigned ix, unsigned len) const
+{
+ int l=len;
+ unsigned val=0;
+ unsigned bit=0;
+ while (--l>=0)
+ val |= (*this)[ix++]<<bit++;
+ return val;
+}
+
+bool paged_bitmap::Is(unsigned ix, unsigned len, unsigned bit) const
+{
+ unsigned i2 = ix+len;
+ if (i2 > iNbits)
+ return false;
+ for (;;)
+ {
+ if ((*this)[ix] != bit)
+ return false;
+ if (++ix==i2)
+ return true;
+ }
+}
+
+int paged_bitmap::Find(unsigned start, unsigned bit) const
+{
+ if (start<iNbits) do
+ {
+ if ((*this)[start]==bit)
+ return start;
+ } while (++start<iNbits);
+ return -1;
+}
+
+
+//
+// Page allocator code
+//
+void RHybridHeap::PagedInit(TInt aPagePower)
+{
+ if (aPagePower > 0)
+ {
+ if (aPagePower < MINPAGEPOWER)
+ aPagePower = MINPAGEPOWER;
+ }
+ else aPagePower = 31;
+
+ iPageThreshold = aPagePower;
+ /*-------------------------------------------------------------
+ * Initialize page bitmap
+ *-------------------------------------------------------------*/
+ iPageMap.Init((unsigned char*)&iBitMapBuffer, MAXSMALLPAGEBITS, 0);
+}
+
+void* RHybridHeap::PagedAllocate(unsigned size)
+{
+ TInt nbytes = Ceiling(size, iPageSize);
+ void* p = Map(0, nbytes);
+ if (!p)
+ return 0;
+ if (!PagedSetSize(p, nbytes))
+ {
+ Unmap(p, nbytes);
+ return 0;
+ }
+ return p;
+}
+
+void* RHybridHeap::PagedReallocate(void* p, unsigned size, TInt mode)
+{
+
+ HEAP_ASSERT(Ceiling(p, iPageSize) == p);
+ unsigned nbytes = Ceiling(size, iPageSize);
+
+ unsigned osize = PagedSize(p);
+ if ( nbytes == 0 ) // Special case to handle shrinking below min page threshold
+ nbytes = Min((1 << MINPAGEPOWER), osize);
+
+ if (osize == nbytes)
+ return p;
+
+ if (nbytes < osize)
+ { // shrink in place, unmap final pages and rewrite the pagemap
+ Unmap(Offset(p, nbytes), osize-nbytes);
+ // zap old code and then write new code (will not fail)
+ PagedZapSize(p, osize);
+
+ TBool check = PagedSetSize(p, nbytes);
+ __ASSERT_ALWAYS(check, HEAP_PANIC(ETHeapBadCellAddress));
+
+ return p;
+ }
+
+ // nbytes > osize
+ // try and extend current region first
+
+ void* newp = Map(Offset(p, osize), nbytes-osize);
+ if (newp)
+ { // In place growth. Possibility that pagemap may have to grow AND then fails
+ if (!PagedSetSize(p, nbytes))
+ { // must release extra mapping
+ Unmap(Offset(p, osize), nbytes-osize);
+ return 0;
+ }
+ // if successful, the new length code will have overwritten the old one (it is at least as long)
+ return p;
+ }
+
+ // fallback to allocate/copy/free
+ if (mode & ENeverMove)
+ return 0; // not allowed to move cell
+
+ newp = PagedAllocate(nbytes);
+ if (!newp)
+ return 0;
+ memcpy(newp, p, osize);
+ PagedFree(p);
+ return newp;
+}
+
+void RHybridHeap::PagedFree(void* p)
+{
+ HEAP_ASSERT(Ceiling(p, iPageSize) == p);
+
+
+ unsigned size = PagedSize(p);
+
+ PagedZapSize(p, size); // clear page map
+ Unmap(p, size);
+}
+
+void RHybridHeap::PagedInfo(struct HeapInfo* i, SWalkInfo* wi) const
+{
+ for (int ix = 0;(ix = iPageMap.Find(ix,1)) >= 0;)
+ {
+ int npage = PagedDecode(ix);
+ // Introduce paged buffer to the walk function
+ TAny* bfr = Bitmap2addr(ix);
+ int len = npage << PAGESHIFT;
+ if ( len > iPageSize )
+ { // If buffer is not larger than one page it must be a slab page mapped into bitmap
+ i->iAllocBytes += len;
+ ++i->iAllocN;
+ Walk(wi, bfr, len, EGoodAllocatedCell, EPageAllocator);
+ }
+ ix += (npage<<1);
+ }
+}
+
+void RHybridHeap::ResetBitmap()
+/*---------------------------------------------------------
+ * Go through paged_bitmap and unmap all buffers to system
+ * This method is called from RHybridHeap::Reset() to unmap all page
+ * allocated - and slab pages which are stored in bitmap, too
+ *---------------------------------------------------------*/
+{
+ unsigned iNbits = iPageMap.Size();
+ if ( iNbits )
+ {
+ for (int ix = 0;(ix = iPageMap.Find(ix,1)) >= 0;)
+ {
+ int npage = PagedDecode(ix);
+ void* p = Bitmap2addr(ix);
+ unsigned size = PagedSize(p);
+ PagedZapSize(p, size); // clear page map
+ Unmap(p, size);
+ ix += (npage<<1);
+ }
+ if ( (TInt)iNbits > MAXSMALLPAGEBITS )
+ {
+ // unmap page reserved for enlarged bitmap
+ Unmap(iPageMap.Addr(), (iNbits >> 3) );
+ }
+ }
+}
+
+TBool RHybridHeap::CheckBitmap(void* aBfr, TInt aSize, TUint32& aDummy, TInt& aNPages)
+/*---------------------------------------------------------
+ * If aBfr = NULL
+ * Go through paged_bitmap and unmap all buffers to system
+ * and assure that by reading the first word of each page of aBfr
+ * that aBfr is still accessible
+ * else
+ * Assure that specified buffer is mapped with correct length in
+ * page map
+ *---------------------------------------------------------*/
+{
+ TBool ret;
+ if ( aBfr )
+ {
+ __ASSERT_ALWAYS((Ceiling(aBfr, iPageSize) == aBfr), HEAP_PANIC(ETHeapBadCellAddress));
+ ret = ( aSize == (TInt)PagedSize(aBfr));
+ }
+ else
+ {
+ ret = ETrue;
+ unsigned iNbits = iPageMap.Size();
+ if ( iNbits )
+ {
+ TInt npage;
+ aNPages = 0;
+ for (int ix = 0;(ix = iPageMap.Find(ix,1)) >= 0;)
+ {
+ npage = PagedDecode(ix);
+ aNPages += npage;
+ void* p = Bitmap2addr(ix);
+ __ASSERT_ALWAYS((Ceiling(p, iPageSize) == p), HEAP_PANIC(ETHeapBadCellAddress));
+ unsigned s = PagedSize(p);
+ __ASSERT_ALWAYS((Ceiling(s, iPageSize) == s), HEAP_PANIC(ETHeapBadCellAddress));
+ while ( s )
+ {
+ aDummy += *(TUint32*)((TUint8*)p + (s-iPageSize));
+ s -= iPageSize;
+ }
+ ix += (npage<<1);
+ }
+ if ( (TInt)iNbits > MAXSMALLPAGEBITS )
+ {
+ // add enlarged bitmap page(s) to total page count
+ npage = (iNbits >> 3);
+ __ASSERT_ALWAYS((Ceiling(npage, iPageSize) == npage), HEAP_PANIC(ETHeapBadCellAddress));
+ aNPages += (npage / iPageSize);
+ }
+ }
+ }
+
+ return ret;
+}
+
+
+// The paged allocations are tracked in a bitmap which has 2 bits per page
+// this allows us to store allocations as small as 4KB
+// The presence and size of an allocation is encoded as follows:
+// let N = number of pages in the allocation, then
+// 10 : N = 1 // 4KB
+// 110n : N = 2 + n // 8-12KB
+// 1110nnnn : N = nnnn // 16-60KB
+// 1111n[18] : N = n[18] // 64KB-1GB
+
+const struct etab { unsigned char offset, len, codelen, code;} encode_table[] =
+{
+ {1,2,2,0x1},
+ {2,4,3,0x3},
+ {0,8,4,0x7},
+ {0,22,4,0xf}
+};
+
+// Return code length for specified allocation Size(assumed to be aligned to pages)
+inline unsigned paged_codelen(unsigned size, unsigned pagesz)
+{
+ HEAP_ASSERT(size == Ceiling(size, pagesz));
+
+ if (size == pagesz)
+ return 2;
+ else if (size < 4*pagesz)
+ return 4;
+ else if (size < 16*pagesz)
+ return 8;
+ else
+ return 22;
+}
+
+inline const etab& paged_coding(unsigned npage)
+{
+ if (npage < 4)
+ return encode_table[npage>>1];
+ else if (npage < 16)
+ return encode_table[2];
+ else
+ return encode_table[3];
+}
+
+bool RHybridHeap::PagedEncode(unsigned pos, unsigned npage)
+{
+ const etab& e = paged_coding(npage);
+ if (pos + e.len > iPageMap.Size())
+ {
+ // need to grow the page bitmap to fit the cell length into the map
+ // if we outgrow original bitmap buffer in RHybridHeap metadata, then just get enough pages to cover the full space:
+ // * initial 68 byte bitmap mapped (68*8*4kB):2 = 1,1MB
+ // * 4KB can Map(4096*8*4kB):2 = 64MB
+ unsigned maxsize = Ceiling(iMaxLength, iPageSize);
+ unsigned mapbits = maxsize >> (PAGESHIFT-1);
+ maxsize = Ceiling(mapbits>>3, iPageSize);
+ void* newb = Map(0, maxsize);
+ if (!newb)
+ return false;
+
+ unsigned char* oldb = iPageMap.Addr();
+ iPageMap.Init((unsigned char*)newb, (maxsize<<3), 0);
+ memcpy(newb, oldb, Ceiling(MAXSMALLPAGEBITS,8)>>3);
+ }
+ // encode the allocation block size into the bitmap, starting at the bit for the start page
+ unsigned bits = e.code;
+ bits |= (npage - e.offset) << e.codelen;
+ iPageMap.Set(pos, e.len, bits);
+ return true;
+}
+
+unsigned RHybridHeap::PagedDecode(unsigned pos) const
+{
+ __ASSERT_ALWAYS(pos + 2 <= iPageMap.Size(), HEAP_PANIC(ETHeapBadCellAddress));
+
+ unsigned bits = iPageMap.Bits(pos,2);
+ __ASSERT_ALWAYS(bits & 1, HEAP_PANIC(ETHeapBadCellAddress));
+ bits >>= 1;
+ if (bits == 0)
+ return 1;
+ __ASSERT_ALWAYS(pos + 4 <= iPageMap.Size(), HEAP_PANIC(ETHeapBadCellAddress));
+ bits = iPageMap.Bits(pos+2,2);
+ if ((bits & 1) == 0)
+ return 2 + (bits>>1);
+ else if ((bits>>1) == 0)
+ {
+ __ASSERT_ALWAYS(pos + 8 <= iPageMap.Size(), HEAP_PANIC(ETHeapBadCellAddress));
+ return iPageMap.Bits(pos+4, 4);
+ }
+ else
+ {
+ __ASSERT_ALWAYS(pos + 22 <= iPageMap.Size(), HEAP_PANIC(ETHeapBadCellAddress));
+ return iPageMap.Bits(pos+4, 18);
+ }
+}
+
+inline void RHybridHeap::PagedZapSize(void* p, unsigned size)
+{iPageMap.Setn(PtrDiff(p, iMemBase) >> (PAGESHIFT-1), paged_codelen(size, iPageSize) ,0);}
+
+inline unsigned RHybridHeap::PagedSize(void* p) const
+ { return PagedDecode(PtrDiff(p, iMemBase) >> (PAGESHIFT-1)) << PAGESHIFT; }
+
+inline bool RHybridHeap::PagedSetSize(void* p, unsigned size)
+{ return PagedEncode(PtrDiff(p, iMemBase) >> (PAGESHIFT-1), size >> PAGESHIFT); }
+
+inline void* RHybridHeap::Bitmap2addr(unsigned pos) const
+ { return iMemBase + (1 << (PAGESHIFT-1))*pos; }
+
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+/**
+Constructor where minimum and maximum length of the heap can be defined.
+It defaults the chunk heap to be created to have use a new local chunk,
+to have a grow by value of KMinHeapGrowBy, to be unaligned, not to be
+single threaded and not to have any mode flags set.
+
+@param aMinLength The minimum length of the heap to be created.
+@param aMaxLength The maximum length to which the heap to be created can grow.
+ If the supplied value is less than a page size, then it
+ is discarded and the page size is used instead.
+*/
+EXPORT_C TChunkHeapCreateInfo::TChunkHeapCreateInfo(TInt aMinLength, TInt aMaxLength) :
+ iVersionNumber(EVersion0), iMinLength(aMinLength), iMaxLength(aMaxLength),
+iAlign(0), iGrowBy(1), iSingleThread(EFalse),
+iOffset(0), iPaging(EUnspecified), iMode(0), iName(NULL)
+{
+}
+
+
+/**
+Sets the chunk heap to create a new chunk with the specified name.
+
+This overriddes any previous call to TChunkHeapCreateInfo::SetNewChunkHeap() or
+TChunkHeapCreateInfo::SetExistingChunkHeap() for this TChunkHeapCreateInfo object.
+
+@param aName The name to be given to the chunk heap to be created
+If NULL, the function constructs a local chunk to host the heap.
+If not NULL, a pointer to a descriptor containing the name to be
+assigned to the global chunk hosting the heap.
+*/
+EXPORT_C void TChunkHeapCreateInfo::SetCreateChunk(const TDesC* aName)
+{
+ iName = (TDesC*)aName;
+ iChunk.SetHandle(KNullHandle);
+}
+
+
+/**
+Sets the chunk heap to be created to use the chunk specified.
+
+This overriddes any previous call to TChunkHeapCreateInfo::SetNewChunkHeap() or
+TChunkHeapCreateInfo::SetExistingChunkHeap() for this TChunkHeapCreateInfo object.
+
+@param aChunk A handle to the chunk to use for the heap.
+*/
+EXPORT_C void TChunkHeapCreateInfo::SetUseChunk(const RChunk aChunk)
+{
+ iName = NULL;
+ iChunk = aChunk;
+}
+
+EXPORT_C RHeap* UserHeap::FixedHeap(TAny* aBase, TInt aMaxLength, TInt aAlign, TBool aSingleThread)
+/**
+Creates a fixed length heap at a specified location.
+
+On successful return from this function, the heap is ready to use. This assumes that
+the memory pointed to by aBase is mapped and able to be used. You must ensure that you
+pass in a large enough value for aMaxLength. Passing in a value that is too small to
+hold the metadata for the heap (~1 KB) will result in the size being rounded up and the
+heap thereby running over the end of the memory assigned to it. But then if you were to
+pass in such as small value then you would not be able to do any allocations from the
+heap anyway. Moral of the story: Use a sensible value for aMaxLength!
+
+@param aBase A pointer to the location where the heap is to be constructed.
+@param aMaxLength The maximum length in bytes to which the heap can grow. If the
+ supplied value is too small to hold the heap's metadata, it
+ will be increased.
+@param aAlign From Symbian^4 onwards, this value is ignored but EABI 8
+ byte alignment is guaranteed for all allocations 8 bytes or
+ more in size. 4 byte allocations will be aligned to a 4
+ byte boundary. Best to pass in zero.
+@param aSingleThread EFalse if the heap is to be accessed from multiple threads.
+ This will cause internal locks to be created, guaranteeing
+ thread safety.
+
+@return A pointer to the new heap, or NULL if the heap could not be created.
+
+@panic USER 56 if aMaxLength is negative.
+*/
+{
+ __ASSERT_ALWAYS( aMaxLength>=0, ::Panic(ETHeapMaxLengthNegative));
+ if ( aMaxLength < (TInt)sizeof(RHybridHeap) )
+ aMaxLength = sizeof(RHybridHeap);
+
+ RHybridHeap* h = new(aBase) RHybridHeap(aMaxLength, aAlign, aSingleThread);
+
+ if (!aSingleThread)
+ {
+ TInt r = h->iLock.CreateLocal();
+ if (r!=KErrNone)
+ return NULL; // No need to delete the RHybridHeap instance as the new above is only a placement new
+ h->iHandles = (TInt*)&h->iLock;
+ h->iHandleCount = 1;
+ }
+ return h;
+}
+
+/**
+Creates a chunk heap of the type specified by the parameter aCreateInfo.
+
+@param aCreateInfo A reference to a TChunkHeapCreateInfo object specifying the
+type of chunk heap to create.
+
+@return A pointer to the new heap or NULL if the heap could not be created.
+
+@panic USER 41 if the heap's specified minimum length is greater than the specified maximum length.
+@panic USER 55 if the heap's specified minimum length is negative.
+@panic USER 172 if the heap's specified alignment is not a power of 2 or is less than the size of a TAny*.
+*/
+EXPORT_C RHeap* UserHeap::ChunkHeap(const TChunkHeapCreateInfo& aCreateInfo)
+{
+ // aCreateInfo must have been configured to use a new chunk or an exiting chunk.
+ __ASSERT_ALWAYS(!(aCreateInfo.iMode & (TUint32)~EChunkHeapMask), ::Panic(EHeapCreateInvalidMode));
+ RHeap* h = NULL;
+
+ if (aCreateInfo.iChunk.Handle() == KNullHandle)
+ {
+ // A new chunk is to be created for this heap.
+
+ __ASSERT_ALWAYS(aCreateInfo.iMinLength >= 0, ::Panic(ETHeapMinLengthNegative));
+ __ASSERT_ALWAYS(aCreateInfo.iMaxLength >= aCreateInfo.iMinLength, ::Panic(ETHeapCreateMaxLessThanMin));
+
+ TInt maxLength = aCreateInfo.iMaxLength;
+ TInt page_size;
+ GET_PAGE_SIZE(page_size);
+
+ if (maxLength < page_size)
+ maxLength = page_size;
+
+ TChunkCreateInfo chunkInfo;
+#if USE_HYBRID_HEAP
+ if ( aCreateInfo.iOffset )
+ chunkInfo.SetNormal(0, maxLength); // Create DL only heap
+ else
+ {
+ maxLength = 2*maxLength;
+ chunkInfo.SetDisconnected(0, 0, maxLength); // Create hybrid heap
+ }
+#else
+ chunkInfo.SetNormal(0, maxLength); // Create DL only heap
+#endif
+ chunkInfo.SetOwner((aCreateInfo.iSingleThread)? EOwnerThread : EOwnerProcess);
+ if (aCreateInfo.iName)
+ chunkInfo.SetGlobal(*aCreateInfo.iName);
+ // Set the paging attributes of the chunk.
+ if (aCreateInfo.iPaging == TChunkHeapCreateInfo::EPaged)
+ chunkInfo.SetPaging(TChunkCreateInfo::EPaged);
+ if (aCreateInfo.iPaging == TChunkHeapCreateInfo::EUnpaged)
+ chunkInfo.SetPaging(TChunkCreateInfo::EUnpaged);
+ // Create the chunk.
+ RChunk chunk;
+ if (chunk.Create(chunkInfo) != KErrNone)
+ return NULL;
+ // Create the heap using the new chunk.
+ TUint mode = aCreateInfo.iMode | EChunkHeapDuplicate; // Must duplicate the handle.
+ h = OffsetChunkHeap(chunk, aCreateInfo.iMinLength, aCreateInfo.iOffset,
+ aCreateInfo.iGrowBy, maxLength, aCreateInfo.iAlign,
+ aCreateInfo.iSingleThread, mode);
+ chunk.Close();
+ }
+ else
+ {
+ h = OffsetChunkHeap(aCreateInfo.iChunk, aCreateInfo.iMinLength, aCreateInfo.iOffset,
+ aCreateInfo.iGrowBy, aCreateInfo.iMaxLength, aCreateInfo.iAlign,
+ aCreateInfo.iSingleThread, aCreateInfo.iMode);
+ }
+ return h;
+}
+
+
+
+EXPORT_C RHeap* UserHeap::ChunkHeap(const TDesC* aName, TInt aMinLength, TInt aMaxLength, TInt aGrowBy, TInt aAlign, TBool aSingleThread)
+/**
+Creates a heap in a local or global chunk.
+
+The chunk hosting the heap can be local or global.
+
+A local chunk is one which is private to the process creating it and is not
+intended for access by other user processes. A global chunk is one which is
+visible to all processes.
+
+The hosting chunk is local, if the pointer aName is NULL, otherwise the
+hosting chunk is global and the descriptor *aName is assumed to contain
+the name to be assigned to it.
+
+Ownership of the host chunk is vested in the current process.
+
+A minimum and a maximum size for the heap can be specified. On successful
+return from this function, the size of the heap is at least aMinLength.
+If subsequent requests for allocation of memory from the heap cannot be
+satisfied by compressing the heap, the size of the heap is extended in
+increments of aGrowBy until the request can be satisfied. Attempts to extend
+the heap causes the size of the host chunk to be adjusted.
+
+Note that the size of the heap cannot be adjusted by more than aMaxLength.
+
+@param aName If NULL, the function constructs a local chunk to host
+ the heap. If not NULL, a pointer to a descriptor containing
+ the name to be assigned to the global chunk hosting the heap.
+@param aMinLength The minimum length of the heap in bytes. This will be
+ rounded up to the nearest page size by the allocator.
+@param aMaxLength The maximum length in bytes to which the heap can grow. This
+ will be rounded up to the nearest page size by the allocator.
+@param aGrowBy The number of bytes by which the heap will grow when more
+ memory is required. This will be rounded up to the nearest
+ page size by the allocator. If a value is not explicitly
+ specified, the page size is taken by default.
+@param aAlign From Symbian^4 onwards, this value is ignored but EABI 8
+ byte alignment is guaranteed for all allocations 8 bytes or
+ more in size. 4 byte allocations will be aligned to a 4
+ byte boundary. Best to pass in zero.
+@param aSingleThread EFalse if the heap is to be accessed from multiple threads.
+ This will cause internal locks to be created, guaranteeing
+ thread safety.
+
+@return A pointer to the new heap or NULL if the heap could not be created.
+
+@panic USER 41 if aMaxLength is < aMinLength.
+@panic USER 55 if aMinLength is negative.
+@panic USER 56 if aMaxLength is negative.
+*/
+ {
+ TInt page_size;
+ GET_PAGE_SIZE(page_size);
+ TInt minLength = _ALIGN_UP(aMinLength, page_size);
+ TInt maxLength = Max(aMaxLength, minLength);
+
+ TChunkHeapCreateInfo createInfo(minLength, maxLength);
+ createInfo.SetCreateChunk(aName);
+ createInfo.SetGrowBy(aGrowBy);
+ createInfo.SetAlignment(aAlign);
+ createInfo.SetSingleThread(aSingleThread);
+
+ return ChunkHeap(createInfo);
+ }
+
+EXPORT_C RHeap* UserHeap::ChunkHeap(RChunk aChunk, TInt aMinLength, TInt aGrowBy, TInt aMaxLength, TInt aAlign, TBool aSingleThread, TUint32 aMode)
+/**
+Creates a heap in an existing chunk.
+
+This function is intended to be used to create a heap in a user writable code
+chunk as created by a call to RChunk::CreateLocalCode(). This type of heap can
+be used to hold code fragments from a JIT compiler.
+
+@param aChunk The chunk that will host the heap.
+@param aMinLength The minimum length of the heap in bytes. This will be
+ rounded up to the nearest page size by the allocator.
+@param aGrowBy The number of bytes by which the heap will grow when more
+ memory is required. This will be rounded up to the nearest
+ page size by the allocator. If a value is not explicitly
+ specified, the page size is taken by default.
+@param aMaxLength The maximum length in bytes to which the heap can grow. This
+ will be rounded up to the nearest page size by the allocator.
+ If 0 is passed in, the maximum lengt of the chunk is used.
+@param aAlign From Symbian^4 onwards, this value is ignored but EABI 8
+ byte alignment is guaranteed for all allocations 8 bytes or
+ more in size. 4 byte allocations will be aligned to a 4
+ byte boundary. Best to pass in zero.
+@param aSingleThread EFalse if the heap is to be accessed from multiple threads.
+ This will cause internal locks to be created, guaranteeing
+ thread safety.
+@param aMode Flags controlling the heap creation. See RAllocator::TFlags.
+
+@return A pointer to the new heap or NULL if the heap could not be created.
+
+@see UserHeap::OffsetChunkHeap()
+*/
+ {
+ return OffsetChunkHeap(aChunk, aMinLength, 0, aGrowBy, aMaxLength, aAlign, aSingleThread, aMode);
+ }
+
+EXPORT_C RHeap* UserHeap::OffsetChunkHeap(RChunk aChunk, TInt aMinLength, TInt aOffset, TInt aGrowBy, TInt aMaxLength, TInt aAlign, TBool aSingleThread, TUint32 aMode)
+/**
+Creates a heap in an existing chunk, offset from the beginning of the chunk.
+
+This function is intended to be used to create a heap using a chunk which has
+some of its memory already used, at the start of that that chunk. The maximum
+length to which the heap can grow is the maximum size of the chunk, minus the
+data at the start of the chunk.
+
+The offset at which to create the heap is passed in as the aOffset parameter.
+Legacy heap implementations always respected the aOffset value, however more
+modern heap implementations are more sophisticated and cannot necessarily respect
+this value. Therefore, if possible, you should always use an aOffset of 0 unless
+you have a very explicit requirement for using a non zero value. Using a non zero
+value will result in a less efficient heap algorithm being used in order to respect
+the offset.
+
+Another issue to consider when using this function is the type of the chunk passed
+in. In order for the most efficient heap algorithms to be used, the chunk passed
+in should always be a disconnected chunk. Passing in a non disconnected chunk will
+again result in a less efficient heap algorithm being used.
+
+Finally, another requirement for the most efficient heap algorithms to be used is
+for the heap to be able to expand. Therefore, unless you have a specific reason to
+do so, always specify aMaxLength > aMinLength.
+
+So, if possible, use aOffset == zero, aMaxLength > aMinLength and a disconnected
+chunk for best results!
+
+@param aChunk The chunk that will host the heap.
+@param aMinLength The minimum length of the heap in bytes. This will be
+ rounded up to the nearest page size by the allocator.
+@param aOffset The offset in bytes from the start of the chunk at which to
+ create the heap. If used (and it shouldn't really be!)
+ then it will be rounded up to a multiple of 8, to respect
+ EABI 8 byte alignment requirements.
+@param aGrowBy The number of bytes by which the heap will grow when more
+ memory is required. This will be rounded up to the nearest
+ page size by the allocator. If a value is not explicitly
+ specified, the page size is taken by default.
+@param aMaxLength The maximum length in bytes to which the heap can grow. This
+ will be rounded up to the nearest page size by the allocator.
+ If 0 is passed in, the maximum length of the chunk is used.
+@param aAlign From Symbian^4 onwards, this value is ignored but EABI 8
+ byte alignment is guaranteed for all allocations 8 bytes or
+ more in size. 4 byte allocations will be aligned to a 4
+ byte boundary. Best to pass in zero.
+@param aSingleThread EFalse if the heap is to be accessed from multiple threads.
+ This will cause internal locks to be created, guaranteeing
+ thread safety.
+@param aMode Flags controlling the heap creation. See RAllocator::TFlags.
+
+@return A pointer to the new heap or NULL if the heap could not be created.
+
+@panic USER 41 if aMaxLength is < aMinLength.
+@panic USER 55 if aMinLength is negative.
+@panic USER 56 if aMaxLength is negative.
+@panic USER 168 if aOffset is negative.
+*/
+ {
+ TBool dlOnly = EFalse;
+ TInt pageSize;
+ GET_PAGE_SIZE(pageSize);
+ TInt align = RHybridHeap::ECellAlignment; // Always use EABI 8 byte alignment
+
+ __ASSERT_ALWAYS(aMinLength>=0, ::Panic(ETHeapMinLengthNegative));
+ __ASSERT_ALWAYS(aMaxLength>=0, ::Panic(ETHeapMaxLengthNegative));
+
+ if ( aMaxLength > 0 )
+ __ASSERT_ALWAYS(aMaxLength>=aMinLength, ::Panic(ETHeapCreateMaxLessThanMin));
+
+ // Stick to EABI alignment for the start offset, if any
+ aOffset = _ALIGN_UP(aOffset, align);
+
+ // Using an aOffset > 0 means that we can't use the hybrid allocator and have to revert to Doug Lea only
+ if (aOffset > 0)
+ dlOnly = ETrue;
+
+ // Ensure that the minimum length is enough to hold the RHybridHeap object itself
+ TInt minCell = _ALIGN_UP(Max((TInt)RHybridHeap::EAllocCellSize, (TInt)RHybridHeap::EFreeCellSize), align);
+ TInt hybridHeapSize = (sizeof(RHybridHeap) + minCell);
+ if (aMinLength < hybridHeapSize)
+ aMinLength = hybridHeapSize;
+
+ // Round the minimum length up to a multiple of the page size, taking into account that the
+ // offset takes up a part of the chunk's memory
+ aMinLength = _ALIGN_UP((aMinLength + aOffset), pageSize);
+
+ // If aMaxLength is 0 then use the entire chunk
+ TInt chunkSize = aChunk.MaxSize();
+ if (aMaxLength == 0)
+ {
+ aMaxLength = chunkSize;
+ }
+ // Otherwise round the maximum length up to a multiple of the page size, taking into account that
+ // the offset takes up a part of the chunk's memory. We also clip the maximum length to the chunk
+ // size, so the user may get a little less than requested if the chunk size is not large enough
+ else
+ {
+ aMaxLength = _ALIGN_UP((aMaxLength + aOffset), pageSize);
+ if (aMaxLength > chunkSize)
+ aMaxLength = chunkSize;
+ }
+
+ // If the rounded up values don't make sense then a crazy aMinLength or aOffset must have been passed
+ // in, so fail the heap creation
+ if (aMinLength > aMaxLength)
+ return NULL;
+
+ // Adding the offset into the minimum and maximum length was only necessary for ensuring a good fit of
+ // the heap into the chunk. Re-adjust them now back to non offset relative sizes
+ aMinLength -= aOffset;
+ aMaxLength -= aOffset;
+
+ // If we are still creating the hybrid allocator (call parameter
+ // aOffset is 0 and aMaxLength > aMinLength), we must reduce heap
+ // aMaxLength size to the value aMaxLength/2 and set the aOffset to point in the middle of chunk.
+ TInt offset = aOffset;
+ TInt maxLength = aMaxLength;
+ if (!dlOnly && (aMaxLength > aMinLength))
+ maxLength = offset = _ALIGN_UP(aMaxLength >> 1, pageSize);
+
+ // Try to use commit to map aMinLength physical memory for the heap, taking into account the offset. If
+ // the operation fails, suppose that the chunk is not a disconnected heap and try to map physical memory
+ // with adjust. In this case, we also can't use the hybrid allocator and have to revert to Doug Lea only
+ TBool useAdjust = EFalse;
+ TInt r = aChunk.Commit(offset, aMinLength);
+ if (r == KErrGeneral)
+ {
+ dlOnly = useAdjust = ETrue;
+ r = aChunk.Adjust(aMinLength);
+ if (r != KErrNone)
+ return NULL;
+ }
+ else if (r == KErrNone)
+ {
+ // We have a disconnected chunk reset aOffset and aMaxlength
+ aOffset = offset;
+ aMaxLength = maxLength;
+ }
+
+ else
+ return NULL;
+
+ // Parameters have been mostly verified and we know whether to use the hybrid allocator or Doug Lea only. The
+ // constructor for the hybrid heap will automatically drop back to Doug Lea if it determines that aMinLength
+ // == aMaxLength, so no need to worry about that requirement here. The user specified alignment is not used but
+ // is passed in so that it can be sanity checked in case the user is doing something totally crazy with it
+ RHybridHeap* h = new (aChunk.Base() + aOffset) RHybridHeap(aChunk.Handle(), aOffset, aMinLength, aMaxLength,
+ aGrowBy, aAlign, aSingleThread, dlOnly, useAdjust);
+
+ if (h->ConstructLock(aMode) != KErrNone)
+ return NULL;
+
+ // Return the heap address
+ return h;
+ }
+
+#define UserTestDebugMaskBit(bit) (TBool)(UserSvr::DebugMask(bit>>5) & (1<<(bit&31)))
+
+_LIT(KLitDollarHeap,"$HEAP");
+EXPORT_C TInt UserHeap::CreateThreadHeap(SStdEpocThreadCreateInfo& aInfo, RHeap*& aHeap, TInt aAlign, TBool aSingleThread)
+/**
+@internalComponent
+*/
+//
+// Create a user-side heap
+//
+{
+ TInt page_size;
+ GET_PAGE_SIZE(page_size);
+ TInt minLength = _ALIGN_UP(aInfo.iHeapInitialSize, page_size);
+ TInt maxLength = Max(aInfo.iHeapMaxSize, minLength);
+ if (UserTestDebugMaskBit(96)) // 96 == KUSERHEAPTRACE in nk_trace.h
+ aInfo.iFlags |= ETraceHeapAllocs;
+ // Create the thread's heap chunk.
+ RChunk c;
+ TChunkCreateInfo createInfo;
+
+ createInfo.SetThreadHeap(0, maxLength, KLitDollarHeap()); // Initialise with no memory committed.
+#if USE_HYBRID_HEAP
+ //
+ // Create disconnected chunk for hybrid heap with double max length value
+ //
+ maxLength = 2*maxLength;
+ createInfo.SetDisconnected(0, 0, maxLength);
+#endif
+ // Set the paging policy of the heap chunk based on the thread's paging policy.
+ TUint pagingflags = aInfo.iFlags & EThreadCreateFlagPagingMask;
+ switch (pagingflags)
+ {
+ case EThreadCreateFlagPaged:
+ createInfo.SetPaging(TChunkCreateInfo::EPaged);
+ break;
+ case EThreadCreateFlagUnpaged:
+ createInfo.SetPaging(TChunkCreateInfo::EUnpaged);
+ break;
+ case EThreadCreateFlagPagingUnspec:
+ // Leave the chunk paging policy unspecified so the process's
+ // paging policy is used.
+ break;
+ }
+
+ TInt r = c.Create(createInfo);
+ if (r!=KErrNone)
+ return r;
+
+ aHeap = ChunkHeap(c, minLength, page_size, maxLength, aAlign, aSingleThread, EChunkHeapSwitchTo|EChunkHeapDuplicate);
+ c.Close();
+
+ if ( !aHeap )
+ return KErrNoMemory;
+
+ if (aInfo.iFlags & ETraceHeapAllocs)
+ {
+ aHeap->iFlags |= RHeap::ETraceAllocs;
+ BTraceContext8(BTrace::EHeap, BTrace::EHeapCreate,(TUint32)aHeap, RHybridHeap::EAllocCellSize);
+ TInt chunkId = ((RHandleBase&)((RHybridHeap*)aHeap)->iChunkHandle).BTraceId();
+ BTraceContext8(BTrace::EHeap, BTrace::EHeapChunkCreate, (TUint32)aHeap, chunkId);
+ }
+ if (aInfo.iFlags & EMonitorHeapMemory)
+ aHeap->iFlags |= RHeap::EMonitorMemory;
+
+ return KErrNone;
+}
+
+#endif // __KERNEL_MODE__
--- a/kernel/eka/include/e32ver.h Thu Jun 10 11:48:01 2010 +0100
+++ b/kernel/eka/include/e32ver.h Wed Jun 23 11:59:44 2010 +0100
@@ -28,7 +28,7 @@
const TInt KE32MajorVersionNumber=2;
const TInt KE32MinorVersionNumber=0;
-const TInt KE32BuildVersionNumber=3090;
+const TInt KE32BuildVersionNumber=3093;
const TInt KMachineConfigurationMajorVersionNumber=1;
const TInt KMachineConfigurationMinorVersionNumber=0;
--- a/kernel/eka/release.txt Thu Jun 10 11:48:01 2010 +0100
+++ b/kernel/eka/release.txt Wed Jun 23 11:59:44 2010 +0100
@@ -1,3 +1,30 @@
+Version 2.00.3093
+=================
+(Made by vfebvre 09/06/2010)
+
+1. gcochran
+ 1. ou1cimx1#400079 MCL: E32TEST RMessagePtr2::Kill is not exercised by t_message
+
+2. jimhofe
+ 1. ou1cimx1#411346 MCL wk22 build break in kernelhwsrv
+
+
+Version 2.00.3092
+=================
+(Made by vfebvre 04/06/2010)
+
+1. cnotton
+ 1. ou1cimx1#413372 Attempt to export missing file bootstrap_smrif.h
+
+
+Version 2.00.3091
+=================
+(Made by vfebvre 04/06/2010)
+
+1. mmoate
+ 1. MINOR_CHANGE Correct insource docs for aSingleThread parameter in UserHeap methods
+
+
Version 2.00.3090
=================
(Made by vfebvre 03/06/2010)
--- a/kernel/eka/rombuild/nandtest_test_f32tests.oby Thu Jun 10 11:48:01 2010 +0100
+++ b/kernel/eka/rombuild/nandtest_test_f32tests.oby Wed Jun 23 11:59:44 2010 +0100
@@ -100,7 +100,7 @@
#else
rofsname = dir.rofs
#endif //MULTIPLEROFS
-rofssize = 0x550000
+rofssize = 0x5E0000
#ifdef PAGED_ROM
PAGINGOVERRIDE DEFAULTPAGED
--- a/kerneltest/e32test/active/t_messge.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/e32test/active/t_messge.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -78,7 +78,8 @@
class CTestSession : public CSession2
{
public:
- enum {EStop,ETestInt,ETestPtr,ETestClient,ETestComplete,ETestPtrComplete,ETestCompletePanic,ETestOtherSession,ETestCompleteAfter,ETestMessageConstruction, ETestRMessagePtr2LeavingInterface};
+ enum {EStop,ETestInt,ETestPtr,ETestClient,ETestComplete,ETestPtrComplete,ETestCompletePanic,ETestOtherSession,ETestCompleteAfter,ETestMessageConstruction,
+ ETestRMessagePtr2LeavingInterface, ETestKillCompletePanic};
//Override pure virtual
IMPORT_C virtual void ServiceL(const RMessage2& aMessage);
private:
@@ -323,6 +324,10 @@
case ETestRMessagePtr2LeavingInterface:
r=TestRMessagePtr2LeavingInterface(aMessage);
break;
+ case ETestKillCompletePanic:
+ aMessage.Complete(KErrNone);
+ aMessage.Panic(_L("Testing Panic"),0xFF); //This will panic the server!
+ break;
default:
r=KErrNotSupported;
@@ -480,7 +485,7 @@
test.Next(_L("Start ActiveScheduler and signal to client"));
- test.Printf(_L(" There might be something going on beneath this window"));
+ test.Printf(_L(" There might be something going on beneath this window\n"));
sem.Signal();
CActiveScheduler::Start();
test.Next(_L("Destroy ActiveScheduler"));
@@ -522,6 +527,23 @@
session.PublicSendReceive(CTestSession::EStop, TIpcArgs());//panic should occur before this is serviced
return(KErrNone);
}
+
+TInt KillCompletePanicClientThread (TAny*)
+//
+// A client thread entry - signals to server to kill client after completing the message
+//
+ {
+ sem.Wait();
+
+ TInt r=session.PublicCreateSession(_L("CTestServer"),1);
+ test(r==KErrNone);
+
+ r=session.PublicSendReceive(CTestSession::ETestKillCompletePanic, TIpcArgs());
+ test(r==KErrNone);
+
+ session.PublicSendReceive(CTestSession::EStop, TIpcArgs());//panic should occur before this is serviced
+ return(KErrNone);
+ }
void SimpleRMessage()
//
@@ -575,7 +597,86 @@
test.End();
}
+
+void TestServerCompleteTwicePanic(void)
+ {
+ TRequestStatus clientStat,serverStat;
+
+ TBool justInTime=User::JustInTime();
+
+ test.Next(_L("Check server panics if you try to complete a message twice"));
+ test.Start(_L("Create client and server threads"));
+ clientThread.Create(_L("Client Thread1"),CompletePanicClientThread,KDefaultStackSize,KHeapMinSize,KHeapMaxSize,NULL);
+ serverThread.Create(_L("Server Thread"),ServerThread,KDefaultStackSize,KHeapMinSize,KHeapMaxSize,NULL);
+
+ test.Next(_L("Logon to the threads"));
+ clientThread.Logon(clientStat);
+ serverThread.Logon(serverStat);
+ test.Next(_L("Start the threads"));
+ sem.CreateLocal(0);
+ User::SetJustInTime(EFalse);
+ clientThread.Resume();
+ serverThread.Resume();
+
+ test.Next(_L("Wait for the threads to stop"));
+ User::WaitForRequest(clientStat); //
+ User::WaitForRequest(serverStat);
+ User::SetJustInTime(justInTime);
+ test.Next(_L("Check the exit categories"));
+ test(clientThread.ExitType()==EExitKill);
+ test(clientThread.ExitCategory().Compare(_L("Kill"))==0);
+ test(clientThread.ExitReason()==KErrNone);
+
+ test(serverThread.ExitType()==EExitPanic);
+ test(serverThread.ExitCategory().Compare(_L("USER"))==0);
+ test(serverThread.ExitReason()==ETMesCompletion);
+
+ test.Next(_L("Close the threads"));
+ CLOSE_AND_WAIT(serverThread);
+ CLOSE_AND_WAIT(clientThread);
+ test.End();
+ }
+
+void TestServerKillCompletePanic(void)
+ {
+ TRequestStatus clientStat,serverStat;
+
+ TBool justInTime=User::JustInTime();
+
+ test.Next(_L("Check Server panics if you try to panic a client using a completed message"));
+ test.Start(_L("Create client and server threads"));
+ clientThread.Create(_L("Client Thread2"),KillCompletePanicClientThread,KDefaultStackSize,KHeapMinSize,KHeapMaxSize,NULL);
+ serverThread.Create(_L("Server Thread"),ServerThread,KDefaultStackSize,KHeapMinSize,KHeapMaxSize,NULL);
+
+ test.Next(_L("Logon to the threads"));
+ clientThread.Logon(clientStat);
+ serverThread.Logon(serverStat);
+
+ test.Next(_L("Start the threads"));
+ sem.CreateLocal(0);
+ User::SetJustInTime(EFalse);
+ clientThread.Resume();
+ serverThread.Resume();
+
+ test.Next(_L("Wait for the threads to stop"));
+ User::WaitForRequest(clientStat);
+ User::WaitForRequest(serverStat);
+ User::SetJustInTime(justInTime);
+ test.Next(_L("Check the exit categories"));
+ test(clientThread.ExitType()==EExitKill);
+ test(clientThread.ExitCategory().Compare(_L("Kill"))==0);
+ test(clientThread.ExitReason()==KErrNone);
+
+ test(serverThread.ExitType()==EExitPanic);
+ test(serverThread.ExitCategory().Compare(_L("KERN-EXEC"))==0);
+ test(serverThread.ExitReason()==EBadMessageHandle);
+
+ test.Next(_L("Close the threads"));
+ CLOSE_AND_WAIT(serverThread);
+ CLOSE_AND_WAIT(clientThread);
+ test.End();
+ }
GLDEF_C TInt E32Main()
{
@@ -643,41 +744,10 @@
CLOSE_AND_WAIT(serverThread);
CLOSE_AND_WAIT(clientThread);
test.End();
-
- TBool justInTime=User::JustInTime();
-
- test.Next(_L("Check it Panics if you try to Complete a message twice"));
- test.Start(_L("Create client and server threads"));
- clientThread.Create(_L("Client Thread1"),CompletePanicClientThread,KDefaultStackSize,KHeapMinSize,KHeapMaxSize,NULL);
- serverThread.Create(_L("Server Thread"),ServerThread,KDefaultStackSize,KHeapMinSize,KHeapMaxSize,NULL);
-
- test.Next(_L("Logon to the threads"));
- clientThread.Logon(clientStat);
- serverThread.Logon(serverStat);
-
- test.Next(_L("Start the threads"));
- sem.CreateLocal(0);
- User::SetJustInTime(EFalse);
- clientThread.Resume();
- serverThread.Resume();
- test.Next(_L("Wait for the threads to stop"));
- User::WaitForRequest(clientStat); //
- User::WaitForRequest(serverStat);
- User::SetJustInTime(justInTime);
- test.Next(_L("Check the exit categories"));
- test(clientThread.ExitType()==EExitKill);
- test(clientThread.ExitCategory().Compare(_L("Kill"))==0);
- test(clientThread.ExitReason()==KErrNone);
-
- test(serverThread.ExitType()==EExitPanic);
- test(serverThread.ExitCategory().Compare(_L("USER"))==0);
- test(serverThread.ExitReason()==ETMesCompletion);
-
- test.Next(_L("Close the threads"));
- CLOSE_AND_WAIT(serverThread);
- CLOSE_AND_WAIT(clientThread);
- test.End();
+ TestServerCompleteTwicePanic();
+
+ TestServerKillCompletePanic();
test.End();
--- a/kerneltest/e32utils/group/base_e32utils.mrp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/e32utils/group/base_e32utils.mrp Wed Jun 23 11:59:44 2010 +0100
@@ -17,7 +17,6 @@
source \sf\os\kernelhwsrv\kerneltest\e32utils\trace
source \sf\os\kernelhwsrv\kerneltest\e32utils\usbmsapp
source \sf\os\kernelhwsrv\kerneltest\e32utils\sdpartition
-source \sf\os\kernelhwsrv\kerneltest\e32utils\nandboot\coreldr\bootstrap_smrif.h
#MattD: Reltools 2.67 don't understand 'cwtools' are the CW equivelent of 'tools' and try to do '-what cwtools udeb' instead of '-what cwtools deb'.
#binary \sf\os\kernelhwsrv\kerneltest\e32utils\group cwtools
--- a/kerneltest/e32utils/group/bld.inf Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/e32utils/group/bld.inf Wed Jun 23 11:59:44 2010 +0100
@@ -30,8 +30,6 @@
PRJ_EXPORTS
-../nandboot/coreldr/bootstrap_smrif.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(bootstrap_smrif.h)
-
../profiler/profiler.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(profiler.h)
../analyse/profiler.rtf /epoc32/engdoc/profiler/profiler.rtf
--- a/kerneltest/f32test/fileutils/inc/f32_test_utils.h Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/fileutils/inc/f32_test_utils.h Wed Jun 23 11:59:44 2010 +0100
@@ -138,11 +138,14 @@
-TBool Is_Lffs(RFs &aFs, TInt aDrive); //-- returns ETrue if "lffs" FS is mounted on this drive
-TBool Is_Win32(RFs &aFs, TInt aDrive); //-- returns ETrue if "win32" FS is mounted on this drive (i.e this is emulator's drive c:)
-TBool Is_ExFat(RFs &aFs, TInt aDrive); //-- returns ETrue if "exFAT" FS is mounted on this drive
-TBool Is_Automounter(RFs &aFs, TInt aDrive); //-- returns ETrue if "Automounter" FS is mounted on this drive
+TBool Is_Lffs(RFs &aFs, TInt aDrive); //-- returns ETrue if "lffs" FS is mounted on this drive
+TBool Is_Win32(RFs &aFs, TInt aDrive); //-- returns ETrue if "Win32" FS is mounted on this drive (i.e this is emulator's drive C:)
+TBool Is_ExFat(RFs &aFs, TInt aDrive); //-- returns ETrue if "exFAT" FS is mounted on this drive
+TBool Is_Automounter(RFs &aFs, TInt aDrive); //-- returns ETrue if "Automounter" FS is mounted on this drive
+TBool Is_HVFS(RFs &aFs, TInt aDrive); //-- returns ETrue if "HVFS" is mounted on this drive (i.e PlatSim's drive C:)
+TBool Is_SimulatedSystemDrive(RFs &aFs, TInt aDrive); //-- returns ETrue if "HVFS" or "Win32" FS is mounted on this drive
+ // (i.e drive C: of PlatSim or the emulator)
TBool Is_Fat(RFs &aFs, TInt aDrive); //-- returns ETrue if "FAT" FS (FAT12/16/32) is mounted on this drive
--- a/kerneltest/f32test/fileutils/src/f32_test_utils.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/fileutils/src/f32_test_utils.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -248,6 +248,7 @@
_LIT(KFsName_Win32, "Win32");
_LIT(KFsName_ExFAT, "ExFat");
_LIT(KFsName_AutoMonuter, "automounter");
+_LIT(KFsName_HVFS, "HVFS");
/** @return ETrue if "Automounter" FS is mounted on this drive */
TBool F32_Test_Utils::Is_Automounter(RFs &aFs, TInt aDrive)
@@ -273,7 +274,7 @@
}
-/** @return ETrue if "Win32" FS is mounted on this drive (i.e this is emulator's drive c:) */
+/** @return ETrue if "Win32" FS is mounted on this drive (i.e this is emulator's drive C:) */
TBool F32_Test_Utils::Is_Win32(RFs &aFs, TInt aDrive)
{
ASSERT(aDrive >= EDriveA && aDrive <= EDriveZ);
@@ -284,6 +285,29 @@
return (f.CompareF(KFsName_Win32) == 0 );
}
+/** @return ETrue if "HVFS" is mounted on this drive (i.e PlatSim's drive C:) */
+TBool F32_Test_Utils::Is_HVFS(RFs &aFs, TInt aDrive)
+{
+ ASSERT(aDrive >= EDriveA && aDrive <= EDriveZ);
+ TFSName f;
+ TInt r = aFs.FileSystemName(f, aDrive);
+ __ASSERT_ALWAYS((r==KErrNone) && (f.Length()>0), User::Invariant());
+
+ return (f.CompareF(KFsName_HVFS) == 0);
+}
+
+/** @return ETrue if "HVFS" or "Win32" FS is mounted on this drive
+ * (i.e drive C: of PlatSim or the emulator) */
+TBool F32_Test_Utils::Is_SimulatedSystemDrive(RFs &aFs, TInt aDrive)
+{
+ ASSERT(aDrive >= EDriveA && aDrive <= EDriveZ);
+ TFSName f;
+ TInt r = aFs.FileSystemName(f, aDrive);
+ __ASSERT_ALWAYS((r==KErrNone) && (f.Length()>0), User::Invariant());
+
+ return (f.CompareF(KFsName_HVFS) == 0 || f.CompareF(KFsName_Win32) == 0);
+}
+
/** @return ETrue if the filesystem if FAT (fat12/16/32) */
TBool F32_Test_Utils::Is_Fat(RFs &aFs, TInt aDrive)
{
--- a/kerneltest/f32test/group/b_file.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/b_file.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -15,12 +15,13 @@
//
//
-TARGET b_file.exe
+TARGET b_file.exe
TARGETTYPE EXE
SOURCEPATH ../server
SOURCE b_file.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/b_mtst.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/b_mtst.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,7 +21,8 @@
SOURCE b_mtst.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
-SOURCE t_chlffs.cpp
+SOURCE f32_test_utils.cpp
+SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
USERINCLUDE ../server
--- a/kerneltest/f32test/group/b_open.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/b_open.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE b_open.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/b_osfil.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/b_osfil.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,7 +21,8 @@
SOURCE b_osfil.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
-SOURCE t_chlffs.cpp
+SOURCE f32_test_utils.cpp
+SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
USERINCLUDE ../server
--- a/kerneltest/f32test/group/b_rand.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/b_rand.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,7 +21,8 @@
SOURCE b_rand.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
-SOURCE t_chlffs.cpp
+SOURCE f32_test_utils.cpp
+SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
USERINCLUDE ../server
--- a/kerneltest/f32test/group/b_rep.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/b_rep.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,7 +21,8 @@
SOURCE b_rep.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
-SOURCE t_chlffs.cpp
+SOURCE f32_test_utils.cpp
+SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
USERINCLUDE ../server
--- a/kerneltest/f32test/group/clean_prepdc.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/clean_prepdc.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,7 +21,8 @@
SOURCE clean_prepdc.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
-SOURCE t_chlffs.cpp
+SOURCE f32_test_utils.cpp
+SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
USERINCLUDE ../server
--- a/kerneltest/f32test/group/t_alert.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_alert.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_alert.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_appins.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_appins.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -20,7 +20,8 @@
SOURCEPATH ../server
SOURCE t_appins.cpp t_main.cpp
SOURCEPATH ../fileutils/src
-SOURCE t_chlffs.cpp
+SOURCE f32_test_utils.cpp
+SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
USERINCLUDE ../server
--- a/kerneltest/f32test/group/t_bigfile.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_bigfile.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE T_BIGFILE.CPP
SOURCE T_MAIN.CPP
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY EUSER.LIB EFSRV.LIB HAL.LIB
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_blockmap.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_blockmap.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_blockmap.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_cfileman.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_cfileman.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -24,6 +24,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
USERINCLUDE ../server
--- a/kerneltest/f32test/group/t_chkuid.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_chkuid.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_chkuid.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_clobbr.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_clobbr.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,6 +22,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_dcallcaps.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_dcallcaps.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_dcallcaps.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_dcallfiles.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_dcallfiles.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_dcallfiles.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_dcdiskadmin.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_dcdiskadmin.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,7 +21,8 @@
SOURCE t_dcdiskadmin.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
-SOURCE t_chlffs.cpp
+SOURCE f32_test_utils.cpp
+SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_dcdiskadminallfiles.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_dcdiskadminallfiles.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_dcdiskadminallfiles.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_dcnone.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_dcnone.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,7 +21,8 @@
SOURCE t_dcnone.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
-SOURCE t_chlffs.cpp
+SOURCE f32_test_utils.cpp
+SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_dctcb.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_dctcb.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,7 +21,8 @@
SOURCE t_dctcb.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
-SOURCE t_chlffs.cpp
+SOURCE f32_test_utils.cpp
+SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_dctcballfiles.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_dctcballfiles.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,7 +21,8 @@
SOURCE t_dctcballfiles.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
-SOURCE t_chlffs.cpp
+SOURCE f32_test_utils.cpp
+SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_dctcbdiskadmin.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_dctcbdiskadmin.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,7 +21,8 @@
SOURCE t_dctcbdiskadmin.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
-SOURCE t_chlffs.cpp
+SOURCE f32_test_utils.cpp
+SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_dlocl.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_dlocl.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -20,7 +20,8 @@
SOURCEPATH ../server
SOURCE t_dlocl.cpp t_main.cpp
SOURCEPATH ../fileutils/src
-SOURCE t_chlffs.cpp
+SOURCE f32_test_utils.cpp
+SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib ektran.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_dspace.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_dspace.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,7 +21,8 @@
SOURCE t_dspace.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
-SOURCE t_chlffs.cpp
+SOURCE f32_test_utils.cpp
+SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_fman.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_fman.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
source t_fman.cpp
source t_main.cpp
sourcepath ../fileutils/src
+source f32_test_utils.cpp
source t_chlffs.cpp
library euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_fnames.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_fnames.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_fnames.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_fragmentdp.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_fragmentdp.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,6 +22,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_fsched.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_fsched.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -20,9 +20,12 @@
SOURCEPATH ../server
SOURCE t_fsched.cpp
+SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+USERINCLUDE ../fileutils/inc
EPOCSTACKSIZE 0x10000
EPOCHEAPSIZE 0x1000 0x02000000
--- a/kerneltest/f32test/group/t_fsrvbm.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_fsrvbm.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,6 +22,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_fsy2k.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_fsy2k.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_fsy2k.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_fsysbm.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_fsysbm.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,6 +22,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_gdir.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_gdir.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_gdir.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_gen.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_gen.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -20,6 +20,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
SOURCEPATH ../math
SOURCE t_gen.cpp
--- a/kerneltest/f32test/group/t_gen32.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_gen32.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -20,6 +20,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
SOURCEPATH ../math
SOURCE t_gen32.cpp
--- a/kerneltest/f32test/group/t_handshare.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_handshare.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,6 +22,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_localtime.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_localtime.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -20,6 +20,7 @@
SOURCEPATH ../server
SOURCE t_localtime.cpp t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_locate.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_locate.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_locate.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_lock.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_lock.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_lock.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_misc.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_misc.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_misc.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_nmbs.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_nmbs.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_nmbs.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_notifier.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_notifier.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -20,8 +20,9 @@
sourcepath ../server
source t_notifier.cpp
source t_main.cpp
-sourcepath ../fileutils/src
-source t_chlffs.cpp
+sourcepath ../fileutils/src
+source f32_test_utils.cpp
+source t_chlffs.cpp
library euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_notify.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_notify.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
source t_notify.cpp
source t_main.cpp
SOURCEPATH ../fileutils/src
+source f32_test_utils.cpp
source t_chlffs.cpp
library euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_notify_mfs.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_notify_mfs.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,8 +22,9 @@
source t_notify_perf_impl.cpp t_notify_perf_util.cpp
sourcepath ../server
source t_notify_mfs.cpp t_main.cpp
-sourcepath ../fileutils/src
-source t_chlffs.cpp
+sourcepath ../fileutils/src
+source f32_test_utils.cpp
+source t_chlffs.cpp
library euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_notify_perf.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_notify_perf.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -23,7 +23,8 @@
sourcepath ../server
source t_main.cpp
sourcepath ../fileutils/src
-source t_chlffs.cpp
+source f32_test_utils.cpp
+source t_chlffs.cpp
library euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_notifydismount.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_notifydismount.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -20,6 +20,7 @@
SOURCEPATH ../server
SOURCE t_notifydismount.cpp t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_oom.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_oom.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,6 +22,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_open.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_open.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_open.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_parse.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_parse.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -20,6 +20,7 @@
SOURCEPATH ../server
SOURCE t_parse.cpp t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_proc.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_proc.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -20,8 +20,9 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
-SOURCEPATH ../manager
+SOURCEPATH ../manager
SOURCE t_proc.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_ramstr.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_ramstr.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,6 +22,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_rand.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_rand.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_rand.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_rcount.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_rcount.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_rcount.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_rdsect.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_rdsect.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -20,6 +20,7 @@
SOURCEPATH ../server
SOURCE t_rdsect.cpp t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_resize.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_resize.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_resize.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_romg.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_romg.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,6 +22,7 @@
SOURCEPATH ../SERVER
SOURCE T_MAIN.CPP
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE T_CHLFFS.CPP
LIBRARY EUSER.LIB EFSRV.LIB HAL.LIB
--- a/kerneltest/f32test/group/t_scan.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_scan.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_scan.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_sess.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_sess.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -23,6 +23,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_soak1.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_soak1.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,6 +22,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_vfat.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_vfat.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -21,6 +21,7 @@
SOURCE t_vfat.cpp
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_virus.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_virus.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,6 +22,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_whet.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_whet.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,6 +22,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_whetvfp.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/group/t_whetvfp.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,6 +22,7 @@
SOURCEPATH ../server
SOURCE t_main.cpp
SOURCEPATH ../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/locl/t_filematch.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/locl/t_filematch.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -114,7 +114,8 @@
r = dir.Open(TheFs, name, KEntryAttNormal);
test_KErrNone(r);
TEntry entry;
- test(dir.Read(entry) == KErrNone);
+ r = dir.Read(entry);
+ test_KErrNone(r);
dir.Close();
}
@@ -128,7 +129,8 @@
r = dir.Open(TheFs, name, KEntryAttNormal);
test_KErrNone(r);
TEntry entry;
- test(dir.Read(entry) == KErrEof);
+ r = dir.Read(entry);
+ test_Equal(KErrEof, r);
dir.Close();
}
@@ -184,11 +186,11 @@
F32_Test_Utils::SetConsole(test.Console());
TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum);
- test(nRes==KErrNone);
+ test_KErrNone(nRes);
PrintDrvInfo(TheFs, gDriveNum);
- if(Is_Win32(TheFs, gDriveNum) || Is_Fat(TheFs, gDriveNum) || Is_Lffs(TheFs, gDriveNum))
+ if(Is_SimulatedSystemDrive(TheFs, gDriveNum) || Is_Fat(TheFs, gDriveNum) || Is_Lffs(TheFs, gDriveNum))
{
TestFilenameMatches();
}
--- a/kerneltest/f32test/plugins/version_2/crypto_encryption/group/t_encplugin.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/plugins/version_2/crypto_encryption/group/t_encplugin.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -22,6 +22,7 @@
SOURCEPATH ../../../../server
SOURCE t_main.cpp
SOURCEPATH ../../../../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/plugins/version_2/file64bit/group/t_file64bit_plugin.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/plugins/version_2/file64bit/group/t_file64bit_plugin.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -26,6 +26,7 @@
SOURCEPATH ../../../../server
SOURCE t_main.cpp
SOURCEPATH ../../../../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
LIBRARY euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/plugins/version_2/group/t_plugin_v2.mmp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/plugins/version_2/group/t_plugin_v2.mmp Wed Jun 23 11:59:44 2010 +0100
@@ -27,6 +27,7 @@
SOURCEPATH ../../../server
SOURCE t_main.cpp
SOURCEPATH ../../../fileutils/src
+SOURCE f32_test_utils.cpp
SOURCE t_chlffs.cpp
USERINCLUDE ../../../server
--- a/kerneltest/f32test/plugins/version_2beta/t_plugin_v2beta.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/plugins/version_2beta/t_plugin_v2beta.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -172,7 +172,7 @@
}
else
- if ((gFileSystemExtensionLoaded || name.CompareF(_L("Win32"))==0)&& r == KErrNotSupported)
+ if ((gFileSystemExtensionLoaded || F32_Test_Utils::Is_Win32(TheFs,driveNum)) && r == KErrNotSupported)
{
test.Printf(_L("File system extension does not support local buffers\n"));
file.Close();
@@ -449,7 +449,7 @@
// run T_FILE with trace plugin installed
#if defined(__WINS__) // only in WINS to save time
-TestLoadingOfTracePlugin();
+ TestLoadingOfTracePlugin();
RProcess p;
@@ -464,11 +464,11 @@
p.Logon(status);
p.Resume();
User::WaitForRequest(status);
-TestUnloadingOfTracePlugin();
+ TestUnloadingOfTracePlugin();
#endif // __WINS__
// Cannot format drive C: so skip this test on that drive
- if (!F32_Test_Utils::Is_Win32(TheFs, EDriveC))
+ if (!F32_Test_Utils::Is_SimulatedSystemDrive(TheFs, EDriveC))
{
TestLoadingOfFormatPlugin();
TestFormatDriveIntercept();
--- a/kerneltest/f32test/server/b_gen.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/server/b_gen.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -13,6 +13,7 @@
// Description:
//
+#define __E32TEST_EXTENSION__
#include <f32file.h>
#include <e32test.h>
#include <e32math.h>
@@ -136,7 +137,7 @@
TChar drive(aDirName[0]);
TInt driveNo;
c=RFs::CharToDrive(drive,driveNo);
- test(c==KErrNone);
+ test_KErrNone(c);
if ((c=TheFs.Volume(volInfo,driveNo))!=KErrNone)
Error(_L("Device info 1000"),c);
}
@@ -175,7 +176,7 @@
if (aDeviceName.Length())
{
c=RFs::CharToDrive(aDeviceName[0],drive);
- test(c==KErrNone);
+ test_KErrNone(c);
}
if ((c=TheFs.Volume(volInfo,drive))!=anErr)
Error(_L("Device info"),c);
@@ -283,11 +284,11 @@
dirname.Append(KPathDelimiter);
MakeDir(dirname);
TInt err = TheFs.Rename(KDir1, KDir2);
- test(err == KErrNone);
+ test_KErrNone(err);
err = TheFs.RmDir(dirname);
- test(err == KErrNone);
+ test_KErrNone(err);
err = TheFs.RmDir(KDir1);
- test(err == KErrNone);
+ test_KErrNone(err);
}
static void testRename()
@@ -592,7 +593,7 @@
{
TParse parse;
c=TheFs.Parse(aDirName,parse);
- test(c==KErrNone);
+ test_KErrNone(c);
buf=parse.Path();
buf.Append(_L("*"));
if (buf.Length()<=64)
@@ -688,16 +689,16 @@
F32_Test_Utils::SetConsole(test.Console());
TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum);
- test(nRes==KErrNone);
+ test_KErrNone(nRes);
PrintDrvInfo(TheFs, gDriveNum);
- //-- quick format the drive, if it isn't the emulator's C:
- if(!Is_Win32(TheFs, gDriveNum))
- {
+ //-- quick format the drive, if it isn't drive C: of the emulator or PlatSim
+ if(!Is_SimulatedSystemDrive(TheFs, gDriveNum))
+ {
nRes = FormatDrive(TheFs, gDriveNum, ETrue);
- test(nRes==KErrNone);
- }
+ test_KErrNone(nRes);
+ }
//-----------------------------------
TInt c;
@@ -1251,11 +1252,11 @@
//-- This behaviour can be an optimisation to reduce number of media writes due to updating file timestamps.
gFile.Close();
nRes = gFile.Open(TheFs, gNameOut, EFileWrite);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//-- restore the expected position in the file
TInt pos1 = 0;
nRes = gFile.Seek(ESeekEnd, pos1);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//------------------------------------
*/
--- a/kerneltest/f32test/server/b_open.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/server/b_open.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -23,6 +23,9 @@
#include <f32dbg.h>
#include "t_server.h"
#include "t_chlffs.h"
+#include "f32_test_utils.h"
+
+using namespace F32_Test_Utils;
#ifdef __WINS__
#define WIN32_LEAN_AND_MEAN
@@ -344,15 +347,15 @@
// Call tests that may leave
//
{
+ if (Is_SimulatedSystemDrive(TheFs, CurrentDrive()))
+ {
+ // These tests try to create a huge file to fill up the drive.
+ // This fails on WINS with drives with > 1/2G free because
+ // RFile::SetSize() (among other things) only takes a TInt.
+ test.Printf(_L("Skipping B_OPEN on PlatSim/Emulator drive %C:\n"), gSessionPath[0]);
+ return;
+ }
-#ifdef __WINS__
-// These tests try to create a huge file to fill up the drive.
-// This fails on WINS with drives with > 1/2G free because
-// RFile::SetSize() (among other things) only takes a TInt.
-//
- if (gSessionPath.Left(1).CompareF(_L("C")) == 0)
- return;
-#endif
CreateTestDirectory(_L("\\B_OPEN\\"));
InitTest();
testOpenFiles();
--- a/kerneltest/f32test/server/t_ext1.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/server/t_ext1.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -15,6 +15,7 @@
//
//
+#define __E32TEST_EXTENSION__
#include <f32file.h>
#include <e32test.h>
#include <e32svr.h>
@@ -46,98 +47,97 @@
test.Next(_L("TestSecondaryExtensions()"));
TInt drive;
TInt err=RFs::CharToDrive(gDriveToTest,drive);
- test(err==KErrNone);
+ test_KErrNone(err);
TPckgBuf<TBool> drvSyncBuf;
err = TheFs.QueryVolumeInfoExt(drive, EIsDriveSync, drvSyncBuf);
- test(err==KErrNone);
+ test_KErrNone(err);
const TBool bDrvSync = drvSyncBuf();
TFullName fsName;
TInt r=TheFs.FileSystemName(fsName,drive);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Printf(_L("fsName=%S\n"),&fsName);
-#if defined(__WINS__)
- if(drive==EDriveC)
+ if (Is_SimulatedSystemDrive(TheFs, drive))
{
- // check that the extension cannot be mounted since not supported by the file system
+ // check that the extension cannot be mounted since it is not supported by the file system
+ test.Printf(_L("Test extension cannot be mounted"));
r=TheFs.AddExtension(KExtensionLog);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.MountExtension(KExtensionLogName,drive);
- test(r==KErrNotSupported);
+ test_Value(r, r == KErrNotSupported);
r=TheFs.RemoveExtension(KExtensionLogName);
- test(r==KErrNone);
+ test_KErrNone(r);
return;
}
-#endif
test.Next(_L("RFs::AddExtension()"));
r=TheFs.AddExtension(KExtensionLog);
RDebug::Print(_L("addext=%d"),r);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.AddExtension(KExtensionLog);
- test(r==KErrAlreadyExists);
+ test_Value(r, r == KErrAlreadyExists);
r=TheFs.AddExtension(KExtensionRubbish);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
r=TheFs.AddExtension(KExtensionEmpty);
- test(r==KErrNone);
+ test_KErrNone(r);
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(r==KErrNotSupported);
+ test_Value(r, r == KErrNotSupported);
#endif
// test mounting on drive with no file system
r=TheFs.DismountFileSystem(fsName,drive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.MountExtension(KExtensionLogName,drive);
- test(r==KErrNotReady);
+ test_Value(r, r == KErrNotReady);
r=TheFs.MountFileSystem(fsName,drive,bDrvSync);
- test(r==KErrNone);
+ test_KErrNone(r);
// test with a resource open
_LIT(KFileName,"testing.doc");
RFile file;
r=file.Replace(TheFs,KFileName,EFileShareExclusive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.MountExtension(KExtensionLogName,drive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
file.Close();
r=TheFs.Delete(KFileName);
- test(r==KErrNone);
+ test_KErrNone(r);
// 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(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.MountExtension(KExtensionLogName,drive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
format.Close();
// get the extension name
TFullName extName;
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
// now load the extension
r=TheFs.MountExtension(KExtensionLogName,drive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNone && extName==KExtensionLogName);
+ test_Value(r, r == KErrNone && extName==KExtensionLogName);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
// try remounting the same extension
r=TheFs.MountExtension(KExtensionLogName,drive);
- test(r==KErrAlreadyExists);
+ test_Value(r, r == KErrAlreadyExists);
// mount a second extension
r=TheFs.MountExtension(KExtensionEmptyName,drive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNone && extName==KExtensionLogName);
+ test_Value(r, r == KErrNone && extName==KExtensionLogName);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNone && extName==KExtensionEmptyName);
+ test_Value(r, 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(r == KErrNotReady || r == KErrNone);
+ test_Value(r, r == KErrNotReady || r == KErrNone);
do
{
@@ -181,7 +181,7 @@
RLocalDrive d;
TBool flag=EFalse;
r=d.Connect(1,flag);
- test(r==KErrNone);
+ test_KErrNone(r);
d.ForceMediaChange();
d.Close();
//#if defined(__WINS__)
@@ -195,9 +195,9 @@
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNone && extName==KExtensionLogName);
+ test_Value(r, r == KErrNone && extName==KExtensionLogName);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNone && extName==KExtensionEmptyName);
+ test_Value(r, 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(r==KErrNone||r==KErrAlreadyExists);
+ test_Value(r, r == KErrNone||r==KErrAlreadyExists);
RFile file1;
r=file1.Replace(TheFs,file1Name,EFileShareExclusive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file1.Write(toWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file1.Read(0,readBuf);
test(readBuf==toWrite);
r=file1.SetSize(0);
- test(r==KErrNone);
+ test_KErrNone(r);
file1.Close();
r=TheFs.Delete(file1Name);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(dir1);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("RFs::DismountExtension()"));
// test with a resource open
r=file.Replace(TheFs,KFileName,EFileShareExclusive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.DismountExtension(KExtensionLogName,drive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
file.Close();
r=TheFs.Delete(KFileName);
- test(r==KErrNone);
+ test_KErrNone(r);
// test with a format open
r=format.Open(TheFs,driveBuf,EHighDensity,count);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.DismountExtension(KExtensionLogName,drive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
format.Close();
// now dismount an extension
r=TheFs.DismountExtension(KExtensionLogName,drive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNone && extName==KExtensionEmptyName);
+ test_Value(r, r == KErrNone && extName==KExtensionEmptyName);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
// try to dismount an extension that is not mounted
r=TheFs.DismountExtension(KExtensionLogName,drive);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNone && extName==KExtensionEmptyName);
+ test_Value(r, r == KErrNone && extName==KExtensionEmptyName);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
// dismount the remaining extension
r=TheFs.DismountExtension(KExtensionEmptyName,drive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
test.Next(_L("RFs::RemoveExtension()"));
r=TheFs.RemoveExtension(KExtensionLogName);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RemoveExtension(KExtensionEmptyName);
- test(r==KErrNone);
+ test_KErrNone(r);
}
void TestPrimaryExtensions()
@@ -276,16 +276,17 @@
test.Next(_L("TestPrimaryExtensions()"));
TInt drive;
TInt err=RFs::CharToDrive(gDriveToTest,drive);
- test(err==KErrNone);
+ test_KErrNone(err);
-#if defined(__WINS__)
- if(drive==EDriveC)
+ if(Is_SimulatedSystemDrive(TheFs, drive))
+ {
+ test.Printf(_L("Skipping TestPrimaryExtensions on PlatSim/Emulator drive %C:\n"), gSessionPath[0]);
return;
-#endif
+ }
TPckgBuf<TBool> drvSyncBuf;
err = TheFs.QueryVolumeInfoExt(drive, EIsDriveSync, drvSyncBuf);
- test(err==KErrNone);
+ test_KErrNone(err);
const TBool bDrvSync = drvSyncBuf();
// don't test on ram drive since accesses memory directly
@@ -296,142 +297,142 @@
TFullName fsName;
r=TheFs.FileSystemName(fsName,drive);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Printf(_L("fsName=%S\n"),&fsName);
test.Next(_L("RFs::AddExtension()"));
r=TheFs.AddExtension(KExtensionLog);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.AddExtension(KExtensionEmpty);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.AddExtension(KExtensionBit);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("RFs::MountFileSystem()"));
// test with file system that already exists
r=TheFs.MountFileSystem(fsName,KExtensionBitName,drive,bDrvSync);
- test(r==KErrAccessDenied);
+ test_Value(r, r == KErrAccessDenied);
// unmount drive and mount primary extension along with file system
r=TheFs.DismountFileSystem(fsName,drive);
- test(r==KErrNone);
+ test_KErrNone(r);
//-- !! 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(r==KErrNone||r==KErrCorrupt);
+ test_Value(r, r == KErrNone||r==KErrCorrupt);
// and now format
Format(drive);
TFullName extName;
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNone && extName==KExtensionBitName);
+ test_Value(r, r == KErrNone && extName==KExtensionBitName);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
// and now do some file system operations
TBuf8<16> readBuf;
r=TheFs.MkDir(dir1);
- test(r==KErrNone||r==KErrAlreadyExists);
+ test_Value(r, r == KErrNone||r==KErrAlreadyExists);
RFile file1;
r=file1.Replace(TheFs,file1Name,EFileShareExclusive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file1.Write(toWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file1.Read(0,readBuf);
test(readBuf==toWrite);
r=file1.SetSize(0);
- test(r==KErrNone);
+ test_KErrNone(r);
file1.Close();
r=TheFs.Delete(file1Name);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(dir1);
- test(r==KErrNone);
+ test_KErrNone(r);
// add a secondary extension
test.Printf(_L("RFs::MountExtension()"));
r=TheFs.MountExtension(KExtensionLogName,drive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNone && extName==KExtensionBitName);
+ test_Value(r, r == KErrNone && extName==KExtensionBitName);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNone && extName==KExtensionLogName);
+ test_Value(r, r == KErrNone && extName==KExtensionLogName);
// try to add the same extension
r=TheFs.MountExtension(KExtensionBitName,drive);
- test(r==KErrAlreadyExists);
+ test_Value(r, r == KErrAlreadyExists);
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNone && extName==KExtensionBitName);
+ test_Value(r, r == KErrNone && extName==KExtensionBitName);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNone && extName==KExtensionLogName);
+ test_Value(r, r == KErrNone && extName==KExtensionLogName);
// try to add a third extension
r=TheFs.MountExtension(KExtensionEmptyName,drive);
- test(r==KErrAccessDenied);
+ test_Value(r, r == KErrAccessDenied);
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNone && extName==KExtensionBitName);
+ test_Value(r, r == KErrNone && extName==KExtensionBitName);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNone && extName==KExtensionLogName);
+ test_Value(r, r == KErrNone && extName==KExtensionLogName);
// and now do some file system operations
r=TheFs.MkDir(dir1);
- test(r==KErrNone||r==KErrAlreadyExists);
+ test_Value(r, r == KErrNone||r==KErrAlreadyExists);
r=file1.Replace(TheFs,file1Name,EFileShareExclusive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file1.Write(toWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file1.Read(0,readBuf);
test(readBuf==toWrite);
r=file1.SetSize(0);
- test(r==KErrNone);
+ test_KErrNone(r);
file1.Close();
r=TheFs.Delete(file1Name);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(dir1);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Printf(_L("RFs::DismountExtension()"));
// test that can't dismount a primary extension via this method
r=TheFs.DismountExtension(KExtensionLogName,drive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNone && extName==KExtensionBitName);
+ test_Value(r, r == KErrNone && extName==KExtensionBitName);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
r=TheFs.DismountExtension(KExtensionBitName,drive);
- test(r==KErrAccessDenied);
+ test_Value(r, r == KErrAccessDenied);
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNone && extName==KExtensionBitName);
+ test_Value(r, r == KErrNone && extName==KExtensionBitName);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
test.Printf(_L("RFs::DismountFileSystem()"));
r=TheFs.MountExtension(KExtensionLogName,drive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNone && extName==KExtensionBitName);
+ test_Value(r, r == KErrNone && extName==KExtensionBitName);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNone && extName==KExtensionLogName);
+ test_Value(r, r == KErrNone && extName==KExtensionLogName);
// and now dismount
r=TheFs.DismountFileSystem(fsName,drive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNotReady);
+ test_Value(r, r == KErrNotReady);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNotReady);
+ test_Value(r, r == KErrNotReady);
// remount the file system
r=TheFs.MountFileSystem(fsName,drive,bDrvSync);
- test(r==KErrNone||r==KErrCorrupt);
+ test_Value(r, r == KErrNone||r==KErrCorrupt);
r=TheFs.ExtensionName(extName,drive,0);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
r=TheFs.ExtensionName(extName,drive,1);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
Format(drive);
test.Next(_L("RFs::RemoveExtension()"));
r=TheFs.RemoveExtension(KExtensionLogName);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RemoveExtension(KExtensionEmptyName);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RemoveExtension(KExtensionBitName);
- test(r==KErrNone);
+ test_KErrNone(r);
}
@@ -446,8 +447,21 @@
TInt drive;
TInt err=RFs::CharToDrive(gDriveToTest,drive);
test.Start(_L("Starting Test - T_EXT1"));
- test(err==KErrNone);
+ test_KErrNone(err);
+ // Check that the drive supports extensions.
+ TBool extensionsSupported = EFalse;
+ TPckg<TBool> 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
@@ -461,6 +475,7 @@
TheFs.Drive(driveInfo,drive);
if (driveInfo.iType == EMediaNANDFlash)
{
+ test.Printf(_L("Skipping T_EXT1 as drive %C: is NAND\n"), gSessionPath[0]);
return;
}
#endif
--- a/kerneltest/f32test/server/t_falsespace.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/server/t_falsespace.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -1178,11 +1178,9 @@
r = TheFs.Drive(drv, gTestDrive);
test_KErrNone(r);
-
//-- print drive information
PrintDrvInfo(TheFs, gTestDrive);
-
// do not run the remainder of this test on RAM drive
if (drv.iType == EMediaRam)
{
@@ -1191,9 +1189,9 @@
return;
}
- if (Is_Win32(TheFs, gTestDrive))
+ if (Is_SimulatedSystemDrive(TheFs, gTestDrive))
{
- test.Printf(_L("Skipping on emulator %C: drive\n"), gSessionPath[0]);
+ test.Printf(_L("Skipping T_FALSESPACE on PlatSim/Emulator drive %C:\n"), gSessionPath[0]);
return;
}
@@ -1201,12 +1199,12 @@
Test1(); // General test for new APIs
Test2(); // Test to ensure drive and session reserve limits are not exceeded
Test3();
- Test4(); // test filling the drive and that each checked API fails
+ Test4(); // Test filling the drive and that each checked API fails
Test5();
Test6();
Test7();
TestForDEF142554();
- Test2(); // run this test to check reserves are being cleared correctly
+ Test2(); // Run this test to check reserves are being cleared correctly
TestFAT4G_Boundary();
--- a/kerneltest/f32test/server/t_file.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/server/t_file.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -50,10 +50,10 @@
RFile f1;
TInt r=f1.Open(TheFs,_L("TESTER"),EFileRead|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
RFile f2;
r=f2.Open(TheFs,_L("TESTER"),EFileWrite|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f2.Write(_L("0"));
test.Printf(_L("returned %d"),r);
@@ -62,49 +62,49 @@
f2.Close();
r=TheFs.Delete(_L("TESTER"));
- test(r==KErrNone);
+ test_KErrNone(r);
*/
RFile f1;
TInt r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareExclusive);
- test(r==KErrNone);
+ test_KErrNone(r);
RFile f2;
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareExclusive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareAny);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
f1.Close();
r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileWrite|EFileShareExclusive);
- test(r==KErrNone);
+ test_KErrNone(r);
f1.Close();
test.Next(_L("Test readers only sharing"));
r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileWrite|EFileShareReadersOnly);
- test(r==KErrArgument);
+ test_Value(r, r == KErrArgument);
r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareExclusive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareAny);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileWrite|EFileShareReadersOnly);
- test(r==KErrArgument);
+ test_Value(r, r == KErrArgument);
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
f1.Close();
f2.Close();
test.Next(_L("Test any sharing"));
r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileWrite|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareExclusive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
f1.Close();
f2.Close();
@@ -121,63 +121,63 @@
RFile f1;
RFile f2;
TInt r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareExclusive);
- test(r==KErrNone); // Opened exclusive
+ test_KErrNone(r); // Opened exclusive
r=f1.ChangeMode(EFileShareReadersOnly);
- test(r==KErrNone); // Change to readers only
+ test_KErrNone(r); // Change to readers only
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrNone); // Open as reader
+ test_KErrNone(r); // Open as reader
r=f1.ChangeMode(EFileShareExclusive);
- test(r==KErrAccessDenied); // Change back to exclusive fails
+ test_Value(r, r == KErrAccessDenied); // Change back to exclusive fails
r=f2.ChangeMode(EFileShareExclusive);
- test(r==KErrAccessDenied); // Change to exclusive fails
+ test_Value(r, r == KErrAccessDenied); // Change to exclusive fails
f1.Close(); // Close other reader
r=f2.ChangeMode(EFileShareExclusive);
- test(r==KErrNone); // Change to exclusive succeeds.
+ test_KErrNone(r); // Change to exclusive succeeds.
f2.Close();
r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrNone); // Opened readers only
+ test_KErrNone(r); // Opened readers only
r=f1.ChangeMode(EFileShareExclusive);
- test(r==KErrNone); // Change to exclusive
+ test_KErrNone(r); // Change to exclusive
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrInUse); // Open as reader fails
+ test_Value(r, r == KErrInUse); // Open as reader fails
r=f1.ChangeMode(EFileShareReadersOnly);
- test(r==KErrNone); // Change to readers only
+ test_KErrNone(r); // Change to readers only
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrNone); // Open as reader
+ test_KErrNone(r); // Open as reader
r=f1.ChangeMode(EFileShareExclusive);
- test(r==KErrAccessDenied); // Change back to exclusive fails
+ test_Value(r, r == KErrAccessDenied); // Change back to exclusive fails
r=f2.ChangeMode(EFileShareExclusive);
- test(r==KErrAccessDenied); // Change to exclusive fails
+ test_Value(r, r == KErrAccessDenied); // Change to exclusive fails
f1.Close(); // Close other reader
r=f2.ChangeMode(EFileShareExclusive);
- test(r==KErrNone); // Change to exclusive succeeds.
+ test_KErrNone(r); // Change to exclusive succeeds.
f2.Close();
r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileWrite|EFileShareExclusive);
- test(r==KErrNone); // Opened exclusive for writing
+ test_KErrNone(r); // Opened exclusive for writing
r=f1.ChangeMode(EFileShareReadersOnly);
- test(r==KErrAccessDenied); // Change to readers fails
+ test_Value(r, r == KErrAccessDenied); // Change to readers fails
r=f1.ChangeMode(EFileShareExclusive);
- test(r==KErrNone); // No change ok
+ test_KErrNone(r); // No change ok
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrInUse); // Open as reader fails
+ test_Value(r, r == KErrInUse); // Open as reader fails
f1.Close();
r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareAny);
- test(r==KErrNone); // Opened share any
+ test_KErrNone(r); // Opened share any
r=f1.ChangeMode(EFileShareExclusive);
- test(r==KErrAccessDenied); // Change to exclusive fails
+ test_Value(r, r == KErrAccessDenied); // Change to exclusive fails
r=f1.ChangeMode(EFileShareReadersOnly);
- test(r==KErrAccessDenied); // Change to readers only fails
+ test_Value(r, r == KErrAccessDenied); // Change to readers only fails
f1.Close();
r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareExclusive);
- test(r==KErrNone); // Opened exclusive
+ test_KErrNone(r); // Opened exclusive
r=f1.ChangeMode(EFileShareAny);
- test(r==KErrArgument); // Change to share any fails KErrArgument
+ test_Value(r, r == KErrArgument); // Change to share any fails KErrArgument
r=f1.ChangeMode((TFileMode)42);
- test(r==KErrArgument); // Change to random value fails
+ test_Value(r, r == KErrArgument); // Change to random value fails
f1.Close();
test.End();
}
@@ -191,44 +191,44 @@
test.Start(_L("Test read file"));
RFile f,ZFile;
TInt r=f.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText);
- test(r==KErrNone);
+ test_KErrNone(r);
TFileName fn = _L("Z:\\TEST\\T_FILE.CPP");
fn[0] = gExeFileName[0];
r=ZFile.Open(TheFs,fn,EFileStreamText);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("Read file"));
TBuf8<0x100> a,b;
FOREVER
{
r=f.Read(b);
- test(r==KErrNone);
+ test_KErrNone(r);
r=ZFile.Read(a);
- test(r==KErrNone);
+ test_KErrNone(r);
test(a==b);
if (b.Length()<b.MaxLength())
break;
}
b.SetLength(10);
r=f.Read(b);
- test(r==KErrNone);
+ test_KErrNone(r);
test(b.Length()==0);
f.Close();
ZFile.Close();
test.Next(_L("Read way beyond the end of the file"));
r=f.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Read(3000000,gBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
test.Next(_L("Write way beyond the end of the file"));
r=f.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
gBuf.SetLength(10);
r=f.Write(3000000,gBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
test.End();
}
@@ -242,20 +242,20 @@
test.Start(_L("Test multiple read file"));
RFile f1;
TInt r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
RFile f2;
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("Read file"));
FOREVER
{
TBuf8<0x100> b1;
r=f1.Read(b1);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf8<0x100> b2;
r=f2.Read(b2);
- test(r==KErrNone);
+ test_KErrNone(r);
test(b1==b2);
if (b1.Length()<b1.MaxLength())
break;
@@ -280,68 +280,68 @@
// write test 1
TInt r=file.Replace(TheFs,fn,EFileStreamText);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("Write file"));
r=file.Write(testData);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
// test write modes
// test writing with EFileRead
r=file.Open(TheFs,fn,EFileStreamText|EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("Write file"));
r=file.Write(testData);
- test(r==KErrAccessDenied);
+ test_Value(r, r == KErrAccessDenied);
file.Close();
// test writing with EFileWrite
r=file.Open(TheFs,fn,EFileStreamText|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("Write file"));
r=file.Write(testData);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
// test writing with share mode EFileShareExclusive
r=file.Open(TheFs,fn,EFileStreamText|EFileWrite|EFileShareExclusive);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("Write file"));
r=file.Write(testData);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
// test writing with share mode EFileShareReadersOnly (fails with KErrArgument)
r=file.Open(TheFs,fn,EFileStreamText|EFileWrite|EFileShareReadersOnly);
- test(r==KErrArgument);
+ test_Value(r, r == KErrArgument);
// test writing with share mode EFileShareReadersOrWriters
r=file.Open(TheFs,fn,EFileStreamText|EFileWrite|EFileShareReadersOrWriters);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("Write file"));
r=file.Write(testData);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
// test writing with share mode EFileShareAny
r=file.Open(TheFs,fn,EFileStreamText|EFileWrite|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("Write file"));
r=file.Write(testData);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
// tidy up
r=TheFs.Delete(fn);
- test(r==KErrNone);
+ test_KErrNone(r);
test.End();
}
@@ -357,30 +357,30 @@
TParse f;
TInt r;
r=TheFs.Parse(fn,f);
- test(r==KErrNone);
+ test_KErrNone(r);
TParse fCopy;
r=TheFs.Parse(f.NameAndExt(),fCopy);
- test(r==KErrNone);
+ test_KErrNone(r);
RFile f1;
r=f1.Open(TheFs,f.FullName(),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
RFile f2;
r=f2.Replace(TheFs,fCopy.FullName(),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf8<512> copyBuf;
TInt rem;
r=f1.Size(rem);
- test(r==KErrNone);
+ test_KErrNone(r);
TInt pos=0;
while (rem)
{
TInt s=Min(rem,copyBuf.MaxSize());
r=f1.Read(pos,copyBuf,s);
- test(r==KErrNone);
+ test_KErrNone(r);
test(copyBuf.Length()==s);
r=f2.Write(pos,copyBuf,s);
- test(r==KErrNone);
+ test_KErrNone(r);
pos+=s;
rem-=s;
}
@@ -404,26 +404,26 @@
RFile f;
TInt r=f.Replace(TheFs,_L("TEXTFILE.TXT"),0);
- test(r==KErrNone);
+ test_KErrNone(r);
TFileText textFile;
textFile.Set(f);
TInt i=0;
for (i=0;i<5;i++)
{
r=textFile.Write(record[i]);
- test(r==KErrNone);
+ test_KErrNone(r);
}
r=textFile.Seek(ESeekStart);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf<16> recBuf;
for(i=0;i<5;i++)
{
r=textFile.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf==record[i]);
}
r=textFile.Read(recBuf);
- test(r==KErrEof);
+ test_Value(r, r == KErrEof);
test(recBuf.Length()==0);
f.Close();
@@ -445,36 +445,36 @@
trecord[5].Set((TUint8*)tTextrecord[5].Ptr(),tTextrecord[5].Length()*sizeof(TText));
trecord[6].Set((TUint8*)tTextrecord[6].Ptr(),tTextrecord[6].Length()*sizeof(TText));
r=f.Replace(TheFs,_L("TEXTFILE.TXT"),0);
- test(r==KErrNone);
+ test_KErrNone(r);
for(i=0;i<7;i++)
{
TBuf8<256> buf;
buf.Copy(trecord[i]);
r=f.Write(buf);
- test(r==KErrNone);
+ test_KErrNone(r);
}
textFile.Set(f);
textFile.Seek(ESeekStart);
for(i=0;i<5;i++)
{
r=textFile.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf==record[i]);
}
r=textFile.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf==_L("Sixth record"));
r=textFile.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf==_L("\rSeventh record"));
r=textFile.Read(recBuf);
- test(r==KErrEof);
+ test_Value(r, r == KErrEof);
test(recBuf.Length()==0);
f.Close();
test.Next(_L("Test read with bufferSize == dataSize"));
r=f.Replace(TheFs,_L("TEXTFILE.TXT"),0);
- test(r==KErrNone);
+ test_KErrNone(r);
record[0].Set(_L("1234567890123456"));
// trecord[0].Set(_L8("1234567890123456\r\n"));
// trecord[1].Set(_L8("1234567890123456\n"));
@@ -489,37 +489,37 @@
for (i=0;i<2;i++)
{
r=f.Write(trecord[i]);
- test(r==KErrNone);
+ test_KErrNone(r);
}
textFile.Set(f);
textFile.Seek(ESeekStart);
for(i=0;i<2;i++)
{
r=textFile.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf==record[0]);
}
r=textFile.Read(recBuf);
- test(r==KErrEof);
+ test_Value(r, r == KErrEof);
test(recBuf.Length()==0);
f.Close();
test.Next(_L("Read into a buffer < recordSize"));
TBuf<8> smallBuf;
r=f.Open(TheFs,_L("TEXTFILE.txt"),0);
- test(r==KErrNone);
+ test_KErrNone(r);
textFile.Set(f);
for(i=0;i<2;i++)
{
r=textFile.Read(smallBuf);
- test(r==KErrTooBig);
+ test_Value(r, r == KErrTooBig);
test(smallBuf==_L("12345678"));
}
f.Close();
test.Next(_L("Nasty cases: 1) \\r \\n split over buffer boundary"));
r=f.Replace(TheFs,_L("TEXTFILE.txt"),0);
- test(r==KErrNone);
+ test_KErrNone(r);
HBufC* largeRecord=HBufC::NewL(600);
largeRecord->Des().SetLength(250);
largeRecord->Des().Fill('A');
@@ -527,96 +527,96 @@
TPtrC8 bufPtr;
bufPtr.Set((TUint8*)largeRecord->Ptr(),largeRecord->Size()); // Size() returns length in bytes
r=f.Write(bufPtr);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf<16> boundaryBuf=_L("12345\r\n");
bufPtr.Set((TUint8*)boundaryBuf.Ptr(),boundaryBuf.Size());
r=f.Write(bufPtr);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Write(trecord[0]);
- test(r==KErrNone);
+ test_KErrNone(r);
textFile.Set(f);
textFile.Seek(ESeekStart);
r=textFile.Read(recBuf);
- test(r==KErrTooBig);
+ test_Value(r, r == KErrTooBig);
test(recBuf==_L("AAAAAAAAAAAAAAAA"));
r=textFile.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf==_L("12345"));
r=textFile.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf==record[0]);
f.Close();
test.Next(_L("Nasty cases: 2) \\r on buffer boundary"));
r=f.Replace(TheFs,_L("TEXTFILE.txt"),0);
- test(r==KErrNone);
+ test_KErrNone(r);
largeRecord->Des().SetLength(250);
largeRecord->Des().Fill('A');
largeRecord->Des()[249]='\n';
bufPtr.Set((TUint8*)largeRecord->Ptr(),largeRecord->Size());
r=f.Write(bufPtr);
- test(r==KErrNone);
+ test_KErrNone(r);
boundaryBuf=_L("12345\rxyz\n");
bufPtr.Set((TUint8*)boundaryBuf.Ptr(),boundaryBuf.Size());
r=f.Write(bufPtr);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Write(trecord[0]);
- test(r==KErrNone);
+ test_KErrNone(r);
textFile.Set(f);
textFile.Seek(ESeekStart);
r=textFile.Read(recBuf);
- test(r==KErrTooBig);
+ test_Value(r, r == KErrTooBig);
test(recBuf==_L("AAAAAAAAAAAAAAAA"));
r=textFile.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf==_L("12345\rxyz"));
r=textFile.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf==record[0]);
f.Close();
test.Next(_L("Nasty cases: 3) record size > buffer size"));
r=f.Replace(TheFs,_L("TEXTFILE.txt"),0);
- test(r==KErrNone);
+ test_KErrNone(r);
largeRecord->Des().SetLength(600);
largeRecord->Des().Fill('Z');
largeRecord->Des()[511]='\r';
largeRecord->Des()[599]='\n';
bufPtr.Set((TUint8*)largeRecord->Ptr(),largeRecord->Size());
r=f.Write(bufPtr);
- test(r==KErrNone);
+ test_KErrNone(r);
boundaryBuf=_L("12345\rxyz\n");
bufPtr.Set((TUint8*)boundaryBuf.Ptr(),boundaryBuf.Size());
r=f.Write(bufPtr);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Write(trecord[0]);
- test(r==KErrNone);
+ test_KErrNone(r);
textFile.Set(f);
textFile.Seek(ESeekStart);
r=textFile.Read(recBuf);
- test(r==KErrTooBig);
+ test_Value(r, r == KErrTooBig);
test(recBuf==_L("ZZZZZZZZZZZZZZZZ"));
r=textFile.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf==_L("12345\rxyz"));
r=textFile.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf==record[0]);
TBuf<601> bigBuf;
TPtrC largePtr((TText*)largeRecord->Ptr(),(largeRecord->Length()-1));
textFile.Seek(ESeekStart);
r=textFile.Read(bigBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(bigBuf==largePtr);
r=textFile.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf==_L("12345\rxyz"));
r=textFile.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf==record[0]);
f.Close();
@@ -632,60 +632,60 @@
test.Next(_L("Test FileText last record has no terminator"));
RFile f;
TInt r=f.Replace(TheFs,_L("TextFile"),0);
- test(r==KErrNone);
+ test_KErrNone(r);
TPtrC8 bufPtr;
TBuf<16>boundaryBuf=_L("Record1\n");
bufPtr.Set((TUint8*)boundaryBuf.Ptr(),boundaryBuf.Size());
r=f.Write(bufPtr);
- test(r==KErrNone);
+ test_KErrNone(r);
boundaryBuf=_L("Record2\n");
bufPtr.Set((TUint8*)boundaryBuf.Ptr(),boundaryBuf.Size());
r=f.Write(bufPtr);
- test(r==KErrNone);
+ test_KErrNone(r);
boundaryBuf=_L("Record3\n");
bufPtr.Set((TUint8*)boundaryBuf.Ptr(),boundaryBuf.Size());
r=f.Write(bufPtr);
- test(r==KErrNone);
+ test_KErrNone(r);
TFileText fText;
fText.Set(f);
r=fText.Seek(ESeekStart);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf<32> recBuf;
r=fText.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf.MatchF(_L("record1"))!=KErrNotFound);
r=fText.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf.MatchF(_L("record2"))!=KErrNotFound);
r=fText.Read(recBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(recBuf.MatchF(_L("record3"))!=KErrNotFound);
r=fText.Read(recBuf);
- test(r==KErrEof);
+ test_Value(r, r == KErrEof);
test(recBuf.Length()==0);
f.Close();
TBuf<0x100> bigBuf(0x100);
bigBuf.Fill('A');
r=f.Replace(TheFs,_L("TextFile"),0);
- test(r==KErrNone);
+ test_KErrNone(r);
bufPtr.Set((TUint8*)bigBuf.Ptr(),bigBuf.Size());
r=f.Write(bufPtr);
- test(r==KErrNone);
+ test_KErrNone(r);
fText.Set(f);
r=fText.Seek(ESeekStart);
- test(r==KErrNone);
+ test_KErrNone(r);
bigBuf.SetLength(0);
r=fText.Read(bigBuf);
test.Printf(_L("fText.Read returns %d\n"),r);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Printf(_L("BigBuf.Length()==%d\n"),bigBuf.Length());
test(bigBuf.Length()==0x100);
r=fText.Read(bigBuf);
- test(r==KErrEof);
+ test_Value(r, r == KErrEof);
test(bigBuf.Length()==0);
f.Close();
}
@@ -700,7 +700,7 @@
TFileName tempFileName;
RFile f;
TInt r=f.Temp(TheFs,_L(""),tempFileName,EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
TParse p;
p.Set(tempFileName,NULL,NULL);
test(p.DrivePresent());
@@ -710,10 +710,10 @@
f.Close();
r=f.Replace(TheFs,_L("WELCOMETO"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
r=f.Replace(TheFs,_L("WELCOMETO.WRD"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
}
@@ -732,189 +732,189 @@
test.Next(_L("Archive att is set after creation"));
RFile f;
TInt r=TheFs.Delete(_L("FILEATT.ARC"));
- test(r==KErrNone || r==KErrNotFound);
+ test_Value(r, r == KErrNone || r==KErrNotFound);
r=f.Create(TheFs,_L("FILEATT.ARC"),EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
TUint atts;
r=f.Att(atts);
- test(r==KErrNone);
+ test_KErrNone(r);
test((atts&ATT_MASK)==KEntryAttArchive);
TEntry fileAtt;
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==KEntryAttArchive);
f.Close();
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==KEntryAttArchive);
test.Next(_L("Archive att is set after a write"));
TheFs.SetAtt(_L("FILEATT.ARC"),0,KEntryAttArchive);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==0);
r=f.Open(TheFs,_L("FILEATT.ARC"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Write(_L8("Hello World"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Att(atts);
- test(r==KErrNone);
+ test_KErrNone(r);
test((atts&ATT_MASK)==KEntryAttArchive);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==KEntryAttArchive);
f.Close();
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==KEntryAttArchive);
test.Next(_L("Archive att is set after setsize"));
TheFs.SetAtt(_L("FILEATT.ARC"),0,KEntryAttArchive);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==0);
r=f.Open(TheFs,_L("FILEATT.ARC"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.SetSize(447);
- test(r==KErrNone);
+ test_KErrNone(r);
TInt size;
r=f.Size(size);
- test(r==KErrNone);
+ test_KErrNone(r);
test(size==447);
r=f.Att(atts);
- test(r==KErrNone);
+ test_KErrNone(r);
test((atts&ATT_MASK)==KEntryAttArchive);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==KEntryAttArchive);
f.Close();
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==KEntryAttArchive);
test.Next(_L("Archive att is not set after open"));
r=TheFs.SetAtt(_L("FILEATT.ARC"),0,KEntryAttArchive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Open(TheFs,_L("FILEATT.ARC"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Att(atts);
- test(r==KErrNone);
+ test_KErrNone(r);
test((atts&ATT_MASK)==0);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==0);
f.Close();
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==0);
test.Next(_L("Archive att is not set after a read"));
TheFs.SetAtt(_L("FILEATT.ARC"),0,KEntryAttArchive);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==0);
r=f.Open(TheFs,_L("FILEATT.ARC"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf8<16> readBuf;
r=f.Read(readBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Att(atts);
- test(r==KErrNone);
+ test_KErrNone(r);
test((atts&ATT_MASK)==0);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==0);
f.Close();
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==0);
test.Next(_L("Archive att is set after replace"));
r=f.Replace(TheFs,_L("FILEATT.ARC"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Att(atts);
- test(r==KErrNone);
+ test_KErrNone(r);
test((atts&ATT_MASK)==KEntryAttArchive);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==KEntryAttArchive);
f.Close();
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==KEntryAttArchive);
test.Next(_L("Read only bit can be unset"));
r=TheFs.SetAtt(_L("FILEATT.ARC"),KEntryAttReadOnly|KEntryAttHidden,0);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==(KEntryAttReadOnly|KEntryAttHidden|KEntryAttArchive));
r=TheFs.SetAtt(_L("FILEATT.ARC"),0,KEntryAttHidden);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==(KEntryAttReadOnly|KEntryAttArchive));
r=TheFs.SetAtt(_L("FILEATT.ARC"),0,KEntryAttReadOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==(KEntryAttArchive));
r=TheFs.SetAtt(_L("FILEATT.ARC"),KEntryAttReadOnly|KEntryAttHidden,0);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==(KEntryAttReadOnly|KEntryAttHidden|KEntryAttArchive));
r=TheFs.SetAtt(_L("FILEATT.ARC"),0,KEntryAttReadOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==(KEntryAttHidden|KEntryAttArchive));
r=TheFs.SetAtt(_L("FILEATT.ARC"),0,KEntryAttHidden);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==(KEntryAttArchive));
TTime time(0);
r=TheFs.SetEntry(_L("FILEATT.ARC"),time,KEntryAttReadOnly|KEntryAttHidden,0);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==(KEntryAttReadOnly|KEntryAttHidden|KEntryAttArchive));
r=TheFs.SetEntry(_L("FILEATT.ARC"),time,0,KEntryAttHidden);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==(KEntryAttReadOnly|KEntryAttArchive));
r=TheFs.SetEntry(_L("FILEATT.ARC"),time,0,KEntryAttReadOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==(KEntryAttArchive));
r=TheFs.SetEntry(_L("FILEATT.ARC"),time,KEntryAttReadOnly|KEntryAttHidden,0);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==(KEntryAttReadOnly|KEntryAttHidden|KEntryAttArchive));
r=TheFs.SetEntry(_L("FILEATT.ARC"),time,0,KEntryAttReadOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==(KEntryAttHidden|KEntryAttArchive));
r=TheFs.SetEntry(_L("FILEATT.ARC"),time,0,KEntryAttHidden);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Entry(_L("FILEATT.ARC"),fileAtt);
- test(r==KErrNone);
+ test_KErrNone(r);
test(fileAtt.iAtt==(KEntryAttArchive));
test.Next(_L("Cashing the 'read-only' attribute"));
@@ -922,42 +922,42 @@
// Test RO attribute after creating a file
r=f.Create(TheFs,fname,EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.SetAtt(KEntryAttReadOnly,0);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Write(_L8("Hello World"));
- test(r==KErrNone); // <-- here!
+ test_KErrNone(r); // <-- here!
f.Close();
// Test we can't open for write or delete a RO file
r=f.Open(TheFs,fname,EFileWrite);
- test(r==KErrAccessDenied);
+ test_Value(r, r == KErrAccessDenied);
r=TheFs.Delete(fname);
- test(r==KErrAccessDenied);
+ test_Value(r, r == KErrAccessDenied);
// Tidy up and re-create test file
r=TheFs.SetAtt(fname,0,KEntryAttReadOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(fname);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Create(TheFs,fname,EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
// Test RO attribute after opening a file
r=f.Open(TheFs,fname,EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.SetAtt(KEntryAttReadOnly,0);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Write(_L8("Hello World"));
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
// Tidy up
r=TheFs.SetAtt(fname,0,KEntryAttReadOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(fname);
- test(r==KErrNone);
+ test_KErrNone(r);
}
static void testShortNameAccessorFunctions()
@@ -976,21 +976,21 @@
TBuf<64> sessionPath;
TInt r=TheFs.SessionPath(sessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
RFile f;
r=TheFs.MkDirAll(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\RANDOM.ENDBIT"));
- test(r==KErrNone || r==KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r==KErrAlreadyExists);
r=f.Replace(TheFs,_L("LONGFILENAME.LONGEXT"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
r=f.Replace(TheFs,_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\LONGFILENAME.LONGEXT"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
r=f.Replace(TheFs,_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\BAD CHAR"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
r=f.Replace(TheFs,_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\GoodCHAR.TXT"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
TBuf<12> shortName1;
TBuf<12> shortName2;
@@ -998,15 +998,15 @@
TBuf<12> shortName4;
TBuf<12> shortName5;
r=TheFs.GetShortName(_L("LONGFILENAME.LONGEXT"),shortName1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetShortName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\LONGFILENAME.LONGEXT"),shortName2);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetShortName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\BAD CHAR"),shortName3);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetShortName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\GOODCHAR.TXT"),shortName4);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetShortName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY"),shortName5);
- test(r==KErrNone);
+ test_KErrNone(r);
if(Is_Win32(TheFs, gDriveNum))
{
@@ -1035,48 +1035,48 @@
if (Is_Win32(TheFs, gDriveNum))
{
r=TheFs.GetLongName(_L("LONGFI~1.LON"),longName1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetLongName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\LONGFI~1.LON"),longName2);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetLongName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\BADCHA~1"),longName3);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetLongName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\GOODCHAR.TXT"),longName4);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetLongName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE~1"),longName5);
- test(r==KErrNone);
+ test_KErrNone(r);
}
else if (!IsTestingLFFS())
{
r=TheFs.GetLongName(_L("LONGFI~1.LON"),longName1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetLongName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\LONGFI~1.LON"),longName2);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetLongName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\BAD_CHAR"),longName3);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetLongName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\GOODCHAR.TXT"),longName4);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetLongName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE~1"),longName5);
- test(r==KErrNone);
+ test_KErrNone(r);
}
else
{
// LFFS longname tests
r=TheFs.GetLongName(shortName1,longName1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.SetSessionPath(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-DIRECTORY\\LASTDIR\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetLongName(shortName2,longName2);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetLongName(shortName3,longName3);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetLongName(shortName4,longName4);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.SetSessionPath(_L("\\F32-TST\\TFILE\\TOPLEVEL\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.GetLongName(shortName5,longName5);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.SetSessionPath(sessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
}
test(longName1==_L("LONGFILENAME.LONGEXT"));
@@ -1086,16 +1086,16 @@
test(longName5==_L("MIDDLE-DIRECTORY"));
r=TheFs.GetShortName(_L("XXX.YYY"),shortName1);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
r=TheFs.GetShortName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-YROTCERID\\LASTDIR\\BAD-CHAR"),shortName1);
- test(r==KErrPathNotFound);
+ test_Value(r, r == KErrPathNotFound);
r=TheFs.GetLongName(_L("XXX.YYY"),longName1);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
r=TheFs.GetLongName(_L("\\F32-TST\\TFILE\\TOPLEVEL\\MIDDLE-YROTCERID\\LASTDIR\\BAD-CHAR"),longName1);
- test(r==KErrPathNotFound);
+ test_Value(r, r == KErrPathNotFound);
r=TheFs.Delete(_L("LONGFILENAME.LONGEXT"));
- test(r==KErrNone);
+ test_KErrNone(r);
TEntry romEntry;
r=TheFs.Entry(_L("Z:\\System"),romEntry);
@@ -1105,13 +1105,13 @@
//test.Getch();
//return;
}
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf<64> romFileName=_L("Z:\\");
romFileName.Append(romEntry.iName);
r=TheFs.GetShortName(romFileName,shortName1);
- test(r==KErrNotSupported);
+ test_Value(r, r == KErrNotSupported);
r=TheFs.GetLongName(_L("Z:\\system"),longName1);
- test(r==KErrNotSupported);
+ test_Value(r, r == KErrNotSupported);
}
static void RmDir(const TDesC& aDirName)
@@ -1122,7 +1122,7 @@
CFileMan* fMan=CFileMan::NewL(TheFs);
test(fMan!=NULL);
TInt r=TheFs.SessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.CheckDisk(gSessionPath);
if (r!=KErrNone && r!=KErrNotSupported)
ReportCheckDiskFailure(r);
@@ -1132,7 +1132,7 @@
fMan->Attribs(removeDirName, 0, KEntryAttReadOnly, 0, CFileMan::ERecurse);
r=fMan->RmDir(removeDirName);
- test(r==KErrNone || r==KErrNotFound || r==KErrPathNotFound);
+ test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrPathNotFound);
delete fMan;
}
@@ -1173,14 +1173,10 @@
// Check the generated shortname of the original file
TBuf<12> shortName;
err = TheFs.GetShortName(KOrigFileName, shortName);
- test(err==KErrNone);
-
- // Validate the generated shorname against the original filename.
- if (Is_Win32(TheFs, gDriveNum))
- {
- test(shortName==_L("2222~1.JAR"));
- }
- else if(!IsTestingLFFS())
+ test_KErrNone(err);
+
+ // Validate the generated shortname against the original filename.
+ if(!IsTestingLFFS())
{
// LFFS short names not the same as VFAT ones
test(shortName==_L("2222~1.JAR"));
@@ -1191,7 +1187,7 @@
CheckFileExists(KOrigFileShortName, KErrNone, EFalse);
err = TheFs.Rename(KOrigFileName,KDestinationFileName);
- test(err==KErrNone);
+ test_KErrNone(err);
// Clean up before leaving
RmDir(_L("INC112803\\"));
@@ -1206,43 +1202,43 @@
test.Next(_L("Test IsFileOpen"));
TBool answer;
TInt r=TheFs.IsFileOpen(_L("OPEN.FILE"),answer);
- test(r==KErrNotFound || (r==KErrNone && answer==EFalse));
+ test_Value(r, r == KErrNotFound || (r==KErrNone && answer==EFalse));
RFile f;
r=f.Replace(TheFs,_L("OPEN.FILE"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.IsFileOpen(_L("OPEN.FILE"),answer);
- test(r==KErrNone);
+ test_KErrNone(r);
test(answer!=EFalse);
f.Close();
r=TheFs.IsFileOpen(_L("OPEN.FILE"),answer);
- test(r==KErrNone);
+ test_KErrNone(r);
test(answer==EFalse);
r=TheFs.Delete(_L("OPEN.FILE"));
- test(r==KErrNone);
+ test_KErrNone(r);
RFile f2;
r=f2.Replace(TheFs,_L("AnotherOpen.File"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.IsFileOpen(_L("AnotherOpen.File"),answer);
- test(r==KErrNone);
+ test_KErrNone(r);
test(answer!=EFalse);
r=f.Replace(TheFs,_L("OPEN.FILE"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.IsFileOpen(_L("OPEN.FILE"),answer);
- test(r==KErrNone);
+ test_KErrNone(r);
test(answer!=EFalse);
f2.Close();
r=TheFs.IsFileOpen(_L("OPEN.FILE"),answer);
- test(r==KErrNone);
+ test_KErrNone(r);
test(answer!=EFalse);
f.Close();
r=TheFs.IsFileOpen(_L("OPEN.FILE"),answer);
- test(r==KErrNone);
+ test_KErrNone(r);
test(answer==EFalse);
r=TheFs.Delete(_L("AnotherOpen.File"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(_L("OPEN.FILE"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
static void testDeleteOpenFiles()
@@ -1255,99 +1251,99 @@
RFile f;
f.Close();
TInt r=f.Replace(TheFs,_L("Open.File"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(_L("OPEN.FILE"));
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
f.Close();
f.Close();
f.Close();
r=TheFs.Delete(_L("Open.FILe"));
- test(r==KErrNone);
+ test_KErrNone(r);
TFileName fileName;
r=f.Temp(TheFs,_L(""),fileName,EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(fileName);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
f.Close();
r=TheFs.Delete(fileName);
- test(r==KErrNone);
+ test_KErrNone(r);
MakeFile(_L("\\Documents\\TEstfile.txt"));
r=f.Open(TheFs,_L("\\Documents\\TEstfile.txt"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(_L("\\Documents\\TEstfile.txt"));
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=TheFs.Delete(_L("\\documents\\TEstfile.txt"));
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=TheFs.Delete(_L("\\Documents.\\TEstfile.txt"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.Delete(_L("\\documents.\\TEstfile.txt"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.Delete(_L("\\Documents\\Testfile.txt"));
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=TheFs.Delete(_L("\\documents\\testfile.txt"));
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=TheFs.Delete(_L("\\Documents.\\TEstfile.TXT"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.Delete(_L("\\docUMENTS.\\TESTFILE.TXT"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
f.Close();
r=TheFs.Delete(_L("\\Documents\\TEstfile.TXT"));
- test(r==KErrNone);
+ test_KErrNone(r);
MakeFile(_L("\\Documents\\Documents\\TEstfile.txt"));
r=f.Open(TheFs,_L("\\Documents\\Documents\\TEstfile.txt"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(_L("\\Documents\\documents.\\TEstfile.txt"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.Delete(_L("\\documents\\Documents.\\TEstfile.txt"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.Delete(_L("\\Documents.\\documents\\TEstfile.txt"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.Delete(_L("\\documents.\\Documents\\TEstfile.txt"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.Delete(_L("\\Documents\\Documents\\Testfile.txt"));
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=TheFs.Delete(_L("\\documents\\documents\\testfile.txt"));
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=TheFs.Delete(_L("\\Documents.\\Documents.\\TEstfile.TXT"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.Delete(_L("\\docUMENTS.\\docUMENTS.\\TESTFILE.TXT"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.RmDir(_L("\\Documents\\"));
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=TheFs.RmDir(_L("\\documents\\"));
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=TheFs.RmDir(_L("\\Documents.\\"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.RmDir(_L("\\documents.\\"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.RmDir(_L("\\Documents\\documents\\"));
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=TheFs.RmDir(_L("\\documents\\documents.\\"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.RmDir(_L("\\Documents.\\Documents\\"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.RmDir(_L("\\documents.\\Documents.\\"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.RmDir(_L("\\Documents\\TestFile.TXT"));
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=TheFs.RmDir(_L("\\documents\\TestFile"));
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=TheFs.RmDir(_L("\\Documents.\\Testfile."));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.RmDir(_L("\\documents.\\t"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
f.Close();
r=TheFs.Delete(_L("\\Documents\\documents\\TEstfile.TXT"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(_L("\\Documents\\documents.\\"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.RmDir(_L("\\Documents.\\"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
}
static void testFileSeek()
@@ -1358,7 +1354,7 @@
test.Next(_L("Test file seek"));
RFile f;
TInt r=f.Open(TheFs,_L("T_File.cpp"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf8<20> text1;TInt pos1=0;
TBuf8<20> text2;TInt pos2=510;
@@ -1367,67 +1363,67 @@
TBuf8<20> text5;TInt pos5=4999;
r=f.Read(pos1,text1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Read(pos2,text2);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Read(pos3,text3);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Read(pos4,text4);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Read(pos5,text5);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf8<20> testBuf;
r=f.Read(pos3,testBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testBuf==text3);
r=f.Read(pos1,testBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testBuf==text1);
r=f.Read(pos4,testBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testBuf==text4);
r=f.Read(pos2,testBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testBuf==text2);
r=f.Read(pos5,testBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testBuf==text5);
r=f.Read(pos2,testBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testBuf==text2);
r=f.SetSize(1023);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Read(pos2,testBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testBuf==text2);
r=f.SetSize(1024);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Read(pos1,testBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testBuf==text1);
r=f.Read(pos2,testBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testBuf==text2);
r=f.Read(pos1,testBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testBuf==text1);
r=f.SetSize(511);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Read(pos1,testBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testBuf==text1);
r=f.SetSize(512);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Read(pos1,testBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testBuf==text1);
f.Close();
}
@@ -1440,60 +1436,60 @@
// Create a zero length file
RFile file;
TInt r=file.Replace(TheFs,_L("\\F32-TST\\TFILE\\seektest"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file.SetSize(20);
- test(r==KErrNone);
+ test_KErrNone(r);
// Seek beyond the length of the file
TInt seekPos;
seekPos = 80; // Pick a likely offset
TInt err = file.Seek(ESeekEnd, seekPos); // and go there
- test(err==KErrNone);
+ test_KErrNone(err);
test(seekPos==20); // Somewhat non-intuitive?
r=file.Write(_L8("A Devil's Haircut"));
- test(r==KErrNone);
+ test_KErrNone(r);
TInt newFileSize;
r=file.Size(newFileSize);
- test(r==KErrNone);
+ test_KErrNone(r);
seekPos = 0;
err = file.Seek(ESeekCurrent, seekPos); // Find out where we ended up?
- test(err==KErrNone);
+ test_KErrNone(err);
test(seekPos==37);
file.SetSize(512);
seekPos=513;
err=file.Seek(ESeekStart, seekPos);
- test(err==KErrNone);
+ test_KErrNone(err);
test(seekPos==513);
err=file.Seek(ESeekEnd, seekPos);
- test(err==KErrNone);
+ test_KErrNone(err);
test(seekPos==512);
seekPos=-530;
err=file.Seek(ESeekEnd, seekPos);
- test(err==KErrNone);
+ test_KErrNone(err);
test(seekPos==0);
seekPos=-10;
err=file.Seek(ESeekEnd, seekPos);
- test(err==KErrNone);
+ test_KErrNone(err);
test(seekPos==502);
seekPos=-10;
err=file.Seek(ESeekStart,seekPos);
- test(err==KErrArgument);
+ test_Value(err, err == KErrArgument);
test(seekPos==-10);
seekPos=0;
err=file.Seek(ESeekEnd,seekPos);
- test(err==KErrNone);
+ test_KErrNone(err);
test(seekPos==512);
file.Close();
r=TheFs.Delete(_L("\\F32-TST\\TFILE\\seektest"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
static void testSetSize()
@@ -1506,18 +1502,18 @@
RFile f1;
TInt i=0;
TInt r=f1.Replace(TheFs,_L("File.File"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
gBuf.SetLength(32);
for(i=0;i<32;i++)
gBuf[i]=(TUint8)i;
r=f1.Write(gBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
gBuf.SetLength(1334);
for(i=64;i<1334+64;i++)
gBuf[i-64]=(TUint8)i;
r=f1.Write(30,gBuf);
r=f1.Read(30,gBuf,1000);
- test(r==KErrNone);
+ test_KErrNone(r);
test(gBuf[0]==64);
test(gBuf[1]==65);
test(gBuf[2]==66);
@@ -1525,23 +1521,23 @@
test.Next(_L("Open a large file"));
r=f1.Replace(TheFs,_L("File.File"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
CheckDisk();
r=f1.SetSize(131072); // 128K
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf8<16> testData=_L8("testData");
r=f1.Write(131060,testData);
- test(r==KErrNone);
+ test_KErrNone(r);
f1.Close();
r=f1.Open(TheFs,_L("File.File"),EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
TInt size;
r=f1.Size(size);
- test(r==KErrNone);
+ test_KErrNone(r);
test(size==131072);
TBuf8<16> testData2;
r=f1.Read(131060,testData2,8);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testData==testData2);
f1.Close();
TheFs.Delete(_L("File.file"));
@@ -1552,10 +1548,10 @@
{
RFile f;
TInt r=f.Open(TheFs, PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)?_L("Z:\\Sys\\Bin\\eshell.exe"):_L("Z:\\System\\Bin\\eshell.exe"), EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
TInt anAddress=0;
r=f.Seek(ESeekAddress, anAddress);
- test(r==KErrNone);
+ test_KErrNone(r);
#if !defined(__WINS__)
test(RFs::IsRomAddress((TAny *)anAddress)); // Always returns EFalse if WINS
#endif
@@ -1576,25 +1572,25 @@
RFile f1;
TInt temp;
TInt r=f1.Replace(TheFs,_L("File.File"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f1.Size(temp);
- test(r==KErrNone);
+ test_KErrNone(r);
test(temp==0);
TUint data=0;
TPtrC8 buf((TText8*)&data,1);
r=f1.Write(buf);
// r=f1.Write(_L("\0"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=f1.Size(temp);
- test(r==KErrNone);
+ test_KErrNone(r);
test(temp==1);
temp=0;
r=f1.Seek(ESeekStart,temp);
- test(r==KErrNone);
+ test_KErrNone(r);
test(temp==0);
TBuf8<32> testBuf;
r=f1.Read(testBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test(testBuf==buf);
f1.Close();
@@ -1607,15 +1603,15 @@
RHackFile f2;
f2.Open(TheFs, _L("File.File"), EFileRead);
- test(r == KErrNone);
+ test_KErrNone(r);
r = f2.SendReceive(/*47*/ EFsFileChangeMode, TIpcArgs(EFileRead | EFileWrite)); // <- must fail!
- test(r == KErrArgument);
+ test_Value(r, r == KErrArgument);
r = f2.Write(_L8("Hacked!")); // <- must fail!
- test(r == KErrAccessDenied);
+ test_Value(r, r == KErrAccessDenied);
f2.Close();
r=TheFs.Delete(_L("File.FIle"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
static void testFileRename()
@@ -1635,46 +1631,46 @@
//-- test renaming a file to a non-existing directory
r = TheFs.MkDir(_L("\\temp\\"));
- test(r==KErrNone || r==KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r==KErrAlreadyExists);
r = f1.Replace(TheFs, _L("\\temp\\file1"), 0);
- test(r==KErrNone);
+ test_KErrNone(r);
r = f1.Rename(_L("\\temp\\temp\\file1"));
- test(r == KErrPathNotFound);
+ test_Value(r, r == KErrPathNotFound);
f1.Close();
r=f1.Replace(TheFs,name2,EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f1.Write(_L8("1234"));
- test(r==KErrNone);
+ test_KErrNone(r);
TInt len=CheckFileExists(name2,KErrNone);
test(len==4);
r=f1.Rename(name1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f1.Read(0,contents);
- test(r==KErrNone);
+ test_KErrNone(r);
test(contents==_L8("1234"));
r=f1.Write(4,_L8("5678"));
- test(r==KErrNone);
+ test_KErrNone(r);
len=CheckFileExists(name1,KErrNone);
test(len==8);
CheckFileExists(name2,KErrNotFound);
r=f1.Write(8,_L8("90"));
- test(r==KErrNone);
+ test_KErrNone(r);
f1.Close();
len=CheckFileExists(name1,KErrNone);
test(len==10);
test.Next(_L("Test can change case using rename"));
r=f1.Open(TheFs,name1,EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f1.Rename(name3);
- test(r==KErrNone);
+ test_KErrNone(r);
CheckFileExists(name1,KErrNone,EFalse);
len=CheckFileExists(name3,KErrNone);
test(len==10);
@@ -1685,9 +1681,9 @@
test.Next(_L("Test can rename to an identical filename"));
r=f1.Open(TheFs,name3,EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f1.Rename(name3);
- test(r==KErrNone);
+ test_KErrNone(r);
len=CheckFileExists(name3,KErrNone);
test(len==10);
f1.Close();
@@ -1696,20 +1692,20 @@
test.Next(_L("Test rename to a name containing a wildcard is rejected"));
r=f1.Open(TheFs,name3,EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f1.Rename(_L("asdf*ASDF"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=f1.Rename(_L("asdf?AF"));
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
f1.Close();
r=f1.Open(TheFs,name3,EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f1.Read(contents);
- test(r==KErrNone);
+ test_KErrNone(r);
test(contents==_L8("1234567890"));
r=f1.Read(contents);
- test(r==KErrNone);
+ test_KErrNone(r);
test(contents.Length()==0);
f1.Close();
@@ -1717,26 +1713,26 @@
TDateTime dateTime(1995,(TMonth)10,19,23,0,0,0);
TTime oldTime(dateTime);
r=TheFs.SetEntry(name3,oldTime,0,0);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f1.Open(TheFs,name3,EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
TTime check;
r=f1.Modified(check);
- test(r==KErrNone);
+ test_KErrNone(r);
test(check==oldTime);
r=f1.Rename(_L("OldFile.Old"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=f1.Modified(check);
- test(r==KErrNone);
+ test_KErrNone(r);
test(check==oldTime);
r=TheFs.Modified(_L("oldfile.old"),check);
- test(r==KErrNone);
+ test_KErrNone(r);
test(check==oldTime);
f1.Close();
r=TheFs.Modified(_L("oldfile.old"),check);
- test(r==KErrNone);
+ test_KErrNone(r);
test(check==oldTime);
}
@@ -1754,20 +1750,20 @@
TEntry e;
TInt r=TheFs.Entry(_L("Tmp04005.$$$"),e);
- test(r==KErrNone);
+ test_KErrNone(r);
test(uidData==e.iType);
r=TheFs.Entry(_L("Sketch(01)"),e);
- test(r==KErrNone);
+ test_KErrNone(r);
test(uidData1==e.iType);
test.Next(_L("Test replace preserves UIDs"));
r=TheFs.Replace(_L("Tmp04005.$$$"),_L("Sketch(01)"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Entry(_L("Tmp04005.$$$"),e);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
r=TheFs.Entry(_L("Sketch(01)"),e);
- test(r==KErrNone);
+ test_KErrNone(r);
test(uidData==e.iType);
}
@@ -1777,11 +1773,11 @@
// Test max length filenames can be created/deleted
//
{
-
-#if defined(__WINS__)
- if (gSessionPath[0]=='C')
+ if(Is_SimulatedSystemDrive(TheFs, gDriveNum))
+ {
+ test.Printf(_L("Skipping TestMaxLengthFilenames() on PlatSim/Emulator drive %C:\n"), gSessionPath[0]);
return;
-#endif
+ }
test.Next(_L("Test max length filenames"));
TFileName bigName;
@@ -1789,10 +1785,10 @@
bigName[0]='\\';
RFile f;
TInt r=f.Create(TheFs,bigName,EFileRead);
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
bigName.SetLength(254);
r=f.Create(TheFs,bigName,EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
TInt count;
@@ -1805,35 +1801,35 @@
if (r==KErrDirFull)
{
r=TheFs.Delete(countedBigName);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
break;
}
if (r!=KErrNone)
test.Printf(_L("File create failed:%d"),r);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
}
while(count--)
{
countedBigName[2]=(TText)('A'+count);
r=TheFs.Delete(countedBigName);
- test(r==KErrNone);
+ test_KErrNone(r);
}
r=TheFs.Delete(bigName);
- test(r==KErrNone);
+ test_KErrNone(r);
TFileName subDirFileName=_L("\\F32-TST\\TFILE");
bigName.SetLength(241);
subDirFileName.Append(bigName);
r=f.Create(TheFs,subDirFileName,EFileRead);
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
subDirFileName.SetLength(254);
r=f.Create(TheFs,subDirFileName,EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
r=TheFs.Delete(subDirFileName);
- test(r==KErrNone);
+ test_KErrNone(r);
}
@@ -1851,30 +1847,30 @@
// Open a file in EFileShareReadersOnly mode
RFile f1;
TInt r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
// Opening a share in EFileShareReadersOnly mode should succeed
RFile f2;
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
// Opening a share in EFileShareReadersOrWriters mode with EFileRead access should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
// Opening a share in EFileShareReadersOrWriters mode with EFileWrite access should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileWrite);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// Opening a share in EFileShareReadersOrWriters mode with EFileRead|EFileWrite access should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileRead|EFileWrite);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// Opening a share in EShareAny mode should fail
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareAny);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
f1.Close();
@@ -1882,36 +1878,36 @@
// Open a file in EFileShareReadersOrWriters mode for reading
r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
// Opening a share in EFileShareExclusive mode should fail
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareExclusive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// Opening a share in EFileShareReadersOnly mode should succeed
// (the share doesn't care if the file is opened for reading or writing)
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
// Opening a share in EFileShareReadersOnly mode with EFileRead accesss should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
// Opening a share in EFileShareReadersOnly mode with EFileWrite accesss should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
// Opening a share in EFileShareReadersOnly mode with EFileRead|EFileWrite accesss should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
// Opening a share in EFileShareAny mode should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
f1.Close();
@@ -1920,34 +1916,34 @@
// Open a file in EFileShareReadersOrWriters mode for writing
r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
// Opening a share in EFileShareExclusive mode should fail
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareExclusive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// Opening a share in EFileShareReadersOnly mode should fail
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// Opening a share in EFileShareReadersOrWriters mode with EFileRead access should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
// Opening a share in EFileShareReadersOrWriters mode with EFileWrite access should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
// Opening a share in EFileShareReadersOrWriters mode with EFileRead|EFileWrite access should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
// Opening a share in EFileShareAny mode should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
f1.Close();
@@ -1956,34 +1952,34 @@
// Open a file in EFileShareAny mode
r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
// Opening a share in EFileShareExclusive mode should fail
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareExclusive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// Opening a share in EFileShareReadersOnly mode should fail
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
// Opening a share in EFileShareReadersOrWriters mode with EFileRead access should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
// Opening a share in EFileShareReadersOrWriters mode with EFileWrite access should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
// Opening a share in EFileShareReadersOrWriters mode with EFileRead|EFileWrite access should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
// Opening a share in EFileShareAny mode with should succeed
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
f2.Close();
f1.Close();
@@ -1992,12 +1988,12 @@
// Open a file in EFileShareReadersOrWriters mode for reading
r=f1.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
// Opening a share in EFileShareReadersOnly mode should succeed
// - The share should now be promoted to EFileShareReadersOnly mode
r=f2.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
TInt pass = 2;
while(pass--)
@@ -2005,7 +2001,7 @@
RFile f3;
// Opening a share in EFileShareReadersOnly mode with EFileRead accesss should succeed
r=f3.Open(TheFs,_L("T_FILE.CPP"),EFileStreamText|EFileShareReadersOrWriters|EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
f3.Close();
// Opening a share in EFileShareReadersOnly mode with EFileWrite accesss should fail
@@ -2013,12 +2009,12 @@
if(pass == 1)
{
// The share is promoted - should obey EFileShareReadersOnly rules
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
}
else
{
// The share is demoted - should obey EFileShareReadersOrWriters rules
- test(r==KErrNone);
+ test_KErrNone(r);
f3.Close();
}
@@ -2027,12 +2023,12 @@
if(pass == 1)
{
// The share is promoted - should obey EFileShareReadersOnly rules
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
}
else
{
// The share is demoted - should obey EFileShareReadersOrWriters rules
- test(r==KErrNone);
+ test_KErrNone(r);
f3.Close();
}
@@ -2041,13 +2037,13 @@
if(pass == 1)
{
// The share is promoted - should obey EFileShareReadersOnly rules
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
f2.Close();
}
else
{
// The share is demoted - should obey EFileShareReadersOrWriters rules
- test(r==KErrNone);
+ test_KErrNone(r);
f3.Close();
}
}
@@ -2150,7 +2146,7 @@
createTestFile(TheFile);
r=TheFile.Write(gBuf, -1);
- test(r==KErrArgument);
+ test_Value(r, r == KErrArgument);
removeTestFile(TheFile);
@@ -2167,7 +2163,7 @@
// EXPORT_C TInt RFile::Write(TInt aPos,const TDesC8& aDes,TInt aLength)
createTestFile(TheFile);
r = TheFile.Write(0,gBuf,-1);
- test(r==KErrArgument);
+ test_Value(r, r == KErrArgument);
removeTestFile(TheFile);
@@ -2285,7 +2281,7 @@
test.Next(_L("Execute sync call RFile::Write(const TDesC8& aDes) with zero length aDes"));
TInt r=TheFile.Write(gLongBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Printf(_L("Test case passed\n"));
@@ -2352,7 +2348,7 @@
#else
r=TheFile.Write(gLongBuf, 0x80000);
- test(r==KErrNone);
+ test_KErrNone(r);
#endif
test.Printf(_L("Test case passed\n"));
@@ -2404,7 +2400,7 @@
test.Next(_L("Execute sync call RFile::Write(TInt aPos, const TDesC8& aDes) with zero length aDes"));
r=TheFile.Write(0, gLongBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Printf(_L("Test case passed\n"));
@@ -2455,7 +2451,7 @@
test.Next(_L("Execute sync call RFile::Write(TInt aPos, const TDesC8& aDes, TInt aLength) with zero length aDes"));
r=TheFile.Write(0, gLongBuf, 0x80000);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Printf(_L("Test case passed\n"));
@@ -2519,7 +2515,7 @@
// EXPORT_C TInt RFile::Read(TDes8& aDes,TInt aLength) const
err = file.Read(buf8,5);
- test(err==KErrOverflow);
+ test_Value(err, err == KErrOverflow);
err = KErrNone;
// EXPORT_C void RFile::Read(TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const
@@ -2529,7 +2525,7 @@
// EXPORT_C TInt RFile::Read(TInt aPos,TDes8& aDes,TInt aLength) const
err = file.Read(0,buf8,5);
- test(err==KErrOverflow);
+ test_Value(err, err == KErrOverflow);
// EXPORT_C void RFile::Read(TInt aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const
file.Read(0,buf8,5,status);
@@ -2555,13 +2551,13 @@
RFile file;
TInt r=fs.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
if (testMode & EDoCDeleteOnClose)
fileMode|=EDeleteOnClose;
r=file.Temp(fs,_L(""),gLastTempFileName,fileMode);
- test(r==KErrNone);
+ test_KErrNone(r);
// Signal controlling thread and pause for panic where requested
// by caller.
if (testMode & EDoCPanic)
@@ -2607,11 +2603,11 @@
//! 1. The temporary file is successfully created and deleted.
//---------------------------------------------------------------------------------------------------------------------
r=clientThread.Create(_L("DeleteOnCloseClientThread 1"),DeleteOnCloseClientThread,KDefaultStackSize,0x2000,0x2000,(TAny*)0);
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Resume();
gSleepThread.Wait();
r=TheFs.Delete(gLastTempFileName);
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Close();
//
@@ -2634,11 +2630,11 @@
//---------------------------------------------------------------------------------------------------------------------
test.Next(_L("RFile::Temp EDeleteOnClose behaviour"));
r=clientThread.Create(_L("DeleteOnCloseClientThread 2"),DeleteOnCloseClientThread,KDefaultStackSize,0x2000,0x2000,(TAny*)EDoCDeleteOnClose);
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Resume();
gSleepThread.Wait();
r=TheFs.Delete(gLastTempFileName);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
clientThread.Close();
//
@@ -2659,7 +2655,7 @@
//---------------------------------------------------------------------------------------------------------------------
test.Next(_L("RFile::Temp default panic behaviour"));
r=clientThread.Create(_L("DeleteOnCloseClientThread 3"),DeleteOnCloseClientThread,KDefaultStackSize,0x2000,0x2000,(TAny*)EDoCPanic);
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Resume();
gSleepThread.Wait();
User::SetJustInTime(EFalse);
@@ -2668,7 +2664,7 @@
CLOSE_AND_WAIT(clientThread);
FsBarrier();
r=TheFs.Delete(gLastTempFileName);
- test(r==KErrNone);
+ test_KErrNone(r);
//
//---------------------------------------------------------------------------------------------------------------------
@@ -2690,7 +2686,7 @@
//---------------------------------------------------------------------------------------------------------------------
test.Next(_L("RFile::Temp EDeleteOnClose panic behaviour"));
r=clientThread.Create(_L("DeleteOnCloseClientThread 4"),DeleteOnCloseClientThread,KDefaultStackSize,0x2000,0x2000,(TAny*)(EDoCPanic|EDoCDeleteOnClose));
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Resume();
gSleepThread.Wait();
User::SetJustInTime(EFalse);
@@ -2699,7 +2695,7 @@
CLOSE_AND_WAIT(clientThread);
FsBarrier();
r=TheFs.Delete(gLastTempFileName);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
//
//---------------------------------------------------------------------------------------------------------------------
@@ -2719,10 +2715,10 @@
//---------------------------------------------------------------------------------------------------------------------
test.Next(_L("RFile::Create EDeleteOnClose behaviour"));
r=file.Create(TheFs,_L("DoC5"),EFileRead|EFileWrite|EDeleteOnClose);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
r=TheFs.Delete(filename);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
//
//---------------------------------------------------------------------------------------------------------------------
@@ -2746,16 +2742,16 @@
//---------------------------------------------------------------------------------------------------------------------
test.Next(_L("DoC 6 - Multiple subsessions"));
r=file.Create(TheFs,filename,EFileShareAny|EFileRead|EFileWrite|EDeleteOnClose);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file2.Open(TheFs,filename,EFileShareAny|EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(filename);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
file2.Close();
r=TheFs.Delete(filename);
- test(r==KErrNotFound);
+ test_Value(r, r == KErrNotFound);
//
//---------------------------------------------------------------------------------------------------------------------
@@ -2773,10 +2769,10 @@
//---------------------------------------------------------------------------------------------------------------------
test.Next(_L("RFile::Create existing file behaviour"));
r=file.Create(TheFs,filename,EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
r=file.Create(TheFs,filename,EFileRead|EFileWrite|EDeleteOnClose);
- test(r==KErrAlreadyExists);
+ test_Value(r, r == KErrAlreadyExists);
//
//---------------------------------------------------------------------------------------------------------------------
@@ -2793,9 +2789,9 @@
//---------------------------------------------------------------------------------------------------------------------
test.Next(_L("RFile::Open EDeleteOnClose flag validation"));
r=file.Open(TheFs,filename,EFileRead|EFileWrite|EDeleteOnClose);
- test(r==KErrArgument);
+ test_Value(r, r == KErrArgument);
r=TheFs.Delete(filename);
- test(r==KErrNone);
+ test_KErrNone(r);
gSleepThread.Close();
test.End();
@@ -2824,21 +2820,21 @@
//-- 1. create test file
nRes = CreateEmptyFile(TheFs, KFile, 33);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//-- 2. open it for write
RFile file;
nRes = file.Open(TheFs, KFile, EFileWrite);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//-- 3. write a couple of bytes there. This must cause 'Archive' attribute set
nRes = file.Write(0, _L8("a"));
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
nRes = file.Write(10, _L8("b"));
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
nRes = TheFs.Entry(KFile, entry);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
test(entry.IsArchive()); //-- 'A' attribute must be set.
@@ -2846,23 +2842,23 @@
//-- 4. set new file attributes (w/o 'A') and creation time
const TUint newAtt = KEntryAttSystem ;
nRes = file.SetAtt(newAtt, ~newAtt & KEntryAttMaskSupported);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
TTime newTime;
nRes = newTime.Set(_L("19970310:101809.000000"));
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
nRes = file.SetModified(newTime);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//-- 5. wait 5 seconds. file server shall flush dirty data during this period.
User::After(5*K1Sec);
//-- 6. check that attributes haven't chanded because of flush
nRes = file.Flush(); //-- this will flush attributes to the media
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
nRes = TheFs.Entry(KFile, entry);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
test(entry.iAtt == newAtt);
test(entry.iModified.DateTime().Year() == 1997);
@@ -2871,12 +2867,12 @@
//-- 7. write some data and ensure that 'A' attribute is set now and 'modified' time updated
nRes = file.Write(12, _L8("c"));
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
file.Close(); //-- this will flush attributes to the media
nRes = TheFs.Entry(KFile, entry);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
test(entry.iAtt == (newAtt | KEntryAttArchive));
test(entry.iModified.DateTime().Year() != 1997);
@@ -2905,7 +2901,7 @@
//-- check disk space, it shall be > 4G
TVolumeInfo volInfo;
nRes = TheFs.Volume(volInfo, gDriveNum);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
const TUint32 KMaxFAT32FileSize = 0xFFFFFFFF; // 4GB-1
@@ -2923,17 +2919,17 @@
//-- this file has enabled write caching by default
test.Printf(_L("creating maximal length file, size = 0x%x\n"),KMaxFAT32FileSize);
nRes = file64.Replace(TheFs, KFileName, EFileWrite);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
const TInt64 fileSize = KMaxFAT32FileSize;
nRes = file64.SetSize(fileSize);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
test.Printf(_L("seeking to the file end...\n"));
TInt64 filePos = 0;
nRes = file64.Seek(ESeekEnd, filePos);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
test.Printf(_L("test writing to the last bytes of the file (rel pos addressing) \n"));
@@ -2941,31 +2937,31 @@
//-- 1. writing using relative position
filePos = -1;
nRes = file64.Seek(ESeekEnd, filePos);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
test(filePos == fileSize-1);
nRes = file64.Write(_L8("z")); //-- write 1 byte a pos 0xFFFFFFFE, this is the last allowed position of the FAT32 file
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
nRes = file64.Write(_L8("x")); //-- write 1 byte a pos 0xFFFFFFFF, beyond the max. allowed file size, this shall fail
- test(nRes == KErrNotSupported);
+ test_Value(nRes, nRes == KErrNotSupported);
nRes = file64.Flush();
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//-- 1.1 check the result by reading data using rel. pos
filePos = -1;
nRes = file64.Seek(ESeekEnd, filePos);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
test(filePos == fileSize-1);
test.Printf(_L("reading 1 byte at pos: 0x%x\n"), filePos);
nRes = file64.Read(buf, 1); //-- read 1 byte a pos 0xFFFFFFFE, this is the last allowed position of the FAT32 file
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
test(buf.Length() == 1 && buf[0]=='z');
nRes = file64.Read(buf, 1); //-- read 1 byte a pos 0xFFFFFFFF, beyond the max. allowed file size, this shall fail
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
test(buf.Length() == 0);
file64.Close();
@@ -2973,45 +2969,45 @@
test.Printf(_L("test writing to the last bytes of the file (absolute pos addressing) \n"));
//-- 2. writing using absolute position
nRes = file64.Open(TheFs, KFileName, EFileWrite);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
filePos = fileSize-1;
nRes = file64.Write(filePos-2, _L8("0"), 1); //-- write 1 byte a pos 0xFFFFFFFC
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
nRes = file64.Write(filePos, _L8("a"), 1); //-- write 1 byte a pos 0xFFFFFFFE, this is the last allowed position of the FAT32 file
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
nRes = file64.Write(filePos+1, _L8("b"), 1); //-- write 1 byte a pos 0xFFFFFFFF, beyond the max. allowed file size, this shall fail
- test(nRes == KErrNotSupported);
+ test_Value(nRes, nRes == KErrNotSupported);
nRes = file64.Flush();
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//-- 1.1 check the result by reading data absolute rel. position
nRes = file64.Read(filePos-2, buf, 1); //-- read 1 byte a pos 0xFFFFFFFD
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
test(buf.Length() == 1 && buf[0]=='0');
nRes = file64.Read(filePos, buf, 1); //-- read 1 byte a pos 0xFFFFFFFE, this is the last allowed position of the FAT32 file
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
test(buf.Length() == 1 && buf[0]=='a');
nRes = file64.Read(filePos+1, buf, 1); //-- read 1 byte a pos 0xFFFFFFFF, beyond the max. allowed file size
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
test(buf.Length() == 0);
nRes = file64.Read(filePos+2, buf, 1); //buf.Len must be 0
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
test(buf.Length() == 0);
file64.Close();
test.Printf(_L("deleting the huge file.\n"));
nRes = TheFs.Delete(KFileName);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
#else
@@ -3031,7 +3027,7 @@
F32_Test_Utils::SetConsole(test.Console());
TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum);
- test(nRes==KErrNone);
+ test_KErrNone(nRes);
PrintDrvInfo(TheFs, gDriveNum);
@@ -3040,26 +3036,26 @@
gShortFileNamesSupported = ETrue;
if(Is_Win32(TheFs, gDriveNum))
- {//-- find out if this is NTFS and if it supports short names (this feature can be switched OFF)
+ {//-- find out if this is NTFS and if it supports short names (this feature can be switched OFF)
_LIT(KLongFN, "\\this is a long file name");
nRes = CreateEmptyFile(TheFs, KLongFN, 10);
- test(nRes==KErrNone);
+ test_KErrNone(nRes);
TBuf<12> shortName;
nRes = TheFs.GetShortName(KLongFN, shortName);
gShortFileNamesSupported = (nRes == KErrNone);
nRes = TheFs.Delete(KLongFN);
- test(nRes==KErrNone);
+ test_KErrNone(nRes);
DeleteTestDirectory();
- }
+ }
else
- {
+ {
nRes = FormatDrive(TheFs, gDriveNum, ETrue);
- test(nRes==KErrNone);
- }
+ test_KErrNone(nRes);
+ }
CreateTestDirectory(_L("\\F32-TST\\TFILE\\"));
--- a/kerneltest/f32test/server/t_file64bit.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/server/t_file64bit.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -25,6 +25,7 @@
//
+#define __E32TEST_EXTENSION__
#include <f32file.h>
#include <e32test.h>
#include <e32svr.h>
@@ -57,7 +58,7 @@
RBuf8 buf;
r = buf.CreateMax(KBufSize);
- test(r == KErrNone);
+ test_KErrNone(r);
RFile64 file;
TFileName fileName;
@@ -65,10 +66,10 @@
fileName.Append(KTestPath);
fileName.Append(_L("File4GBMinusOne.txt"));
r = file.Replace(TheFs,fileName, EFileWrite);
- test(r == KErrNone);
+ test_KErrNone(r);
r = file.SetSize(K4GBMinusOne);
- test(r == KErrNone);
+ test_KErrNone(r);
TInt64 nNumberOfBytesToWrite = 0;
TInt64 nNumberOfBytesWritten = 0;
@@ -89,7 +90,7 @@
}
r = file.Flush();
- test(r == KErrNone);
+ test_KErrNone(r);
test.Printf(_L("\nFile writing is completed!!"));
@@ -177,7 +178,7 @@
{
test.Printf(_L("%S File Replaced with %S\n"),&anOldName,&aNewName);\
TInt r = TheFs.Replace(anOldName,aNewName);
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -190,20 +191,9 @@
TInt r = TheFs.ReadFileSection(aName,aPos,aBuffer,aLen);
TInt len = aBuffer.Length();
- if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
- {
- if(aPos < K4GB)
- test(r == KErrNone);
- else
- {
- test(r == KErrNone);
- test(len == 0);
- }
- }
- else
- {
- test (r == KErrNone);
- }
+ test_KErrNone(r);
+ if(KFileSizeMaxLargerThan4GBMinusOne == EFalse && aPos >= K4GB)
+ test(len == 0);
return(*this);
}
@@ -215,7 +205,7 @@
{
test.Printf(_L("Name of the directory for which listing is required %S\n"),&aName);
TInt r = TheFs.GetDir(aName,anEntryAttMask,anEntrySortKey,anEntryList);
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -226,7 +216,7 @@
{
test.Printf(_L("Name of the directory for which directory and file listing is required %S\n"),&aName);
TInt r = TheFs.GetDir(aName,anEntryAttMask,anEntrySortKey,anEntryList,aDirList);
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -237,7 +227,7 @@
{
test.Printf(_L("Name of the directory for which listing is required %S\n"),&aName);
TInt r = TheFs.GetDir(aName,anEntryUid,anEntrySortKey,aFileList);
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -256,7 +246,7 @@
{
test.Printf(_L("%S create %S in %d Mode\n"),&iName,&aName,aFileMode);
TInt r = RFile64::Create(TheFs,aName,aFileMode);
- test(r == KErrNone || r == KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r == KErrAlreadyExists);
return(*this);
}
@@ -268,7 +258,7 @@
{
test.Printf(_L("%S replace %S\n"),&iName,&aName);
TInt r = RFile64::Replace(TheFs,aName,EFileStream|EFileWrite);
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -280,10 +270,7 @@
{
test.Printf(_L("%S replace %S in %d Mode\n"),&iName,&aName, aFileMode);
TInt r = RFile64::Replace(TheFs,aName,aFileMode);
- if (r == KErrNone)
- test(r == KErrNone);
- else
- test(r == KErrBadName);
+ test_Value(r, r == KErrNone || r == KErrBadName);
return(*this);
}
@@ -294,7 +281,7 @@
{
test.Printf(_L("%S open %S\n"),&iName,&aName);
TInt r = RFile64::Open(TheFs,aName,EFileWrite|EFileShareAny);
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -305,7 +292,7 @@
{
test.Printf(_L("%S open %S in %d Mode\n"),&iName,&aName, aFileMode);
TInt r = RFile64::Open(TheFs,aName,aFileMode);
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -316,7 +303,7 @@
{
test.Printf(_L("%S Temp file %S in %d Mode\n"),&iName,&aName, aFileMode);
TInt r = RFile64::Temp(TheFs,aPath,aName,aFileMode);
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -335,7 +322,7 @@
{
test.Printf(_L("%S lock 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
TInt r = RFile64::Lock(aPos,aLen);
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -346,7 +333,7 @@
{
test.Printf(_L("%S lockE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
TInt r = RFile64::Lock(aPos,aLen);
- test(r == KErrLocked);
+ test_Value(r, r == KErrLocked);
return(*this);
}
@@ -357,7 +344,7 @@
{
test.Printf(_L("%S ulock 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
TInt r = RFile64::UnLock(aPos,aLen);
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -368,7 +355,7 @@
{
test.Printf(_L("%S ulockE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
TInt r = RFile64::UnLock(aPos,aLen);
- test(r == KErrNotFound);
+ test_Value(r, r == KErrNotFound);
return(*this);
}
@@ -391,13 +378,17 @@
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
{
if((seekPos + aDes.Length()) < K4GB)
- test(r == KErrNone);
+ {
+ test_KErrNone(r);
+ }
else
- test(r == KErrNotSupported);
+ {
+ test_Value(r, r == KErrNotSupported);
+ }
}
else
{
- test (r == KErrNone);
+ test_KErrNone(r);
}
return(*this);
}
@@ -423,10 +414,13 @@
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
{
if((seekPos + aDes.Length()) < K4GB)
+ {
test(aStatus.Int() == KErrNone);
+ }
else
+ {
test(aStatus.Int() == KErrNotSupported);
-
+ }
}
else
{
@@ -452,13 +446,17 @@
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
{
if((seekPos + aLength) < K4GB)
- test(r == KErrNone);
+ {
+ test_KErrNone(r);
+ }
else
- test(r == KErrNotSupported);
+ {
+ test_Value(r, r == KErrNotSupported);
+ }
}
else
{
- test(r == KErrNone);
+ test_KErrNone(r);
}
return(*this);
}
@@ -508,13 +506,17 @@
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
{
if ((aPos + aDes.Length()) < K4GB)
- test(r == KErrNone);
+ {
+ test_KErrNone(r);
+ }
else
- test(r == KErrNotSupported);
+ {
+ test_Value(r, r == KErrNotSupported);
+ }
}
else
{
- test(r == KErrNone);
+ test_KErrNone(r);
}
return(*this);
}
@@ -529,7 +531,7 @@
TInt r = RFile64::Write(aPos,aDes);
if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
r = RFile64::Flush();
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -548,19 +550,29 @@
if ((aPos + aLen) < K4GB)
{
if (aLen < 0)
- test(r == KErrArgument);
+ {
+ test_Value(r, r == KErrArgument);
+ }
else
- test(r == KErrNone);
+ {
+ test_KErrNone(r);
+ }
}
else
- test(r == KErrNotSupported);
+ {
+ test_Value(r, r == KErrNotSupported);
+ }
}
else
{
if (aLen < 0)
- test(r == KErrArgument);
+ {
+ test_Value(r, r == KErrArgument);
+ }
else
- test(r == KErrNone);
+ {
+ test_KErrNone(r);
+ }
}
return(*this);
}
@@ -575,7 +587,7 @@
TInt r = RFile64::Write(aPos,aDes,aLen);
if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
r = RFile64::Flush();
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -587,10 +599,7 @@
{
test.Printf(_L("%S writeE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
TInt r = RFile64::Write(aPos,aDes,aLen);
- if (aLen < 0)
- test(r == KErrArgument);
- else
- test(r == KErrLocked);
+ test_Value(r, r == (aLen < 0) ? KErrArgument : KErrLocked);
return(*this);
}
@@ -701,7 +710,7 @@
{
test.Printf(_L("%S read \n"),&iName);
TInt r = RFile64::Read(aDes);
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -770,10 +779,7 @@
{
test.Printf(_L("%S read 0x%08x bytes\n"),&iName,aLen);
TInt r = RFile64::Read(aDes,aLen);
- if(aLen < 0)
- test(r == KErrArgument);
- else
- test(r == KErrNone);
+ test_Value(r, r == (aLen < 0) ? KErrArgument : KErrNone);
return(*this);
}
@@ -785,10 +791,7 @@
test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
TInt r = RFile64::Read(aPos,aDes,aLen);
TInt len = aDes.Length();
- if(aLen < 0)
- test(r == KErrArgument);
- else
- test(r == KErrNone);
+ test_Value(r, r == (aLen < 0) ? KErrArgument : KErrNone);
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
{
if(aPos >= K4GB)
@@ -804,7 +807,7 @@
{
test.Printf(_L("%S readE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
TInt r = RFile64::Read(aPos,aDes,aLen);
- test(r == KErrLocked);
+ test_Value(r, r == KErrLocked);
return(*this);
}
@@ -836,7 +839,7 @@
{
test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
TInt r = RFile64::Read(aPos,aDes);
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -848,7 +851,7 @@
{
test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
TInt r = RFile64::Read(aPos,aDes);
- test(r == KErrNone);
+ test_KErrNone(r);
return(*this);
}
@@ -873,10 +876,7 @@
{
test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
TInt r = RFile64::Read(aPos,aDes,aLen);
- if(aLen < 0)
- test(r == KErrArgument);
- else
- test(r == KErrNone);
+ test_Value(r, r == (aLen < 0) ? KErrArgument : KErrNone);
return(*this);
}
@@ -919,13 +919,17 @@
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
{
if(aSize < K4GB)
- test(r == KErrNone);
+ {
+ test_KErrNone(r);
+ }
else
- test(r == KErrNotSupported);
+ {
+ test_Value(r, r == KErrNotSupported);
+ }
}
else
{
- test(r == KErrNone);
+ test_KErrNone(r);
}
return(*this);
}
@@ -937,7 +941,7 @@
{
test.Printf(_L("%S sizeE: 0x%lx\n"),&iName,aSize);
TInt r = RFile64::SetSize(aSize);
- test(r == KErrLocked);
+ test_Value(r, r == KErrLocked);
return(*this);
}
@@ -952,13 +956,17 @@
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
{
if(aSize < K4GB)
- test(r == KErrNone);
+ {
+ test_KErrNone(r);
+ }
else
- test(r == KErrTooBig);
+ {
+ test_Value(r, r == KErrTooBig);
+ }
}
else
{
- test(r == KErrNone);
+ test_KErrNone(r);
}
return(*this);
@@ -970,10 +978,7 @@
{
test.Printf(_L("Seek to pos %LD in %d Mode\n"),aPos, aMode);
TInt r = RFile64::Seek(aMode, aPos);
- if(aPos < 0)
- test(r == KErrArgument);
- else
- test(r == KErrNone);
+ test_Value(r, r == (aPos < 0) ? KErrArgument : KErrNone);
return(*this);
}
@@ -1012,7 +1017,7 @@
test.Next(_L("2GB File: Open"));
TInt r = TheFs.Entry(fileName, entry);
- test(r == KErrNone);
+ test_KErrNone(r);
test((TUint) entry.iSize == testSize);
TestRFile1.Open(fileName, EFileRead);
@@ -1023,7 +1028,7 @@
TestRFile1.Close();
r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -1060,7 +1065,7 @@
test.Next(_L("3GB File: Open"));
r = TheFs.Entry(fileName, entry);
- test(r == KErrNone);
+ test_KErrNone(r);
test((TUint) entry.iSize == testSize);
TestRFile1.Open(fileName,EFileRead);
@@ -1070,7 +1075,7 @@
TestRFile1.Close();
r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -1107,7 +1112,7 @@
test.Next(_L("4GB-1 File: Open"));
r = TheFs.Entry(fileName, entry);
- test(r == KErrNone);
+ test_KErrNone(r);
test((TUint) entry.iSize == testSize);
@@ -1119,7 +1124,7 @@
TestRFile1.Close();
r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -1156,7 +1161,7 @@
test.Next(_L("4GB File: Open"));
r = TheFs.Entry(fileName, entry);
- test(r == KErrNone);
+ test_KErrNone(r);
if ((TUint) entry.iSize == testSize)
{
@@ -1167,7 +1172,7 @@
}
r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
@@ -1254,10 +1259,10 @@
RFile64 file64;
TInt r = file64.Open(TheFs,fileName,EDeleteOnClose);
- test (r == KErrArgument);
+ test_Value(r, r == KErrArgument);
r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
@@ -1310,7 +1315,7 @@
test.Start(_L("Test opening a file using RFile and RFile64 in file sharing mode\n"));
TInt r = file.Replace(TheFs,fileName,EFileShareAny|EFileWrite);
- test(r == KErrNone);
+ test_KErrNone(r);
TBuf8<100> writeBuf;
TBuf8<100> readBuf;
@@ -1322,11 +1327,11 @@
test.Next(_L("Write 100 bytes to the file\n"));
r = file.Write(0, writeBuf, 100);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Read 100 bytes from position 0"));
r = file.Read(0, readBuf, 100);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Compare the read data to the written data"));
test(readBuf == writeBuf);
@@ -1340,13 +1345,13 @@
test.Next(_L("Query the file size using Rfile::Size()\n"));
r = file.Size(size);
- test (r == KErrTooBig);
+ test_Value(r, r == KErrTooBig);
test.Next(_L("Seek to the file position using 2GB+5 using RFile::Seek()\n"));
TUint seekPos1 = K2GB + 5;
TInt seekPos = (TInt)seekPos1;
r = file.Seek(ESeekStart,seekPos);
- test(r == KErrArgument);
+ test_Value(r, r == KErrArgument);
test.Next(_L("Get the file size using RFile64::Size()\n"));
TestRFile1.Size(size64);
@@ -1374,14 +1379,14 @@
test.Next(_L("Open the file using Rfile::Open()\n"));
r = file.Open(TheFs,fileName,EFileShareAny|EFileWrite);
- test(r == KErrTooBig);
+ test_Value(r, r == KErrTooBig);
test.Next(_L("Open the file using Rfile64::Open() and close\n"));
TestRFile1.Open(fileName,EFileShareAny|EFileWrite);
TestRFile1.Close();
r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -1425,7 +1430,7 @@
testDir.Append(KTestPath);
TInt r = TheFs.MkDir(testDir);
- test(r == KErrNone || r == KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r == KErrAlreadyExists);
TFileName fileName;
TestRFile1.Temp(testDir, fileName, EFileWrite|EDeleteOnClose);
@@ -1486,7 +1491,7 @@
test.Next(_L("Delete the temporary file\n"));
r = TheFs.Delete(fileName);
- test(r == KErrNotFound);
+ test_Value(r, r == KErrNotFound);
test.Next(_L("Create a temporary file using RFile64::Temp without EDeleteOnClose flag\n"));
TestRFile1.Temp(testDir, fileName, EFileWrite);
@@ -1496,7 +1501,7 @@
test.Next(_L("Delete the temporary the file\n"));
r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
@@ -1625,10 +1630,10 @@
test.Next(_L("create a file with InvalidPath and fileName\n"));
RFile64 file64;
TInt r = file64.Create(TheFs, _L("C:\\InvalidPathName\\FileName"),EFileWrite);
- test(r == KErrPathNotFound);
+ test_Value(r, r == KErrPathNotFound);
r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -1775,10 +1780,10 @@
test.Next(_L("Replace a file FileLargeOne.txt with invalid path\n"));
RFile64 file64;
TInt r = file64.Replace(TheFs,_L("C:\\InvalidPath\\FileLargeOne.Txt"),EFileWrite);
- test (r == KErrPathNotFound);
+ test_Value(r, r == KErrPathNotFound);
r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -1870,7 +1875,7 @@
test.Next(_L("Close the file and delete\n"));
TestRFile1.Close();
TInt r = TheFs.Delete(fileNameReplace);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -1901,39 +1906,39 @@
RProcess p;
TInt r = p.Create(_L("FHServer64Bit.exe"), KNullDesC);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Connect to the File server \n"));
RFs fs;
r = fs.Connect();
- test(r == KErrNone);
+ test_KErrNone(r);
// Check the number of open file handles
TInt resCount = fs.ResourceCount();
test(resCount == 0);
r = fs.ShareProtected();
- test(r == KErrNone);
+ test_KErrNone(r);
r = fs.CreatePrivatePath(gDrive);
- test(r == KErrNone);
+ test_KErrNone(r);
r = fs.SetSessionToPrivate(gDrive);
test.Next(_L("Create a file and set the file size to 4GB-1\n"));
RFile64 file1;
r = file1.Replace(fs,KClientFileName,EFileWrite);
- test(r == KErrNone);
+ test_KErrNone(r);
r = file1.SetSize(K4GB-1);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Write few bytes to the location 4GB-10, length = 9bytes\n"));
r = file1.Write(K4GB-10,KTestData3(),9);
- test(r == KErrNone);
+ test_KErrNone(r);
file1.Close();
r = p.SetParameter(3, gDrive);
- test(r == KErrNone);
+ test_KErrNone(r);
p.Resume();
@@ -1945,39 +1950,39 @@
r = handsvr.Connect();
}
while(r == KErrNotFound);
- test(r == KErrNone);
+ test_KErrNone(r);
r = handsvr.SetTestDrive(gDrive);
- test(r == KErrNone);
+ test_KErrNone(r);
r = fs.SetSessionToPrivate(gDrive);
- test(r == KErrNone);
+ test_KErrNone(r);
r = file1.Open(fs,KClientFileName,EFileRead);
- test(r == KErrNone);
+ test_KErrNone(r);
// pass the file handle to FHServer
test.Next(_L("RFile::TransferToServer()"));
TIpcArgs ipcArgs;
r = file1.TransferToServer(ipcArgs, 0, 1);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Adopt the already open file from a client using RFile64::AdoptFromClient()\n"));
r = handsvr.PassFileHandleProcessLargeFileClient(ipcArgs);
- test(r == KErrNone);
+ test_KErrNone(r);
// verify that the original file handle's position is unchanged
TInt64 pos = 0;
r = file1.Seek(ESeekCurrent, pos);
- test(r == KErrNone);
+ test_KErrNone(r);
test(pos == 0);
// make sure we can still use it
test.Next(_L("Read the file from position 4GB-10 and compare the data\n"));
TBuf8<9> rbuf;
r = file1.Read(K4GB-10,rbuf);
- test(r == KErrNone);
+ test_KErrNone(r);
test (rbuf == KTestData3);
// Close the file
@@ -1985,14 +1990,14 @@
handsvr.Exit();
handsvr.Close();
r = fs.MkDir(_L("C:\\mdir"));
- test(r == KErrNone || r == KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r == KErrAlreadyExists);
// Check the number of open file handles
resCount = fs.ResourceCount();
test(resCount == 0);
r = fs.Delete(KClientFileName);
- test(r == KErrNone);
+ test_KErrNone(r);
fs.Close();
}
@@ -2031,39 +2036,39 @@
test.Next(_L("Create a process named FHServer64Bit.exe\n"));
RProcess p;
r = p.Create(_L("FHServer64Bit.exe"), KNullDesC);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Connect to the file server\n"));
RFs fs;
r = fs.Connect();
- test(r == KErrNone);
+ test_KErrNone(r);
// Check the number of open file handles
TInt resCount = fs.ResourceCount();
test(resCount == 0);
r = fs.ShareProtected();
- test(r == KErrNone);
+ test_KErrNone(r);
r = fs.CreatePrivatePath(gDrive);
- test(r == KErrNone);
+ test_KErrNone(r);
r = fs.SetSessionToPrivate(gDrive);
test.Next(_L("Create a file and set the file size to 4GB-1\n"));
RFile64 file1;
r = file1.Replace(fs,KClientFileName,EFileWrite);
- test(r == KErrNone);
+ test_KErrNone(r);
r = file1.SetSize(K4GB-1);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Write few bytes to the location 4GB-10, length = 3bytes\n"));
r = file1.Write(K4GB-10,KTestData2(),3);
- test(r == KErrNone);
+ test_KErrNone(r);
file1.Close();
r = file1.Open(fs, KClientFileName, EFileWrite);
- test(r == KErrNone);
+ test_KErrNone(r);
// NB slot 0 is reserved for the command line
@@ -2072,21 +2077,21 @@
r = file1.TransferToProcess(p, 1, 2);
r = p.SetParameter(3, gDrive);
- test(r == KErrNone);
+ test_KErrNone(r);
r = fs.SetSessionToPrivate(gDrive);
- test(r == KErrNone);
+ test_KErrNone(r);
// make sure we can still read from the file
TBuf8<3> rbuf;
r = file1.Read(K4GB-10,rbuf,3);
- test(r == KErrNone);
+ test_KErrNone(r);
r = rbuf.CompareF(KTestData2());
- test(r == KErrNone);
+ test_KErrNone(r);
file1.Close();
r = fs.MkDir(_L("C:\\mdir"));
- test(r == KErrNone || r == KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r == KErrAlreadyExists);
// Check the number of open file handles -
// should be 1 (the one duplicated for the other process)
@@ -2106,13 +2111,13 @@
r = handsvr.Connect();
}
while(r == KErrNotFound);
- test(r == KErrNone);
+ test_KErrNone(r);
r = handsvr.SetTestDrive(gDrive);
- test(r == KErrNone);
+ test_KErrNone(r);
// wait for server to read the file
r = handsvr.PassFileHandleProcessLargeFileCreator();
- test (r == KErrNone);
+ test_KErrNone(r);
// cleanup
@@ -2151,37 +2156,37 @@
test.Next(_L("Connect to the file server\n"));
RFs fs;
r = fs.Connect();
- test(r == KErrNone);
+ test_KErrNone(r);
// Check the number of open file handles
TInt resCount = fs.ResourceCount();
test(resCount == 0);
r = fs.ShareProtected();
- test(r == KErrNone);
+ test_KErrNone(r);
r = fs.CreatePrivatePath(gDrive);
- test(r == KErrNone);
+ test_KErrNone(r);
r = fs.SetSessionToPrivate(gDrive);
test.Next(_L("Create a file and set the file size to 4GB-1\n"));
RFile64 file1;
r = file1.Replace(fs,KClientFileName,EFileWrite);
- test(r == KErrNone);
+ test_KErrNone(r);
r = file1.SetSize(K4GB-1);
- test(r == KErrNone);
+ test_KErrNone(r);
r = file1.Write(K4GB-10,KTestData3(),9);
- test(r == KErrNone);
+ test_KErrNone(r);
file1.Close();
r = fs.Delete(KClientFileName);
- test(r == KErrNone);
+ test_KErrNone(r);
RProcess p;
r = p.Create(_L("FHServer64Bit.exe"), KNullDesC);
- test(r == KErrNone);
+ test_KErrNone(r);
// Request an open file (write mode) from the server
// using RFile64::AdoptFromServer()
@@ -2193,10 +2198,10 @@
r = handsvr.Connect();
}
while(r == KErrNotFound);
- test(r == KErrNone);
+ test_KErrNone(r);
r = handsvr.SetTestDrive(gDrive);
- test(r == KErrNone);
+ test_KErrNone(r);
TInt ssh;
TInt fsh = handsvr.GetFileHandleLargeFile2(ssh, EFileWrite);
@@ -2215,30 +2220,30 @@
RFile64 file;
r = file.AdoptFromServer(fsh, ssh);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Read the file from position 4GB-10 and compare the data\n"));
TBuf8<9> rbuf;
r = file.Read(K4GB-10,rbuf);
- test(r == KErrNone);
+ test_KErrNone(r);
// server should write KTestData1 ("Server!!!") to file
test (rbuf == KTestData4);
TFileName fileName;
r = file.FullName(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
file.Close();
//cleanup
r = fs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
TFileName sessionPath;
r = fs.SessionPath(sessionPath);
- test(r == KErrNone);
+ test_KErrNone(r);
r = fs.RmDir(sessionPath);
- test(r == KErrNone);
+ test_KErrNone(r);
fs.Close();
@@ -2271,7 +2276,7 @@
TBuf8<KBufSize> readBuf2;
TUint i;
TInt r = GenerateBigFileContents();
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Open & Read Synchronously Large File From Diff Offset:"));
@@ -2901,7 +2906,7 @@
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -3038,7 +3043,7 @@
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -3177,7 +3182,7 @@
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -3342,7 +3347,7 @@
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -3522,7 +3527,7 @@
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -3594,7 +3599,7 @@
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
@@ -3703,7 +3708,7 @@
TestRFile2.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -3797,7 +3802,7 @@
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -3904,7 +3909,7 @@
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -4011,7 +4016,7 @@
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -4048,9 +4053,9 @@
fileName.Append(_L("File4GBMinusOne.txt"));
TInt r = file.Replace(TheFs,fileName,EFileWrite);
- test(r == KErrNone);
+ test_KErrNone(r);
r = file.SetSize(K4GBMinusOne);
- test(r == KErrNone);
+ test_KErrNone(r);
file.Close();
test.Next(_L("Read from a big file using RFs::ReadFileSection() from position 3GB-1,52byte lengths of data\n"));
@@ -4081,7 +4086,7 @@
}
r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -4145,11 +4150,11 @@
test.Next(_L("Get the directory listing, sort by size\n"));
RDir dir;
TInt r = dir.Open(TheFs, dirName, KEntryAttNormal);
- test (r == KErrNone);
+ test_KErrNone(r);
TEntryArray entryArray;
r = dir.Read(entryArray);
- test (r == KErrEof);
+ test_Value(r, r == KErrEof);
test.Next(_L("Check the files count in the directory. Number of files in a directory is 4\n"));
test(entryArray.Count() == gFilesInDirectory);
@@ -4297,12 +4302,12 @@
test.Next(_L("Open the directory containing large file, using RDir open()\n"));
RDir dir;
TInt r = dir.Open(TheFs, dirName, KEntryAttNormal);
- test (r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Read the directory entry using TEntryArray as parameter\n"));
TEntryArray entryArray;
r = dir.Read(entryArray);
- test (r == KErrEof);
+ test_Value(r, r == KErrEof);
test.Next(_L("Check the count\n"));
test(entryArray.Count() == gFilesInDirectory);
@@ -4341,7 +4346,7 @@
testDir0.Append(_L("F32-TEST"));
TInt r = TheFs.MkDir(testDir0);
- test(r == KErrNone || r == KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r == KErrAlreadyExists);
test.Next(_L("Sort with number of entries =0\n"));
TestRFs.GetDir(testDir0, KEntryAttMaskSupported, ESortBySize, anEntryList);
@@ -4468,13 +4473,13 @@
file3GB.Append(_L("File3GB.txt"));
TInt r = TheFs.Delete(file4GBMinusOne);
- test(r == KErrNone);
+ test_KErrNone(r);
r = TheFs.Delete(file2GBMinusOne);
- test(r == KErrNone);
+ test_KErrNone(r);
r = TheFs.Delete(file2GB);
- test(r == KErrNone);
+ test_KErrNone(r);
r = TheFs.Delete(file3GB);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@@ -4521,20 +4526,20 @@
test.Next(_L("Open test file and get the file size using RFile64::Size() and set the file handle to TFileText object\n"));
r = file64.Replace(TheFs,fileName,EFileRead|EFileWrite);
- test(r == KErrNone);
+ test_KErrNone(r);
r = file64.SetSize(sizeK3GB);
- test(r == KErrNone);
+ test_KErrNone(r);
TFileText fileText;
fileText.Set(file64);
test.Next(_L("Seek to the file end using TFileText::Seek()\n"));
r = fileText.Seek(ESeekEnd);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Get current file position using RFile64::Seek() and verify it is at file end.\n"));
TInt64 pos = 0;
r = file64.Seek(ESeekCurrent, pos);
- test(r == KErrNone);
+ test_KErrNone(r);
test(pos == sizeK3GB);
test.Next(_L("Write data to the file using RFile64::Write\n"));
@@ -4544,7 +4549,7 @@
TPtrC8 bufPtr;
bufPtr.Set((TUint8*)record->Ptr(),record->Size()); // Size() returns length in bytes
r = file64.Write(pos,bufPtr);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Read data using TFileText::Read\n"));
TBuf<20> fileTextReadBuf;
@@ -4554,26 +4559,26 @@
test.Next(_L("Seek to the file end using TFileText::Seek(ESeekEnd)\n"));
r = fileText.Seek(ESeekEnd);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Write known data using TFileText::Write\n"));
TBuf<20> fileTextWriteBuf(_L("AAAAAAAAAA"));
pos = 0;
r = file64.Seek(ESeekCurrent,pos);
r = fileText.Write(fileTextWriteBuf);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Read the data using RFile64::Read\n"));
TBuf8<20> file64ReadBuf;
file64ReadBuf.Zero();
r = file64.Read(pos,file64ReadBuf);
r = bufPtr.Compare(file64ReadBuf);
- test (r == KErrNone);
+ test_KErrNone(r);
file64.Close();
r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
User::Free(record);
}
@@ -4666,7 +4671,7 @@
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
test.End();
}
@@ -4746,13 +4751,13 @@
fileName1.Append(_L("File2GB.txt"));
RFile64 file;
TInt r = file.Replace(TheFs, fileName1, EFileWrite);
- test (r == KErrNone);
+ test_KErrNone(r);
file.SetSize(K2GB);
- test (r == KErrNone);
+ test_KErrNone(r);
file.Close();
TestRFs.ReadFileSection(fileName1,0,readBuf,100);
r = TheFs.Delete(fileName1);
- test (r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Creating test pattern"));
TBuf8<0x63> writeBuf63;
@@ -4786,7 +4791,7 @@
TestRFile1.Close();
r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
test.End();
}
@@ -4937,7 +4942,7 @@
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
test.End();
}
@@ -5076,7 +5081,7 @@
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
test.End();
}
@@ -5223,7 +5228,7 @@
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
test.End();
}
/**
@@ -5375,7 +5380,7 @@
}
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
test.End();
}
/**
@@ -5459,7 +5464,7 @@
}
TestRFile1.Close();
TInt r = TheFs.Delete(fileName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@SYMTestCaseID PBASE-T_FILE64BIT-2354
@@ -5587,20 +5592,20 @@
test.Next(_L("Copy the files from one folder to another using CFileMan::Copy()\n"));
TInt r = fileMan->Copy(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite);
- test(r == KErrNone || r == KErrTooBig);
+ test_Value(r, r == KErrNone || r == KErrTooBig);
test.Next(_L("Get the directory entry and find how many files are copied\n"));
// check SMALL and LARGE files have been copied
r = dir.Open(TheFs, filePathNew, KEntryAttNormal);
- test (r == KErrNone);
+ test_KErrNone(r);
r = dir.Read(entryArray);
- test (r == KErrEof);
+ test_Value(r, r == KErrEof);
test(entryArray.Count() == gFilesInDirectory);
dir.Close();
// then delete the new directory
r = fileMan->Delete(filePathNew);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Next(_L("Set file man observer\n"));
// attempt to copy to new directory again - this time with an observer
@@ -5608,7 +5613,7 @@
test.Next(_L("Copy the files from one folder to another, source folder has 3 small files and a large file\n"));
r = fileMan->Copy(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite);
- test(r == KErrNone || r == KErrTooBig);
+ test_Value(r, r == KErrNone || r == KErrTooBig);
test.Next(_L("Check observer for number of successful copy and failed copy\n"));
// test that 3 small files and 1 large file were copied
@@ -5619,28 +5624,28 @@
test.Next(_L("Get the directory entry and find how many files copied\n"));
// check SMALL files have been copied
r = dir.Open(TheFs, filePathNew, KEntryAttNormal);
- test (r == KErrNone);
+ test_KErrNone(r);
r = dir.Read(entryArray);
- test (r == KErrEof);
+ test_Value(r, r == KErrEof);
test(entryArray.Count() == gFilesInDirectory);
dir.Close();
// then delete the new directory
r = fileMan->Delete(filePathNew);
- test(r == KErrNone);
+ test_KErrNone(r);
delete observer;
delete fileMan;
r = TheFs.Delete(fileSmall1);
- test(r == KErrNone);
+ test_KErrNone(r);
r = TheFs.Delete(fileSmall2);
- test(r == KErrNone);
+ test_KErrNone(r);
r = TheFs.Delete(fileSmall3);
- test(r == KErrNone);
+ test_KErrNone(r);
r = TheFs.Delete(fileLarge1);
- test(r == KErrNone);
+ test_KErrNone(r);
}
/**
@SYMTestCaseID PBASE-T_FILE64BIT-2355
@@ -5718,21 +5723,21 @@
// move to new directory
TInt r = fileMan->Move(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite);
- test(r == KErrNone || r == KErrTooBig);
+ test_Value(r, r == KErrNone || r == KErrTooBig);
// check SMALL and LARGE files have been moved
RDir dir;
r = dir.Open(TheFs, filePathNew, KEntryAttNormal);
- test (r == KErrNone);
+ test_KErrNone(r);
TEntryArray entryArray;
r = dir.Read(entryArray);
- test (r == KErrEof);
+ test_Value(r, r == KErrEof);
test(entryArray.Count() == 4);
dir.Close();
// then delete the new directory
r = fileMan->Delete(filePathNew);
- test(r == KErrNone);
+ test_KErrNone(r);
delete fileMan;
}
@@ -5756,13 +5761,13 @@
TInt r;
RFs fs;
r = fs.Connect();
- test(r == KErrNone);
+ test_KErrNone(r);
r = fs.ShareProtected();
- 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);
fs.Close();
TestRFile64AdoptFromCreator();
TestRFile64AdoptFromClient();
@@ -5902,11 +5907,11 @@
// If a zero length is passed into the Write function, KErrNone should be returned.
r=aFile.Write(aPos,gBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
// If the length is a negative, KErrArgument should be returned.
r=aFile.Write(aPos,gBuf,aLen);
- test(r==KErrArgument);
+ test_Value(r, r == KErrArgument);
// Test the asynchronous requests
aFile.Write(aPos,gBuf,aLen,status1);
@@ -5918,7 +5923,7 @@
aFile.Close();
r = TheFs.Delete(_L("\\testRFile64NegLen.txt"));
- test(r == KErrNone);
+ test_KErrNone(r);
test.End();
}
//-------------------------------------------------------------------------------------------------------------------
@@ -5956,9 +5961,11 @@
{
KFileSizeMaxLargerThan4GBMinusOne = EFalse; //-- FAT doesn't support >= 4G files
}
- else if(Is_Win32(TheFs, aDrive))
- {//-- this is the emulator's windows drive. The maximal file size depends on the Windows FS used for this drive.
- //-- if it is NTFS, files >= 4G are supported.
+ else if(Is_SimulatedSystemDrive(TheFs, aDrive))
+ {
+ //-- This is the emulator's windows drive or PlatSim's HVFS.
+ //-- The maximal file size depends on the Windows FS used for this drive.
+ //-- If it is NTFS, files >= 4G are supported.
r = CreateEmptyFile(TheFs, _L("\\test_file"), K4GB);
KFileSizeMaxLargerThan4GBMinusOne = (r == KErrNone);
@@ -5980,7 +5987,7 @@
{
TInt r;
r = RFs::CharToDrive(gDriveToTest, gDrive);
- test(r == KErrNone);
+ test_KErrNone(r);
//-- set up console output
F32_Test_Utils::SetConsole(test.Console());
@@ -6029,7 +6036,7 @@
dirName.Append(gDriveToTest);
dirName.Append(KTestPath);
r = TheFs.RmDir(dirName);
- test(r == KErrNone);
+ test_KErrNone(r);
}
--- a/kerneltest/f32test/server/t_format.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/server/t_format.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -40,7 +40,7 @@
RFormat format;
TInt count;
TInt r=format.Open(TheFs,b,EHighDensity,count);
- test(r==KErrNone);
+ test_KErrNone(r);
format.Close();
}
@@ -96,9 +96,9 @@
RFs fs;
TInt ret=fs.Connect();
- test(ret==KErrNone);
+ test_KErrNone(ret);
ret=fs.SetSessionPath(gSessionPath);
- test(ret==KErrNone);
+ test_KErrNone(ret);
TTestCode testCode=*(TTestCode*)&aTestCode;
TInt count;
RFormat format;
@@ -107,10 +107,10 @@
case ETest3:
{
ret=format.Open(fs,gSessionPath,EQuickFormat,count);
- test(ret==KErrNone);
+ test_KErrNone(ret);
ret = DoFormatSteps(format, count);
- test(ret==KErrNone);
+ test_KErrNone(ret);
format.Close();
break;
@@ -118,7 +118,7 @@
case ETest5:
{
ret=format.Open(fs,gSessionPath,EFullFormat,count);
- test(ret==KErrNone);
+ test_KErrNone(ret);
gSleepThread.Signal();
User::After(100000000);
break;
@@ -139,7 +139,7 @@
RRawDisk raw;
TInt r=raw.Open(TheFs,CurrentDrive());
- test(r==KErrNone);
+ test_KErrNone(r);
if (!Is_Lffs(TheFs, gDrive))
{
TBuf8<KSectorSize> zeroBuf(KSectorSize);
@@ -151,7 +151,7 @@
for(TInt i=0; i<KMaxSectors; ++i)
{
r=raw.Write(i*KSectorSize, zeroBuf);
- test(r==KErrNone);
+ test_KErrNone(r);
}
}
else
@@ -174,7 +174,7 @@
// aligned 32-byte blocks, we don't need to bother that much.
// The device driver writes the block but fails when reading
// it back.
- // test(r==KErrNone);
+ // test_KErrNone(r);
}
}
else if(cntlModeSize>0)
@@ -238,16 +238,16 @@
RFormat format;
TInt r=format.Open(TheFs,gSessionPath,EFullFormat,count);
- test(r==KErrNone);
+ test_KErrNone(r);
r = DoFormatSteps(format, count);
- test(r==KErrNone);
+ test_KErrNone(r);
format.Close();
TVolumeInfo volInfo;
r=TheFs.Volume(volInfo);
- test(r==KErrNone);
+ test_KErrNone(r);
if (volInfo.iSize-volInfo.iFree!=0)
{
@@ -258,15 +258,15 @@
test.Next(_L("Test EQuickFormat"));
r=format.Open(TheFs,gSessionPath,EQuickFormat,count);
- test(r==KErrNone);
+ test_KErrNone(r);
r = DoFormatSteps(format, count);
- test(r==KErrNone);
+ test_KErrNone(r);
format.Close();
r=TheFs.Volume(volInfo);
- test(r==KErrNone);
+ test_KErrNone(r);
if (volInfo.iSize-volInfo.iFree!=0)
{
@@ -288,16 +288,16 @@
test.Next(_L("Test disk cannot be formatted while a file is open"));
RFile f;
TInt r=f.Replace(TheFs,_L("BLARGME.BLARG"),EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
TInt count;
RFormat format;
r=format.Open(TheFs,gSessionPath,EFullFormat,count);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
f.Close();
r=format.Open(TheFs,gSessionPath,EFullFormat,count);
- test(r==KErrNone);
+ test_KErrNone(r);
format.Close();
CheckFileExists(_L("BLARGME.BLARG"),KErrNone);
@@ -318,7 +318,7 @@
RThread clientThread;
TInt r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest3);
test.Printf(_L("Created helper thread #1, res=%d\n"),r);
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Logon(gThreadLogon);
clientThread.Resume();
@@ -336,7 +336,7 @@
TheFs.NotifyChange(ENotifyAll,reqStat);
r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest3);
test.Printf(_L("Created helper thread #2, res=%d\n"),r);
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Logon(gThreadLogon);
@@ -375,15 +375,15 @@
RFormat format;
TInt r=format.Open(TheFs,gSessionPath,EFullFormat,count);
- test(r==KErrNone);
+ test_KErrNone(r);
while(count)
{
RDir dir;
r=dir.Open(TheFs,_L("\\*.*"),KEntryAttNormal);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=format.Next(count);
- test(r==KErrNone);
+ test_KErrNone(r);
}
format.Close();
@@ -418,7 +418,7 @@
RThread clientThread;
TInt r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
test.Printf(_L("Created helper thread #1, res=%d\n"),r);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Printf(_L("Panicing formatting thread #1\n"));
clientThread.Resume();
@@ -438,7 +438,7 @@
// }
// else
// {
- test(r==KErrCorrupt);
+ test_Value(r, r == KErrCorrupt);
// }
test.Printf(_L("Formatting the drive...\n"));
@@ -446,10 +446,10 @@
TInt count;
RFormat format;
r=format.Open(TheFs,gSessionPath,EQuickFormat,count);
- test(r==KErrNone);
+ test_KErrNone(r);
r = DoFormatSteps(format, count);
- test(r==KErrNone);
+ test_KErrNone(r);
format.Close();
@@ -469,51 +469,51 @@
test.Next(_L("Test ramdrive shrinks after formatting"));
TVolumeInfo volInfo;
TInt r=TheFs.Volume(volInfo);
- test(r==KErrNone);
+ test_KErrNone(r);
if ((volInfo.iDrive.iMediaAtt&KMediaAttVariableSize)==0)
return;
TInt64 used=volInfo.iSize-volInfo.iFree;
RFile f;
r=f.Replace(TheFs,_L("BIGFILE.SIZE"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f.SetSize(0x100000); // 1MB
f.Close();
r=TheFs.Volume(volInfo);
- test(r==KErrNone);
+ test_KErrNone(r);
TInt64 used2=volInfo.iSize-volInfo.iFree;
test(used<used2);
r=TheFs.Delete(_L("BIGFILE.SIZE"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Volume(volInfo);
- test(r==KErrNone);
+ test_KErrNone(r);
used2=volInfo.iSize-volInfo.iFree;
test(used==used2);
r=f.Replace(TheFs,_L("BIGFILE.SIZE"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f.SetSize(0x100000); // 1MB
f.Close();
r=TheFs.Volume(volInfo);
- test(r==KErrNone);
+ test_KErrNone(r);
used2=volInfo.iSize-volInfo.iFree;
test(used<used2);
TInt count;
RFormat format;
r=format.Open(TheFs,gSessionPath,EQuickFormat,count);
- test(r==KErrNone);
+ test_KErrNone(r);
r = DoFormatSteps(format, count);
- test(r==KErrNone);
+ test_KErrNone(r);
format.Close();
r=TheFs.Volume(volInfo);
- test(r==KErrNone);
+ test_KErrNone(r);
used2=volInfo.iSize-volInfo.iFree;
test(used>=used2);
}
@@ -535,7 +535,7 @@
TVolumeInfo volInfo;
TInt r=TheFs.Volume(volInfo);
- test(r==KErrNone);
+ test_KErrNone(r);
if (volInfo.iDrive.iMediaAtt&KMediaAttVariableSize)
return; // Don't bother on internal disk
@@ -550,10 +550,10 @@
TInt count;
RFormat format;
r=format.Open(TheFs,gSessionPath,EQuickFormat,count);
- test(r==KErrNone);
+ test_KErrNone(r);
r = DoFormatSteps(format, count);
- test(r==KErrNone);
+ test_KErrNone(r);
format.Close();
}
@@ -585,33 +585,33 @@
TVolumeInfo volInfo;
TInt r=TheFs.Volume(volInfo);
-// test(r==KErrCorrupt);
+// test_Value(r, r == KErrCorrupt);
TInt count;
RFormat format;
r=format.Open(TheFs,gSessionPath,EQuickFormat,count);
r=TheFs.Volume(volInfo);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=format.Next(count);
- test(r==KErrNone);
+ test_KErrNone(r);
TDriveList driveList;
r=TheFs.DriveList(driveList);
- test(r==KErrNone);
+ test_KErrNone(r);
if(gDrive == EDriveC)
{
r=TheFs.Volume(volInfo, gDrive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
}
else
{
r=TheFs.Volume(volInfo,EDriveC);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Volume(volInfo,gDrive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
r=TheFs.Volume(volInfo,gDrive);
- test(r==KErrInUse);
+ test_Value(r, r == KErrInUse);
}
@@ -664,7 +664,7 @@
fmtMode = EQuickFormat;
nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt);
- test(nRes == KErrInUse);
+ test_Value(nRes, nRes == KErrInUse);
format.Close();
buf8.SetLength(22);
@@ -679,7 +679,7 @@
fmtMode = EQuickFormat;
nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt);
- test(nRes == KErrInUse);
+ test_Value(nRes, nRes == KErrInUse);
format.Close();
dir.Close();
@@ -695,9 +695,9 @@
test_KErrNone(nRes);
//-- this will mark the current Mount as "Dismounted" and will instantiate another CMountCB for formatting
- fmtMode = EQuickFormat | EForceFormat;
+ fmtMode = EQuickFormat | EForceFormat;
- nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt);
+ nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt);
test_KErrNone(nRes);
nRes = DoFormatSteps(format, fmtCnt);
@@ -707,11 +707,11 @@
nRes=TheFs.CheckDisk(gSessionPath);
- test(nRes==KErrNone||nRes==KErrNotSupported);
+ test_Value(nRes, nRes == KErrNone||nRes==KErrNotSupported);
buf8.SetLength(22);
nRes = file1.Write(buf8);
- test(nRes == KErrDisMounted);
+ test_Value(nRes, nRes == KErrDisMounted);
file1.Close(); //-- this will make the previously "Dismounted" mount die.
dir.Close();
@@ -734,11 +734,11 @@
format.Close();
nRes=TheFs.CheckDisk(gSessionPath);
- test(nRes==KErrNone||nRes==KErrNotSupported);
+ test_Value(nRes, nRes == KErrNone||nRes==KErrNotSupported);
buf8.SetLength(22);
nRes = file1.Write(buf8);
- test(nRes == KErrDisMounted);
+ test_Value(nRes, nRes == KErrDisMounted);
file1.Close(); //-- this will make the previously "Dismounted" mount die.
//---------------------------------------------------------------------------------
@@ -754,7 +754,7 @@
fmtMode = EQuickFormat;
nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt);
- test(nRes == KErrInUse);
+ test_Value(nRes, nRes == KErrInUse);
format.Close();
test(stat1.Int() == KRequestPending);
@@ -769,7 +769,7 @@
buf8.SetLength(22);
nRes = file1.Write(buf8);
- test(nRes == KErrDisMounted);
+ test_Value(nRes, nRes == KErrDisMounted);
file1.Close();
//---------------------------------------------------------------------------------
@@ -789,7 +789,7 @@
format.Close();
nRes = file1.Write(buf8);
- test(nRes == KErrDisMounted);
+ test_Value(nRes, nRes == KErrDisMounted);
file1.Close();
@@ -801,11 +801,11 @@
RFormat format1;
nRes = format1.Open(TheFs, drivePath, fmtMode, fmtCnt);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
fmtMode = EQuickFormat | EForceFormat;
nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt);
- test(nRes == KErrInUse);
+ test_Value(nRes, nRes == KErrInUse);
format.Close();
format1.Close();
@@ -813,11 +813,11 @@
//-- 5.1 check that forced formatting will fail when there are "disk access" objects opened RRawDisk
RRawDisk rawDisk;
nRes = rawDisk.Open(TheFs, gDrive);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
fmtMode = EQuickFormat | EForceFormat;
nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt);
- test(nRes == KErrInUse);
+ test_Value(nRes, nRes == KErrInUse);
format.Close();
rawDisk.Close();
@@ -847,7 +847,7 @@
{
fmtMode = EQuickFormat | EForceFormat;
nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt);
- test(nRes == KErrInUse);
+ test_Value(nRes, nRes == KErrInUse);
format.Close();
}
@@ -867,18 +867,21 @@
TInt r;
r = TheFs.CharToDrive(gDriveToTest, gDrive);
- test(r == KErrNone);
+ test_KErrNone(r);
//-- set up console output
F32_Test_Utils::SetConsole(test.Console());
TInt nRes=TheFs.CharToDrive(gDriveToTest, gDrive);
- test(nRes==KErrNone);
+ test_KErrNone(nRes);
PrintDrvInfo(TheFs, gDrive);
- if(Is_Win32(TheFs, gDrive))
- return; //-- emulator drive c:
+ if(Is_SimulatedSystemDrive(TheFs, gDrive))
+ {
+ test.Printf(_L("Skipping T_FORMAT on PlatSim/Emulator drive %C:\n"), gSessionPath[0]);
+ return;
+ }
SetSessionPath(_L("\\"));
@@ -894,7 +897,7 @@
TestFormat_ForceDismount();
r=TheFs.CheckDisk(gSessionPath);
- test(r==KErrNone||r==KErrNotSupported);
+ test_Value(r, r == KErrNone||r==KErrNotSupported);
}
--- a/kerneltest/f32test/server/t_fsched.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/server/t_fsched.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -29,6 +29,9 @@
#include "t_server.h"
#include <e32twin.h>
#include <e32cmn.h>
+#include "f32_test_utils.h"
+
+using namespace F32_Test_Utils;
//----------------------------------------------------------------------------------------------
//! @SYMTestCaseID PBASE-T_FSCHED-0191
@@ -930,9 +933,9 @@
test.Printf(_L("\nSync read done %d ms before the write ended\n"),I64LOW(timeTaken.Int64() / KuStomS));
TReal time=I64LOW(timeTaken.Int64() / KuStomS);
#if !defined(__WINS__)
- // If this condition fails, means that writing the sync file while fairscheduling a small sync read takes too long
+ // If this condition fails, it means that writing the sync file while fairscheduling a small sync read takes too long
test.Printf(_L("time: %f\n"), time);
-// test((time > 0) && (((gTotalTimeSync[0]-time)>0) || ((gTotalTimeSync[1]-time)>0)) );
+ // test((time > 0) && (((gTotalTimeSync[0]-time)>0) || ((gTotalTimeSync[1]-time)>0)) );
test(time > 0);
#endif
@@ -959,11 +962,14 @@
time = I64LOW(timeTaken.Int64() / KuStomS);
#if !defined(__WINS__)
- // If this condition fails, means that writing the async file while fairscheduling a small async read takes too long
+ if (!Is_HVFS(TheFs, gDrive))
+ {
+ // If this condition fails, it means that writing the async file while fairscheduling a small async read takes too long
test.Printf(_L("time: %f\n"), time);
test.Printf(_L("gTotalTimeAsync[0] = %d , gTotalTimeAsync[1] = %d\n"),gTotalTimeAsync[0],gTotalTimeAsync[1] );
-// test((time > 0) && (((gTotalTimeAsync[0]-time)>0) || ((gTotalTimeAsync[1]-time)>0)) );
+ // test((time > 0) && (((gTotalTimeAsync[0]-time)>0) || ((gTotalTimeAsync[1]-time)>0)) );
test(time > 0);
+ }
#endif
}
@@ -998,9 +1004,9 @@
test.Printf(_L("\nSync write done %d ms before the big write ended\n"),I64LOW(timeTaken.Int64() / KuStomS));
TReal time=I64LOW(timeTaken.Int64() / KuStomS);
#if !defined(__WINS__)
- // If this condition fails, means that writing the sync file while fairscheduling a small sync write takes too long
+ // If this condition fails, it means that writing the sync file while fairscheduling a small sync write takes too long
test.Printf(_L("time: %f\n"), time);
-// test((time > 0) && (((gTotalTimeSync[0]-time)>0) || ((gTotalTimeSync[1]-time)>0)) );
+ // test((time > 0) && (((gTotalTimeSync[0]-time)>0) || ((gTotalTimeSync[1]-time)>0)) );
test(time > 0);
#endif
@@ -1018,13 +1024,16 @@
timeTaken = time2.MicroSecondsFrom(time1);
test.Printf(_L("\nAsync write done %d ms before the big write ended\n"),I64LOW(timeTaken.Int64() / KuStomS));
- time=I64LOW(timeTaken.Int64() / KuStomS);
+ time=I64LOW(timeTaken.Int64() / KuStomS);
#if !defined(__WINS__)
- // If this condition fails, means that writing the async file while fairscheduling a small async write takes too long
+ if (!Is_HVFS(TheFs, gDrive))
+ {
+ // If this condition fails, it means that writing the async file while fairscheduling a small async write takes too long
test.Printf(_L("time: %f\n"), time);
test.Printf(_L("gTotalTimeAsync[0] = %d , gTotalTimeAsync[1] = %d\n"),gTotalTimeAsync[0],gTotalTimeAsync[1] );
-// test((time > 0) && (((gTotalTimeAsync[0]-time)>0) || ((gTotalTimeAsync[1]-time)>0)) );
+ // test((time > 0) && (((gTotalTimeAsync[0]-time)>0) || ((gTotalTimeAsync[1]-time)>0)) );
test(time > 0);
+ }
#endif
bigFile.Close();
smallFile.Close();
@@ -1277,7 +1286,7 @@
TBool simulatelockFailureMode = EFalse;
r = controlIo(TheFs, gDrive, KControlIoSimulateLockFailureMode, simulatelockFailureMode);
- test (r == KErrNone || r == KErrNotSupported);
+ test_Value(r, r == KErrNone || r == KErrNotSupported);
#endif
// FileNames/File generation
@@ -1336,9 +1345,9 @@
TestWriteOrder();
// Format the drive to make sure no blocks are left to be erased in LFFS
- #if !defined(__WINS__)
+ if (!Is_Win32(TheFs, gDrive))
Format(gDrive);
- #endif
+
r = TheFs.MkDirAll(gSessionPath);
TimeTakenToWriteBigFile(1);
@@ -1366,7 +1375,7 @@
// turn lock failure mode back ON (if cache is enabled)
simulatelockFailureMode = ETrue;
r = controlIo(TheFs, gDrive, KControlIoSimulateLockFailureMode, simulatelockFailureMode);
- test (r == KErrNone || r == KErrNotSupported);
+ test_Value(r, r == KErrNone || r == KErrNotSupported);
#endif
test.End();
@@ -1505,10 +1514,9 @@
test.Printf(_L("%c: Media corruption; previous test may have aborted; else, check hardware\n"), (TUint)gDrive + 'A');
}
TESTERROR(r);
-#if !defined(__WINS__)
- if ((volInfo.iDrive.iMediaAtt & KMediaAttFormattable))
+
+ if (!Is_Win32(TheFs, gDrive) && (volInfo.iDrive.iMediaAtt & KMediaAttFormattable))
Format(gDrive);
-#endif
if(CheckForDiskSize())
{
--- a/kerneltest/f32test/server/t_fsrv.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/server/t_fsrv.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -99,9 +99,9 @@
test.Start(_L("Path test thread"));
RFs f;
TInt r=f.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.SessionPath(tPath);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
return(KErrNone);
@@ -209,59 +209,55 @@
test.Printf(_L("Dismounting the Remote Drive returned %d\n"),r);
- test(r==KErrNone );
+ test_Value(r, r == KErrNone );
}
LOCAL_C void CreateSubstDrive()
{
- test.Printf(_L("Create Substitute Drive \n"));
-
- TDriveList driveList;
- TInt i ;
-
- TInt r=TheFs.SessionPath(gTestSessionPath);
- test(r==KErrNone);
+ test.Printf(_L("Create Substitute Drive \n"));
+
+ TDriveList driveList;
+
+ TInt r=TheFs.SessionPath(gTestSessionPath);
+ test_KErrNone(r);
r=TheFs.DriveList(driveList, KDriveAttExclude|KDriveAttLocal);
- test( r==KErrNone );
+ test_KErrNone(r);
- for ( i = EDriveO; i < KMaxDrives; i++)
- {
-
- if ( driveList[i] == 0)
- {
- if (i == EDriveQ) continue; // Q reserved to mount a virtual Remote Drive, as part of the test.
- substDrive = i;
- break;
- }
- }
-
-
+ for (TInt i = EDriveO; i < KMaxDrives; i++)
+ {
+ if (driveList[i] == 0)
+ {
+ if (i == EDriveQ)
+ continue; // Q reserved to mount a virtual Remote Drive, as part of the test.
+ substDrive = i;
+ break;
+ }
+ }
+
if (substDrive)
{
TDriveInfo driveInfo;
r=TheFs.Drive(driveInfo,substDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
if (driveInfo.iDriveAtt==KDriveAttLocal)
- {
+ {
return; // Subst local drives fails
}
TFileName n;
r=TheFs.Subst(n,substDrive);
- test(r==KErrNone);
- test(n.Length()==0);
+ test_KErrNone(r);
+ test_Value(n.Length(), n.Length() == 0);
r=TheFs.SetSubst(gTestSessionPath,substDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Subst(n,substDrive);
- test(r==KErrNone);
- test(n==gTestSessionPath);
+ test_KErrNone(r);
+ test(n==gTestSessionPath);
}
-
-
}
@@ -269,9 +265,9 @@
{
if( substDrive)
{
- test.Printf(_L("Removing Substitute Drive \n"));
- TInt r =TheFs.SetSubst(_L(""),substDrive);
- test(r ==KErrNone);
+ test.Printf(_L("Removing Substitute Drive \n"));
+ TInt r =TheFs.SetSubst(_L(""),substDrive);
+ test_KErrNone(r);
}
}
@@ -284,16 +280,16 @@
//
{
- test(anInfo.iConnectionBusType==EConnectionBusInternal || anInfo.iConnectionBusType==EConnectionBusUsb);
+ test_Value(anInfo.iConnectionBusType, anInfo.iConnectionBusType==EConnectionBusInternal || anInfo.iConnectionBusType==EConnectionBusUsb);
if (aDrive==EDriveZ)
{
if (anInfo.iType==EMediaNotPresent)
return;
- test(anInfo.iMediaAtt==KMediaAttWriteProtected);
- test(anInfo.iDriveAtt==(KDriveAttRom|KDriveAttInternal));
- test(anInfo.iType==EMediaRom);
+ test_Value(anInfo.iMediaAtt, anInfo.iMediaAtt==KMediaAttWriteProtected);
+ test_Value(anInfo.iDriveAtt, anInfo.iDriveAtt==(KDriveAttRom|KDriveAttInternal));
+ test_Value(anInfo.iType, anInfo.iType==EMediaRom);
}
else if (GetDriveLFFS()==aDrive)
@@ -301,9 +297,9 @@
if (anInfo.iType==EMediaNotPresent)
return;
- test(anInfo.iDriveAtt&(KDriveAttLocal|KDriveAttInternal)==KDriveAttLocal|KDriveAttInternal); // LFFS sets KDriveAttTransaction as well
- test(anInfo.iType==EMediaFlash);
- test(anInfo.iMediaAtt==KMediaAttFormattable);
+ test_Value(anInfo.iDriveAtt, anInfo.iDriveAtt&(KDriveAttLocal|KDriveAttInternal)==KDriveAttLocal|KDriveAttInternal); // LFFS sets KDriveAttTransaction as well
+ test_Value(anInfo.iType, anInfo.iType==EMediaFlash);
+ test_Value(anInfo.iMediaAtt, anInfo.iMediaAtt==KMediaAttFormattable);
}
/*
Why assume certain drive letters can only refer to certain drive types?
@@ -381,17 +377,17 @@
test.Printf(_L("Test existing DriveList \n"));
err = TheFs.DriveList(driveList);
- test( err == KErrNone );
+ test_KErrNone(err);
for ( i = 0; i < KMaxDrives; i++)
{
if (driveList[i])
{
err = TheFs.Drive(info, i);
- test( err == KErrNone );
- test( info.iType != EMediaRemote );
- test( !(info.iDriveAtt & KDriveAttRemote ) );
- test( !(info.iDriveAtt & KDriveAttHidden ) );
+ test_KErrNone(err);
+ test_Value(info.iType, info.iType != EMediaRemote);
+ test_Value(info.iDriveAtt, !(info.iDriveAtt & KDriveAttRemote));
+ test_Value(info.iDriveAtt, !(info.iDriveAtt & KDriveAttHidden));
drivecount++;
if( info.iDriveAtt & KDriveAttRemovable)
@@ -430,13 +426,13 @@
flags = KDriveAttAll;
err = TheFs.DriveList(driveList, flags);
- test( err == KErrNone );
+ test_KErrNone(err);
for ( i = 0; i < KMaxDrives; i++)
{
if (driveList[i])
{
err = TheFs.Drive(info,i);
- test( err == KErrNone );
+ test_KErrNone(err);
allDrivecount++;
if( info.iDriveAtt & KDriveAttSubsted )
@@ -462,9 +458,6 @@
}
}
- test(allDrivecount == drivecount + hiddenOrRemoteDriveCount);
- test(hiddenOrRemoteDriveCount - hiddenDriveCount == 1);
-
test.Printf(_L("Found %d substitute drives\n"), substDriveCount);
test.Printf(_L("Found %d exclusively substitute drives \n"),exclusiveSubstDriveCount);
test.Printf(_L("Found %d hidden drives\n"), hiddenDriveCount);
@@ -475,6 +468,9 @@
test.Printf(_L("Found %d physically removable drives \n"),physicallyRemovable);
test.Printf(_L("Found %d logically removable drives \n"),logicallyRemovableDriveCount);
+ test(allDrivecount == drivecount + hiddenOrRemoteDriveCount);
+ test(hiddenOrRemoteDriveCount - hiddenDriveCount == 1);
+
//---------------------------------------------
//! @SYMTestCaseID PBASE-T_FSRV-0546
@@ -495,22 +491,22 @@
flags = KDriveAttRemovable;
err = TheFs.DriveList(driveList, flags);
- test( err == KErrNone );
+ test_KErrNone(err);
for ( i = 0; i < KMaxDrives; i++)
{
if (driveList[i])
{
err = TheFs.Drive(info, i);
- test( err == KErrNone );
- test( info.iDriveAtt & KDriveAttRemovable );
- drivecount++;
+ test_KErrNone(err);
+ test_Value(info.iDriveAtt, info.iDriveAtt & KDriveAttRemovable);
+ drivecount++;
printDriveAtt(i,info.iDriveAtt);
}
}
- test( drivecount == removableDriveCount ); // no removable drive was added
+ test_Value(drivecount, drivecount == removableDriveCount); // no removable drive was added
//---------------------------------------------
@@ -531,14 +527,14 @@
drivecount = 0;
flags = KDriveAttRemovable | KDriveAttRemote;
err = TheFs.DriveList(driveList, flags);
- test( err == KErrNone );
+ test_KErrNone(err);
for ( i = 0; i < KMaxDrives; i++)
{
if (driveList[i])
{
err = TheFs.Drive(info, i);
- test( err == KErrNone );
- test( (info.iDriveAtt & KDriveAttRemovable ) || (info.iDriveAtt & KDriveAttRemote));
+ test_KErrNone(err);
+ test_Value(info.iDriveAtt, (info.iDriveAtt & KDriveAttRemovable ) || (info.iDriveAtt & KDriveAttRemote));
drivecount++;
printDriveAtt(i,info.iDriveAtt);
@@ -546,7 +542,7 @@
}
}
- test( drivecount == removableDriveCount + 1 ); //contains the remote drive we mounted
+ test_Value(drivecount, drivecount == removableDriveCount + 1 ); //contains the remote drive we mounted
//---------------------------------------------
@@ -568,21 +564,21 @@
flags = KDriveAttExclusive | KDriveAttRemote;
TUint match = KDriveAttRemote;
err = TheFs.DriveList(driveList, flags);
- test( err == KErrNone );
+ test_KErrNone(err);
for ( i = 0; i < KMaxDrives; i++)
{
if (driveList[i])
{
err = TheFs.Drive(info, i);
- test( err == KErrNone );
- test( (info.iDriveAtt == match));
+ test_KErrNone(err);
+ test_Value(info.iDriveAtt, (info.iDriveAtt == match));
drivecount++;
printDriveAtt(i,info.iDriveAtt);
}
}
- test( drivecount == 1 ); //The remote drive we mounted.
+ test_Value(drivecount, drivecount == 1); //The remote drive we mounted.
//---------------------------------------------
@@ -603,22 +599,22 @@
drivecount = 0;
flags = KDriveAttExclude | KDriveAttRemovable;
err = TheFs.DriveList(driveList, flags);
- test( err == KErrNone );
+ test_KErrNone(err);
for (i = 0; i < KMaxDrives; i++)
{
if (driveList[i])
{
err = TheFs.Drive(info, i);
- test( err == KErrNone );
- test( (!(info.iDriveAtt & KDriveAttRemovable ) ));
+ test_KErrNone(err);
+ test_Value(info.iDriveAtt, (!(info.iDriveAtt & KDriveAttRemovable ) ));
drivecount++;
printDriveAtt(i,info.iDriveAtt);
}
}
- test ( drivecount == allDrivecount - removableDriveCount);
- test ( drivecount == nonRemovables + hiddenDriveCount + 1) ; //The remote drive we added is non removable
+ test_Value(drivecount, drivecount == allDrivecount - removableDriveCount);
+ test_Value (drivecount, drivecount == nonRemovables + hiddenDriveCount + 1) ; //The remote drive we added is non removable
@@ -643,21 +639,21 @@
flags = KDriveAttExclude | KDriveAttRemovable | KDriveAttRemote;
err = TheFs.DriveList(driveList, flags);
- test( err == KErrNone );
+ test_KErrNone(err);
for ( i = 0; i < KMaxDrives; i++)
{
if (driveList[i])
{
err = TheFs.Drive(info,i);
- test( err == KErrNone );
- test( (!(info.iDriveAtt & KDriveAttRemovable ) && (!(info.iDriveAtt & KDriveAttRemote ))));
+ test_KErrNone(err);
+ test_Value(info.iDriveAtt, (!(info.iDriveAtt & KDriveAttRemovable ) && (!(info.iDriveAtt & KDriveAttRemote ))));
drivecount++;
printDriveAtt(i,info.iDriveAtt);
}
}
- test(drivecount == (allDrivecount - removableDriveCount - 1) ); // also excluding the removables and the remote drive
+ test_Value(drivecount, drivecount == (allDrivecount - removableDriveCount - 1) ); // also excluding the removables and the remote drive
@@ -687,21 +683,21 @@
flags = KDriveAttExclude | KDriveAttRemote | KDriveAttSubsted;
err = TheFs.DriveList(driveList, flags);
- test( err == KErrNone );
+ test_KErrNone(err);
for ( i = 0; i < KMaxDrives; i++)
{
if (driveList[i])
{
err = TheFs.Drive(info,i);
- test( err == KErrNone );
- test( (!(info.iDriveAtt & KDriveAttRemote ) && (!(info.iDriveAtt & KDriveAttSubsted ))));
+ test_KErrNone(err);
+ test_Value(info.iDriveAtt, (!(info.iDriveAtt & KDriveAttRemote ) && (!(info.iDriveAtt & KDriveAttSubsted ))));
drivecount++;
printDriveAtt(i,info.iDriveAtt);
}
}
- test(drivecount == (allDrivecount - substDriveCount- 1) );
+ test_Value(drivecount, drivecount == (allDrivecount - substDriveCount- 1) );
@@ -711,15 +707,15 @@
flags = KDriveAttExclusive | KDriveAttExclude | KDriveAttSubsted;
err = TheFs.DriveList(driveList, flags);
- test( err == KErrNone );
+ test_KErrNone(err);
for ( i = 0; i < KMaxDrives; i++)
{
if (driveList[i])
{
err = TheFs.Drive(info,i);
- test( err == KErrNone );
- test( info.iDriveAtt != KDriveAttSubsted );
+ test_KErrNone(err);
+ test_Value(info.iDriveAtt, info.iDriveAtt != KDriveAttSubsted);
drivecount++;
printDriveAtt(i,info.iDriveAtt);
@@ -727,7 +723,7 @@
}
- test(drivecount == (allDrivecount - exclusiveSubstDriveCount) );
+ test_Value(drivecount, drivecount == (allDrivecount - exclusiveSubstDriveCount) );
}
@@ -767,14 +763,14 @@
TDriveList fullDriveList;
err = TheFs.DriveList(fullDriveList, KDriveAttAll);
- test( err == KErrNone );
+ test_KErrNone(err);
for ( i = 0; i < KMaxDrives; i++)
{
if (driveList[i])
{
err = TheFs.Drive(info,i);
- test( err == KErrNone );
+ test_KErrNone(err);
printDriveAtt(i,info.iDriveAtt);
}
}
@@ -794,14 +790,14 @@
//test.Printf(_L("Expected Result : %d \n"), testAtt == 0 ? testCombinations[matchIdx].iExpectedResultNoAtts : testCombinations[matchIdx].iExpectedResultWithAtts);
//test.Printf(_L(" Actual Result : 0x%08x \n"), err);
- test( err == (testAtt == 0 ? testCombinations[matchIdx].iExpectedResultNoAtts : testCombinations[matchIdx].iExpectedResultWithAtts) );
+ test_Value(err, err == (testAtt == 0 ? testCombinations[matchIdx].iExpectedResultNoAtts : testCombinations[matchIdx].iExpectedResultWithAtts));
if(err == KErrNone)
{
//printDriveAtt(0, testAtt); //Prints attributes
for ( i = 0; i < KMaxDrives; i++)
{
- TBool expectMatch = EFalse;
+ TBool expectMatch = EFalse;
switch(testCombinations[matchIdx].iMatchMask)
{
@@ -813,11 +809,11 @@
expectMatch = ETrue;
break;
- case KDriveAttExclude :
+ case KDriveAttExclude:
expectMatch = (fullDriveList[i] & testAtt) == 0;
break;
- case KDriveAttExclusive :
+ case KDriveAttExclusive:
expectMatch = (fullDriveList[i] == testAtt);
break;
@@ -825,20 +821,14 @@
expectMatch = (fullDriveList[i] != testAtt);
break;
- case KDriveAttAll | KDriveAttExclude :
- test(0); // Invalid - should never get here as this returns KErrArgument for all cases
- break;
-
- case KDriveAttAll | KDriveAttExclusive :
- test(0); // Invalid - should never get here as this returns KErrArgument for all cases
- break;
-
- case KDriveAttAll | KDriveAttExclude | KDriveAttExclusive :
- test(0); // Invalid - should never get here as this returns KErrArgument for all cases
- break;
-
+ case KDriveAttAll | KDriveAttExclude:
+ // Invalid - should never get here as this returns KErrArgument for all cases
+ case KDriveAttAll | KDriveAttExclusive:
+ // Invalid - should never get here as this returns KErrArgument for all cases
+ case KDriveAttAll | KDriveAttExclude | KDriveAttExclusive:
+ // Invalid - should never get here as this returns KErrArgument for all cases
default:
- test.Printf(_L("Unexpected Match Mask %08x"), testCombinations[matchIdx].iMatchMask);
+ test.Printf(_L("Unexpected or invalid Match Mask %08x"), testCombinations[matchIdx].iMatchMask);
test(0);
break;
}
@@ -846,7 +836,7 @@
if(expectMatch)
{
//test.Printf(_L(" %c MATCHED OK "), 'A' + i);
- test(newDriveList[i] == fullDriveList[i]);
+ test_Value(newDriveList[i], newDriveList[i] == fullDriveList[i]);
}
else
{
@@ -859,7 +849,7 @@
test.Printf(_L(" %c NOT MATCHED "), 'A' + i);
}
*/
- test(newDriveList[i] == 0);
+ test_Value(newDriveList[i], newDriveList[i] == 0);
}
}
}
@@ -885,14 +875,14 @@
drivecount = 0;
flags = KDriveAttLogicallyRemovable;
err = TheFs.DriveList(driveList, flags);
- test( err == KErrNone );
+ test_KErrNone(err);
for ( i = 0; i < KMaxDrives; i++)
{
if (driveList[i])
{
err = TheFs.Drive(info, i);
- test( err == KErrNone );
- test( info.iDriveAtt & KDriveAttLogicallyRemovable );
+ test_KErrNone(err);
+ test_Value(info.iDriveAtt, info.iDriveAtt & KDriveAttLogicallyRemovable);
drivecount++;
printDriveAtt(i,info.iDriveAtt);
@@ -900,8 +890,7 @@
}
- test( drivecount == logicallyRemovableDriveCount ); // no logically removable drive was added
-
+ test_Value(drivecount, drivecount == logicallyRemovableDriveCount); // no logically removable drive was added
test.End();
}
@@ -921,7 +910,7 @@
test.Start(_L("The drive info"));
TDriveList list;
TInt r=TheFs.DriveList(list);
- test(r==KErrNone);
+ test_KErrNone(r);
for (TInt i=0;i<KMaxDrives;i++)
{
TInt att=list[i];
@@ -929,7 +918,7 @@
{
TDriveInfo d;
r=TheFs.Drive(d,i);
- test(r==KErrNone);
+ test_KErrNone(r);
printDriveInfo(i,d);
test.Printf(_L("\n"));
testDriveInfo(i,d);
@@ -948,7 +937,7 @@
test.Start(_L("The volume info"));
TDriveList list;
TInt r=TheFs.DriveList(list);
- test(r==KErrNone);
+ test_KErrNone(r);
for (TInt i=0;i<KMaxDrives;i++)
{
TVolumeInfo v;
@@ -1012,7 +1001,7 @@
}
else
r=f.Set(name,NULL,NULL);
- test(r==KErrNone);
+ test_KErrNone(r);
test(TPtrC(p.fullName)==f.FullName());
test(TPtrC(p.drive)==f.Drive());
test(TPtrC(p.path)==f.Path());
@@ -1032,28 +1021,28 @@
test.Start(_L("Test path handling"));
TFileName p;
TInt r=TheFs.SessionPath(p);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Printf(_L("SESSION=\"%S\"\n"),&p);
r=TheFs.SetSessionPath(_L("A:\\TEST\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.SessionPath(p);
- test(r==KErrNone);
+ test_KErrNone(r);
test(p==_L("A:\\TEST\\"));
r=TheFs.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
TheFs.SetAllocFailure(gAllocFailOff);
RThread t;
r=t.Create(_L("PathTest"),pathTestThread,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
- test(r==KErrNone);
+ test_KErrNone(r);
TRequestStatus tStat;
t.Logon(tStat);
t.Resume();
User::WaitForRequest(tStat);
- test(tStat==KErrNone);
- test(r==KErrNone);
+ r = tStat.Int();
+ test_KErrNone(r);
t.Close();
TheFs.SetAllocFailure(gAllocFailOn);
@@ -1071,9 +1060,9 @@
TFileName old;
TInt r=TheFs.SessionPath(old);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.SetSessionPath(_L("C:\\ABCDEF\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
for (TInt i=0;i<KMaxParses;i++)
{
TInt r;
@@ -1084,7 +1073,7 @@
r=TheFs.Parse(name,TPtrC(p.rel),f);
else
r=TheFs.Parse(name,f);
- test(r==KErrNone);
+ test_KErrNone(r);
test(TPtrC(p.fullName)==f.FullName());
test(TPtrC(p.drive)==f.Drive());
test(TPtrC(p.path)==f.Path());
@@ -1092,7 +1081,7 @@
test(TPtrC(p.ext)==f.Ext());
}
r=TheFs.SetSessionPath(old);
- test(r==KErrNone);
+ test_KErrNone(r);
test.End();
}
@@ -1106,14 +1095,14 @@
test.Printf(_L("Test subst"));
TVolumeInfo v;
TInt r=TheFs.Volume(v);
- test(r==KErrNone);
+ test_KErrNone(r);
TDriveInfo origDI;
r=TheFs.Drive(origDI);
- test(r==KErrNone);
+ test_KErrNone(r);
TDriveInfo driveInfo;
r=TheFs.Drive(driveInfo,EDriveO);
- test(r==KErrNone);
+ test_KErrNone(r);
if (driveInfo.iDriveAtt==KDriveAttLocal)
{
@@ -1122,40 +1111,40 @@
TFileName n;
r=TheFs.Subst(n,EDriveO);
- test(r==KErrNone);
- test(n.Length()==0);
+ test_KErrNone(r);
+ test_Value(n.Length(), n.Length()==0);
r=TheFs.SetSubst(gSessionPath,EDriveO);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Subst(n,EDriveO);
- test(r==KErrNone);
+ test_KErrNone(r);
test(n==gSessionPath);
TVolumeInfo w;
r=TheFs.Volume(w,EDriveO);
- test(r==KErrNone);
- test(w.iDrive.iType==v.iDrive.iType);
- test(w.iDrive.iConnectionBusType==v.iDrive.iConnectionBusType);
- test(w.iDrive.iDriveAtt==KDriveAttSubsted);
- test(w.iDrive.iMediaAtt==v.iDrive.iMediaAtt);
+ test_KErrNone(r);
+ test_Value(w.iDrive.iType, w.iDrive.iType==v.iDrive.iType);
+ test_Value(w.iDrive.iConnectionBusType, w.iDrive.iConnectionBusType==v.iDrive.iConnectionBusType);
+ test_Value(w.iDrive.iDriveAtt, w.iDrive.iDriveAtt==KDriveAttSubsted);
+ test_Value(w.iDrive.iMediaAtt, w.iDrive.iMediaAtt==v.iDrive.iMediaAtt);
test(w.iUniqueID==v.iUniqueID);
test(w.iSize==v.iSize);
test(w.iFree==v.iFree);
test(w.iName==v.iName);
TDriveList driveList;
r=TheFs.DriveList(driveList);
- test(r==KErrNone);
+ test_KErrNone(r);
test(driveList[EDriveO]==KDriveAttSubsted);
TDriveInfo d;
r=TheFs.Drive(d,EDriveO);
- test(r==KErrNone);
- test(d.iDriveAtt==KDriveAttSubsted);
- test(d.iMediaAtt==origDI.iMediaAtt);
- test(d.iType==origDI.iType);
- test(d.iConnectionBusType==origDI.iConnectionBusType);
+ test_KErrNone(r);
+ test_Value(d.iDriveAtt, d.iDriveAtt==KDriveAttSubsted);
+ test_Value(d.iMediaAtt, d.iMediaAtt==origDI.iMediaAtt);
+ test_Value(d.iType, d.iType==origDI.iType);
+ test_Value(d.iConnectionBusType, d.iConnectionBusType==origDI.iConnectionBusType);
test.Next(_L("Test real name"));
r=TheFs.RealName(_L("O:\\FILE.XXX"),n);
- test(r==KErrNone);
+ test_KErrNone(r);
TFileName substedPath=gSessionPath;
substedPath.Append(_L("FILE.XXX"));
test(n.CompareF(substedPath)==KErrNone);
@@ -1165,25 +1154,25 @@
TFileName dir=gSessionPath;
dir+=KTurgid;
r=TheFs.MkDirAll(dir);
- test(r==KErrNone);
+ test_KErrNone(r);
dir+=_L("subdir\\");
r=TheFs.MkDir(dir);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(_L("O:\\turgid\\subdir\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Rename(_L("O:\\turgid"), _L("O:\\facile"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.MkDir(_L("O:\\insipid\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Rename(_L("O:\\insipid"), _L("O:\\glib"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(_L("O:\\facile\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
_LIT(KGlib,"glib\\");
dir=gSessionPath;
dir+=KGlib;
r=TheFs.RmDir(dir);
- test(r==KErrNone);
+ test_KErrNone(r);
//
test.Next(_L("Test file operations on Substed drive"));
_LIT(File1,"File1.txt");
@@ -1195,21 +1184,21 @@
name1+=File1;
RFile f1;
r=f1.Replace(TheFs,name1,EFileShareExclusive|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
name2=SubstRoot;
name2+=File2;
TBool isValid=TheFs.IsValidName(name2);
test(isValid);
r=f1.Rename(name2);
- test(r==KErrNone);
+ test_KErrNone(r);
f1.Close();
r=f1.Create(TheFs,name1,EFileShareExclusive|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f1.Close();
r=TheFs.Replace(name2,name1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(name1);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("Test notifications on Substed drive"));
name1=gSessionPath;
name1+=Subdir;
@@ -1220,58 +1209,62 @@
TRequestStatus status2;
TRequestStatus status3;
TheFs.NotifyChange(ENotifyDir,status1,name1);
- test(status1==KRequestPending);
+ test_Value(status1.Int(), status1==KRequestPending);
TheFs.NotifyChange(ENotifyDir,status2,name2);
- test(status2==KRequestPending);
+ test_Value(status2.Int(), status2==KRequestPending);
r=TheFs.MkDirAll(name1);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(status1);
User::WaitForRequest(status2);
- test(status1==KErrNone && status2==KErrNone);
+ test_KErrNone(status1.Int());
+ test_KErrNone(status2.Int());
TheFs.NotifyChange(ENotifyDir,status1,name1);
- test(status1==KRequestPending);
+ test_Value(status1.Int(), status1==KRequestPending);
TheFs.NotifyChange(ENotifyDir,status2,name2);
- test(status2==KRequestPending);
+ test_Value(status2.Int(), status2==KRequestPending);
TheFs.NotifyChange(ENotifyAll,status3,name2);
- test(status3==KRequestPending);
+ test_Value(status3.Int(), status3==KRequestPending);
r=f1.Temp(TheFs,name2,n,EFileShareAny|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(status3);
- test(status3==KErrNone && status1==KRequestPending && status2==KRequestPending);
+ test_KErrNone(status3.Int());
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status2.Int(), status2==KRequestPending);
f1.Close();
TheFs.NotifyChangeCancel();
- test(status1==KErrCancel && status2==KErrCancel);
+ test_Value(status1.Int(), status1==KErrCancel);
+ test_Value(status2.Int(), status2==KErrCancel);
r=TheFs.Delete(n);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(name1);
- test(r==KErrNone);
+ test_KErrNone(r);
//
test.Next(_L("Test file systems on Substed drive"));
// test cannot mount file system on substituted drive
TInt sessionDrv;
r=TheFs.CharToDrive(gSessionPath[0],sessionDrv);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.FileSystemName(n,sessionDrv);
- test(r==KErrNone || r==KErrNotFound);
+ test_Value(r, r == KErrNone || r==KErrNotFound);
r=TheFs.MountFileSystem(n,EDriveO);
- test(r==KErrAccessDenied);
+ test_Value(r, r == KErrAccessDenied);
// test file system name on substitued drive is null
r=TheFs.FileSystemName(n,EDriveO);
- test(r==KErrNotFound && n==KNullDesC);
+ test_Value(r, r == KErrNotFound && n==KNullDesC);
// test cannot format a substitued drive
RFormat format;
TInt count;
r=format.Open(TheFs,SubstRoot,EHighDensity,count);
- test(r==KErrAccessDenied);
+ test_Value(r, r == KErrAccessDenied);
r=TheFs.SetSubst(_L(""),EDriveO);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Subst(n,EDriveO);
- test(r==KErrNone);
+ test_KErrNone(r);
test(n==_L(""));
r=TheFs.Drive(d,EDriveO);
- test(r==KErrNone);
- test(d.iDriveAtt==0);
+ test_KErrNone(r);
+ test_Value(d.iDriveAtt, d.iDriveAtt==0);
}
LOCAL_C void testSetVolume()
@@ -1286,7 +1279,7 @@
TVolumeInfo v;
TInt r=TheFs.Volume(v,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
TFileName n=v.iName;
test.Printf(_L("VOL=\"%S\"\n"),&n);
@@ -1300,27 +1293,27 @@
return;
}
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Volume(v,driveNum);
- test(r==KErrNone );
+ test_Value(r, r == KErrNone );
+ test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
test(v.iName==_L(""));
- test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
test.Next(_L("Set volume label to ABCDEFGHIJK"));
r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Volume(v,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
+ test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
test(v.iName==_L("ABCDEFGHIJK"));
- test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
test.Next(_L("Set volume label to ABCDE"));
r=TheFs.SetVolumeLabel(_L("ABCDE"),driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Volume(v,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
+ test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
test(v.iName==_L("ABCDE"));
- test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
test.Next(_L("Test replacement of non-ascii chars"));
@@ -1338,7 +1331,7 @@
uBuf[9]=0x104;
uBuf[10]='f';
r=TheFs.SetVolumeLabel(uBuf,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
TFileName drive=_L("?:");
drive[0]=gSessionPath[0];
@@ -1348,56 +1341,54 @@
TFileName sess;
r=TheFs.SessionPath(sess);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Volume(v,driveNum);
- test(r==KErrNone);
-
+ test_KErrNone(r);
+ test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
if(Is_Fat(TheFs, gDrive)) //-- FAT doesn't support normal UNICODE in volume labels
test(v.iName==_L("a_b_c_d_e_f"));
else
test(v.iName == uBuf);
-
- test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
-
-
test.Next(_L("Set volume label back to nothing"));
r=TheFs.SetVolumeLabel(_L(""),driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Volume(v,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
+ test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
test(v.iName==_L(""));
- test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
test.Next(_L("Attempt to set volume label containing illegal characters"));
r=TheFs.SetVolumeLabel(_L("abc>def"),driveNum);
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.SetVolumeLabel(_L("ghi*jkl"),driveNum);
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.SetVolumeLabel(_L("mno?pqr"),driveNum);
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.SetVolumeLabel(_L("stu|vwx"),driveNum);
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.SetVolumeLabel(_L("yz<abc"),driveNum);
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.SetVolumeLabel(_L("def//ghi"),driveNum);
- test(r==KErrBadName);
+ test_Value(r, r == KErrBadName);
r=TheFs.Volume(v,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
+ test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
test(v.iName==_L(""));
- test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
// test volume label after remount (for removable media only)
test.Next(_L("Test volume label after remount"));
TDriveInfo info;
- test(TheFs.Drive(info, driveNum) == KErrNone);
+ r = TheFs.Drive(info, driveNum);
+ test_KErrNone(r);
if((info.iDriveAtt & KDriveAttRemovable) != 0)
{
// 1. set volume label
- test(TheFs.SetVolumeLabel(_L("XXX"), driveNum) == KErrNone);
+ r = TheFs.SetVolumeLabel(_L("XXX"), driveNum);
+ test_KErrNone(r);
// 2. change bootsector volume label
const TInt offset = IsFileSystemFAT32(TheFs, driveNum)?
@@ -1408,15 +1399,20 @@
RRawDisk rdisk;
TPtrC8 label(_S8("Z"), 1);
- test(rdisk.Open(TheFs, driveNum) == KErrNone);
- test(rdisk.Write(offset, label) == KErrNone);
+ r = rdisk.Open(TheFs, driveNum);
+ test_KErrNone(r);
+ r = rdisk.Write(offset, label);
+ test_KErrNone(r);
rdisk.Close();
// 3. remount the drive
- test(TheFs.RemountDrive(driveNum) == KErrNone);
+ r = TheFs.RemountDrive(driveNum);
+ test_KErrNone(r);
// 4. check volume label
- test(TheFs.Volume(v, driveNum) == KErrNone);
+ r = TheFs.Volume(v, driveNum);
+ test_KErrNone(r);
+ test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
test(v.iName == _L("XXX"));
test.Printf(_L("- Passed.\n"));
}
@@ -1426,11 +1422,11 @@
// clean up
test.Next(_L("Set volume label to original"));
r=TheFs.SetVolumeLabel(n,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Volume(v,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
+ test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
test(v.iName==n);
- test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
test.End();
}
@@ -1444,45 +1440,46 @@
test.Start(_L("Test modified/SetModified functions"));
TTime savedTime;
TInt r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),savedTime);
- test(r==KErrNone);
+ test_KErrNone(r);
TDateTime dateTime=savedTime.DateTime();
test.Printf(_L("T_FSRV.CPP last modified %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond());
test.Next(_L("Set modified"));
dateTime.Set(1993,EAugust,23,1,13,54,123456);
TTime newTime(dateTime);
r=TheFs.SetModified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),newTime);
- test(r==KErrNone);
+ test_KErrNone(r);
TTime checkTime;
r=TheFs.Modified(_L("\\XXXX\\YYYY\\ZZZZ.CPP"),checkTime);
- test(r==KErrPathNotFound);
+ test_Value(r, r == KErrPathNotFound);
r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime);
- test(r==KErrNone);
+ test_KErrNone(r);
dateTime=checkTime.DateTime();
+ test.Printf(_L("T_FSRV.CPP last modified %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond());
test(dateTime.Year()==1993);
test(dateTime.Month()==EAugust);
test(dateTime.Day()==23);
test(dateTime.Hour()==1);
test(dateTime.Minute()==13);
test(dateTime.Second()==54);
- test.Printf(_L("T_FSRV.CPP last modified %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond());
// test(dateTime.MicroSecond()==123456); // dos is not accurate enough
r=TheFs.SetModified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),savedTime);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime);
- test(r==KErrNone);
+ test_KErrNone(r);
test(checkTime==savedTime);
RFile f;
r=f.Open(TheFs,_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
dateTime.Set(1997,EJanuary,1,2,55,51,999999);
newTime=dateTime;
r=f.SetModified(newTime);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime);
- test(r==KErrNone);
+ test_KErrNone(r);
dateTime=checkTime.DateTime();
+ test.Printf(_L("T_FSRV.CPP last modified via RFs::Modified() %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond());
test(dateTime.Year()==1997);
test(dateTime.Month()==EJanuary);
test(dateTime.Day()==1);
@@ -1491,9 +1488,10 @@
test(dateTime.Second()>=50 && dateTime.Second()<=51); // Dos stores seconds %2
r=f.Modified(checkTime);
- test(r==KErrNone);
+ test_KErrNone(r);
dateTime=checkTime.DateTime();
+ test.Printf(_L("T_FSRV.CPP last modified via RFile::Modified() %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond());
test(dateTime.Year()==1997);
test(dateTime.Month()==EJanuary);
test(dateTime.Day()==1);
@@ -1503,9 +1501,10 @@
f.Close();
r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime);
- test(r==KErrNone);
+ test_KErrNone(r);
dateTime=checkTime.DateTime();
+ test.Printf(_L("T_FSRV.CPP last modified via RFs::Modified() %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond());
test(dateTime.Year()==1997);
test(dateTime.Month()==EJanuary);
test(dateTime.Day()==1);
@@ -1529,23 +1528,27 @@
RFile file;
TInt r=file.Open(TheFs, KFileName, 0 );
- if (r!=KErrNone)
- {
- test.Printf(_L("Error %d opening file %S\n"), r, &KFileName);
- test(0);
- }
+ test_KErrNone(r);
TFileName fileName;
// Check RFile::Name just retuns the file name, without path and drive
r=file.Name(fileName);
- test(r==KErrNone);
- test(fileName==KFileName());
+ test_KErrNone(r);
+ if (fileName != KFileName)
+ {
+ test.Printf(_L("%S\n"), &fileName);
+ test(0);
+ }
// Check RFile::FullName returns the complete file name and path
r=file.FullName(fileName);
- test(r==KErrNone);
- test(fileName.Mid(2)==KFileNameAndPath); // chop off drive letter + ':'
+ test_KErrNone(r);
+ if (fileName.Mid(2)!=KFileNameAndPath) // chop off drive letter + ':'
+ {
+ test.Printf(_L("%S\n"), &fileName);
+ test(0);
+ }
file.Close();
@@ -1565,13 +1568,7 @@
TInt r=file.Replace(TheFs,fileName,EFileWrite);
if (r==KErrDiskFull)
return(r);
- if (r!=KErrNone)
- {
- test.Printf(_L("ERROR:: Replace returned %d\n"),r);
- test(0);
- //test.Getch();
- return(KErrDiskFull);
- }
+ test_KErrNone(r);
if (!IsTestingLFFS())
r=file.SetSize(LargeFileSize);
@@ -1588,14 +1585,7 @@
file.Close();
return(r);
}
- if (r!=KErrNone)
- {
- test.Printf(_L("ERROR:: SetSize/Write returned %d\n"),r);
- test(0);
- //test.Getch();
- file.Close();
- return(KErrDiskFull);
- }
+ test_KErrNone(r);
file.Close();
// r=TheFs.CheckDisk(fileName);
@@ -1618,12 +1608,12 @@
TBuf<128> fileName=aBaseName;
fileName.AppendNum(aX);
TInt r=TheFs.Delete(fileName);
- test(r==KErrNone);
+ test_KErrNone(r);
// r=TheFs.CheckDisk(fileName);
// if (r!=KErrNone && r!=KErrNotSupported)
// {
// test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
-// test(r==KErrNone);
+// test_KErrNone(r);
// }
test.Printf(_L("Deleted File %d\n"),aX);
return(KErrNone);
@@ -1637,43 +1627,37 @@
test.Start(_L("Create and delete large files"));
TInt r=TheFs.MkDirAll(_L("\\F32-TST\\SMALLDIRECTORY\\"));
- test(r==KErrNone || r==KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r==KErrAlreadyExists);
TBuf<128> fileName=_L("\\F32-TST\\SMALLDIRECTORY\\FILE");
r=CreateFileX(fileName,0);
- test(r==KErrNone);
+ test_KErrNone(r);
r=CreateFileX(fileName,1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=DeleteFileX(fileName,0);
- test(r==KErrNone);
+ test_KErrNone(r);
r=CreateFileX(fileName,2);
- test(r==KErrNone);
+ test_KErrNone(r);
r=CreateFileX(fileName,1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=CreateFileX(fileName,3);
- test(r==KErrNone);
+ test_KErrNone(r);
r=DeleteFileX(fileName,1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=CreateFileX(fileName,4);
- test(r==KErrNone);
+ test_KErrNone(r);
r=DeleteFileX(fileName,2);
- test(r==KErrNone);
+ test_KErrNone(r);
r=DeleteFileX(fileName,3);
- test(r==KErrNone);
+ test_KErrNone(r);
r=DeleteFileX(fileName,4);
- test(r==KErrNone);
+ test_KErrNone(r);
r=CreateFileX(fileName,1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=DeleteFileX(fileName,1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.CheckDisk(fileName);
- if (r!=KErrNone && r!=KErrNotSupported)
- {
- test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
- test(0);
- //test.Getch();
- }
-
+ test_Value(r, r == KErrNone || r == KErrNotSupported);
test.End();
}
@@ -1685,43 +1669,31 @@
test.Start(_L("Fill disk to capacity"));
TInt r=TheFs.MkDirAll(_L("\\F32-TST\\BIGDIRECTORY\\"));
- test(r==KErrNone || r==KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r==KErrAlreadyExists);
TInt count=0;
TFileName sessionPath;
r=TheFs.SessionPath(sessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf<128> fileName=_L("\\F32-TST\\BIGDIRECTORY\\FILE");
FOREVER
{
TInt r=CreateFileX(fileName,count);
if (r==KErrDiskFull)
break;
- test(r==KErrNone);
+ test_KErrNone(r);
count++;
-#if defined(__WINS__)
- if (count==32 && sessionPath[0]=='C')
- break;
-#endif
+ if (Is_SimulatedSystemDrive(TheFs,gDrive) && count==32)
+ break; // Limit on disk size for emulator/PlatSim
}
r=TheFs.CheckDisk(fileName);
- if (r!=KErrNone && r!=KErrNotSupported)
- {
- test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
- test(0);
- //test.Getch();
- }
+ test_Value(r, r == KErrNone || r == KErrNotSupported);
while(count--)
DeleteFileX(fileName,count);
r=TheFs.CheckDisk(fileName);
- if (r!=KErrNone && r!=KErrNotSupported)
- {
- test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
- test(0);
- //test.Getch();
- }
+ test_Value(r, r == KErrNone || r == KErrNotSupported);
test.End();
}
@@ -1736,31 +1708,31 @@
fn[0] = gExeFileName[0];
TParse f;
TInt r=TheFs.Parse(fn,f);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("Copying file to test directory"));
TParse fCopy;
r=TheFs.Parse(f.NameAndExt(),fCopy);
- test(r==KErrNone);
+ test_KErrNone(r);
RFile f1;
r=f1.Open(TheFs,f.FullName(),EFileStreamText|EFileShareReadersOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
RFile f2;
r=f2.Replace(TheFs,fCopy.FullName(),EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf8<512> copyBuf;
TInt rem;
r=f1.Size(rem);
- test(r==KErrNone);
+ test_KErrNone(r);
TInt pos=0;
while (rem)
{
TInt s=Min(rem,copyBuf.MaxSize());
r=f1.Read(pos,copyBuf,s);
- test(r==KErrNone);
- test(copyBuf.Length()==s);
+ test_KErrNone(r);
+ test_Value(copyBuf.Length(), copyBuf.Length() == s);
r=f2.Write(pos,copyBuf,s);
- test(r==KErrNone);
+ test_KErrNone(r);
pos+=s;
rem-=s;
}
@@ -1790,26 +1762,26 @@
//========== just create a file
nRes = TheFs.SetErrorCondition(KMyError,0); //-- set up FS error simulation
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//-- this shall fail immediately
nRes = file.Replace(TheFs, KFileName, EFileWrite);
- test(nRes == KMyError);
+ test_Value(nRes, nRes == KMyError);
nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation
file.Close();
//========== create file & duplicate a handle #1
nRes = TheFs.SetErrorCondition(KMyError,1); //-- set up FS error simulation
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//-- this shall succeed
nRes = file.Replace(TheFs, KFileName, EFileWrite); //-- err cnt -> 0
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//-- this shall fail inside RFile::Duplicate() half way through in the RFile::DuplicateHandle()
nRes = file1.Duplicate(file);
- test(nRes == KMyError);
+ test_Value(nRes, nRes == KMyError);
file1.Close();
nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation
@@ -1817,19 +1789,19 @@
//-- check that the file isn't locked
nRes = TheFs.Delete(KFileName);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//========== create file & duplicate a handle #2
nRes = TheFs.SetErrorCondition(KMyError,2); //-- set up FS error simulation
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//-- this shall succeed
nRes = file.Replace(TheFs, KFileName, EFileWrite); //-- err cnt -> 1
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//-- this must not fail, because EFsFileAdopt is excluded from the erros simulation
nRes = file1.Duplicate(file);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
file1.Close();
nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation
@@ -1837,7 +1809,7 @@
//-- check that the file isn't locked
nRes = TheFs.Delete(KFileName);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
//========== crazy loop, for DEF103757
@@ -1859,7 +1831,7 @@
//-- check that the file isn't locked
nRes = TheFs.Delete(KFileName);
- test(nRes == KErrNone);
+ test_KErrNone(nRes);
#endif
@@ -1877,14 +1849,14 @@
F32_Test_Utils::SetConsole(test.Console());
TInt nRes=TheFs.CharToDrive(gDriveToTest, gDrive);
- test(nRes==KErrNone);
+ test_KErrNone(nRes);
PrintDrvInfo(TheFs, gDrive);
TVolumeInfo v;
TInt r=TheFs.Volume(v, CurrentDrive());
- test(r==KErrNone);
+ test_KErrNone(r);
LargeFileSize=Max((TUint32)I64LOW(v.iFree >> 7), (TUint32)65536u);
if (gFirstTime)
--- a/kerneltest/f32test/server/t_main.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/server/t_main.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -24,6 +24,7 @@
#include <f32dbg.h>
#include "t_server.h"
#include "t_chlffs.h"
+#include "f32_test_utils.h"
GLDEF_D RFs TheFs;
GLDEF_D TFileName gSessionPath;
@@ -157,14 +158,11 @@
while(illegalChar)
{
-#if defined(__WINS__)
- if (gSessionPath[0]=='C')
+ if (F32_Test_Utils::Is_SimulatedSystemDrive(TheFs, CurrentDrive()))
letter=(TChar)('A'+Math::Rand(aSeed)%26);
else
letter=(TChar)Math::Rand(aSeed)%256;
-#else
- letter=(TChar)Math::Rand(aSeed)%256;
-#endif
+
TBool space=letter.IsSpace();
if (space && spaceChar==-1)
spaceChar=i;
@@ -666,12 +664,12 @@
TInt orgSessionCount;
r = controlIo(TheFs,theDrive, KControlIoSessionCount, orgSessionCount);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Printf(_L("Session count start=%d\n"),orgSessionCount);
TInt orgObjectCount;
r = controlIo(TheFs,theDrive, KControlIoObjectCount, orgObjectCount);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Printf(_L("Object count start=%d\n"),orgObjectCount);
@@ -717,7 +715,7 @@
// NB: This won't help if the test has opened another session & left sub-sessions open.
TheFs.Close();
r=TheFs.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
// Display the file cache stats before closing the file queue
TFileCacheStats endFileCacheStats;
@@ -743,11 +741,11 @@
test_KErrNone(r);
r = controlIo(TheFs,theDrive, KControlIoSessionCount, endSessionCount);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Printf(_L("Session count end=%d\n"),endSessionCount);
r = controlIo(TheFs,theDrive, KControlIoObjectCount, endObjectCount);
- test(r==KErrNone);
+ test_KErrNone(r);
test.Printf(_L("Object count end=%d\n"),endObjectCount);
if (endSessionCount == orgSessionCount && endObjectCount == orgObjectCount)
--- a/kerneltest/f32test/server/t_notify.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/kerneltest/f32test/server/t_notify.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -15,11 +15,15 @@
//
//
+#define __E32TEST_EXTENSION__
#include <f32file.h>
#include <e32test.h>
#include <e32svr.h>
#include <hal.h>
#include "t_server.h"
+#include "f32_test_utils.h"
+
+using namespace F32_Test_Utils;
const TInt KHeapSize=0x200;
@@ -109,9 +113,9 @@
{
RFs fs;
TInt r=fs.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
TTestCode testCode=*(TTestCode*)&aTestCode;
RFile f;
switch (testCode)
@@ -119,26 +123,26 @@
case ETest1:
r=f.Replace(fs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
break;
case ETest2:
r=f.Replace(fs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
break;
case ETest3:
r=fs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\"));
- test((r==KErrNone)||(r==KErrAlreadyExists));
+ test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
break;
case ETest4:
{
TRequestStatus s;
fs.NotifyChange(ENotifyAll,s);
- test(s==KRequestPending);
+ test_Value(s.Int(), s==KRequestPending);
gSleepThread.Signal();
User::After(100000000);
}
@@ -148,34 +152,34 @@
{
RFile file;
TInt r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file.SetSize(sizeof(TCheckedUid));
- test(r==KErrNone);
+ test_KErrNone(r);
r=file.Write(sizeof(TCheckedUid),_L8("012345678912"));
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf8<64> dum;
r=file.Read(0,dum);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file.SetSize(50);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file.Write(sizeof(TCheckedUid),_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=file.Read(0,dum);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file.SetSize(50);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file.Write(sizeof(TCheckedUid),_L8("01234567890123456789"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=file.Read(0,dum);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
gSleepThread.Signal();
}
@@ -193,9 +197,9 @@
{
RFile file;
TInt r=file.Open(fs,_L("\\F32-TST\\NOTIFY\\NewFILE.TXT"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file.Write(_L8("asdfasdfasdf"));
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
gSleepThread.Signal();
}
@@ -204,7 +208,7 @@
case ETest8:
{
r=f.Open(fs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
f.SetSize(500);
f.Close();
break;
@@ -215,7 +219,7 @@
TRequestStatus s;
TFileName path=_L("\\F32-TST\\NOTIFY\\");
fs.NotifyChange(ENotifyAll,s,path);
- test(s==KRequestPending);
+ test_Value(s.Int(), s==KRequestPending);
gSleepThread.Signal();
User::After(100000000);
}
@@ -224,7 +228,7 @@
{
TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\");
r=fs.MkDir(path);
- test(r==KErrNone);
+ test_KErrNone(r);
break;
}
case ETest11:
@@ -232,7 +236,7 @@
TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man");
RFile file;
r=file.Replace(fs,path,EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
break;
}
@@ -240,12 +244,12 @@
{
RFile writer;
TInt r=writer.Open(fs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileWrite|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
TInt i;
for(i=0; i<10; i++)
{
r=writer.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::After(1000000);
}
writer.Close();
@@ -288,58 +292,58 @@
TheFs.NotifyChange(ENotifyEntry,reqStat);
RThread thread;
r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
- test(r==KErrNone);
+ test_KErrNone(r);
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
thread.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
RFile file;
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite|EFileShareExclusive);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Write(_L8("Somewhere over the rainbow..."),reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
TBuf8<256> buf;
file.Read(0, buf,reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
file.Close();
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareExclusive);
- test(r==KErrArgument);
+ test_Value(r, r == KErrArgument);
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareReadersOnly);
- test(r==KErrArgument);
+ test_Value(r, r == KErrArgument);
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Read(0, buf, 100, reqStat);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Read(0, buf, 100, reqStat);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
file.ReadCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
file.Close();
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Read(0, buf, 100, reqStat);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
file.SetSize(100);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
- test(buf.Length() == 100);
+ test_KErrNone(reqStat.Int());
+ test_Equal(100, buf.Length());
file.Close();
test.Next(_L("Repeat Test notification of an entry change"));
@@ -348,15 +352,10 @@
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
thread.Close();
User::WaitForRequest(reqStat);
- if (reqStat!=KErrNone)
- {
- test.Printf(_L("ReqStat=%d\n"),reqStat.Int());
- //test.Getch();
- }
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
test.Next(_L("Test Notify cancel"));
TheFs.NotifyChange(ENotifyEntry,reqStat);
@@ -369,10 +368,10 @@
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
thread.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
}
static void Test2()
@@ -386,23 +385,23 @@
TRequestStatus reqStat1(KRequestPending);
RFs fs1;
TInt r=fs1.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
fs1.NotifyChange(ENotifyEntry,reqStat1);
TRequestStatus reqStat2(KRequestPending);
RFs fs2;
r=fs2.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
fs2.NotifyChange(ENotifyEntry,reqStat2);
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NEWFILE.TXT"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat1);
User::WaitForRequest(reqStat2);
- test(reqStat1==KErrNone);
- test(reqStat2==KErrNone);
+ test_KErrNone(reqStat1.Int());
+ test_KErrNone(reqStat2.Int());
}
static void Test3()
@@ -414,7 +413,7 @@
test.Next(_L("Cancel notification"));
RFs fs1;
TInt r=fs1.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
TRequestStatus status1;
TRequestStatus status2;
@@ -427,25 +426,25 @@
fs1.NotifyChange(ENotifyAll,status3);
fs1.NotifyChange(ENotifyAll,status4);
fs1.NotifyChange(ENotifyAll,status5);
- test(status1==KRequestPending);
- test(status2==KRequestPending);
- test(status3==KRequestPending);
- test(status4==KRequestPending);
- test(status5==KRequestPending);
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status2.Int(), status2==KRequestPending);
+ test_Value(status3.Int(), status3==KRequestPending);
+ test_Value(status4.Int(), status4==KRequestPending);
+ test_Value(status5.Int(), status5==KRequestPending);
test.Next(_L("RFs::NotifyCancel()"));
// Test that one call to RFs::NotifyCancel() cancels all outstanding requests
fs1.NotifyChangeCancel();
User::WaitForRequest(status1);
- test(status1==KErrCancel);
+ test_Value(status1.Int(), status1==KErrCancel);
User::WaitForRequest(status2);
- test(status2==KErrCancel);
+ test_Value(status2.Int(), status2==KErrCancel);
User::WaitForRequest(status3);
- test(status3==KErrCancel);
+ test_Value(status3.Int(), status3==KErrCancel);
User::WaitForRequest(status4);
- test(status4==KErrCancel);
+ test_Value(status4.Int(), status4==KErrCancel);
User::WaitForRequest(status5);
- test(status5==KErrCancel);
+ test_Value(status5.Int(), status5==KErrCancel);
// Call the cancel function again to check no further action
fs1.NotifyChangeCancel();
@@ -456,49 +455,49 @@
fs1.NotifyChange(ENotifyAll,status3);
fs1.NotifyChange(ENotifyAll,status4);
fs1.NotifyChange(ENotifyAll,status5);
- test(status1==KRequestPending);
- test(status2==KRequestPending);
- test(status3==KRequestPending);
- test(status4==KRequestPending);
- test(status5==KRequestPending);
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status2.Int(), status2==KRequestPending);
+ test_Value(status3.Int(), status3==KRequestPending);
+ test_Value(status4.Int(), status4==KRequestPending);
+ test_Value(status5.Int(), status5==KRequestPending);
// Cancel the outstanding request with status5
test.Next(_L("RFs::NotifyCancel()"));
fs1.NotifyChangeCancel(status5);
User::WaitForRequest(status5);
- test(status1==KRequestPending);
- test(status2==KRequestPending);
- test(status3==KRequestPending);
- test(status4==KRequestPending);
- test(status5==KErrCancel);
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status2.Int(), status2==KRequestPending);
+ test_Value(status3.Int(), status3==KRequestPending);
+ test_Value(status4.Int(), status4==KRequestPending);
+ test_Value(status5.Int(), status5==KErrCancel);
fs1.NotifyChangeCancel(status2);
User::WaitForRequest(status2);
- test(status1==KRequestPending);
- test(status2==KErrCancel);
- test(status3==KRequestPending);
- test(status4==KRequestPending);
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status2.Int(), status2==KErrCancel);
+ test_Value(status3.Int(), status3==KRequestPending);
+ test_Value(status4.Int(), status4==KRequestPending);
fs1.NotifyChangeCancel(status4);
User::WaitForRequest(status4);
- test(status1==KRequestPending);
- test(status3==KRequestPending);
- test(status4==KErrCancel);
-
- fs1.NotifyChangeCancel(status4); // Test no side effects on trying to cancel a request
- test(status4==KErrCancel); // that has already been cancelled
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status3.Int(), status3==KRequestPending);
+ test_Value(status4.Int(), status4==KErrCancel);
+
+ fs1.NotifyChangeCancel(status4); // Test no side effects on trying to cancel a request
+ test_Value(status4.Int(), status4==KErrCancel); // that has already been cancelled
fs1.NotifyChangeCancel(status1);
User::WaitForRequest(status1);
- test(status1==KErrCancel);
- test(status3==KRequestPending);
+ test_Value(status1.Int(), status1==KErrCancel);
+ test_Value(status3.Int(), status3==KRequestPending);
fs1.NotifyChangeCancel(status1); // Test no side effects on trying to cancel a request
- test(status1==KErrCancel); // that has already been cancelled
+ test_Value(status1.Int(), status1==KErrCancel); // that has already been cancelled
fs1.NotifyChangeCancel(status3);
User::WaitForRequest(status3);
- test(status3==KErrCancel);
+ test_Value(status3.Int(), status3==KErrCancel);
fs1.Close();
}
@@ -511,7 +510,7 @@
test.Next(_L("Kill client"));
TInt r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread clientThread;
r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest4);
if (r!=KErrNone)
@@ -532,7 +531,7 @@
clientThread.Close();
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\"));
- test(r==KErrNone || r==KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r==KErrAlreadyExists);
MakeFile(_L("\\F32-TST\\NOTIFY\\NewFile.Txt"));
User::After(1000);
}
@@ -548,37 +547,37 @@
RFile file;
TInt r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
TRequestStatus reqStat=0;
TheFs.NotifyChange(ENotifyEntry,reqStat);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread clientThread;
r=clientThread.Create(_L("Test5Thread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Resume();
gSleepThread.Wait();
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
@@ -594,7 +593,7 @@
{
TDriveInfo driveInfo;
TInt r=TheFs.Drive(driveInfo,CurrentDrive());
- test(r==KErrNone);
+ test_KErrNone(r);
// only test on removable media
if (driveInfo.iDriveAtt&KDriveAttRemovable)
{
@@ -604,16 +603,16 @@
TRequestStatus reqStat=0;
TInt r;
TheFs.NotifyChange(ENotifyEntry,reqStat);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread clientThread;
r=clientThread.Create(_L("Test6Thread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6);
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Resume();
gSleepThread.Wait();
TInt reqInt=reqStat.Int();
- test(reqInt==KErrNone);
+ test_KErrNone(reqInt);
User::WaitForRequest(reqStat);
WaitForMediaChange();
gSleepThread.Close();
@@ -623,7 +622,7 @@
//-- it seems that after generating media change the meia driver isn't ready for some time
User::After(2000000);
r=TheFs.Drive(driveInfo,CurrentDrive());
- test(r==KErrNone);
+ test_KErrNone(r);
}
@@ -640,19 +639,19 @@
MakeFile(_L("NewFile.TXT"));
TInt r;
TheFs.NotifyChange(ENotifyEntry,reqStat);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread clientThread;
r=clientThread.Create(_L("Test7Thread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest7);
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Resume();
gSleepThread.Wait();
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("Newfile.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
@@ -669,7 +668,7 @@
{
TDriveInfo driveInfo;
TInt r=TheFs.Drive(driveInfo,CurrentDrive());
- test(r==KErrNone);
+ test_KErrNone(r);
// only test on removable media
if (driveInfo.iDriveAtt&KDriveAttRemovable)
{
@@ -678,17 +677,17 @@
TFileName path = _L("\\F32-tst\\NOTIFY\\");
TInt r;
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread clientThread;
gSocketNumber=0;
r=clientThread.Create(_L("Test6Thread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6); //only generates a media change on removable media
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Resume();
gSleepThread.Wait();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
WaitForMediaChange();
gSleepThread.Close();
clientThread.Close();
@@ -696,19 +695,19 @@
//-- it seems that after generating media change the meia driver isn't ready for some time
User::After(2000000);
r=TheFs.Drive(driveInfo,CurrentDrive());
- test(r==KErrNone);
+ test_KErrNone(r);
TheFs.NotifyChange(ENotifyDisk,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
r=clientThread.Create(_L("Test6Thread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6);
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Resume();
gSleepThread.Wait();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
WaitForMediaChange();
gSleepThread.Close();
clientThread.Close();
@@ -716,18 +715,18 @@
//-- it seems that after generating media change the meia driver isn't ready for some time
User::After(2000000);
r=TheFs.Drive(driveInfo,CurrentDrive());
- test(r==KErrNone);
+ test_KErrNone(r);
TheFs.NotifyChange(ENotifyWrite,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
r=clientThread.Create(_L("Test6Thread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6);
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Resume();
gSleepThread.Wait();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
WaitForMediaChange();
gSleepThread.Close();
clientThread.Close();
@@ -735,7 +734,7 @@
//-- it seems that after generating media change the meia driver isn't ready for some time
User::After(2000000);
r=TheFs.Drive(driveInfo,CurrentDrive());
- test(r==KErrNone);
+ test_KErrNone(r);
}
}
@@ -750,153 +749,153 @@
// First a simple example
TInt r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"));
- test((r==KErrNotFound)||(r==KErrPathNotFound)||(r==KErrNone));
+ test_Value(r, (r == KErrNotFound)||(r==KErrPathNotFound)||(r==KErrNone));
TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\");
TRequestStatus reqStat(KRequestPending);
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man");
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
RFile file;
r=file.Replace(TheFs,path,EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.Delete(path);
- test(r==KErrNone);
+ test_KErrNone(r);
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// Now cancel the outstanding request
TheFs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// Repeat with a ENotifyFile request
TheFs.NotifyChange(ENotifyFile,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Replace(TheFs,path,EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.Delete(path);
- test(r==KErrNone);
+ test_KErrNone(r);
TheFs.NotifyChange(ENotifyFile,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// Now cancel the outstanding request
TheFs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// Repeat with an ENotifyAttributes request
TheFs.NotifyChange(ENotifyAttributes,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Replace(TheFs,path,EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone); // Monitoring attributes but informed anyway
+ test_KErrNone(reqStat.Int()); // Monitoring attributes but informed anyway
r=TheFs.Delete(path);
- test(r==KErrNone);
+ test_KErrNone(r);
TheFs.NotifyChange(ENotifyAttributes,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// Now cancel the outstanding request
TheFs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// Repeat with an ENotifyWrite request
TheFs.NotifyChange(ENotifyWrite,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Replace(TheFs,path,EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone); // Monitoring file writing but informed anyway
+ test_KErrNone(reqStat.Int()); // Monitoring file writing but informed anyway
r=TheFs.Delete(path);
- test(r==KErrNone);
+ test_KErrNone(r);
TheFs.NotifyChange(ENotifyWrite,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// Now cancel the outstanding request
TheFs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// Repeat with an ENotifyDisk request
TheFs.NotifyChange(ENotifyDisk,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Replace(TheFs,path,EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone); // Monitoring disk activity but informed anyway
+ test_KErrNone(reqStat.Int()); // Monitoring disk activity but informed anyway
r=TheFs.Delete(path);
- test(r==KErrNone);
+ test_KErrNone(r);
TheFs.NotifyChange(ENotifyAttributes,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// Now cancel the outstanding request
TheFs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// Now do much the same with directory monitoring
path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\");
TheFs.RmDir(path);
TheFs.NotifyChange(ENotifyDir,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
TheFs.MkDir(path);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
TheFs.RmDir(path);
- test(r==KErrNone);
+ test_KErrNone(r);
TheFs.NotifyChange(ENotifyDir,reqStat,path);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// Now cancel the outstanding request
TheFs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
TheFs.NotifyChange(ENotifyDir,reqStat,path);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// Get a separate thread to create the directory
RThread thread;
@@ -907,19 +906,19 @@
thread.Close();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
TheFs.RmDir(path);
- test(r==KErrNone);
+ test_KErrNone(r);
// Check that notification is not received for a non-existent file if only the previously
// non existent directory that contains it is created
path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man");
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
thread.Create(_L("RequestAheadThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest10);
thread.Logon(thrdStat);
@@ -927,35 +926,35 @@
thread.Close();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(thrdStat.Int());
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// Now get a thread to create the file
thread.Create(_L("RequestAhead"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest11);
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
thread.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
TheFs.Delete(path);
- test(r==KErrNone);
+ test_KErrNone(r);
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// Now cancel the outstanding request
TheFs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\");
TheFs.RmDir(path);
- test(r==KErrNone);
+ test_KErrNone(r);
}
@@ -971,52 +970,52 @@
TFileName path=(_L("\\F32-TST\\"));
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
RThread thread;
TInt r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
- test(r==KErrNone);
+ test_KErrNone(r);
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
thread.Close();
// Repeat the test
test.Next(_L("Repeat Test notification of an entry change"));
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=thread.Create(_L("MyThread2"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
- test(r==KErrNone);
+ test_KErrNone(r);
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
thread.Close();
// Test it can be cancelled
test.Next(_L("Test Notify cancel"));
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
TheFs.NotifyChangeCancel();
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// Test it can be notified again
test.Next(_L("Test notification still works"));
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=thread.Create(_L("MyThread3"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
- test(r==KErrNone);
+ test_KErrNone(r);
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
thread.Close();
// Test notification doesn't occur when a change occurs above the directory monitored
@@ -1024,200 +1023,200 @@
// will occur - this is tested for in Test18())
test.Next(_L("Test changing above monitored directory"));
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"));
- test((r==KErrNone)||(r==KErrAlreadyExists));
+ test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=thread.Create(_L("MyThread4"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
- test(r==KErrNone);
+ test_KErrNone(r);
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
User::After(500000);
thread.Close();
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
TheFs.NotifyChangeCancel();
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// Test notification occurs when a change is made to the subdirectory monitored
test.Next(_L("Create a file in monitored subdirectory"));
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=thread.Create(_L("MyThread5"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest2);
- test(r==KErrNone);
+ test_KErrNone(r);
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
thread.Close();
test.Next(_L("Create a directory in monitored subdirectory"));
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=thread.Create(_L("MyThread6"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest3);
- test(r==KErrNone);
+ test_KErrNone(r);
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
thread.Close();
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
// Test again that notification doesn't occur above the subdirectory being monitored
test.Next(_L("Test changing above monitored directory"));
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"));
- test((r==KErrNone)||(r==KErrAlreadyExists));
+ test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=thread.Create(_L("MyThread7"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
- test(r==KErrNone);
+ test_KErrNone(r);
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
User::After(500000);
thread.Close();
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
TheFs.NotifyChangeCancel();
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// Test notification occurs when a change is made to the subdirectory monitored
test.Next(_L("Delete a file in monitored subdirectory"));
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
RFile file;
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
// Test notification on a specific file
test.Next(_L("Monitor changes to a specific file"));
path+=_L("WickedWitch.msg");
TheFs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=thread.Create(_L("MyThread8"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest8);
- test(r==KErrNone);
+ test_KErrNone(r);
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
thread.Close();
// Test notification does not occur if a change is made above the file
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
thread.Create(_L("MyThread9"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest2);
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
User::After(500000);
thread.Close();
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
TheFs.NotifyChangeCancel();
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// Test notification occurs when a change is made to the file
test.Next(_L("Delete monitored file"));
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.Msg"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// Test notification request is now submitted on the non existent path successfully
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
TheFs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc");
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// Submit a request for a path which does not yet exist
path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\");
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// Now create the directory we are waiting on
r=TheFs.MkDir(path);
- test(r==KErrNone);
+ test_KErrNone(r);
// Make sure the notification has now been received
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// Submit a request for a file which does not yet exist
path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\Red-Shoes.red");
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// Now create the file we are waiting on
r=file.Replace(TheFs,path,EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
// Make sure the notification has now been received
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// Submit another notification request and delete the file
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(path);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\");
TheFs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.RmDir(path);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// test passing in an empty string
TheFs.NotifyChange(ENotifyEntry,reqStat,_L(""));
User::WaitForRequest(reqStat);
- test(reqStat==KErrArgument);
+ test_Value(reqStat.Int(), reqStat==KErrArgument);
}
static void Test9()
@@ -1231,13 +1230,13 @@
// Create five sessions monitoring various levels of a directory tree
TInt r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\ANIMAL\\"));
- test((r==KErrNone)||(r==KErrAlreadyExists));
+ test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
RFile file;
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\cat.txt"),EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\dog.txt"),EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
TFileName path1=_L("\\F32-TST\\");
@@ -1250,127 +1249,127 @@
TRequestStatus reqStat1(KRequestPending);
RFs fs1;
r=fs1.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs1.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
fs1.NotifyChange(ENotifyEntry,reqStat1,path1);
TRequestStatus reqStat2(KRequestPending);
RFs fs2;
r=fs2.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs2.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
fs2.NotifyChange(ENotifyEntry,reqStat2,path2);
TRequestStatus reqStat3(KRequestPending);
RFs fs3;
r=fs3.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs3.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
fs3.NotifyChange(ENotifyEntry,reqStat3,path3);
TRequestStatus reqStat4(KRequestPending);
RFs fs4;
r=fs4.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs4.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
fs4.NotifyChange(ENotifyEntry,reqStat4,path4);
TRequestStatus reqStat5(KRequestPending);
RFs fs5;
r=fs5.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs5.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
fs5.NotifyChange(ENotifyEntry,reqStat5,path5);
TRequestStatus reqStat6(KRequestPending);
RFs fs6;
r=fs6.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs6.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
- test(reqStat5==KRequestPending);
- test(reqStat6==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+ test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+ test_Value(reqStat6.Int(), reqStat6==KRequestPending);
// Make a change a the top level and check that only the session monitoring
// that level is notified
test.Next(_L("Test only client monitoring top level is notified"));
r=file.Replace(TheFs,_L("\\F32-TST\\NewFile.txt"),EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
User::WaitForRequest(reqStat1);
- test(reqStat1==KErrNone);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
- test(reqStat5==KRequestPending);
+ test_KErrNone(reqStat1.Int());
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+ test_Value(reqStat5.Int(), reqStat5==KRequestPending);
User::WaitForRequest(reqStat6);
- test(reqStat6==KErrNone);
+ test_KErrNone(reqStat6.Int());
r=TheFs.Delete(_L("\\F32-TST\\NewFile.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
// Renew the notify request at the top level and make a change one step lower
fs1.NotifyChange(ENotifyEntry,reqStat1,path1);
fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
- test(reqStat1==KRequestPending);
- test(reqStat6==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat6.Int(), reqStat6==KRequestPending);
test.Next(_L("Test clients monitoring levels 1 and 2 are notified"));
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
User::WaitForRequest(reqStat1);
User::WaitForRequest(reqStat2);
- test(reqStat1==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
- test(reqStat5==KRequestPending);
+ test_KErrNone(reqStat1.Int());
+ test_KErrNone(reqStat2.Int());
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+ test_Value(reqStat5.Int(), reqStat5==KRequestPending);
User::WaitForRequest(reqStat6);
- test(reqStat6==KErrNone);
+ test_KErrNone(reqStat6.Int());
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NewFile.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
// Renew the notify request at the top and second levels and make a change
// one step lower still
fs1.NotifyChange(ENotifyEntry,reqStat1,path1);
fs2.NotifyChange(ENotifyEntry,reqStat2,path2);
fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat6==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat6.Int(), reqStat6==KRequestPending);
test.Next(_L("Test clients monitoring levels 1,2 and 3 are notified"));
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\NewFile.txt"),EFileStream);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
User::WaitForRequest(reqStat1);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat1==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending);
- test(reqStat5==KRequestPending);
+ test_KErrNone(reqStat1.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+ test_Value(reqStat5.Int(), reqStat5==KRequestPending);
User::WaitForRequest(reqStat6);
- test(reqStat6==KErrNone);
+ test_KErrNone(reqStat6.Int());
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\NewFile.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
// Renew the notify request at the top, second and third levels and make a change
// one step lower still
@@ -1378,25 +1377,25 @@
fs2.NotifyChange(ENotifyEntry,reqStat2,path2);
fs3.NotifyChange(ENotifyEntry,reqStat3,path3);
fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat6==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat6==KRequestPending);
test.Next(_L("Test clients monitoring levels 1 - 4 are notified"));
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\cat.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat1);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
User::WaitForRequest(reqStat4);
- test(reqStat1==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KErrNone);
- test(reqStat5==KRequestPending);
+ test_KErrNone(reqStat1.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_KErrNone(reqStat4.Int());
+ test_Value(reqStat5.Int(), reqStat5==KRequestPending);
User::WaitForRequest(reqStat6);
- test(reqStat6==KErrNone);
+ test_KErrNone(reqStat6.Int());
// Renew the notify request at the top, second and third levels and on the file deleted above
// which will be successful, but will not complete (for obvious reasons)
@@ -1407,31 +1406,31 @@
fs3.NotifyChange(ENotifyEntry,reqStat3,path3);
fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
fs4.NotifyChange(ENotifyEntry,reqStat4,path4);
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
- test(reqStat6==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+ test_Value(reqStat6.Int(), reqStat6==KRequestPending);
test.Next(_L("Test clients monitoring levels 1 - 3 and 5 are notified"));
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\dog.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat1);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
// Don't wait for reqStat4
User::WaitForRequest(reqStat5);
User::WaitForRequest(reqStat6);
- test(reqStat1==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending); // File does not exist
- test(reqStat5==KErrNone);
- test(reqStat6==KErrNone);
+ test_KErrNone(reqStat1.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending); // File does not exist
+ test_KErrNone(reqStat5.Int());
+ test_KErrNone(reqStat6.Int());
fs4.NotifyChangeCancel(reqStat4);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
// Renew the notify request at the top, second and third levels and attempt to renew
// the request on the files deleted above (which will fail).
@@ -1442,25 +1441,25 @@
fs4.NotifyChange(ENotifyEntry,reqStat4,path4);
fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
fs5.NotifyChange(ENotifyEntry,reqStat5,path5);
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
- test(reqStat5==KRequestPending);
- test(reqStat6==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+ test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+ test_Value(reqStat6.Int(), reqStat6==KRequestPending);
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\ANIMAL\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat1);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat1==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending);
- test(reqStat5==KRequestPending);
+ test_KErrNone(reqStat1.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+ test_Value(reqStat5.Int(), reqStat5==KRequestPending);
User::WaitForRequest(reqStat6);
- test(reqStat6==KErrNone);
+ test_KErrNone(reqStat6.Int());
// Renew the notify request at the top and second levels on the third level
// which was removed - it'll succeed but won't complete.
@@ -1472,12 +1471,12 @@
fs3.NotifyChange(ENotifyEntry,reqStat3,path3);
fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
- test(reqStat5==KRequestPending);
- test(reqStat6==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+ test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+ test_Value(reqStat6.Int(), reqStat6==KRequestPending);
fs1.NotifyChangeCancel();
fs2.NotifyChangeCancel();
@@ -1509,9 +1508,9 @@
TFileName path=_L("\\F32-TST\\NOTIFY\\");
RFs fs1;
TInt r=fs1.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs1.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
TRequestStatus status1;
TRequestStatus status2;
@@ -1524,25 +1523,25 @@
fs1.NotifyChange(ENotifyAll,status3,path);
fs1.NotifyChange(ENotifyAll,status4,path);
fs1.NotifyChange(ENotifyAll,status5,path);
- test(status1==KRequestPending);
- test(status2==KRequestPending);
- test(status3==KRequestPending);
- test(status4==KRequestPending);
- test(status5==KRequestPending);
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status2.Int(), status2==KRequestPending);
+ test_Value(status3.Int(), status3==KRequestPending);
+ test_Value(status4.Int(), status4==KRequestPending);
+ test_Value(status5.Int(), status5==KRequestPending);
test.Next(_L("RFs::NotifyCancel()"));
// Test that one call to RFs::NotifyCancel() cancels all outstanding requests
fs1.NotifyChangeCancel();
User::WaitForRequest(status1);
- test(status1==KErrCancel);
+ test_Value(status1.Int(), status1==KErrCancel);
User::WaitForRequest(status2);
- test(status2==KErrCancel);
+ test_Value(status2.Int(), status2==KErrCancel);
User::WaitForRequest(status3);
- test(status3==KErrCancel);
+ test_Value(status3.Int(), status3==KErrCancel);
User::WaitForRequest(status4);
- test(status4==KErrCancel);
+ test_Value(status4.Int(), status4==KErrCancel);
User::WaitForRequest(status5);
- test(status5==KErrCancel);
+ test_Value(status5.Int(), status5==KErrCancel);
// Call the cancel function again to check no further action
fs1.NotifyChangeCancel();
@@ -1553,62 +1552,62 @@
fs1.NotifyChange(ENotifyAll,status3,path);
fs1.NotifyChange(ENotifyAll,status4,path);
fs1.NotifyChange(ENotifyAll,status5,path);
- test(status1==KRequestPending);
- test(status2==KRequestPending);
- test(status3==KRequestPending);
- test(status4==KRequestPending);
- test(status5==KRequestPending);
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status2.Int(), status2==KRequestPending);
+ test_Value(status3.Int(), status3==KRequestPending);
+ test_Value(status4.Int(), status4==KRequestPending);
+ test_Value(status5.Int(), status5==KRequestPending);
// Cancel the outstanding request with status5
test.Next(_L("RFs::NotifyCancel()"));
fs1.NotifyChangeCancel(status5);
User::WaitForRequest(status5);
- test(status1==KRequestPending);
- test(status2==KRequestPending);
- test(status3==KRequestPending);
- test(status4==KRequestPending);
- test(status5==KErrCancel);
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status2.Int(), status2==KRequestPending);
+ test_Value(status3.Int(), status3==KRequestPending);
+ test_Value(status4.Int(), status4==KRequestPending);
+ test_Value(status5.Int(), status5==KErrCancel);
r=TheFs.MkDir(_L("\\F32-TST\\TROPICANA\\"));
- test(r==KErrNone);
- test(status1==KRequestPending);
- test(status2==KRequestPending);
- test(status3==KRequestPending);
- test(status4==KRequestPending);
+ test_KErrNone(r);
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status2.Int(), status2==KRequestPending);
+ test_Value(status3.Int(), status3==KRequestPending);
+ test_Value(status4.Int(), status4==KRequestPending);
fs1.NotifyChangeCancel(status2);
User::WaitForRequest(status2);
- test(status1==KRequestPending);
- test(status2==KErrCancel);
- test(status3==KRequestPending);
- test(status4==KRequestPending);
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status2.Int(), status2==KErrCancel);
+ test_Value(status3.Int(), status3==KRequestPending);
+ test_Value(status4.Int(), status4==KRequestPending);
r=TheFs.RmDir(_L("\\F32-TST\\TROPICANA\\"));
- test(r==KErrNone);
- test(status1==KRequestPending);
- test(status3==KRequestPending);
- test(status4==KRequestPending);
+ test_KErrNone(r);
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status3.Int(), status3==KRequestPending);
+ test_Value(status4.Int(), status4==KRequestPending);
fs1.NotifyChangeCancel(status4);
User::WaitForRequest(status4);
- test(status1==KRequestPending);
- test(status3==KRequestPending);
- test(status4==KErrCancel);
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status3.Int(), status3==KRequestPending);
+ test_Value(status4.Int(), status4==KErrCancel);
fs1.NotifyChangeCancel(status4); // Test no side effects on trying to cancel a request
- test(status4==KErrCancel); // that has already been cancelled
+ test_Value(status4.Int(), status4==KErrCancel); // that has already been cancelled
fs1.NotifyChangeCancel(status1);
User::WaitForRequest(status1);
- test(status1==KErrCancel);
- test(status3==KRequestPending);
+ test_Value(status1.Int(), status1==KErrCancel);
+ test_Value(status3.Int(), status3==KRequestPending);
fs1.NotifyChangeCancel(status1); // Test no side effects on trying to cancel a request
- test(status1==KErrCancel); // that has already been cancelled
+ test_Value(status1.Int(), status1==KErrCancel); // that has already been cancelled
fs1.NotifyChangeCancel(status3);
User::WaitForRequest(status3);
- test(status3==KErrCancel);
+ test_Value(status3.Int(), status3==KErrCancel);
fs1.Close();
}
@@ -1622,11 +1621,11 @@
test.Next(_L("Kill client while it is monitoring changes to a directory"));
// Call CreateLocal to create RSemaphore gSleepThread which is local to this process
TInt r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread clientThread;
r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest9);
- test(r==KErrNone);
+ test_KErrNone(r);
clientThread.Resume();
gSleepThread.Wait(); // Wait for gSleepThread to be signalled
// Client thread is waiting for notification of changes
@@ -1641,7 +1640,7 @@
// Make a change and check there's no disaster
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\"));
- test(r==KErrNone || r==KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r==KErrAlreadyExists);
MakeFile(_L("\\F32-TST\\NOTIFY\\NewFile.Txt"));
User::After(1000);
}
@@ -1658,95 +1657,95 @@
RFile file;
TInt r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
TFileName path=_L("\\F32-TST\\NOTIFY\\");
TRequestStatus reqStat1(KRequestPending);
RFs fs1;
r=fs1.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs1.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
fs1.NotifyChange(ENotifyEntry,reqStat1,path);
TRequestStatus reqStat2(KRequestPending);
RFs fs2;
r=fs2.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs2.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
fs2.NotifyChange(ENotifyEntry,reqStat2,path);
TRequestStatus reqStat3(KRequestPending);
RFs fs3;
r=fs3.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs3.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
fs3.NotifyChange(ENotifyEntry,reqStat3,path);
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread thread1;
r=thread1.Create(_L("TestThread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
- test(r==KErrNone);
+ test_KErrNone(r);
thread1.Resume();
gSleepThread.Wait();
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat1);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat1==KErrNone); // All three notifications occur because they
- test(reqStat2==KErrNone); // are all monitoring the top level directory
- test(reqStat3==KErrNone); // Later, we'll test monitoring individual files...
+ test_KErrNone(reqStat1.Int()); // All three notifications occur because they
+ test_KErrNone(reqStat2.Int()); // are all monitoring the top level directory
+ test_KErrNone(reqStat3.Int()); // Later, we'll test monitoring individual files...
gSleepThread.Close();
thread1.Close();
test.Next(_L("Test reads and writes do cause notification under ENotifyAll"));
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
fs1.NotifyChange(ENotifyAll,reqStat1,path);
fs2.NotifyChange(ENotifyAll,reqStat2,path);
fs3.NotifyChange(ENotifyAll,reqStat3,path);
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread thread2;
r=thread2.Create(_L("TestThread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
- test(r==KErrNone);
+ test_KErrNone(r);
thread2.Resume();
gSleepThread.Wait();
User::WaitForRequest(reqStat1);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat1==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
+ test_KErrNone(reqStat1.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
gSleepThread.Close();
thread2.Close();
@@ -1763,33 +1762,33 @@
fs2.NotifyChange(ENotifyEntry,reqStat2,path2);
fs3.NotifyChange(ENotifyAll,reqStat3,path3);
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread thread3;
r=thread3.Create(_L("TestThread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
- test(r==KErrNone);
+ test_KErrNone(r);
thread3.Resume();
gSleepThread.Wait();
User::WaitForRequest(reqStat1);
- test(reqStat1==KErrNone);
- test(reqStat2==KRequestPending); // Monitoring with ENotifyEntry
+ test_KErrNone(reqStat1.Int());
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyEntry
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrNone);
+ test_KErrNone(reqStat3.Int());
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrNone);
+ test_KErrNone(reqStat2.Int());
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
gSleepThread.Close();
thread3.Close();
@@ -1806,17 +1805,17 @@
{
RFs fs; // Session to be notified of any changes
TInt r=fs.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"));
- test(r==KErrNone||r==KErrAlreadyExists);
+ test_Value(r, r == KErrNone||r==KErrAlreadyExists);
RFile file;
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileStream);
- test(r==KErrNone||KErrAlreadyExists);
+ test_Value(r, r == KErrNone || r == KErrAlreadyExists);
file.Close();
// Test notification on a specific file
@@ -1825,48 +1824,48 @@
TRequestStatus reqStat(KRequestPending);
TRequestStatus thrdStat(KRequestPending);
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
RThread thread;
r=thread.Create(_L("MyThread7"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest8);
- test(r==KErrNone);
+ test_KErrNone(r);
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
thread.Close();
// Test notification does not occur if a change is made above the file
fs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=thread.Create(_L("MyThread8"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
- test(r==KErrNone);
+ test_KErrNone(r);
thread.Logon(thrdStat);
thread.Resume();
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
User::After(500000);
thread.Close();
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NEWFILE.TXT"));
- test(r==KErrNone);
+ test_KErrNone(r);
// Test notification does not occur if a change is made to another file
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Lion.log"),EFileStream);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
file.Close();
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Lion.log"));
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// Test notification occurs when a change is made to the file
test.Next(_L("Delete monitored file"));
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.Msg"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
fs.Close();
}
@@ -1880,9 +1879,9 @@
//
RFs fs;
TInt r=fs.Connect(); // Session to be notified of any changes
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
// RFile::Write() to a file within the monitored directory
test.Next(_L("RFile::Write()"));
@@ -1892,178 +1891,178 @@
RFile file;
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::Read() a file within the monitored directory - no notification for reads
path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
TBuf8<100> temp;
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Read(0,temp,100);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// RFile::SetAtt() of a file within the monitored directory
test.Next(_L("RFile::SetAtt()"));
r=file.SetAtt(KEntryAttSystem,KEntryAttNormal);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// RFile::SetSize() of a file within the monitored directory
test.Next(_L("RFile::SetSize()"));
r=file.SetSize(256);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
file.Close();
// RFile::Temp() to create a temp file within the monitored directory
test.Next(_L("RFile::Temp()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
TFileName fileName;
r=file.Temp(TheFs,path,fileName,EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
file.Close();
// RFile::SetModified() to change modification time of a file within monitored dir
test.Next(_L("RFile::SetModified()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
TTime now;
now.HomeTime();
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
file.SetModified(now);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFs::SetEntry() to change a directory entry within the monitored directory
test.Next(_L("RFs::SetEntry()"));
TEntry entry;
fs.NotifyChange(ENotifyAll,reqStat,path);
r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
now.HomeTime();
r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::Set() to change file's modification time and attributes
test.Next(_L("RFile::Set()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
now.HomeTime();
r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFs::SetDriveName()
test.Next(_L("RFs::SetDriveName()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
User::After(KNotifyChangeAfter);
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
fs.NotifyChange(ENotifyEntry,reqStat,path);
User::After(KNotifyChangeAfter);
r=TheFs.SetDriveName(KDefaultDrive,_L("TEST"));
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
fs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
fs.NotifyChange(ENotifyDisk,reqStat,path);
User::After(KNotifyChangeAfter);
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE"));
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
fs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// RFs::MkDir()
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
test.Next(_L("RFs::MkDir()"));
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFs::RmDir()
test.Next(_L("RFs::RmDir()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::Create()
test.Next(_L("RFile::Create()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
file.Close();
// RFs::Delete()
test.Next(_L("RFs::Delete()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::Replace()
test.Next(_L("RFile::Replace()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
file.Close();
// RFs::Delete()
test.Next(_L("RFs::Delete()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFs::SetVolumeLabel() - should only be notification when monitoring relevant TNotifyTypes
test.Next(_L("RFs::SetVolumeLabel"));
@@ -2074,52 +2073,52 @@
TFileName currentVolName;
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
currentVolName=volInfo.iName;
r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
if (r==KErrNone)
{
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
test(volInfo.iName==_L("VOL"));
// Test notification occurs under ENotifyDisk
fs.NotifyChange(ENotifyDisk,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
test(volInfo.iName==_L("ABCDEFGHIJK"));
// Test notification does not occur under ENotifyAttributes
fs.NotifyChange(ENotifyAttributes,reqStat,path);
r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
test(volInfo.iName==_L("TROPICANA"));
fs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// Test notification occurs under ENotifyEntry
fs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.SetVolumeLabel(currentVolName,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
test(volInfo.iName==currentVolName);
}
@@ -2135,31 +2134,29 @@
test.Next(_L("RFs::Rename()"));
fs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"));
- test(r==KErrNone);
-
-#if defined(__WINS__)
- if(gSessionPath[0]=='Y'||gSessionPath[0]=='X')
-#endif
- {
+ test_KErrNone(r);
+
+ if(!Is_SimulatedSystemDrive(TheFs,driveNum))
+ {// Skip emulator/PlatSim drive C:
test.Next(_L("RFs::Rename() with max path length"));
TFileName longName=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
while(longName.Length()<(KMaxFileName-2))
longName+=_L("a");
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),longName);
- test(r==KErrNone);
+ test_KErrNone(r);
fs.NotifyChange(ENotifyEntry,reqStat,longName);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Rename(longName,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
}
fs.Close();
@@ -2175,9 +2172,9 @@
//
RFs fs; // Session to be notified when a change occurs
TInt r=fs.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
// RFile::Write() to a file in the subtree
test.Next(_L("RFile::Write()"));
@@ -2187,48 +2184,48 @@
RFile file;
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::Read() a file within the monitored directory - no notification for reads
fs.NotifyChange(ENotifyAll,reqStat,path);
TBuf8<100> temp;
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Read(0,temp,100);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// RFile::SetAtt() of a file within the monitored directory
test.Next(_L("RFile::SetAtt()"));
r=file.SetAtt(KEntryAttNormal,KEntryAttHidden);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::SetSize() of a file within the monitored directory
test.Next(_L("RFile::SetSize()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.SetSize(256);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
file.Close();
// RFile::Temp() to create a temp file in the subtree
test.Next(_L("RFile::Temp()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
TFileName fileName;
r=file.Temp(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"),fileName,EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
file.Close();
// RFile::SetModified() to change modification time of a file within monitored dir
@@ -2237,118 +2234,118 @@
TTime now;
now.HomeTime();
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
file.SetModified(now);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFs::Entry() to change a directory entry within the monitored directory
test.Next(_L("RFs::Entry()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
TEntry entry;
r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
now.HomeTime();
r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::Set() to change file's modification time and attributes
test.Next(_L("RFile::Set()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
now.HomeTime();
r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFs::SetDriveName()
test.Next(_L("RFs::SetDriveName()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
User::After(KNotifyChangeAfter);
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
fs.NotifyChange(ENotifyEntry,reqStat,path);
r=TheFs.SetDriveName(KDefaultDrive,_L("TEST"));
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
User::After(KNotifyChangeAfter);
fs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
fs.NotifyChange(ENotifyDisk,reqStat,path);
User::After(KNotifyChangeAfter);
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE"));
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
fs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// RFs::MkDir()
test.Next(_L("RFs::MkDir()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFs::RmDir()
test.Next(_L("RFs::RmDir()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::Create()
test.Next(_L("RFile::Create()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
file.Close();
// RFs::Delete()
test.Next(_L("RFs::Delete()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::Replace()
test.Next(_L("RFile::Replace()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
file.Close();
// RFs::Delete()
test.Next(_L("RFs::Delete()"));
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFs::SetVolumeLabel() - should be notification under relevant TNotifyType monitoring
// The operation is non-path specific so all outstanding interested requests are notified
@@ -2360,52 +2357,52 @@
TVolumeInfo volInfo;
TFileName currentVolName;
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
currentVolName=volInfo.iName;
r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
if (r==KErrNone)
{
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
test(volInfo.iName==_L("VOL"));
// Test notification occurs under ENotifyDisk
fs.NotifyChange(ENotifyDisk,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
test(volInfo.iName==_L("ABCDEFGHIJK"));
// Test notification does not occur under ENotifyAttributes
fs.NotifyChange(ENotifyAttributes,reqStat,path);
r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
test(volInfo.iName==_L("TROPICANA"));
fs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// Test notification occurs under ENotifyEntry
fs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.SetVolumeLabel(currentVolName,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
test(volInfo.iName==currentVolName);
}
@@ -2420,18 +2417,18 @@
// Test that notification is made when change is made to monitored directory
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
fs.Close();
}
@@ -2445,9 +2442,9 @@
//
RFs fs;
TInt r=fs.Connect(); // Session to be notified when a change occurs
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
// RFile::Write() to a file in the subtree
TFileName path=_L("\\F32-TST\\NOTIFY\\");
@@ -2456,35 +2453,35 @@
RFile file;
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::Read() a file within the monitored directory - no notification for reads
fs.NotifyChange(ENotifyAll,reqStat,path);
TBuf8<100> temp;
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Read(0,temp,100);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
// RFile::SetAtt() of a file within the monitored directory
r=file.SetAtt(KEntryAttNormal,KEntryAttHidden);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::SetSize() of a file within the monitored directory
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.SetSize(256);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
file.Close();
@@ -2493,109 +2490,109 @@
TTime now;
now.HomeTime();
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
file.SetModified(now);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFs::Entry() to change a directory entry within the monitored directory
fs.NotifyChange(ENotifyAll,reqStat,path);
TEntry entry;
r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
now.HomeTime();
r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::Set() to change file's modification time and attributes
fs.NotifyChange(ENotifyAll,reqStat,path);
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
now.HomeTime();
r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFs::SetDriveName() - should be no notification ever with extended notification
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
User::After(KNotifyChangeAfter);
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
fs.NotifyChange(ENotifyEntry,reqStat,path);
User::After(KNotifyChangeAfter);
r=TheFs.SetDriveName(KDefaultDrive,_L("TEST"));
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
fs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
fs.NotifyChange(ENotifyDisk,reqStat,path);
User::After(KNotifyChangeAfter);
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE"));
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
fs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// RFs::MkDir()
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFs::RmDir()
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::Create()
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
file.Close();
// RFs::Delete()
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFile::Replace()
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
file.Close();
// RFs::Delete()
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// RFs::SetVolumeLabel()
// Not path specific, so all outstanding requests of correct TNotifyType are notified
@@ -2604,52 +2601,52 @@
TVolumeInfo volInfo;
TFileName currentVolName;
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
currentVolName=volInfo.iName;
r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
if (r==KErrNone)
{
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
test(volInfo.iName==_L("VOL"));
// Test notification occurs under ENotifyDisk
fs.NotifyChange(ENotifyDisk,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
test(volInfo.iName==_L("ABCDEFGHIJK"));
// Test notification does not occur under ENotifyAttributes
fs.NotifyChange(ENotifyAttributes,reqStat,path);
r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
test(volInfo.iName==_L("TROPICANA"));
fs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
// Test notification occurs under ENotifyEntry
fs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.SetVolumeLabel(currentVolName,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
test(volInfo.iName==currentVolName);
}
@@ -2662,26 +2659,26 @@
// RFs::Rename()
fs.NotifyChange(ENotifyEntry,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
// Test that notification is made when change is made to monitored directory
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
fs.Close();
}
@@ -2696,20 +2693,20 @@
RFile file;
TInt r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\koala.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\dingo.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
RFs fs;
r=fs.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
TRequestStatus reqStat1(KRequestPending);
TFileName path1=_L("\\F32-TST\\NOTIFY\\");
@@ -2759,66 +2756,66 @@
r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread thread1;
r=thread1.Create(_L("TestThread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
- test(r==KErrNone);
+ test_KErrNone(r);
thread1.Resume();
gSleepThread.Wait();
- test(status1==KRequestPending);
- test(status2==KRequestPending);
- test(status3==KRequestPending);
- test(status4==KRequestPending);
- test(status5==KRequestPending);
- test(status6==KRequestPending);
-
- test(statusExtended1==KRequestPending);
- test(statusExtended2==KRequestPending);
- test(statusExtended3==KRequestPending);
- test(statusExtended4==KRequestPending);
- test(statusExtended5==KRequestPending);
- test(statusExtended6==KRequestPending);
-
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(status1.Int(), status1==KRequestPending);
+ test_Value(status2.Int(), status2==KRequestPending);
+ test_Value(status3.Int(), status3==KRequestPending);
+ test_Value(status4.Int(), status4==KRequestPending);
+ test_Value(status5.Int(), status5==KRequestPending);
+ test_Value(status6.Int(), status6==KRequestPending);
+
+ test_Value(statusExtended1.Int(), statusExtended1==KRequestPending);
+ test_Value(statusExtended2.Int(), statusExtended2==KRequestPending);
+ test_Value(statusExtended3.Int(), statusExtended3==KRequestPending);
+ test_Value(statusExtended4.Int(), statusExtended4==KRequestPending);
+ test_Value(statusExtended5.Int(), statusExtended5==KRequestPending);
+ test_Value(statusExtended6.Int(), statusExtended6==KRequestPending);
+
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat1);
- test(reqStat1==KErrNone);
+ test_KErrNone(reqStat1.Int());
User::WaitForRequest(status1);
- test(status1==KErrNone);
+ test_KErrNone(status1.Int());
User::WaitForRequest(status2);
- test(status2==KErrNone);
+ test_KErrNone(status2.Int());
User::WaitForRequest(status3);
- test(status3==KErrNone);
+ test_KErrNone(status3.Int());
User::WaitForRequest(status4);
- test(status4==KErrNone);
+ test_KErrNone(status4.Int());
User::WaitForRequest(status5);
- test(status5==KErrNone);
+ test_KErrNone(status5.Int());
User::WaitForRequest(status6);
- test(status6==KErrNone);
+ test_KErrNone(status6.Int());
User::WaitForRequest(statusExtended1);
- test(statusExtended1==KErrNone);
+ test_KErrNone(statusExtended1.Int());
User::WaitForRequest(statusExtended2);
- test(statusExtended2==KErrNone);
+ test_KErrNone(statusExtended2.Int());
User::WaitForRequest(statusExtended3);
- test(statusExtended3==KErrNone);
+ test_KErrNone(statusExtended3.Int());
User::WaitForRequest(statusExtended4);
- test(statusExtended4==KErrNone);
+ test_KErrNone(statusExtended4.Int());
User::WaitForRequest(statusExtended5);
- test(statusExtended5==KErrNone);
+ test_KErrNone(statusExtended5.Int());
User::WaitForRequest(statusExtended6);
- test(statusExtended6==KErrNone);
+ test_KErrNone(statusExtended6.Int());
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrNone);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat2.Int());
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
fs.NotifyChangeCancel(); // Cancels both remaining notification requests
User::WaitForRequest(reqStat3);
@@ -2829,32 +2826,32 @@
test.Next(_L("Test reads and writes do cause notification under ENotifyAll"));
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
file.Close();
fs.NotifyChange(ENotifyAll,reqStat1,path1);
fs.NotifyChange(ENotifyEntry,reqStat2,path2);
fs.NotifyChange(ENotifyAll,reqStat3,path3);
fs.NotifyChange(ENotifyEntry,reqStat4,path4);
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread thread2;
r=thread2.Create(_L("TestThread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
- test(r==KErrNone);
+ test_KErrNone(r);
thread2.Resume();
gSleepThread.Wait();
User::WaitForRequest(reqStat1);
- test(reqStat1==KErrNone);
- test(reqStat2==KRequestPending);
+ test_KErrNone(reqStat1.Int());
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
gSleepThread.Close();
thread2.Close();
@@ -2862,55 +2859,55 @@
fs.NotifyChange(ENotifyAll,reqStat1,path1);
fs.NotifyChange(ENotifyAll,reqStat3,path3);
- test(reqStat1==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=gSleepThread.CreateLocal(0);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread thread3;
r=thread3.Create(_L("TestThread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
- test(r==KErrNone);
+ test_KErrNone(r);
thread3.Resume();
gSleepThread.Wait();
User::WaitForRequest(reqStat1);
- test(reqStat1==KErrNone);
- test(reqStat2==KRequestPending); // Monitoring with ENotifyEntry
+ test_KErrNone(reqStat1.Int());
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyEntry
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending); // Monitoring with ENotifyEntry
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring with ENotifyEntry
RFs fs2;
r=fs2.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs2.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
TRequestStatus reqStat(KRequestPending);
fs2.NotifyChange(ENotifyEntry,reqStat);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrNone);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat2.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
+ test_KErrNone(reqStat.Int());
fs2.NotifyChange(ENotifyAll,reqStat);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrNone);
+ test_KErrNone(reqStat4.Int());
gSleepThread.Close();
thread3.Close();
@@ -2928,9 +2925,9 @@
//
RFs fs;
TInt r=fs.Connect(); // Session to be notified of any changes
- test(r==KErrNone);
+ test_KErrNone(r);
r=fs.SetSessionPath(gSessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
// RFile::Write() to a file within the monitored directory
test.Next(_L("RFile::Write()"));
@@ -2946,7 +2943,7 @@
RFile file;
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
fs.NotifyChange(ENotifyAll,reqStat,path);
fs.NotifyChange(ENotifyFile,reqStat2,path);
@@ -2957,43 +2954,43 @@
fs.NotifyChange(ENotifyDisk,reqStat7,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrArgument); // Cannot monitor a file with ENotifyDir
- test(reqStat5==KRequestPending);
- test(reqStat6==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KErrArgument); // Cannot monitor a file with ENotifyDir
+ test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+ test_Value(reqStat6.Int(), reqStat6==KRequestPending);
fs.NotifyChange(ENotifyEntry,reqStat4,path);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
- test(reqStat2==KRequestPending); // Monitoring with ENotifyFile
+ test_KErrNone(reqStat.Int());
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyFile
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending); // Monitoring with ENotifyEntry
- test(reqStat5==KRequestPending);
- test(reqStat6==KRequestPending);
- test(reqStat7==KRequestPending);
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring with ENotifyEntry
+ test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+ test_Value(reqStat6.Int(), reqStat6==KRequestPending);
+ test_Value(reqStat7.Int(), reqStat7==KRequestPending);
fs.NotifyChangeCancel(); // Cancels all outstanding notification requests
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrCancel);
+ test_Value(reqStat2.Int(), reqStat2==KErrCancel);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
User::WaitForRequest(reqStat5);
- test(reqStat5==KErrCancel);
+ test_Value(reqStat5.Int(), reqStat5==KErrCancel);
User::WaitForRequest(reqStat6);
- test(reqStat6==KErrCancel);
+ test_Value(reqStat6.Int(), reqStat6==KErrCancel);
User::WaitForRequest(reqStat7);
- test(reqStat7==KErrCancel);
+ test_Value(reqStat7.Int(), reqStat7==KErrCancel);
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
// RFile::SetAtt() of a file within the monitored directory
fs.NotifyChange(ENotifyAll,reqStat,path);
@@ -3004,88 +3001,88 @@
fs.NotifyChange(ENotifyWrite,reqStat6,path);
fs.NotifyChange(ENotifyDisk,reqStat7,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
User::WaitForRequest(reqStat5);
- test(reqStat5==KErrArgument);
- test(reqStat6==KRequestPending);
- test(reqStat7==KRequestPending);
+ test_Value(reqStat5.Int(), reqStat5==KErrArgument);
+ test_Value(reqStat6.Int(), reqStat6==KRequestPending);
+ test_Value(reqStat7.Int(), reqStat7==KRequestPending);
test.Next(_L("RFile::SetAtt()"));
r=file.SetAtt(KEntryAttSystem,KEntryAttNormal);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat4);
- test(reqStat==KErrNone);
- test(reqStat2==KRequestPending); // Monitoring with ENotifyFile
- test(reqStat3==KRequestPending); // Monitoring with ENotifyEntry
- test(reqStat4==KErrNone); // Monitoring a file - can't use ENotifyDir
- test(reqStat6==KRequestPending);
- test(reqStat7==KRequestPending);
+ test_KErrNone(reqStat.Int());
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyFile
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring with ENotifyEntry
+ test_KErrNone(reqStat4.Int()); // Monitoring a file - can't use ENotifyDir
+ test_Value(reqStat6.Int(), reqStat6==KRequestPending);
+ test_Value(reqStat7.Int(), reqStat7==KRequestPending);
fs.NotifyChange(ENotifyWrite,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
fs.NotifyChange(ENotifyDir,reqStat4,path);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrArgument);
+ test_Value(reqStat4.Int(), reqStat4==KErrArgument);
r=file.SetAtt(KEntryAttNormal,KEntryAttSystem);
- test(r==KErrNone);
- test(reqStat==KRequestPending); // Monitoring with ENotifyWrite
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending); // Monitoring with ENotifyWrite
fs.NotifyChangeCancel(); // Cancel outstanding notification request
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrCancel);
+ test_Value(reqStat2.Int(), reqStat2==KErrCancel);
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrCancel);
+ test_Value(reqStat3.Int(), reqStat3==KErrCancel);
User::WaitForRequest(reqStat6);
- test(reqStat6==KErrCancel);
+ test_Value(reqStat6.Int(), reqStat6==KErrCancel);
User::WaitForRequest(reqStat7);
- test(reqStat7==KErrCancel);
+ test_Value(reqStat7.Int(), reqStat7==KErrCancel);
fs.NotifyChange(ENotifyAll,reqStat,path);
fs.NotifyChange(ENotifyFile,reqStat2,path);
fs.NotifyChange(ENotifyEntry,reqStat3,path);
fs.NotifyChange(ENotifyAttributes,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
// RFile::SetSize() of a file within the monitored directory
test.Next(_L("RFile::SetSize()"));
r=file.SetSize(256);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat4);
- test(reqStat==KErrNone);
- test(reqStat2==KRequestPending); // Monitoring with ENotifyFile
- test(reqStat3==KRequestPending); // Monitoring with ENotifyEntry
- test(reqStat4==KErrNone);
+ test_KErrNone(reqStat.Int());
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyFile
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring with ENotifyEntry
+ test_KErrNone(reqStat4.Int());
fs.NotifyChange(ENotifyWrite,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
fs.NotifyChange(ENotifyDir,reqStat4,path);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrArgument);
+ test_Value(reqStat4.Int(), reqStat4==KErrArgument);
r=file.SetSize(200);
- test(r==KErrNone);
+ test_KErrNone(r);
User::After(1000000);
- test(reqStat==KRequestPending); // Monitoring with ENotifyWrite
+ test_Value(reqStat.Int(), reqStat==KRequestPending); // Monitoring with ENotifyWrite
file.Close();
fs.NotifyChangeCancel(); // Cancels all outstanding notification requests
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrCancel);
+ test_Value(reqStat2.Int(), reqStat2==KErrCancel);
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrCancel);
+ test_Value(reqStat3.Int(), reqStat3==KErrCancel);
// RFile::Temp() to create a temp file within the monitored directory
test.Next(_L("RFile::Temp()"));
@@ -3096,47 +3093,47 @@
fs.NotifyChange(ENotifyEntry,reqStat3,path);
fs.NotifyChange(ENotifyAttributes,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
TFileName fileName;
r=file.Temp(TheFs,path,fileName,EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending); // Monitoring ENotifyEntry
- test(reqStat4==KRequestPending); // Monitoring ENotifyAttributes
+ test_KErrNone(reqStat.Int());
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring ENotifyEntry
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring ENotifyAttributes
file.Close();
fs.NotifyChangeCancel();
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrCancel);
+ test_Value(reqStat2.Int(), reqStat2==KErrCancel);
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrCancel);
+ test_Value(reqStat3.Int(), reqStat3==KErrCancel);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
fs.NotifyChange(ENotifyFile,reqStat,path);
fs.NotifyChange(ENotifyDisk,reqStat2,path);
fs.NotifyChange(ENotifyWrite,reqStat3,path);
r=file.Temp(TheFs,path,fileName,EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending); // Monitoring ENotifyFile
- test(reqStat2==KRequestPending); // Monitoring ENotifyDisk
- test(reqStat3==KRequestPending); // Monitoring ENotifyWrite
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending); // Monitoring ENotifyFile
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring ENotifyDisk
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring ENotifyWrite
file.Close();
fs.NotifyChangeCancel(); // Cancels all outstanding notification requests
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrCancel);
+ test_Value(reqStat2.Int(), reqStat2==KErrCancel);
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrCancel);
+ test_Value(reqStat3.Int(), reqStat3==KErrCancel);
// RFile::SetModified() to change modification time of a file within monitored dir
test.Next(_L("RFile::SetModified()"));
@@ -3146,30 +3143,30 @@
fs.NotifyChange(ENotifyAttributes,reqStat3,path);
fs.NotifyChange(ENotifyFile,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
TTime now;
now.HomeTime();
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
file.SetModified(now);
file.Close();
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
- test(reqStat2==KRequestPending);
+ test_KErrNone(reqStat.Int());
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
fs.NotifyChangeCancel();
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrCancel);
+ test_Value(reqStat2.Int(), reqStat2==KErrCancel);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
// RFs::SetEntry() to change a directory entry within the monitored directory
test.Next(_L("RFs::SetEntry()"));
@@ -3179,28 +3176,28 @@
fs.NotifyChange(ENotifyAttributes,reqStat3,path);
fs.NotifyChange(ENotifyDisk,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),entry);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
now.HomeTime();
r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),now,KEntryAttHidden,KEntryAttNormal);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone);
- test(reqStat2==KRequestPending);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat.Int());
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
fs.NotifyChangeCancel();
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrCancel);
+ test_Value(reqStat2.Int(), reqStat2==KErrCancel);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
// RFile::Set() to change file's modification time and attributes
test.Next(_L("RFile::Set()"));
@@ -3209,29 +3206,29 @@
fs.NotifyChange(ENotifyAttributes,reqStat3,path);
fs.NotifyChange(ENotifyWrite,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
now.HomeTime();
r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
file.Close();
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone);
- test(reqStat2==KRequestPending);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat.Int());
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
fs.NotifyChangeCancel();
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrCancel);
+ test_Value(reqStat2.Int(), reqStat2==KErrCancel);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
// RFs::SetDriveName()
@@ -3241,27 +3238,27 @@
fs.NotifyChange(ENotifyDisk,reqStat3,path);
fs.NotifyChange(ENotifyAttributes,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
User::After(KNotifyChangeAfter);
r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
- test(reqStat==KErrNone);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat.Int());
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
fs.NotifyChangeCancel();
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrCancel);
+ test_Value(reqStat2.Int(), reqStat2==KErrCancel);
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrCancel);
+ test_Value(reqStat3.Int(), reqStat3==KErrCancel);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
// RFs::MkDir()
test.Next(_L("RFs::MkDir()"));
@@ -3272,20 +3269,20 @@
fs.NotifyChange(ENotifyDir,reqStat3,path);
fs.NotifyChange(ENotifyFile,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
// RFs::RmDir()
test.Next(_L("RFs::RmDir()"));
@@ -3293,24 +3290,24 @@
fs.NotifyChange(ENotifyDir,reqStat2,path);
fs.NotifyChange(ENotifyWrite,reqStat3,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
fs.NotifyChangeCancel();
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrCancel);
+ test_Value(reqStat3.Int(), reqStat3==KErrCancel);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
// RFile::Create()
test.Next(_L("RFile::Create()"));
@@ -3319,20 +3316,20 @@
fs.NotifyChange(ENotifyDir,reqStat3,path);
fs.NotifyChange(ENotifyFile,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat4);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KRequestPending); // Monitoring ENotifyDir
- test(reqStat4==KErrNone);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring ENotifyDir
+ test_KErrNone(reqStat4.Int());
file.Close();
fs.NotifyChangeCancel(reqStat3);
User::WaitForRequest(reqStat3);
@@ -3342,26 +3339,26 @@
fs.NotifyChange(ENotifyDisk,reqStat3,path);
fs.NotifyChange(ENotifyWrite,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
file.Close();
fs.NotifyChangeCancel();
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrCancel);
+ test_Value(reqStat3.Int(), reqStat3==KErrCancel);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
// RFs::Delete()
test.Next(_L("RFs::Delete()"));
@@ -3370,46 +3367,46 @@
fs.NotifyChange(ENotifyDir,reqStat3,path);
fs.NotifyChange(ENotifyFile,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat4);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KRequestPending); // Monitoring ENotifyDir
- test(reqStat4==KErrNone);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring ENotifyDir
+ test_KErrNone(reqStat4.Int());
fs.NotifyChangeCancel(reqStat3);
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrCancel);
+ test_Value(reqStat3.Int(), reqStat3==KErrCancel);
fs.NotifyChange(ENotifyAll,reqStat,path);
fs.NotifyChange(ENotifyEntry,reqStat2,path);
fs.NotifyChange(ENotifyAttributes,reqStat3,path);
fs.NotifyChange(ENotifyAll,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat4);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KRequestPending);
- test(reqStat4==KErrNone);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_KErrNone(reqStat4.Int());
fs.NotifyChangeCancel(reqStat3);
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrCancel);
+ test_Value(reqStat3.Int(), reqStat3==KErrCancel);
// RFile::Replace()
test.Next(_L("RFile::Replace()"));
@@ -3418,28 +3415,28 @@
fs.NotifyChange(ENotifyFile,reqStat3,path);
fs.NotifyChange(ENotifyDir,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
file.Close();
fs.NotifyChangeCancel();
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
// RFs::Delete()
test.Next(_L("RFs::Delete()"));
@@ -3449,21 +3446,21 @@
fs.NotifyChange(ENotifyFile,reqStat3,path);
fs.NotifyChange(ENotifyDir,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrArgument);
+ test_Value(reqStat4.Int(), reqStat4==KErrArgument);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KErrArgument);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KErrArgument);
// RFs::SetVolumeLabel()
test.Next(_L("RFs::SetVolumeLabel()"));
@@ -3476,20 +3473,20 @@
fs.NotifyChange(ENotifyAttributes,reqStat6,path);
fs.NotifyChange(ENotifyDisk,reqStat7,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
- test(reqStat5==KRequestPending);
- test(reqStat6==KRequestPending);
- test(reqStat7==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+ test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+ test_Value(reqStat6.Int(), reqStat6==KRequestPending);
+ test_Value(reqStat7.Int(), reqStat7==KRequestPending);
TInt driveNum=CurrentDrive();
TVolumeInfo volInfo;
TFileName currentVolName;
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
currentVolName=volInfo.iName;
r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
@@ -3499,51 +3496,51 @@
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat7);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
- test(reqStat5==KRequestPending);
- test(reqStat6==KRequestPending);
- test(reqStat7==KErrNone);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+ test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+ test_Value(reqStat6.Int(), reqStat6==KRequestPending);
+ test_KErrNone(reqStat7.Int());
fs.NotifyChange(ENotifyAll,reqStat,path);
fs.NotifyChange(ENotifyEntry,reqStat2,path);
fs.NotifyChange(ENotifyDisk,reqStat7,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat7==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat7.Int(), reqStat7==KRequestPending);
r=TheFs.SetVolumeLabel(currentVolName,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat7);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
- test(reqStat5==KRequestPending);
- test(reqStat6==KRequestPending);
- test(reqStat7==KErrNone);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+ test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+ test_Value(reqStat6.Int(), reqStat6==KRequestPending);
+ test_KErrNone(reqStat7.Int());
r=TheFs.Volume(volInfo,driveNum);
- test(r==KErrNone);
+ test_KErrNone(r);
test(volInfo.iName==currentVolName);
fs.NotifyChangeCancel();
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrCancel);
+ test_Value(reqStat3.Int(), reqStat3==KErrCancel);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
User::WaitForRequest(reqStat5);
- test(reqStat5==KErrCancel);
+ test_Value(reqStat5.Int(), reqStat5==KErrCancel);
User::WaitForRequest(reqStat6);
- test(reqStat6==KErrCancel);
+ test_Value(reqStat6.Int(), reqStat6==KErrCancel);
}
else // RFs::SetVolumeLabel() doesn't work on subst drives
@@ -3570,49 +3567,49 @@
fs.NotifyChange(ENotifyFile,reqStat3,path);
fs.NotifyChange(ENotifyDir,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=file.Rename(_L("\\F32-TST\\NOTIFY\\OldFile.abc"));
- test(r==KErrNone||r==KErrAlreadyExists);
+ test_Value(r, r == KErrNone||r==KErrAlreadyExists);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending); // Monitoring ENotifyDir
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring ENotifyDir
file.Close();
fs.NotifyChangeCancel();
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
path=_L("\\F32-TST\\NOTIFY\\OldFile.abc");
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\OldFile.abc"),EFileShareExclusive|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
fs.NotifyChange(ENotifyAll,reqStat,path);
fs.NotifyChange(ENotifyEntry,reqStat2,path);
fs.NotifyChange(ENotifyFile,reqStat3,path);
fs.NotifyChange(ENotifyDir,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrArgument);
+ test_Value(reqStat4.Int(), reqStat4==KErrArgument);
r=file.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KErrArgument);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KErrArgument);
file.Close();
// RFs::Rename()
@@ -3623,27 +3620,27 @@
fs.NotifyChange(ENotifyFile,reqStat3,path);
fs.NotifyChange(ENotifyDir,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz"),_L("\\F32-TST\\NOTIFY\\NewerFile.cat"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending); // Changed a file not a directory entry
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Changed a file not a directory entry
fs.NotifyChangeCancel();
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
path=_L("\\F32-TST\\NOTIFY\\NewerFile.cat");
fs.NotifyChange(ENotifyAll,reqStat,path);
@@ -3651,20 +3648,20 @@
fs.NotifyChange(ENotifyFile,reqStat3,path);
fs.NotifyChange(ENotifyDir,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrArgument);
+ test_Value(reqStat4.Int(), reqStat4==KErrArgument);
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewerFile.cat"),_L("\\F32-TST\\NOTIFY\\Original.dog"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
path=_L("\\F32-TST\\NOTIFY\\");
fs.NotifyChange(ENotifyAll,reqStat,path);
@@ -3672,22 +3669,22 @@
fs.NotifyChange(ENotifyFile,reqStat3,path);
fs.NotifyChange(ENotifyDir,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\"),_L("\\F32-TST\\NOTIFY_TEMP\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
User::WaitForRequest(reqStat4);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone); // Changed a directory entry but notified anyway despite
- test(reqStat4==KErrNone); // requesting file notification only because the path we
- // were monitoring has changed
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int()); // Changed a directory entry but notified anyway despite
+ test_KErrNone(reqStat4.Int()); // requesting file notification only because the path we
+ // were monitoring has changed
path=_L("\\F32-TST\\NOTIFY_TEMP\\Original.dog");
fs.NotifyChange(ENotifyAll,reqStat,path);
@@ -3695,113 +3692,113 @@
fs.NotifyChange(ENotifyFile,reqStat3,path);
fs.NotifyChange(ENotifyDir,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrArgument);
+ test_Value(reqStat4.Int(), reqStat4==KErrArgument);
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_TEMP\\"),_L("\\F32-TST\\NOTIFY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone); // Modified a directory above the level at which we
- test(reqStat2==KErrNone); // are monitoring for changes - we must be notified
- test(reqStat3==KErrNone); // anyway because the path has changed
+ test_KErrNone(reqStat.Int()); // Modified a directory above the level at which we
+ test_KErrNone(reqStat2.Int()); // are monitoring for changes - we must be notified
+ test_KErrNone(reqStat3.Int()); // anyway because the path has changed
fs.NotifyChange(ENotifyAll,reqStat,path);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
fs.NotifyChange(ENotifyEntry,reqStat2,path);
- test(reqStat2==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
fs.NotifyChange(ENotifyFile,reqStat3,path);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
fs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
fs.NotifyChangeCancel(reqStat2);
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrCancel);
+ test_Value(reqStat2.Int(), reqStat2==KErrCancel);
fs.NotifyChangeCancel(reqStat3);
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrCancel);
+ test_Value(reqStat3.Int(), reqStat3==KErrCancel);
path=_L("\\F32-TST\\NOTIFY\\Original.dog");
fs.NotifyChange(ENotifyAll,reqStat,path);
fs.NotifyChange(ENotifyEntry,reqStat2,path);
fs.NotifyChange(ENotifyFile,reqStat3,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Original.dog"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
path=_L("\\F32-TST\\NOTIFY\\");
fs.NotifyChange(ENotifyAll,reqStat,path);
fs.NotifyChange(ENotifyEntry,reqStat2,path);
fs.NotifyChange(ENotifyDir,reqStat3,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
r=TheFs.Rename(_L("\\F32-TST\\"),_L("\\F32-TEST\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone); // Modified a directory above the level at which we
- test(reqStat2==KErrNone); // are monitoring for changes but we receive notification
- test(reqStat3==KErrNone); // because the notification path has been changed
+ test_KErrNone(reqStat.Int()); // Modified a directory above the level at which we
+ test_KErrNone(reqStat2.Int()); // are monitoring for changes but we receive notification
+ test_KErrNone(reqStat3.Int()); // because the notification path has been changed
fs.NotifyChange(ENotifyAll,reqStat,path);
// Notification request is submitted, despite the subject's disappearance
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
fs.NotifyChange(ENotifyEntry,reqStat2,path);
// Notification request is submitted, despite the subject's disappearance
- test(reqStat2==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
fs.NotifyChange(ENotifyFile,reqStat3,path);
// Notification request is submitted, despite the subject's disappearance
- test(reqStat3==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
fs.NotifyChangeCancel(reqStat);
User::WaitForRequest(reqStat);
- test(reqStat==KErrCancel);
+ test_Value(reqStat.Int(), reqStat==KErrCancel);
fs.NotifyChangeCancel(reqStat2);
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrCancel);
+ test_Value(reqStat2.Int(), reqStat2==KErrCancel);
fs.NotifyChangeCancel(reqStat3);
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrCancel);
+ test_Value(reqStat3.Int(), reqStat3==KErrCancel);
path=_L("\\F32-TEST\\NOTIFY\\");
fs.NotifyChange(ENotifyAll,reqStat,path);
fs.NotifyChange(ENotifyEntry,reqStat2,path);
fs.NotifyChange(ENotifyDir,reqStat3,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
r=TheFs.Rename(_L("\\F32-TEST\\NOTIFY\\"),_L("\\F32-TEST\\NOTIFY_CHANGED\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone); // Rename the directory we were monitoring
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
+ test_KErrNone(reqStat.Int()); // Rename the directory we were monitoring
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
// Tidy up the test directory before continuing (while testing notifications of renaming to the monitored directory)
@@ -3811,26 +3808,26 @@
fs.NotifyChange(ENotifyDir,reqStat3,path);
fs.NotifyChange(ENotifyFile,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=TheFs.Rename(_L("\\F32-TEST\\"),_L("\\F32-TST\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone); // Renaming to (under) the directory we were monitoring
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat.Int()); // Renaming to (under) the directory we were monitoring
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
fs.NotifyChangeCancel(reqStat4);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
path=_L("\\F32-TST\\NOTIFY\\");
fs.NotifyChange(ENotifyAll,reqStat,path);
@@ -3838,26 +3835,26 @@
fs.NotifyChange(ENotifyDir,reqStat3,path);
fs.NotifyChange(ENotifyFile,reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_CHANGED\\"),_L("\\F32-TST\\NOTIFY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone); // Renaming to the directory we were monitoring
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat.Int()); // Renaming to the directory we were monitoring
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
fs.NotifyChangeCancel(reqStat4);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
// Test combinations of notify types
test.Next(_L("Test combinations of notify types"));
@@ -3868,24 +3865,24 @@
fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyFile),reqStat3,path);
fs.NotifyChange((TNotifyType)(ENotifyDisk|ENotifyAttributes),reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending); // Monitoring ENotifyAttributes|ENotifyDisk
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring ENotifyAttributes|ENotifyDisk
file.Close();
fs.NotifyChangeCancel(reqStat4);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
// RFile::SetModified()
fs.NotifyChange(ENotifyAll,reqStat,path);
@@ -3893,28 +3890,28 @@
fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyFile),reqStat3,path);
fs.NotifyChange((TNotifyType)(ENotifyDisk|ENotifyAttributes),reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
TTime nowTime;
nowTime.HomeTime();
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite);
- test(r==KErrNone);
- test(reqStat==KRequestPending);
+ test_KErrNone(r);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
file.SetModified(now);
file.Close();
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat4);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KRequestPending);
- test(reqStat4==KErrNone);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_KErrNone(reqStat4.Int());
fs.NotifyChangeCancel();
User::WaitForRequest(reqStat3);
- test(reqStat3==KErrCancel);
+ test_Value(reqStat3.Int(), reqStat3==KErrCancel);
// RFile::Write()
fs.NotifyChange(ENotifyAll,reqStat,path);
@@ -3922,25 +3919,25 @@
fs.NotifyChange((TNotifyType)(ENotifyFile|ENotifyWrite),reqStat3,path);
fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyWrite),reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
file.Close();
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat3);
User::WaitForRequest(reqStat4);
- test(reqStat==KErrNone);
- test(reqStat2==KRequestPending);
- test(reqStat3==KErrNone);
- test(reqStat4==KErrNone);
+ test_KErrNone(reqStat.Int());
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_KErrNone(reqStat3.Int());
+ test_KErrNone(reqStat4.Int());
fs.NotifyChangeCancel(reqStat2); // Cancels all outstanding notification requests
User::WaitForRequest(reqStat2);
- test(reqStat2==KErrCancel);
+ test_Value(reqStat2.Int(), reqStat2==KErrCancel);
// RFs::Delete()
test.Next(_L("RFs::Delete()"));
@@ -3949,23 +3946,23 @@
fs.NotifyChange((TNotifyType)(ENotifyFile|ENotifyWrite),reqStat3,path);
fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyWrite),reqStat4,path);
- test(reqStat==KRequestPending);
- test(reqStat2==KRequestPending);
- test(reqStat3==KRequestPending);
- test(reqStat4==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
+ test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+ test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Munchkin.msg"));
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(reqStat);
User::WaitForRequest(reqStat2);
User::WaitForRequest(reqStat3);
- test(reqStat==KErrNone);
- test(reqStat2==KErrNone);
- test(reqStat3==KErrNone);
- test(reqStat4==KRequestPending);
+ test_KErrNone(reqStat.Int());
+ test_KErrNone(reqStat2.Int());
+ test_KErrNone(reqStat3.Int());
+ test_Value(reqStat4.Int(), reqStat4==KRequestPending);
fs.NotifyChangeCancel(reqStat4);
User::WaitForRequest(reqStat4);
- test(reqStat4==KErrCancel);
+ test_Value(reqStat4.Int(), reqStat4==KErrCancel);
fs.Close();
}
@@ -3983,48 +3980,48 @@
RFs fs;
TInt r=fs.Connect();
- test(r==KErrNone);
+ test_KErrNone(r);
TDriveInfo driveInfo;
TInt driveNum = EDriveC + SocketToDrive[gSocketNumber];
// verify TDriveInfo.iType == EMediaHardDisk
r = fs.Drive(driveInfo, driveNum);
- test (r == KErrNone);
+ test_KErrNone(r);
test.Printf(_L("iType = %d\n"), driveInfo.iType);
test(driveInfo.iType == EMediaHardDisk);
// ask the user to eject the media
TheFs.NotifyChange(ENotifyEntry,reqStat);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
test.Printf(_L("Please eject media on drive %C...\n"), 'A' + driveNum);
User::WaitForRequest(reqStat);
test.Printf(_L("Done.\n"));
TInt reqInt=reqStat.Int();
- test(reqInt==KErrNone);
+ test_KErrNone(reqInt);
User::WaitForRequest(reqStat);
// verify TDriveInfo.iType == EMediaNotPresent
r = fs.Drive(driveInfo, driveNum);
- test (r == KErrNone);
+ test_KErrNone(r);
test.Printf(_L("iType = %d\n"), driveInfo.iType);
test(driveInfo.iType == EMediaNotPresent);
// ask the user to re-insert the media
TheFs.NotifyChange(ENotifyEntry,reqStat);
- test(reqStat==KRequestPending);
+ test_Value(reqStat.Int(), reqStat==KRequestPending);
test.Printf(_L("Please re-insert media...\n"));
User::WaitForRequest(reqStat);
test.Printf(_L("Done.\n"));
reqInt = reqStat.Int();
- test(reqInt==KErrNone);
+ test_KErrNone(reqInt);
User::WaitForRequest(reqStat);
// verify TDriveInfo.iType == EMediaHardDisk
r = fs.Drive(driveInfo, driveNum);
- test (r == KErrNone);
+ test_KErrNone(r);
test.Printf(_L("iType = %d\n"), driveInfo.iType);
test(driveInfo.iType == EMediaHardDisk);
@@ -4058,39 +4055,39 @@
test.Next(_L("Test original behaviour of asynchronous read API"));
RFile reader;
TInt r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf8<596> readBuf;
reader.Read(0, readBuf, 100, readStat1);
User::WaitForRequest(readStat1);
- test(readStat1==KErrNone);
- test(readBuf.Length()==0);
+ test_KErrNone(readStat1.Int());
+ test_Equal(0, readBuf.Length());
reader.Close();
test.Next(_L("Test asynchronous read fails in EFileShareExclusive mode"));
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareExclusive);
- test(r==KErrArgument);
+ test_Value(r, r == KErrArgument);
test.Next(_L("Test asynchronous read fails in EFileShareReadersOnly mode"));
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareReadersOnly);
- test(r==KErrArgument);
+ test_Value(r, r == KErrArgument);
test.Next(_L("Test asynchronous read is cancelled when file is closed"));
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
reader.Read(0, readBuf, 100, readStat1);
- test(readStat1==KRequestPending);
+ test_Value(readStat1.Int(), readStat1==KRequestPending);
reader.Close();
User::WaitForRequest(readStat1);
- test(readStat1==KErrCancel);
+ test_Value(readStat1.Int(), readStat1==KErrCancel);
test.Next(_L("Test asynchronous read can be cancelled"));
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
reader.Read(0, readBuf, 100, readStat1);
- test(readStat1==KRequestPending);
+ test_Value(readStat1.Int(), readStat1==KRequestPending);
reader.ReadCancel(readStat1);
User::WaitForRequest(readStat1);
- test(readStat1==KErrCancel);
+ test_Value(readStat1.Int(), readStat1==KErrCancel);
reader.Close();
// DEF105438: File server thread safety issues
@@ -4098,63 +4095,63 @@
// runs (to test whether cancelling still works...)
test.Next(_L("Test asynchronous read is cancelled when running at high priority"));
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
RThread thisThread;
thisThread.SetPriority(EPriorityRealTime);
reader.Read(0, readBuf, 100, readStat1);
- test(readStat1==KRequestPending);
+ test_Value(readStat1.Int(), readStat1==KRequestPending);
reader.ReadCancel(readStat1);
test.Printf(_L("readStat1 %d"), readStat1.Int());
User::WaitForRequest(readStat1);
- test(readStat1==KErrCancel);
+ test_Value(readStat1.Int(), readStat1==KErrCancel);
reader.Close();
thisThread.SetPriority(EPriorityNormal);
test.Next(_L("Test asynchronous read is notified due to RFile::SetSize()"));
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
reader.Read(0, readBuf, 100, readStat1);
- test(readStat1==KRequestPending);
+ test_Value(readStat1.Int(), readStat1==KRequestPending);
r = reader.SetSize(100);
- test(r==KErrNone);
+ test_KErrNone(r);
User::WaitForRequest(readStat1);
- test(readStat1==KErrNone);
- test(readBuf.Length() == 100);
+ test_KErrNone(readStat1.Int());
+ test_Equal(100, readBuf.Length());
r=reader.SetSize(0);
- test(r==KErrNone);
+ test_KErrNone(r);
reader.Close();
test.Next(_L("Test asynchronous read is notified due to RFile::Write()"));
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
reader.Read(0, readBuf, 26, readStat1);
- test(readStat1==KRequestPending);
+ test_Value(readStat1.Int(), readStat1==KRequestPending);
RFile writer;
r=writer.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileWrite|EFileShareAny);
writer.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
User::WaitForRequest(readStat1);
- test(readStat1==KErrNone);
- test(readBuf.Length() == 26);
+ test_KErrNone(readStat1.Int());
+ test_Equal(26, readBuf.Length());
reader.Close();
writer.Close();
test.Next(_L("Test multiple asynchronous readers notified from separate thread"));
r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny);
- test(r==KErrNone);
+ test_KErrNone(r);
r=reader.SetSize(0);
- test(r==KErrNone);
+ test_KErrNone(r);
const TInt KReadLen = 26;
test.Printf(_L(">Read%d[%d]\n"), 0, KReadLen);
reader.Read(0, readBuf, KReadLen, readStat1);
TBuf8<596> readBuf2;
test.Printf(_L(">Read%d[%d]\n"), 1, KReadLen);
reader.Read(KReadLen, readBuf2, KReadLen, readStat2);
- test(readStat1==KRequestPending);
- test(readStat2==KRequestPending);
+ test_Value(readStat1.Int(), readStat1==KRequestPending);
+ test_Value(readStat2.Int(), readStat2==KRequestPending);
RThread thread;
r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest12);
- test(r==KErrNone);
+ test_KErrNone(r);
thread.Logon(thrdStat);
thread.Resume();
thread.Close();
@@ -4163,7 +4160,7 @@
TRequestStatus timerStat(KRequestPending);
timer.CreateLocal();
timer.After(timerStat, 30000000); // 30 seconds timeout (the following async test should take 10 seconds)
- test(timerStat==KRequestPending);
+ test_Value(timerStat.Int(), timerStat==KRequestPending);
#define ODDPASS (pass&0x01)
#define REQSTAT (ODDPASS ? readStat2 : readStat1)
@@ -4177,13 +4174,13 @@
FOREVER
{
User::WaitForRequest(REQSTAT, timerStat);
- test(REQSTAT==KErrNone);
- test(timerStat==KRequestPending);
- test(READBUF.Length() == COMPLEN);
+ test_KErrNone(REQSTAT.Int());
+ test_Value(timerStat.Int(), timerStat==KRequestPending);
+ test_Equal(COMPLEN, READBUF.Length());
test(READBUF.Right(KReadLen) == _L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
test.Printf(_L(">Read%d[%d]\n"), pass&0x01, READLEN);
reader.Read(READPOS, READBUF, READLEN, REQSTAT);
- test(REQSTAT==KRequestPending);
+ test_Value(REQSTAT.Int(), REQSTAT==KRequestPending);
if(++pass==10)
break;
}
@@ -4193,12 +4190,12 @@
User::WaitForRequest(timerStat);
reader.Close();
User::WaitForRequest(readStat1);
- test(readStat1==KErrCancel);
+ test_Value(readStat1.Int(), readStat1==KErrCancel);
User::WaitForRequest(readStat2);
- test(readStat2==KErrCancel);
+ test_Value(readStat2.Int(), readStat2==KErrCancel);
User::WaitForRequest(thrdStat);
- test(thrdStat==KErrNone);
+ test_KErrNone(thrdStat.Int());
}
@@ -4218,7 +4215,7 @@
//-- set up notifier
TheFs.NotifyChange(ENotifyAll, reqStatNotify1, KTestPath);
- test(reqStatNotify1.Int() == KRequestPending);
+ test_Value(reqStatNotify1.Int(), reqStatNotify1 == KRequestPending);
//-- create a file in the root dir
RFile file;
@@ -4227,12 +4224,12 @@
fileName.Append(_L("TestFile.tst"));
nRes=file.Replace(TheFs, fileName, EFileWrite|EFileRead);
- test(nRes == KErrNone || nRes ==KErrAlreadyExists);
+ test_Value(nRes, nRes == KErrNone || nRes ==KErrAlreadyExists);
file.Close();
//-- check that the notifier worked
User::WaitForRequest(reqStatNotify1);
- test(reqStatNotify1.Int() == KErrNone);
+ test_KErrNone(reqStatNotify1.Int());
}
@@ -4287,7 +4284,7 @@
if (r == KErrNotSupported)
continue;
- test(r==KErrNone);
+ test_KErrNone(r);
TInt sockNum = 0;
if (d.IsRemovable(sockNum)>0)
{
@@ -4323,7 +4320,7 @@
// Test RFs::NotifyChange() extended notification
TInt uid;
- test(HAL::Get(HAL::EMachineUid,uid)==KErrNone);
+ test_KErrNone(HAL::Get(HAL::EMachineUid,uid));
if(uid!=HAL::EMachineUid_Cogent && uid!=HAL::EMachineUid_IQ80310 &&
uid != HAL::EMachineUid_Integrator && uid!=HAL::EMachineUid_X86PC)
MediaChangeExtendedNotification();
--- a/userlibandfileserver/fileserver/group/release.txt Thu Jun 10 11:48:01 2010 +0100
+++ b/userlibandfileserver/fileserver/group/release.txt Wed Jun 23 11:59:44 2010 +0100
@@ -1,3 +1,22 @@
+Version 2.00.3046
+=================
+(Made by vfebvre 07/06/2010)
+
+1. davegord
+ 1. ou1cimx1#414735 Occasional Loader crashes observed during T_WSD_TST_* tests
+ Crash caused by interrupt occurring during handling of SWI called from
+ SVC mode -- which is not supported. Fix is for Loader not to call RDebug
+ methods while executing in supervisor mode.
+
+
+Version 2.00.3045
+=================
+(Made by vfebvre 04/06/2010)
+
+1. famustaf
+ 1. ou1cimx1#383105 Modify F32 Tests for Platsim's HVFS
+
+
Version 2.00.3044
=================
(Made by vfebvre 27/05/2010)
--- a/userlibandfileserver/fileserver/inc/f32ver.h Thu Jun 10 11:48:01 2010 +0100
+++ b/userlibandfileserver/fileserver/inc/f32ver.h Wed Jun 23 11:59:44 2010 +0100
@@ -58,6 +58,6 @@
@see TVersion
*/
-const TInt KF32BuildVersionNumber=3044;
+const TInt KF32BuildVersionNumber=3046;
//
#endif
--- a/userlibandfileserver/fileserver/sfile/sf_lepoc.cpp Thu Jun 10 11:48:01 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_lepoc.cpp Wed Jun 23 11:59:44 2010 +0100
@@ -287,9 +287,22 @@
}
}
-// A version that will work in user or supervisor mode
-void MyPrintf(const char* aFmt, ...)
+/**
+It would be nice to be able to print debug information from the various functions
+supervisor-mode functions below. Unfortunately, we can't call RDebug::Printf() or
+any of its relatives in supervisor mode, and of course we can't call the equivalent
+kernel functions even when we're already in supervisor mode, because the entry
+points aren't visible.
+
+So this function just wraps and guards the call to RDebug, so we won't call it
+in SVC mode. The outcome is that trace messages are only generated if using the
+flexible memory model, where the code doesn't actually run in SVC mode anyway.
+*/
+void svPrintf(const char* aFmt, ...)
{
+ if (gExecutesInSupervisorMode)
+ return;
+
VA_LIST list;
VA_START(list, aFmt);
TPtrC8 fmt((const TText8*)aFmt);
@@ -379,15 +392,15 @@
E32Image& exporter = *(E32Image*)aPtr;
// Dump everything potentially useful that we know about the exporter ...
- __LDRTRACE(MyPrintf("RelocateExports: paged? %d, iRomImageHeader@%08x, iHeader@%08x",
+ __LDRTRACE(svPrintf("RelocateExports: paged? %d, iRomImageHeader@%08x, iHeader@%08x",
exporter.iUseCodePaging, exporter.iRomImageHeader, exporter.iHeader));
- __LDRTRACE(MyPrintf(" iCodeLoadAddress %08x, iCodeRunAddress %08x, iCodeSize %x iTextSize %x",
+ __LDRTRACE(svPrintf(" iCodeLoadAddress %08x, iCodeRunAddress %08x, iCodeSize %x iTextSize %x",
exporter.iCodeLoadAddress, exporter.iCodeRunAddress,
exporter.iCodeSize, exporter.iTextSize))
- __LDRTRACE(MyPrintf(" iDataLoadAddress %08x, iDataRunAddress %08x, iDataSize %x iBssSize %x iTotalDataSize %x",
+ __LDRTRACE(svPrintf(" iDataLoadAddress %08x, iDataRunAddress %08x, iDataSize %x iBssSize %x iTotalDataSize %x",
exporter.iDataLoadAddress, exporter.iDataRunAddress,
exporter.iDataSize, exporter.iBssSize, exporter.iTotalDataSize));
- __LDRTRACE(MyPrintf(" iCodeDelta, %x iDataDelta %x, iExportDirEntryDelta %x",
+ __LDRTRACE(svPrintf(" iCodeDelta, %x iDataDelta %x, iExportDirEntryDelta %x",
exporter.iCodeDelta, exporter.iDataDelta, exporter.iExportDirEntryDelta));
// It turns out that very little of the exporter info is useful! For
@@ -429,7 +442,7 @@
newValue = relocAddr; // unknown - just leave it alone
*destExport++ = newValue;
- __LDRTRACE(MyPrintf("RelocateExports: export %d %08x => %08x %c",
+ __LDRTRACE(svPrintf("RelocateExports: export %d %08x => %08x %c",
exporter.iExportDirCount-i, relocAddr, newValue,
(relocAddr >= codeStart && relocAddr < codeFinish) ? 'C' :
(relocAddr >= dataStart && relocAddr < dataFinish) ? 'D' : 'X'));
@@ -471,39 +484,39 @@
E32Image& exporter = *info.iExporter;
#ifdef _DEBUG
- __LDRTRACE(MyPrintf(">svFixupImportAddresses %d imports, code@%08x, fixup@%08x exporter@%08x",
+ __LDRTRACE(svPrintf(">svFixupImportAddresses %d imports, code@%08x, fixup@%08x exporter@%08x",
info.iNumImports, info.iCodeLoadAddress, info.iFixup64, info.iExporter));
// Dump everything potentially useful that we know about the exporter ...
- __LDRTRACE(MyPrintf("%S: paged? %d, iRomImageHeader@%08x, iHeader@%08x",
+ __LDRTRACE(svPrintf("%S: paged? %d, iRomImageHeader@%08x, iHeader@%08x",
&exporter.iFileName, exporter.iUseCodePaging,
exporter.iRomImageHeader, exporter.iHeader));
- __LDRTRACE(MyPrintf("iCodeLoadAddress %08x, iCodeRunAddress %08x, iCodeSize %x iTextSize %x",
+ __LDRTRACE(svPrintf("iCodeLoadAddress %08x, iCodeRunAddress %08x, iCodeSize %x iTextSize %x",
exporter.iCodeLoadAddress, exporter.iCodeRunAddress,
exporter.iCodeSize, exporter.iTextSize))
- __LDRTRACE(MyPrintf("iDataLoadAddress %08x, iDataRunAddress %08x, iDataSize %x iBssSize %x iTotalDataSize %x",
+ __LDRTRACE(svPrintf("iDataLoadAddress %08x, iDataRunAddress %08x, iDataSize %x iBssSize %x iTotalDataSize %x",
exporter.iDataLoadAddress, exporter.iDataRunAddress,
exporter.iDataSize, exporter.iBssSize, exporter.iTotalDataSize));
- __LDRTRACE(MyPrintf("iCodeDelta, %x iDataDelta %x, iExportDirEntryDelta %x",
+ __LDRTRACE(svPrintf("iCodeDelta, %x iDataDelta %x, iExportDirEntryDelta %x",
exporter.iCodeDelta, exporter.iDataDelta, exporter.iExportDirEntryDelta));
if (exporter.iRomImageHeader)
{
const TRomImageHeader& rh = *exporter.iRomImageHeader;
- __LDRTRACE(MyPrintf("ROM: iCodeAddress %08x, iCodeSize %x, iTextSize %x",
+ __LDRTRACE(svPrintf("ROM: iCodeAddress %08x, iCodeSize %x, iTextSize %x",
rh.iCodeAddress, rh.iCodeSize, rh.iTextSize));
- __LDRTRACE(MyPrintf("ROM: iDataAddress %08x, iDataSize %x, iBssSize %x",
+ __LDRTRACE(svPrintf("ROM: iDataAddress %08x, iDataSize %x, iBssSize %x",
rh.iDataAddress, rh.iDataSize, rh.iBssSize));
- __LDRTRACE(MyPrintf("ROM: iDataBssLinearBase %08x, iTotalDataSize %x",
+ __LDRTRACE(svPrintf("ROM: iDataBssLinearBase %08x, iTotalDataSize %x",
rh.iDataBssLinearBase, rh.iTotalDataSize));
}
if (exporter.iHeader)
{
const E32ImageHeader& ih = *exporter.iHeader;
- __LDRTRACE(MyPrintf("HEAD: iCodeBase %08x, iCodeSize %x, iTextSize %x",
+ __LDRTRACE(svPrintf("HEAD: iCodeBase %08x, iCodeSize %x, iTextSize %x",
ih.iCodeBase, ih.iCodeSize, ih.iTextSize));
- __LDRTRACE(MyPrintf("HEAD: iDataBase %08x, iDataSize %x, iBssSize %x",
+ __LDRTRACE(svPrintf("HEAD: iDataBase %08x, iDataSize %x, iBssSize %x",
ih.iDataBase, ih.iDataSize, ih.iBssSize));
}
#endif // _DEBUG
@@ -538,7 +551,7 @@
newValue = expAddr;
}
- __LDRTRACE(MyPrintf("svFixupImportAddresses: import[%d]@%08x is export[%d] == %08x",
+ __LDRTRACE(svPrintf("svFixupImportAddresses: import[%d]@%08x is export[%d] == %08x",
iat - info.iIat, iat, ordinal, newValue));
// In non-paged code, we can simply replace the ordinals in the IAT with the
@@ -573,39 +586,39 @@
E32Image& exporter = *info.iExporter;
#ifdef _DEBUG
- __LDRTRACE(MyPrintf(">svElfDerivedFixupImportAddresses %d imports, code@%08x, fixup@%08x exporter@%08x",
+ __LDRTRACE(svPrintf(">svElfDerivedFixupImportAddresses %d imports, code@%08x, fixup@%08x exporter@%08x",
info.iNumImports, info.iCodeLoadAddress, info.iFixup64, info.iExporter));
// Dump everything potentially useful that we know about the exporter ...
- __LDRTRACE(MyPrintf("%S: paged? %d, iRomImageHeader@%08x, iHeader@%08x",
+ __LDRTRACE(svPrintf("%S: paged? %d, iRomImageHeader@%08x, iHeader@%08x",
&exporter.iFileName, exporter.iUseCodePaging,
exporter.iRomImageHeader, exporter.iHeader));
- __LDRTRACE(MyPrintf("iCodeLoadAddress %08x, iCodeRunAddress %08x, iCodeSize %x iTextSize %x",
+ __LDRTRACE(svPrintf("iCodeLoadAddress %08x, iCodeRunAddress %08x, iCodeSize %x iTextSize %x",
exporter.iCodeLoadAddress, exporter.iCodeRunAddress,
exporter.iCodeSize, exporter.iTextSize))
- __LDRTRACE(MyPrintf("iDataLoadAddress %08x, iDataRunAddress %08x, iDataSize %x iBssSize %x iTotalDataSize %x",
+ __LDRTRACE(svPrintf("iDataLoadAddress %08x, iDataRunAddress %08x, iDataSize %x iBssSize %x iTotalDataSize %x",
exporter.iDataLoadAddress, exporter.iDataRunAddress,
exporter.iDataSize, exporter.iBssSize, exporter.iTotalDataSize));
- __LDRTRACE(MyPrintf("iCodeDelta, %x iDataDelta %x, iExportDirEntryDelta %x",
+ __LDRTRACE(svPrintf("iCodeDelta, %x iDataDelta %x, iExportDirEntryDelta %x",
exporter.iCodeDelta, exporter.iDataDelta, exporter.iExportDirEntryDelta));
if (exporter.iRomImageHeader)
{
const TRomImageHeader& rh = *exporter.iRomImageHeader;
- __LDRTRACE(MyPrintf("ROM: iCodeAddress %08x, iCodeSize %x, iTextSize %x",
+ __LDRTRACE(svPrintf("ROM: iCodeAddress %08x, iCodeSize %x, iTextSize %x",
rh.iCodeAddress, rh.iCodeSize, rh.iTextSize));
- __LDRTRACE(MyPrintf("ROM: iDataAddress %08x, iDataSize %x, iBssSize %x",
+ __LDRTRACE(svPrintf("ROM: iDataAddress %08x, iDataSize %x, iBssSize %x",
rh.iDataAddress, rh.iDataSize, rh.iBssSize));
- __LDRTRACE(MyPrintf("ROM: iDataBssLinearBase %08x, iTotalDataSize %x",
+ __LDRTRACE(svPrintf("ROM: iDataBssLinearBase %08x, iTotalDataSize %x",
rh.iDataBssLinearBase, rh.iTotalDataSize));
}
if (exporter.iHeader)
{
const E32ImageHeader& ih = *exporter.iHeader;
- __LDRTRACE(MyPrintf("HEAD: iCodeBase %08x, iCodeSize %x, iTextSize %x",
+ __LDRTRACE(svPrintf("HEAD: iCodeBase %08x, iCodeSize %x, iTextSize %x",
ih.iCodeBase, ih.iCodeSize, ih.iTextSize));
- __LDRTRACE(MyPrintf("HEAD: iDataBase %08x, iDataSize %x, iBssSize %x",
+ __LDRTRACE(svPrintf("HEAD: iDataBase %08x, iDataSize %x, iBssSize %x",
ih.iDataBase, ih.iDataSize, ih.iBssSize));
}
#endif // _DEBUG
@@ -700,7 +713,7 @@
newValue = expAddr + sectionDelta + adjustment;
}
- __LDRTRACE(MyPrintf("svElfDerivedFixupImportAddresses: import[%d] (%08x:%08x) is export[%d] %08x+%08x => %08x",
+ __LDRTRACE(svPrintf("svElfDerivedFixupImportAddresses: import[%d] (%08x:%08x) is export[%d] %08x+%08x => %08x",
iol - info.iImportOffsetList, codePtr, importInfo, ordinal, expAddr, adjustment, newValue));
// In non-paged code, we can simply replace the ordinals in the IAT with the