os/kernelhwsrv/kerneltest/f32test/concur/t_cfssimple.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// f32test\concur\t_cfssimple.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
#define __E32TEST_EXTENSION__
sl@0
    18
#include <f32file.h>
sl@0
    19
#include <e32test.h>
sl@0
    20
#include "t_server.h"
sl@0
    21
#include "t_tdebug.h"
sl@0
    22
sl@0
    23
GLDEF_D RTest test(_L("T_CFSSIMPLE"));
sl@0
    24
GLDEF_D	RFs TheFs;
sl@0
    25
sl@0
    26
LOCAL_D TFullName OldFsName;
sl@0
    27
LOCAL_D TFileName NewFsName;
sl@0
    28
sl@0
    29
_LIT(KFsFile, "CFAFSDLY");
sl@0
    30
_LIT(KFsName, "DelayFS");
sl@0
    31
sl@0
    32
sl@0
    33
struct TExtension
sl@0
    34
	{
sl@0
    35
	TFullName iName;
sl@0
    36
	TBool iExists;
sl@0
    37
	};
sl@0
    38
sl@0
    39
LOCAL_D TExtension gPrimaryExtensions[KMaxDrives];
sl@0
    40
sl@0
    41
LOCAL_C TChar MountTestFileSystem(TInt aDrive)
sl@0
    42
//
sl@0
    43
// Mount a new test filesystem on the drive under test
sl@0
    44
//
sl@0
    45
	{
sl@0
    46
	TBuf<64> b;
sl@0
    47
	TChar c;
sl@0
    48
	TInt r;
sl@0
    49
	if (aDrive > EDriveZ)
sl@0
    50
		{
sl@0
    51
		c = aDrive;
sl@0
    52
		r=TheFs.CharToDrive(c, aDrive);
sl@0
    53
		test_KErrNone(r);
sl@0
    54
		}
sl@0
    55
	else
sl@0
    56
		{
sl@0
    57
		r=TheFs.DriveToChar(aDrive,c);
sl@0
    58
		test_KErrNone(r);
sl@0
    59
		}
sl@0
    60
sl@0
    61
	b.Format(_L("Test mounting of test file system on %c:"),(TUint)c);
sl@0
    62
	test.Next(b);
sl@0
    63
sl@0
    64
	test.Printf(_L("Load filesystem from %S\n"), &KFsFile);
sl@0
    65
sl@0
    66
	r=TheFs.AddFileSystem(KFsFile);
sl@0
    67
	test_Value(r, r == KErrNone || r == KErrAlreadyExists);
sl@0
    68
	
sl@0
    69
	r=TheFs.FileSystemName(OldFsName,aDrive);
sl@0
    70
	test_Value(r, r == KErrNone || r == KErrNotFound);
sl@0
    71
sl@0
    72
	if (OldFsName.Length() > 0)
sl@0
    73
		{
sl@0
    74
		r = TheFs.ExtensionName(gPrimaryExtensions[aDrive].iName, aDrive, 0);
sl@0
    75
		if (r == KErrNone)
sl@0
    76
			gPrimaryExtensions[aDrive].iExists = ETrue;
sl@0
    77
sl@0
    78
		test.Printf(_L("Dismount %S filesystem on %c:\n"), &OldFsName, (TUint)c);
sl@0
    79
		r=TheFs.DismountFileSystem(OldFsName,aDrive);
sl@0
    80
		if (r == KErrNotReady)
sl@0
    81
			{
sl@0
    82
			TDriveInfo d;
sl@0
    83
			r=TheFs.Drive(d, aDrive);
sl@0
    84
			test_KErrNone(r);
sl@0
    85
			if (d.iType == EMediaNotPresent)
sl@0
    86
				test.Printf(_L("%c: Medium not present - cannot perform test.\n"), (TUint)c);
sl@0
    87
			else
sl@0
    88
				test.Printf(_L("medium found (type %d) but drive %c: not ready\nPrevious test may have hung; else, check hardware.\n"), (TInt)d.iType, (TUint)c);
sl@0
    89
			}
sl@0
    90
		else if (r == KErrCorrupt)
sl@0
    91
			test.Printf(_L("drive %c: corrupted, cannot unmount\nPrevious test may have aborted; else, check hardware.\n"), (TUint)c);
sl@0
    92
sl@0
    93
		test_KErrNone(r);
sl@0
    94
		}
sl@0
    95
	
sl@0
    96
	test.Printf(_L("Mount filesystem %S\n"), &KFsName);
sl@0
    97
sl@0
    98
	if (gPrimaryExtensions[aDrive].iExists == EFalse)
sl@0
    99
		r=TheFs.MountFileSystem(KFsName,aDrive);
sl@0
   100
	else
sl@0
   101
		r=TheFs.MountFileSystem(KFsName,gPrimaryExtensions[aDrive].iName,aDrive);
sl@0
   102
	test_KErrNone(r);
sl@0
   103
sl@0
   104
	r=TheFs.FileSystemName(NewFsName,aDrive);
sl@0
   105
	test_KErrNone(r);
sl@0
   106
	test(NewFsName.Compare(KFsName)==0);
sl@0
   107
	test.Printf(_L("New %S filesystem on %c:\n"), &NewFsName, (TUint)c);
sl@0
   108
sl@0
   109
	// Check attributes
sl@0
   110
	TDriveInfo info;
sl@0
   111
	r=TheFs.Drive(info,aDrive);
sl@0
   112
	test_KErrNone(r);
sl@0
   113
 
sl@0
   114
	test.Printf(_L("iType=%d,iConnctionBusType=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
sl@0
   115
		(TUint)info.iConnectionBusType,info.iDriveAtt,info.iMediaAtt);
sl@0
   116
	return c;
sl@0
   117
	}
sl@0
   118
sl@0
   119
LOCAL_C void UnmountFileSystem(TInt aDrive)
sl@0
   120
//
sl@0
   121
// Unmount the test filesystem on the drive under test
sl@0
   122
//
sl@0
   123
	{
sl@0
   124
	TChar c;
sl@0
   125
	TInt r;
sl@0
   126
	if (aDrive > EDriveZ)
sl@0
   127
		{
sl@0
   128
		c = aDrive;
sl@0
   129
		r=TheFs.CharToDrive(c, aDrive);
sl@0
   130
		test_KErrNone(r);
sl@0
   131
		}
sl@0
   132
	else
sl@0
   133
		{
sl@0
   134
		r=TheFs.DriveToChar(aDrive,c);
sl@0
   135
		test_KErrNone(r);
sl@0
   136
		}
sl@0
   137
    test.Printf(_L("Dismount %S filesystem on %c\n"), &NewFsName, (TUint)c);
sl@0
   138
	r=TheFs.DismountFileSystem(NewFsName,aDrive);
sl@0
   139
	test_KErrNone(r);
sl@0
   140
	if (OldFsName.Length() > 0)
sl@0
   141
		{
sl@0
   142
		test.Printf(_L("Remount %S filesystem on %c\n"), &OldFsName, (TUint)c);
sl@0
   143
sl@0
   144
		if (gPrimaryExtensions[aDrive].iExists == EFalse)
sl@0
   145
			r=TheFs.MountFileSystem(OldFsName,aDrive);
sl@0
   146
		else
sl@0
   147
			r=TheFs.MountFileSystem(OldFsName,gPrimaryExtensions[aDrive].iName,aDrive);
sl@0
   148
		test_KErrNone(r);
sl@0
   149
		}
sl@0
   150
	}
sl@0
   151
sl@0
   152
template <TInt N>
sl@0
   153
LOCAL_C TDes* cvtbuff(const TDesC8& buff, TBuf<N>& b)
sl@0
   154
//
sl@0
   155
// Copy an 8-bit buffer to a character one.
sl@0
   156
//
sl@0
   157
	{
sl@0
   158
	TInt i;
sl@0
   159
	TInt len = buff.Length();
sl@0
   160
	TInt max = b.MaxLength();
sl@0
   161
	if (len > max)
sl@0
   162
		len = max;
sl@0
   163
	b.SetLength(len);
sl@0
   164
	for (i = 0; i < len; i++)
sl@0
   165
		b[i] = TText(buff[i]);
sl@0
   166
	return &b;
sl@0
   167
	}
sl@0
   168
sl@0
   169
//---------------------------------------------
sl@0
   170
//! @SYMTestCaseID FSBASE-CR-PCHY-6PALT2
sl@0
   171
//! @SYMTestType CT
sl@0
   172
//! @SYMREQ CR PCHY-6PALT2
sl@0
   173
//! @SYMTestCaseDesc Test asynchronous RFs::Flush(TRequestStatus& aStatus)
sl@0
   174
//! @SYMTestStatus Implemented
sl@0
   175
//! @SYMTestActions Perform an asynchronous flush and wait for completion
sl@0
   176
//! @SYMTestExpectedResults Asynchronous flush completes after expected delay
sl@0
   177
//! @SYMTestPriority Low
sl@0
   178
//! @SYMAuthor Stefan Williams
sl@0
   179
//! @SYMCreationDate 01/06/2006
sl@0
   180
//! @See EFSRV and EFILE components
sl@0
   181
//! @file f32test\concur\t_cfssimple.cpp
sl@0
   182
//---------------------------------------------
sl@0
   183
sl@0
   184
LOCAL_C void testAsyncFlush(RFile& aFile)
sl@0
   185
    {
sl@0
   186
 	TTest::Printf(_L("Test Async RFile::Flush()"));
sl@0
   187
sl@0
   188
	RTimer flushTimer;
sl@0
   189
	TRequestStatus flushTimerStatus;
sl@0
   190
	TInt err = flushTimer.CreateLocal();
sl@0
   191
    TEST(err == KErrNone);
sl@0
   192
sl@0
   193
	flushTimer.After(flushTimerStatus, 10000000); // 10 seconds timeout for RFile::Flush on CFAFSDLY file system
sl@0
   194
sl@0
   195
	TTime startFlush;
sl@0
   196
	startFlush.HomeTime();
sl@0
   197
sl@0
   198
	TRequestStatus flushStatus;
sl@0
   199
	aFile.Flush(flushStatus);
sl@0
   200
    TEST(flushStatus==KRequestPending);
sl@0
   201
sl@0
   202
	User::WaitForRequest(flushTimerStatus, flushStatus);
sl@0
   203
	if ((flushStatus == KRequestPending) && (flushTimerStatus == KErrNone))
sl@0
   204
		{
sl@0
   205
		TTest::Fail(HERE, _L("Flush : Timed Out"));
sl@0
   206
		}
sl@0
   207
sl@0
   208
	if (flushStatus != KErrNone)
sl@0
   209
		{
sl@0
   210
		TTest::Fail(HERE, flushStatus.Int(), _L("Flush : Error"));
sl@0
   211
		}
sl@0
   212
sl@0
   213
	TTime endFlush;
sl@0
   214
	endFlush.HomeTime();
sl@0
   215
sl@0
   216
    TTimeIntervalSeconds flushTime;
sl@0
   217
    err = endFlush.SecondsFrom(startFlush, flushTime);
sl@0
   218
    TEST(err == KErrNone);
sl@0
   219
sl@0
   220
	TTest::Printf(_L("Flush took %d seconds"), flushTime.Int());
sl@0
   221
sl@0
   222
	if(flushTime.Int() < 3)
sl@0
   223
		{
sl@0
   224
		TTest::Fail(HERE, _L("Flush took < 3 Seconds"));
sl@0
   225
		}
sl@0
   226
sl@0
   227
	flushTimer.Cancel();
sl@0
   228
	flushTimer.Close();
sl@0
   229
	}
sl@0
   230
sl@0
   231
LOCAL_C TInt testAccessFile(TAny*)
sl@0
   232
//
sl@0
   233
// Test read file handling with two threads.
sl@0
   234
//
sl@0
   235
    {
sl@0
   236
	TTest::Start(_L("Test write file"));
sl@0
   237
	
sl@0
   238
	TThreadData& data = TTest::Self();
sl@0
   239
	TFileName fileName = data.iFile;
sl@0
   240
sl@0
   241
	TTest::Printf(_L("Connect to myFs\n"));
sl@0
   242
sl@0
   243
	RFs   myFs;
sl@0
   244
	TInt r = myFs.Connect();
sl@0
   245
	TEST(r==KErrNone);
sl@0
   246
sl@0
   247
	TTest::Printf(_L("Create %S\n"), &fileName);
sl@0
   248
sl@0
   249
    RFile f;
sl@0
   250
sl@0
   251
    r = f.Replace(myFs, fileName, EFileStreamText | EFileWrite);
sl@0
   252
    TEST(r==KErrNone);
sl@0
   253
sl@0
   254
	// wait for both tasks to have a chance to complete opening the files
sl@0
   255
	User::After(1000);
sl@0
   256
sl@0
   257
	const TInt KNumBuf = 10;
sl@0
   258
	const TInt KBufLen = 0x80;
sl@0
   259
    TBuf8<KBufLen> a[KNumBuf];
sl@0
   260
    TBuf8<KBufLen> b;
sl@0
   261
	TBuf<KBufLen>  tbuf;
sl@0
   262
	TInt i;
sl@0
   263
sl@0
   264
	TUint base = 0;
sl@0
   265
	for (i = 0; i < fileName.Length(); i++)
sl@0
   266
		base = base * 0x11 + fileName[i];
sl@0
   267
	base += base / 32;
sl@0
   268
	base = base % 32 + 0x30;
sl@0
   269
sl@0
   270
	TRequestStatus status[10];
sl@0
   271
sl@0
   272
	TTest::Next(_L("Write file"));
sl@0
   273
    for (i = 0; i <= 9; i++)
sl@0
   274
        {
sl@0
   275
		TChar val = TChar(base + i);
sl@0
   276
		a[i].Fill(TText(val), i+1);
sl@0
   277
		TTest::Printf(_L("write '%S' started\n"), cvtbuff(a[i], tbuf));
sl@0
   278
        f.Write(a[i], status[i]);
sl@0
   279
		User::After(1);
sl@0
   280
		if (r != KErrNone)
sl@0
   281
			{
sl@0
   282
			TTest::Fail(HERE, r, _L("Write"));
sl@0
   283
			}
sl@0
   284
        }
sl@0
   285
sl@0
   286
	for (i = 0; i < 10; i++)
sl@0
   287
		{
sl@0
   288
		User::WaitForAnyRequest();
sl@0
   289
		if (status[i] == KRequestPending)
sl@0
   290
			{
sl@0
   291
			TTest::Printf(_L("write %d still pending!\n"), i);
sl@0
   292
			}
sl@0
   293
		else
sl@0
   294
			{
sl@0
   295
			TTest::Printf(_L("write %d completed with status %d\n"), i, status[i].Int());
sl@0
   296
			}
sl@0
   297
		}
sl@0
   298
sl@0
   299
	TTest::Printf(_L("Write 64 bytes at the end as padding\n"));
sl@0
   300
	TBuf8<32> fill;
sl@0
   301
	fill.Fill(TText('_'), 32);
sl@0
   302
	f.Write(fill);
sl@0
   303
	f.Write(fill);
sl@0
   304
sl@0
   305
	testAsyncFlush(f);
sl@0
   306
sl@0
   307
    f.Close();
sl@0
   308
sl@0
   309
	b.Fill(TText('*'), b.MaxLength());
sl@0
   310
	TTest::Next(_L("Read file"));
sl@0
   311
sl@0
   312
	// wait to allow the dust to settle
sl@0
   313
	User::After(1000000);
sl@0
   314
	
sl@0
   315
    r = f.Open(myFs, fileName, EFileStreamText);
sl@0
   316
    TEST(r==KErrNone);
sl@0
   317
sl@0
   318
	for (i = 0; i < 10; i++)
sl@0
   319
        {
sl@0
   320
         r=f.Read(b, 12-i);
sl@0
   321
		if (r == KErrNone)
sl@0
   322
			{
sl@0
   323
			TTest::Printf(_L("read %2d bytes <%S>\n"), b.Length(), cvtbuff(b, tbuf));
sl@0
   324
			}
sl@0
   325
		else
sl@0
   326
			{
sl@0
   327
			TTest::Fail(HERE, r, _L("Read"));
sl@0
   328
			}
sl@0
   329
		User::After(1);
sl@0
   330
        }
sl@0
   331
    r=f.Read(b);
sl@0
   332
	if (r != KErrNone)
sl@0
   333
		{
sl@0
   334
		TTest::Fail(HERE, r, _L("Read\n"));
sl@0
   335
		// TEST(r==KErrNone);
sl@0
   336
		}
sl@0
   337
    if (!(b.Length()==0))
sl@0
   338
		{
sl@0
   339
		cvtbuff(b, tbuf);
sl@0
   340
		TTest::Printf(_L("read %2d bytes <%.32S>\n"), b.Length(), &tbuf);
sl@0
   341
		}
sl@0
   342
sl@0
   343
	// wait to allow the dust to settle
sl@0
   344
	User::After(1000000);
sl@0
   345
	
sl@0
   346
	TTest::Printf(_L("Close file"));
sl@0
   347
    f.Close();
sl@0
   348
sl@0
   349
	TTest::Printf(_L("Close session"));
sl@0
   350
	myFs.Close();
sl@0
   351
	return r;
sl@0
   352
    }
sl@0
   353
sl@0
   354
LOCAL_C TInt createThread(TThreadFunction aFunc, TChar aDrvCh)
sl@0
   355
//
sl@0
   356
// Create a thread using function aFunc on drive aDrvCh
sl@0
   357
//
sl@0
   358
	{
sl@0
   359
	static TInt tnum = 0;
sl@0
   360
	TBuf<2>  drive(_L("?"));
sl@0
   361
	TBuf<64> name;
sl@0
   362
    drive[0] = TText(aDrvCh);
sl@0
   363
	drive.UpperCase();
sl@0
   364
	TThreadData& d = TTest::Data(tnum);
sl@0
   365
	d.iFile.Format(_L("%S:\\TEST%d.FILE"), &drive, tnum);
sl@0
   366
	name.Format(_L("Test_%S_%d"), &drive, tnum);
sl@0
   367
	TInt r = TTest::Create(tnum, aFunc, name);
sl@0
   368
	++tnum;
sl@0
   369
	return r;
sl@0
   370
	}
sl@0
   371
sl@0
   372
LOCAL_C TInt testThreads(TChar aDrvCh1, TChar aDrvCh2)
sl@0
   373
//
sl@0
   374
// Create threads operating on files on two drives.
sl@0
   375
//
sl@0
   376
	{
sl@0
   377
	TInt r;
sl@0
   378
	r = createThread(testAccessFile, aDrvCh1);
sl@0
   379
	r = createThread(testAccessFile, aDrvCh2);
sl@0
   380
	r = TTest::Run();
sl@0
   381
	return r;
sl@0
   382
	}
sl@0
   383
sl@0
   384
LOCAL_C TBool isSpace(TChar c)
sl@0
   385
//
sl@0
   386
// Return true if the character is space or tab
sl@0
   387
//
sl@0
   388
	{
sl@0
   389
	return (c == ' ' || c == '\t');
sl@0
   390
	}
sl@0
   391
sl@0
   392
LOCAL_C void parseCmd(TDesC& cmd, TChar& dr0, TChar& dr1, TChar& dr2)
sl@0
   393
// 
sl@0
   394
// Parse command line to get two characters for drive 1 and 2
sl@0
   395
//
sl@0
   396
	{
sl@0
   397
	TInt i = 0;
sl@0
   398
	TInt n = cmd.Length();
sl@0
   399
	// skip to first non-space
sl@0
   400
	while (i < n && isSpace(cmd[i]))
sl@0
   401
		++i;
sl@0
   402
	if (i < n)
sl@0
   403
		dr0 = cmd[i];
sl@0
   404
	// skip to first space
sl@0
   405
	while (i < n && !isSpace(cmd[i]))
sl@0
   406
		++i;
sl@0
   407
	// skip to first non-space
sl@0
   408
	while (i < n && isSpace(cmd[i]))
sl@0
   409
		++i;
sl@0
   410
	if (i < n)
sl@0
   411
		dr1 = cmd[i];
sl@0
   412
	// skip to first space
sl@0
   413
	while (i < n && !isSpace(cmd[i]))
sl@0
   414
		++i;
sl@0
   415
	// skip to first non-space
sl@0
   416
	while (i < n && isSpace(cmd[i]))
sl@0
   417
		++i;
sl@0
   418
	if (i < n)
sl@0
   419
		dr2 = cmd[i];
sl@0
   420
	// skip to first space
sl@0
   421
	while (i < n && !isSpace(cmd[i]))
sl@0
   422
		++i;
sl@0
   423
	}
sl@0
   424
sl@0
   425
GLDEF_C void CallTestsL()
sl@0
   426
//
sl@0
   427
// Do all tests
sl@0
   428
//
sl@0
   429
	{
sl@0
   430
	TBuf<0x100> cmd;
sl@0
   431
	User::CommandLine(cmd);
sl@0
   432
	cmd.UpperCase();
sl@0
   433
sl@0
   434
	TChar dr0 = 'F';
sl@0
   435
	TChar dr1 = 0;
sl@0
   436
	TChar dr2 = 0;
sl@0
   437
	parseCmd(cmd, dr0, dr1, dr2);
sl@0
   438
sl@0
   439
	if (dr1 < 'A')
sl@0
   440
		dr1 = dr0;
sl@0
   441
	
sl@0
   442
	if (dr2 < 'A')
sl@0
   443
		dr2 = dr1;
sl@0
   444
	
sl@0
   445
	if (dr0 < 'A' || dr0 >= 'Z')
sl@0
   446
		{
sl@0
   447
		test.Printf(_L("Test cannnot run on drive\n"));
sl@0
   448
		return;
sl@0
   449
		}
sl@0
   450
sl@0
   451
	MountTestFileSystem(dr0);
sl@0
   452
	// TheFs.SetVolumeLabel(_L("TRACE"));
sl@0
   453
	TInt r = testThreads(dr1, dr2);
sl@0
   454
	TheFs.SetVolumeLabel(_L("OFF"));
sl@0
   455
	UnmountFileSystem(dr0);
sl@0
   456
	test_KErrNone(r);
sl@0
   457
	}
sl@0
   458
sl@0
   459
GLDEF_C TInt E32Main()
sl@0
   460
//
sl@0
   461
// Main entry point
sl@0
   462
//
sl@0
   463
    {
sl@0
   464
sl@0
   465
	for (TInt i = 0; i < KMaxDrives; i++)
sl@0
   466
		{
sl@0
   467
		gPrimaryExtensions[i].iExists = EFalse;
sl@0
   468
		}
sl@0
   469
sl@0
   470
    TInt r;
sl@0
   471
    CTrapCleanup* cleanup;
sl@0
   472
    cleanup=CTrapCleanup::New();
sl@0
   473
    __UHEAP_MARK;
sl@0
   474
sl@0
   475
    test.Title();
sl@0
   476
    test.Start(_L("Starting tests..."));
sl@0
   477
sl@0
   478
    r=TheFs.Connect();
sl@0
   479
    test_KErrNone(r);
sl@0
   480
sl@0
   481
    // TheFs.SetAllocFailure(gAllocFailOn);
sl@0
   482
    TTime timerC;
sl@0
   483
    timerC.HomeTime();
sl@0
   484
sl@0
   485
    TRAP(r,CallTestsL());
sl@0
   486
sl@0
   487
    // reset the debug register
sl@0
   488
    TheFs.SetDebugRegister(0);
sl@0
   489
sl@0
   490
    TTime endTimeC;
sl@0
   491
    endTimeC.HomeTime();
sl@0
   492
    TTimeIntervalSeconds timeTakenC;
sl@0
   493
    r=endTimeC.SecondsFrom(timerC,timeTakenC);
sl@0
   494
    test_KErrNone(r);
sl@0
   495
    test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int());
sl@0
   496
    // TheFs.SetAllocFailure(gAllocFailOff);
sl@0
   497
    TheFs.Close();
sl@0
   498
    test.End();
sl@0
   499
    test.Close();
sl@0
   500
    __UHEAP_MARKEND;
sl@0
   501
    delete cleanup;
sl@0
   502
    return(KErrNone);
sl@0
   503
    }
sl@0
   504