1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/store/TFILE/t_storfcomp.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,613 @@
1.4 +// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <s32file.h>
1.20 +#include <e32test.h>
1.21 +#include <e32math.h>
1.22 +
1.23 +const TInt KTestCleanupStack=0x20;
1.24 +
1.25 +// This is a path specification and should not be used as is
1.26 +_LIT(KFileLocationSpec, "Z:\\STOR-TST\\T_COMPACT.DAT");
1.27 +_LIT(KResultsFile,"RESULTS_%d.TXT");
1.28 +
1.29 +static TFileName TheResultsFile;
1.30 +static TBool AllTests=ETrue;
1.31 +static TInt Iterations=10000;
1.32 +static TInt DataVolume=160;
1.33 +static TInt CompactFrequency=40;
1.34 +
1.35 +class RLog
1.36 + {
1.37 +public:
1.38 + void CreateL(RFs& aFs, const TDesC& aFile);
1.39 + void Close();
1.40 + void PrintL(const char* aFormat, ...);
1.41 +private:
1.42 + RFileWriteStream iLog;
1.43 + };
1.44 +
1.45 +LOCAL_D CTrapCleanup* TheTrapCleanup;
1.46 +LOCAL_D RTest test(_L("t_storfcomp"));
1.47 +LOCAL_D RFs TheFs;
1.48 +LOCAL_D RLog TheLog;
1.49 +
1.50 +class StopWatch
1.51 + {
1.52 +public:
1.53 + void Start();
1.54 + TUint Stop();
1.55 +private:
1.56 + TTime iTime;
1.57 + };
1.58 +
1.59 +void StopWatch::Start()
1.60 + {
1.61 + iTime.UniversalTime();
1.62 + }
1.63 +
1.64 +TUint StopWatch::Stop()
1.65 + {
1.66 + TTime t;
1.67 + t.UniversalTime();
1.68 + TInt64 i = ((t.MicroSecondsFrom(iTime).Int64()) + 500)/1000;
1.69 + return I64LOW(i);
1.70 + }
1.71 +
1.72 +StopWatch CompactSW;
1.73 +
1.74 +void CompactL(CFileStore& aStore)
1.75 +//
1.76 +// Compact the file and record the stats
1.77 +//
1.78 + {
1.79 + aStore.CommitL();
1.80 + TInt startSize;
1.81 + User::LeaveIfError(aStore.File().Size(startSize));
1.82 + CompactSW.Start();
1.83 + TInt wasted = aStore.CompactL();
1.84 + aStore.CommitL();
1.85 + TUint ms = CompactSW.Stop();
1.86 + TInt endSize;
1.87 + User::LeaveIfError(aStore.File().Size(endSize));
1.88 + TheLog.PrintL("%d\t%d\t%d\t%u\n",startSize, endSize, wasted, ms);
1.89 + }
1.90 +
1.91 +void ReclaimCompactL(CFileStore& aStore, TInt aTrigger)
1.92 +//
1.93 +// Reclaim the file and compact on trigger
1.94 +//
1.95 + {
1.96 + TInt startSize;
1.97 + User::LeaveIfError(aStore.File().Size(startSize));
1.98 + CompactSW.Start();
1.99 + TBool compacted = EFalse;
1.100 + if (aTrigger == 0 || aStore.ReclaimL() * 100 > startSize * aTrigger)
1.101 + {
1.102 + aStore.CompactL();
1.103 + aStore.CommitL();
1.104 + compacted = ETrue;
1.105 + }
1.106 + TUint ms = CompactSW.Stop();
1.107 + TInt endSize;
1.108 + User::LeaveIfError(aStore.File().Size(endSize));
1.109 + TheLog.PrintL("%s\t%d\t%u\n",compacted ? "Compact" : "Reclaim", startSize - endSize, ms);
1.110 + }
1.111 +
1.112 +void WriteBytesL(RWriteStream& s, TInt aCount)
1.113 + {
1.114 + const TInt KBufSize = 512;
1.115 + TUint8 buf[KBufSize];
1.116 + while (aCount > KBufSize)
1.117 + {
1.118 + s.WriteL(buf, KBufSize);
1.119 + aCount -= KBufSize;
1.120 + }
1.121 + s.WriteL(buf, aCount);
1.122 + s.CommitL();
1.123 + }
1.124 +
1.125 +TStreamId CreateStreamL(CStreamStore& aStore, TInt aSize)
1.126 + {
1.127 + RStoreWriteStream s;
1.128 + TStreamId id = s.CreateLC(aStore);
1.129 + WriteBytesL(s, aSize);
1.130 + CleanupStack::PopAndDestroy(&s);
1.131 + return id;
1.132 + }
1.133 +
1.134 +TInt Random(TUint aLimit)
1.135 + {
1.136 + return Math::Random() % aLimit;
1.137 + }
1.138 +
1.139 +
1.140 +TBool AllocationFailure()
1.141 + {
1.142 + User::__DbgSetAllocFail(RHeap::EUser,RHeap::EFailNext,1);
1.143 + TAny* cell = User::Alloc(4);
1.144 + User::Free(cell);
1.145 + User::__DbgSetAllocFail(RHeap::EUser,RHeap::ENone,1);
1.146 + return cell == 0;
1.147 + }
1.148 +/**
1.149 +@SYMTestCaseID SYSLIB-STORE-CT-1144
1.150 +@SYMTestCaseDesc Tests for CFileStore::CompactL() function
1.151 +@SYMTestPriority High
1.152 +@SYMTestActions Attempt for compaction process on the store.Tests for KErrNone flag
1.153 +@SYMTestExpectedResults Test must not fail
1.154 +@SYMREQ REQ0000
1.155 +*/
1.156 +void BasicCompactionTestsL()
1.157 + {
1.158 + const TInt KTestCount = 40;
1.159 + const TInt KTestSize = 50;
1.160 + TParsePtrC parse(KFileLocationSpec);
1.161 +//
1.162 + test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1144 "));
1.163 + CFileStore* store = CPermanentFileStore::ReplaceLC(TheFs, parse.NameAndExt(), EFileRead|EFileWrite);
1.164 +
1.165 + store->SetTypeL(store->Layout());
1.166 +//
1.167 + TheLog.PrintL("Compact uncommitted empty store\n");
1.168 + TRAPD(r, store->CompactL());
1.169 + test (r == KErrNone);
1.170 +//
1.171 + TheLog.PrintL("Compact committed empty store\n");
1.172 + r = store->Commit();
1.173 + test (r == KErrNone);
1.174 + TRAP(r, store->CompactL());
1.175 + test (r == KErrNone);
1.176 +//
1.177 + TheLog.PrintL("Compact empty store with full TOC\n");
1.178 + TStreamId streams[KTestCount];
1.179 + TInt i;
1.180 + for (i = 0; i < KTestCount; ++i)
1.181 + streams[i] = CreateStreamL(*store, KTestSize);
1.182 + store->CommitL();
1.183 + for (i = 0; i < KTestCount; ++i)
1.184 + store->DeleteL(streams[i]);
1.185 + store->CommitL();
1.186 + TRAP(r, store->CompactL());
1.187 + test (r == KErrNone);
1.188 +//
1.189 + TheLog.PrintL("Compact empty store with delta TOC\n");
1.190 + streams[0] = CreateStreamL(*store, KTestSize);
1.191 + store->CommitL();
1.192 + store->DeleteL(streams[0]);
1.193 + store->CommitL();
1.194 + TRAP(r, store->CompactL());
1.195 + test (r == KErrNone);
1.196 +//
1.197 + CleanupStack::PopAndDestroy(store);
1.198 + }
1.199 +
1.200 +/**
1.201 +@SYMTestCaseID SYSLIB-STORE-CT-1145
1.202 +@SYMTestCaseDesc Testing fallback compaction algorithm
1.203 +@SYMTestPriority High
1.204 +@SYMTestActions Tests for compaction process on the store,
1.205 + If we have allocation failure we can test that the fallback algorithm is in place
1.206 +@SYMTestExpectedResults Test must not fail
1.207 +@SYMREQ REQ0000
1.208 +*/
1.209 +void CompactionAlgorithmTestL()
1.210 + {
1.211 + const TInt KTestCount = 200;
1.212 + const TInt KTestSize = 50;
1.213 + const TInt KBeyondSuccess = 2;
1.214 + TInt stopat = KMaxTInt;
1.215 + TInt bestTime = -1;
1.216 + TParsePtrC parse(KFileLocationSpec);
1.217 +//
1.218 + test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1145 "));
1.219 + TheLog.PrintL("Testing fallback compaction algorithm\n");
1.220 +//
1.221 + for (TInt failat = 1; failat <= stopat; ++failat)
1.222 + {
1.223 + TheLog.PrintL("Fail allocation #%d: ", failat);
1.224 +//
1.225 + // prepare the store. Leave a single hole at the beginning
1.226 + CFileStore* store = CPermanentFileStore::ReplaceLC(TheFs, parse.NameAndExt(), EFileRead|EFileWrite);
1.227 + store->SetTypeL(store->Layout());
1.228 + TStreamId first = CreateStreamL(*store, KTestSize);
1.229 + for (TInt i = 1; i < KTestCount; ++i)
1.230 + CreateStreamL(*store, KTestSize);
1.231 + store->CommitL();
1.232 + store->DeleteL(first);
1.233 + store->CommitL();
1.234 + //
1.235 + User::__DbgSetAllocFail(RHeap::EUser,RHeap::EFailNext,failat);
1.236 + CompactSW.Start();
1.237 + TRAPD(r, store->CompactL(); store->CommitL();)
1.238 + TInt ms = CompactSW.Stop();
1.239 + User::__DbgSetAllocFail(RHeap::EUser,RHeap::ENone,1);
1.240 + //
1.241 + if (r != KErrNone)
1.242 + {
1.243 + test (bestTime == -1);
1.244 + TheLog.PrintL("compaction failed\n");
1.245 + }
1.246 + else
1.247 + {
1.248 + TheLog.PrintL("compaction succeeded in %u ms\n", ms);
1.249 + if (bestTime == -1)
1.250 + {
1.251 + bestTime = ms;
1.252 + stopat = failat + KBeyondSuccess; //stop after a few passes after sucsss
1.253 + }
1.254 + else if (ms < bestTime)
1.255 + {
1.256 + if (ms < bestTime/2)
1.257 + stopat = failat + KBeyondSuccess; // new algorithm has kicked in
1.258 + bestTime = ms;
1.259 + }
1.260 + }
1.261 +
1.262 + CleanupStack::PopAndDestroy(store);
1.263 + }
1.264 + }
1.265 +
1.266 +
1.267 +struct TTracker
1.268 + {
1.269 + TStreamId iId;
1.270 + TInt iSize;
1.271 + };
1.272 +
1.273 +CFileStore* InitialiseStoreLC(RArray<TTracker>& aStreams, TInt aDataVolume, TInt aAverageSize)
1.274 + {
1.275 + TParsePtrC parse(KFileLocationSpec);
1.276 + CFileStore* store = CPermanentFileStore::ReplaceLC(TheFs, parse.NameAndExt(), EFileRead|EFileWrite);
1.277 + store->SetTypeL(store->Layout());
1.278 + for (TInt count = Max(1,(aDataVolume + aAverageSize/2)/aAverageSize); count > 0; --count)
1.279 + {
1.280 + TInt size;
1.281 + if (count == 1)
1.282 + size = aDataVolume;
1.283 + else
1.284 + {
1.285 + size = aDataVolume / count;
1.286 + TInt spread = Min(aAverageSize, size);
1.287 + size += Random(spread) - spread/2;
1.288 + }
1.289 + TTracker e;
1.290 + e.iSize = size;
1.291 + e.iId = CreateStreamL(*store, size);
1.292 + User::LeaveIfError(aStreams.Append(e));
1.293 + aDataVolume -= size;
1.294 + }
1.295 + store->CommitL();
1.296 + return store;
1.297 + }
1.298 +/**
1.299 +@SYMTestCaseID SYSLIB-STORE-CT-1146
1.300 +@SYMTestCaseDesc Tests for compaction on store
1.301 +@SYMTestPriority High
1.302 +@SYMTestActions Tests for CFileStore::CompactL() function
1.303 +@SYMTestExpectedResults Test must not fail
1.304 +@SYMREQ REQ0000
1.305 +*/
1.306 +void CompactionTestL(const TInt aIterations, const TInt aDataVolume, const TInt aAverageSize, const TInt aCommitFrequency, const TInt aCompactionFrequency)
1.307 + {
1.308 + test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1146 "));
1.309 + TheLog.PrintL("CompactionTest : \n");
1.310 + TheLog.PrintL("\tIterations:\t%d\n",aIterations);
1.311 + TheLog.PrintL("\tDataVolume:\t%d\n",aDataVolume);
1.312 + TheLog.PrintL("\tAverageSize:\t%d\n",aAverageSize);
1.313 + TheLog.PrintL("\tCommitFrequency:\t%d\n",aCommitFrequency);
1.314 + TheLog.PrintL("\tCompactionFrequency:\t%d\n\n",aCompactionFrequency);
1.315 +
1.316 + RArray<TTracker> streams(8);
1.317 + CleanupClosePushL(streams);
1.318 + CFileStore* store = InitialiseStoreLC(streams, aDataVolume, aAverageSize);
1.319 + const TInt maxCount = streams.Count() + (streams.Count() / 5);
1.320 + TInt size = aDataVolume;
1.321 + const TInt span = aDataVolume / 10; // +- 10%
1.322 + for (TInt i = aIterations ; --i >= 0; )
1.323 + {
1.324 + TInt from = Random(streams.Count());
1.325 + TInt to = Random(maxCount);
1.326 + TInt tfr = to == from ? 0 : Random(streams[from].iSize + 1);
1.327 + TInt adj = Random(span - 1) - span/2;
1.328 + if (size > aDataVolume + span/2)
1.329 + adj -= size - (aDataVolume + span/2);
1.330 + else if (size < aDataVolume - span/2)
1.331 + adj += (aDataVolume - span/2) - size;
1.332 + if (adj < 0)
1.333 + {
1.334 + if (adj < tfr - streams[from].iSize)
1.335 + adj = tfr - streams[from].iSize;
1.336 + }
1.337 + TInt fromSize = streams[from].iSize - tfr;
1.338 + if (adj < 0 || to == from)
1.339 + fromSize += adj;
1.340 + if (fromSize > 0)
1.341 + {
1.342 + RStoreWriteStream s;
1.343 + s.ReplaceLC(*store, streams[from].iId);
1.344 + WriteBytesL(s, fromSize);
1.345 + CleanupStack::PopAndDestroy(&s);
1.346 + streams[from].iSize = fromSize;
1.347 + }
1.348 +
1.349 + if (to != from)
1.350 + {
1.351 + if (to < streams.Count())
1.352 + {
1.353 + TInt toSize = streams[to].iSize + tfr;
1.354 + if (adj > 0)
1.355 + toSize += adj;
1.356 + RStoreWriteStream s;
1.357 + s.ReplaceLC(*store, streams[to].iId);
1.358 + WriteBytesL(s, toSize);
1.359 + CleanupStack::PopAndDestroy(&s);
1.360 + streams[to].iSize = toSize;
1.361 + }
1.362 + else
1.363 + {
1.364 + TInt toSize = tfr;
1.365 + if (adj > 0)
1.366 + toSize += adj;
1.367 + TTracker e;
1.368 + e.iSize = toSize;
1.369 + e.iId = CreateStreamL(*store, toSize);
1.370 + User::LeaveIfError(streams.Append(e));
1.371 + }
1.372 + }
1.373 + if (fromSize <= 0)
1.374 + {
1.375 + store->DeleteL(streams[from].iId);
1.376 + streams.Remove(from);
1.377 + }
1.378 + size += adj;
1.379 +//
1.380 + if (Random(aCommitFrequency) == 0)
1.381 + {
1.382 + store->CommitL();
1.383 + if (aCompactionFrequency <= 0)
1.384 + ReclaimCompactL(*store, -aCompactionFrequency);
1.385 + }
1.386 + if (aCompactionFrequency > 0 && Random(aCompactionFrequency) == 0)
1.387 + CompactL(*store);
1.388 + }
1.389 + CleanupStack::PopAndDestroy(store);
1.390 + CleanupStack::PopAndDestroy(&streams);
1.391 + TheLog.PrintL("\nCompactionTestEnd\n\n");
1.392 + }
1.393 +
1.394 +void RLog::CreateL(RFs& aFs, const TDesC& aFile)
1.395 + {
1.396 +#ifdef __WINS__
1.397 + User::LeaveIfError(iLog.Replace(aFs, aFile, EFileWrite));
1.398 +#endif
1.399 + }
1.400 +
1.401 +void RLog::Close()
1.402 + {
1.403 + iLog.Close();
1.404 + }
1.405 +
1.406 +void RLog::PrintL(const char* aFormat, ...)
1.407 + {
1.408 + VA_LIST list;
1.409 + VA_START(list,aFormat);
1.410 + TBuf8<256> b;
1.411 + b.FormatList(_L8(aFormat),list);
1.412 + VA_END(list);
1.413 +#ifdef __WINS__
1.414 + iLog.WriteL(b);
1.415 +#endif
1.416 + TBuf<256> b16;
1.417 + b16.Copy(b);
1.418 + test.Printf(_L("%S"),&b16);
1.419 + }
1.420 +
1.421 +void GetOpt()
1.422 + {
1.423 + TBuf<256> options;
1.424 + User::CommandLine(options);
1.425 + if (options.Length() > 0)
1.426 + {
1.427 + AllTests = EFalse;
1.428 + TLex lex(options);
1.429 + lex.SkipSpace();
1.430 + if (lex.Val(DataVolume) == KErrNone)
1.431 + {
1.432 + lex.SkipSpace();
1.433 + if (lex.Val(Iterations) == KErrNone)
1.434 + {
1.435 + lex.SkipSpace();
1.436 + lex.Val(CompactFrequency);
1.437 + }
1.438 + }
1.439 + }
1.440 + TheResultsFile.Format(KResultsFile,DataVolume);
1.441 + }
1.442 +
1.443 +void testCompactL()
1.444 + {
1.445 + GetOpt();
1.446 + TheLog.CreateL(TheFs, TheResultsFile);
1.447 + if (AllTests)
1.448 + {
1.449 + BasicCompactionTestsL();
1.450 + if (AllocationFailure())
1.451 + CompactionAlgorithmTestL();
1.452 + }
1.453 + CompactionTestL(Iterations, DataVolume<<10, 300, 5, CompactFrequency);
1.454 + TheLog.Close();
1.455 + }
1.456 +
1.457 +LOCAL_C void setupTestDirectory()
1.458 +//
1.459 +// Prepare the test directory.
1.460 +//
1.461 + {
1.462 + TInt r=TheFs.Connect();
1.463 + test(r==KErrNone);
1.464 +//
1.465 + TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive()));
1.466 + TParse parse;
1.467 + parse.Set(drive.Name(), &KFileLocationSpec, NULL);
1.468 +
1.469 + r=TheFs.MkDir(parse.DriveAndPath());
1.470 + test(r==KErrNone||r==KErrAlreadyExists);
1.471 + r=TheFs.SetSessionPath(parse.DriveAndPath());
1.472 + test(r==KErrNone);
1.473 + }
1.474 +
1.475 +LOCAL_C void setupCleanup()
1.476 +//
1.477 +// Initialise the cleanup stack.
1.478 +//
1.479 + {
1.480 + TheTrapCleanup=CTrapCleanup::New();
1.481 + test(TheTrapCleanup!=NULL);
1.482 + TRAPD(r,\
1.483 + {\
1.484 + for (TInt i=KTestCleanupStack;i>0;i--)\
1.485 + CleanupStack::PushL((TAny*)0);\
1.486 + CleanupStack::Pop(KTestCleanupStack);\
1.487 + });
1.488 + test(r==KErrNone);
1.489 + }
1.490 +
1.491 +LOCAL_C void DeleteDataFile(const TDesC& aFullName)
1.492 + {
1.493 + RFs fsSession;
1.494 + TInt err = fsSession.Connect();
1.495 + if(err == KErrNone)
1.496 + {
1.497 + TEntry entry;
1.498 + if(fsSession.Entry(aFullName, entry) == KErrNone)
1.499 + {
1.500 + RDebug::Print(_L("Deleting \"%S\" file.\n"), &aFullName);
1.501 + err = fsSession.SetAtt(aFullName, 0, KEntryAttReadOnly);
1.502 + if(err != KErrNone)
1.503 + {
1.504 + RDebug::Print(_L("Error %d changing \"%S\" file attributes.\n"), err, &aFullName);
1.505 + }
1.506 + err = fsSession.Delete(aFullName);
1.507 + if(err != KErrNone)
1.508 + {
1.509 + RDebug::Print(_L("Error %d deleting \"%S\" file.\n"), err, &aFullName);
1.510 + }
1.511 + }
1.512 + fsSession.Close();
1.513 + }
1.514 + else
1.515 + {
1.516 + RDebug::Print(_L("Error %d connecting file session. File: %S.\n"), err, &aFullName);
1.517 + }
1.518 + }
1.519 +
1.520 +class CTestStreamStore : public CStreamStore
1.521 + {
1.522 +public:
1.523 + static CTestStreamStore* NewL();
1.524 + virtual ~CTestStreamStore();
1.525 +
1.526 +private:
1.527 + CTestStreamStore();
1.528 + virtual MStreamBuf* DoReadL(TStreamId anId) const;
1.529 + virtual MStreamBuf* DoCreateL(TStreamId& anId);
1.530 +
1.531 + };
1.532 +
1.533 +CTestStreamStore* CTestStreamStore::NewL()
1.534 + {
1.535 + return new (ELeave) CTestStreamStore;
1.536 + }
1.537 +
1.538 +CTestStreamStore::~CTestStreamStore()
1.539 + {
1.540 + }
1.541 +
1.542 +CTestStreamStore::CTestStreamStore()
1.543 + {
1.544 + }
1.545 +
1.546 +MStreamBuf* CTestStreamStore::DoReadL(TStreamId) const
1.547 + {
1.548 + return NULL;
1.549 + }
1.550 +
1.551 +MStreamBuf* CTestStreamStore::DoCreateL(TStreamId&)
1.552 + {
1.553 + return NULL;
1.554 + }
1.555 +
1.556 +/**
1.557 +@SYMTestCaseID PDS-STORE-CT-4063
1.558 +@SYMTestCaseDesc CStreamStore tests.
1.559 +@SYMTestActions CStreamStore provides couple of virtual methods in its private section:
1.560 + DoExtendL(), DoDeleteL(), DoReplaceL(), DoReclaimL().
1.561 + They are no-ops and are expected to be overriden in the class derived from
1.562 + CStreamStore. Their implementations leave with KErrNotsupported.
1.563 + The test uses a class derived from CStreamStore, which class does not implement
1.564 + virtuals mentioned above. These virtuals should leave with KErrNotSupported when called.
1.565 +@SYMTestPriority High
1.566 +@SYMTestExpectedResults Test must not fail
1.567 +*/
1.568 +void TestStreamStoreVirtualsL()
1.569 + {
1.570 + CTestStreamStore* store = CTestStreamStore::NewL();
1.571 + TRAPD(err, store->CommitL());
1.572 + test(err == KErrNone);
1.573 + TRAP(err, store->RevertL());
1.574 + test(err == KErrNotSupported);
1.575 + TRAP(err, store->ReclaimL());
1.576 + test(err == KErrNotSupported);
1.577 + TRAP(err, store->CompactL());
1.578 + test(err == KErrNotSupported);
1.579 + TRAP(err, store->DeleteL(TStreamId(1)));
1.580 + test(err == KErrNotSupported);
1.581 + delete store;
1.582 + }
1.583 +
1.584 +//
1.585 +// Test permanent file store.
1.586 +//
1.587 +GLDEF_C TInt E32Main()
1.588 + {
1.589 + test.Title();
1.590 + setupTestDirectory();
1.591 + setupCleanup();
1.592 + __UHEAP_MARK;
1.593 +//
1.594 + test.Start(_L("Test compaction"));
1.595 + TRAPD(r,testCompactL());
1.596 + test(r==KErrNone);
1.597 + test.Next(_L("@SYMTestCaseID:PDS-STORE-CT-4063: Test CStreamStore virtuals"));
1.598 + TRAP(r, TestStreamStoreVirtualsL())
1.599 + test(r==KErrNone);
1.600 +
1.601 + //deletion of data files must be before call to .End() - DEF047652
1.602 + TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive()));
1.603 + TParse parse;
1.604 + parse.Set(drive.Name(), &KFileLocationSpec, NULL);
1.605 + ::DeleteDataFile(parse.FullName());
1.606 +
1.607 + test.End();
1.608 +//
1.609 + __UHEAP_MARKEND;
1.610 +
1.611 + delete TheTrapCleanup;
1.612 + TheFs.Close();
1.613 + test.Close();
1.614 + return 0;
1.615 + }
1.616 +