os/kernelhwsrv/kerneltest/e32test/secure/t_platsecconfig.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2001-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
// e32test\secure\t_platsecconfig.cpp
sl@0
    15
// This test checks the correct functioning of the Platform Security configuration.
sl@0
    16
// To use this test for verification of the features, perform the following steps
sl@0
    17
// On the WINS Emulator
sl@0
    18
// 1.  Run "T_PLATSECCONFIG.EXE"
sl@0
    19
// Check that the results reported are:
sl@0
    20
// PlatSecEnforcement is OFF
sl@0
    21
// Disabled Capabilites: NONE
sl@0
    22
// Check EPOCWIND.OUT and verify that it contains no diagnostic messages. (These will start with the text "*PlatSec* ")
sl@0
    23
// 2.  Run "T_PLATSECCONFIG.EXE -mt_platsecconfig --"
sl@0
    24
// Check that the results reported are:
sl@0
    25
// PlatSecEnforcement is ON
sl@0
    26
// Disabled Capabilites: CommDD MultimediaDD WriteDeviceData TrustedUI DiskAdmin AllFiles NetworkServices ReadUserData Location (These are all ODD numbered capabilities)
sl@0
    27
// Check EPOCWIND.OUT and verify that it contains two lines starting with "*PlatSec* ERROR - Capability check failed"
sl@0
    28
// On reference hardware
sl@0
    29
// 3.  Build a Text Shell ROM contining the E32 tests. E.g.
sl@0
    30
// cd \cedar\generic\base\e32\rombuild
sl@0
    31
// rom -v=lubbock -t=e32test
sl@0
    32
// Boot this ROM and run "T_PLATSECCONFIG.EXE"
sl@0
    33
// Check that the results reported are:
sl@0
    34
// PlatSecEnforcement is OFF
sl@0
    35
// Disabled Capabilites: NONE
sl@0
    36
// Check the output of the debug port and verify that it contains no diagnostic messages.
sl@0
    37
// (These will start with the text "*PlatSec* ")
sl@0
    38
// 4.  Build a Text Shell ROM using the T_PLATSECCONFIG.OBY file. E.g.
sl@0
    39
// cd \cedar\generic\base\e32\rombuild
sl@0
    40
// rom -v=lubbock -t=t_platsecconfig
sl@0
    41
// Boot this ROM and run "T_PLATSECCONFIG.EXE"
sl@0
    42
// Check that the results reported are:
sl@0
    43
// PlatSecEnforcement is ON
sl@0
    44
// Disabled Capabilites: CommDD MultimediaDD WriteDeviceData TrustedUI DiskAdmin AllFiles NetworkServices ReadUserData Location (These are all ODD numbered capabilities)
sl@0
    45
// Check the output of the debug port and verify that it contains two lines with "*PlatSec* ERROR - Capability check failed"
sl@0
    46
// To check ROMBUILD configuration
sl@0
    47
// 5.  Build a Text Shell ROM using the T_PLATSECCONFIG_WARNIG.OBY file. E.g.
sl@0
    48
// cd \cedar\generic\base\e32\rombuild
sl@0
    49
// rom -v=lubbock -t=t_platsecconfig_warning
sl@0
    50
// This should produce the following warning:
sl@0
    51
// WARNING: *PlatSec* WARNING - Capability check failed. Can't load \Epoc32\RELEASE\ARM4\UDEB\t_psc_static.exebecause it links to t_psc_dll{00010000}.dll which has the following capabilities missing: TCB PowerMgmt ReadDeviceData DRM ProtServ NetworkControl SwEvent LocalServices WriteUserData
sl@0
    52
// 6.  Build a Text Shell ROM using the T_PLATSECCONFIG_ERROR.OBY file. E.g.
sl@0
    53
// cd \cedar\generic\base\e32\rombuild
sl@0
    54
// rom -v=lubbock -t=t_platsecconfig_error
sl@0
    55
// This should produce the following error:
sl@0
    56
// ERROR: *PlatSec* ERROR - Capability check failed. Can't load \Epoc32\RELEASE\ARM4\UDEB\t_psc_static.exe because it links to t_psc_dll{00010000}.dll which has the following capabilities missing: TCB PowerMgmt ReadDeviceData DRM ProtServ NetworkControl SwEvent LocalServices WriteUserData
sl@0
    57
// 
sl@0
    58
//
sl@0
    59
sl@0
    60
/**
sl@0
    61
 @file
sl@0
    62
*/
sl@0
    63
sl@0
    64
#define __INCLUDE_CAPABILITY_NAMES__
sl@0
    65
sl@0
    66
#include <e32test.h>
sl@0
    67
sl@0
    68
LOCAL_D RTest test(_L("T_PLATSECCONFIG"));
sl@0
    69
sl@0
    70
enum TTestProcessFunctions
sl@0
    71
	{
sl@0
    72
	ETestProcessServer,
sl@0
    73
	ETestProcessLoadLib,
sl@0
    74
	};
sl@0
    75
sl@0
    76
#include "testprocess.h"
sl@0
    77
sl@0
    78
TInt StartServer();
sl@0
    79
sl@0
    80
TInt DoTestProcess(TInt aTestNum,TInt aArg1,TInt aArg2)
sl@0
    81
	{
sl@0
    82
	(void)aArg1;
sl@0
    83
	(void)aArg2;
sl@0
    84
sl@0
    85
	switch(aTestNum)
sl@0
    86
		{
sl@0
    87
sl@0
    88
	case ETestProcessServer:
sl@0
    89
		return StartServer();
sl@0
    90
sl@0
    91
	case ETestProcessLoadLib:
sl@0
    92
		{
sl@0
    93
		RLibrary lib;
sl@0
    94
		TInt r = lib.Load(_L("T_PSC_DLL"));
sl@0
    95
		lib.Close();
sl@0
    96
		return r;
sl@0
    97
		}
sl@0
    98
sl@0
    99
	default:
sl@0
   100
		User::Panic(_L("T_PLATSECCONFIG"),1);
sl@0
   101
		}
sl@0
   102
sl@0
   103
	return KErrNone;
sl@0
   104
	}
sl@0
   105
sl@0
   106
sl@0
   107
sl@0
   108
//
sl@0
   109
// RTestThread
sl@0
   110
//
sl@0
   111
sl@0
   112
class RTestThread : public RThread
sl@0
   113
	{
sl@0
   114
public:
sl@0
   115
	void Create(TThreadFunction aFunction,TAny* aArg=0);
sl@0
   116
	};
sl@0
   117
sl@0
   118
void RTestThread::Create(TThreadFunction aFunction,TAny* aArg)
sl@0
   119
	{
sl@0
   120
	TInt r=RThread::Create(_L(""),aFunction,KDefaultStackSize,KDefaultStackSize,KDefaultStackSize,aArg);
sl@0
   121
	test(r==KErrNone);
sl@0
   122
	}
sl@0
   123
sl@0
   124
sl@0
   125
//
sl@0
   126
// CTestSession
sl@0
   127
//
sl@0
   128
sl@0
   129
class CTestSession : public CSession2
sl@0
   130
	{
sl@0
   131
public:
sl@0
   132
	enum {EShutdown,EGetSecurityInfo};
sl@0
   133
public:
sl@0
   134
	CTestSession();
sl@0
   135
	virtual void ServiceL(const RMessage2& aMessage);
sl@0
   136
public:
sl@0
   137
	};
sl@0
   138
sl@0
   139
CTestSession::CTestSession()
sl@0
   140
	: CSession2()
sl@0
   141
	{}
sl@0
   142
sl@0
   143
void CTestSession::ServiceL(const RMessage2& aMessage)
sl@0
   144
	{
sl@0
   145
	RMessagePtr2 m(aMessage);
sl@0
   146
	switch (aMessage.Function())
sl@0
   147
		{
sl@0
   148
		case CTestSession::EGetSecurityInfo:
sl@0
   149
			{
sl@0
   150
			TSecurityInfo info;
sl@0
   151
			info.Set(RProcess());
sl@0
   152
			TInt r = aMessage.Write(0,TPtrC8((TUint8*)&info,sizeof(info)));
sl@0
   153
			m.Complete(r);
sl@0
   154
			}
sl@0
   155
			break;
sl@0
   156
sl@0
   157
		case CTestSession::EShutdown:
sl@0
   158
			CActiveScheduler::Stop();
sl@0
   159
			break;
sl@0
   160
sl@0
   161
		default:
sl@0
   162
			m.Complete(KErrNotSupported);
sl@0
   163
			break;
sl@0
   164
		}
sl@0
   165
	}
sl@0
   166
sl@0
   167
sl@0
   168
sl@0
   169
//
sl@0
   170
// CTestServer
sl@0
   171
//
sl@0
   172
sl@0
   173
class CTestServer : public CServer2
sl@0
   174
	{
sl@0
   175
public:
sl@0
   176
	CTestServer(TInt aPriority);
sl@0
   177
	virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
sl@0
   178
	};
sl@0
   179
sl@0
   180
CTestServer::CTestServer(TInt aPriority)
sl@0
   181
	: CServer2(aPriority)
sl@0
   182
	{
sl@0
   183
	}
sl@0
   184
sl@0
   185
CSession2* CTestServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const
sl@0
   186
	{
sl@0
   187
	return new (ELeave) CTestSession();
sl@0
   188
	}
sl@0
   189
sl@0
   190
sl@0
   191
sl@0
   192
//
sl@0
   193
// CTestActiveScheduler
sl@0
   194
//
sl@0
   195
sl@0
   196
class CTestActiveScheduler : public CActiveScheduler
sl@0
   197
	{
sl@0
   198
public:
sl@0
   199
	virtual void Error(TInt anError) const;
sl@0
   200
	};
sl@0
   201
sl@0
   202
void CTestActiveScheduler::Error(TInt anError) const
sl@0
   203
	{
sl@0
   204
	User::Panic(_L("TestServer Error"),anError);
sl@0
   205
	}
sl@0
   206
sl@0
   207
sl@0
   208
sl@0
   209
//
sl@0
   210
// Server thread
sl@0
   211
//
sl@0
   212
sl@0
   213
_LIT(KServerName,"T_PLATSECCONFIG-server");
sl@0
   214
const TInt KServerRendezvous = KRequestPending+1;
sl@0
   215
sl@0
   216
void DoStartServer()
sl@0
   217
	{
sl@0
   218
	CTestActiveScheduler* activeScheduler = new (ELeave) CTestActiveScheduler;
sl@0
   219
	CActiveScheduler::Install(activeScheduler);
sl@0
   220
	CleanupStack::PushL(activeScheduler);
sl@0
   221
sl@0
   222
	CTestServer* server = new (ELeave) CTestServer(0);
sl@0
   223
	CleanupStack::PushL(server);
sl@0
   224
sl@0
   225
	User::LeaveIfError(server->Start(KServerName));
sl@0
   226
sl@0
   227
	RProcess::Rendezvous(KServerRendezvous);
sl@0
   228
sl@0
   229
	CActiveScheduler::Start();
sl@0
   230
sl@0
   231
	CleanupStack::PopAndDestroy(2);
sl@0
   232
	}
sl@0
   233
sl@0
   234
TInt StartServer()
sl@0
   235
	{
sl@0
   236
	CTrapCleanup* cleanupStack = CTrapCleanup::New();
sl@0
   237
	if(!cleanupStack)
sl@0
   238
		return KErrNoMemory;
sl@0
   239
	TRAPD(leaveError,DoStartServer())
sl@0
   240
	delete cleanupStack;
sl@0
   241
	return leaveError;
sl@0
   242
	}
sl@0
   243
sl@0
   244
sl@0
   245
sl@0
   246
//
sl@0
   247
// RTestSession
sl@0
   248
//
sl@0
   249
sl@0
   250
class RTestSession : public RSessionBase
sl@0
   251
	{
sl@0
   252
public:
sl@0
   253
	inline TInt Connect()
sl@0
   254
		{ return CreateSession(KServerName,TVersion());}
sl@0
   255
	inline TInt Send(TInt aFunction)
sl@0
   256
		{ return RSessionBase::SendReceive(aFunction); }
sl@0
   257
	inline TInt Send(TInt aFunction,const TIpcArgs& aArgs)
sl@0
   258
		{ return RSessionBase::SendReceive(aFunction,aArgs); }
sl@0
   259
	inline void Send(TInt aFunction,TRequestStatus& aStatus)
sl@0
   260
		{ RSessionBase::SendReceive(aFunction,aStatus); }
sl@0
   261
	inline void Send(TInt aFunction,const TIpcArgs& aArgs,TRequestStatus& aStatus)
sl@0
   262
		{ RSessionBase::SendReceive(aFunction,aArgs,aStatus); }
sl@0
   263
	};
sl@0
   264
sl@0
   265
sl@0
   266
sl@0
   267
RTestSession Session;
sl@0
   268
sl@0
   269
sl@0
   270
sl@0
   271
void CheckCapabilitySetEqual(const TCapabilitySet& a1,const TCapabilitySet& a2)
sl@0
   272
	{
sl@0
   273
	TInt i;
sl@0
   274
	for(i=0; i<ECapability_Limit; i++)
sl@0
   275
		test((!a1.HasCapability((TCapability)i))==(!a2.HasCapability((TCapability)i)));
sl@0
   276
	}
sl@0
   277
sl@0
   278
TBuf8<1024> CapabilityNameBuffer;
sl@0
   279
TBool PlatSecEnforcement=0;
sl@0
   280
sl@0
   281
TPtrC16 CapabilityList(const TCapabilitySet& aCaps)
sl@0
   282
	{
sl@0
   283
	TCapabilitySet allCaps;
sl@0
   284
	allCaps.SetAllSupported();
sl@0
   285
	CapabilityNameBuffer.Zero();
sl@0
   286
	TBool odd=ETrue;
sl@0
   287
	TBool even=ETrue;
sl@0
   288
	TInt i;
sl@0
   289
	for(i=0; i<ECapability_Limit; i++)
sl@0
   290
		{
sl@0
   291
		if(!aCaps.HasCapability((TCapability)i))
sl@0
   292
			{
sl@0
   293
			if(allCaps.HasCapability((TCapability)i))
sl@0
   294
				{
sl@0
   295
				if(i&1)
sl@0
   296
					odd = EFalse;
sl@0
   297
				else
sl@0
   298
					even = EFalse;
sl@0
   299
				}
sl@0
   300
			continue;
sl@0
   301
			}
sl@0
   302
		TUint8* ptr=(TUint8*)CapabilityNames[i];
sl@0
   303
		TPtrC8 name(ptr,User::StringLength(ptr));
sl@0
   304
		CapabilityNameBuffer.Append(name);
sl@0
   305
		CapabilityNameBuffer.Append((TChar)' ');
sl@0
   306
		}
sl@0
   307
	if(!CapabilityNameBuffer.Length())
sl@0
   308
		CapabilityNameBuffer.Append(_L8("NONE"));
sl@0
   309
	if(even)
sl@0
   310
		CapabilityNameBuffer.Append(_L8("(These are all EVEN numbered capabilities)"));
sl@0
   311
	if(odd)
sl@0
   312
		CapabilityNameBuffer.Append(_L8("(These are all ODD numbered capabilities)"));
sl@0
   313
	return CapabilityNameBuffer.Expand();
sl@0
   314
}
sl@0
   315
sl@0
   316
void TestPlatSecDisabledCaps()
sl@0
   317
	{
sl@0
   318
	TSecurityInfo info;
sl@0
   319
	TPckg<TSecurityInfo> infoPtr(info);
sl@0
   320
sl@0
   321
	test.Start(_L("Get disabled capabilities set"));
sl@0
   322
	TCapabilitySet disabled;
sl@0
   323
	disabled.SetDisabled();
sl@0
   324
	TPtrC16 list(CapabilityList(disabled));
sl@0
   325
	test.Printf(_L("  %S\n"),&list);
sl@0
   326
sl@0
   327
	test.Next(_L("Get capabilites from this EXE"));
sl@0
   328
	Mem::FillZ(&info,sizeof(info));
sl@0
   329
	info.SetToCurrentInfo();
sl@0
   330
sl@0
   331
	test.Next(_L("Check capabilities are same as disabled set"));
sl@0
   332
	CheckCapabilitySetEqual(info.iCaps,disabled);
sl@0
   333
sl@0
   334
	test.Next(_L("Get capabilites from other EXE"));
sl@0
   335
	Mem::FillZ(&info,sizeof(info));
sl@0
   336
	TInt r = Session.Send(CTestSession::EGetSecurityInfo,TIpcArgs(&infoPtr));
sl@0
   337
	test(r==KErrNone);
sl@0
   338
sl@0
   339
	test.Next(_L("Check capabilities are same as disabled set"));
sl@0
   340
	CheckCapabilitySetEqual(info.iCaps,disabled);
sl@0
   341
sl@0
   342
	test.Next(_L("Test PlatSec::IsCapabilityEnforced is consistant with our findings"));
sl@0
   343
	TCapabilitySet notEnforced;
sl@0
   344
	notEnforced.SetEmpty();
sl@0
   345
	for(TInt i=0; i<ECapability_HardLimit; i++)
sl@0
   346
		if(!PlatSec::IsCapabilityEnforced((TCapability)i))
sl@0
   347
			notEnforced.AddCapability((TCapability)i);
sl@0
   348
	if(!PlatSec::ConfigSetting(PlatSec::EPlatSecEnforcement))
sl@0
   349
		disabled.SetAllSupported();
sl@0
   350
	CheckCapabilitySetEqual(notEnforced,disabled);
sl@0
   351
sl@0
   352
	test.End();
sl@0
   353
	}
sl@0
   354
sl@0
   355
_LIT(KRomExe,"T_PLATSECCONFIG2.EXE");
sl@0
   356
_LIT(KOn,"ON");
sl@0
   357
_LIT(KOff,"OFF");
sl@0
   358
sl@0
   359
void TestPlatSecEnforcement()
sl@0
   360
	{
sl@0
   361
	RProcess process;
sl@0
   362
	TInt r;
sl@0
   363
sl@0
   364
	test.Start(_L("Getting PlatSecEnforcement setting"));
sl@0
   365
	PlatSecEnforcement = PlatSec::ConfigSetting(PlatSec::EPlatSecEnforcement);
sl@0
   366
	test.Printf(_L("  PlatSecEnforcement setting returns %S\n"),PlatSecEnforcement?&KOn:&KOff);
sl@0
   367
sl@0
   368
	test.Next(_L("Check dynamic linkage without required capabilities"));
sl@0
   369
	TBuf<10> arg;
sl@0
   370
	arg.Num((TInt)ETestProcessLoadLib);
sl@0
   371
	r=process.Create(_L("T_PSC_DYNAMIC"),arg);
sl@0
   372
	test(r==KErrNone);
sl@0
   373
	TRequestStatus logon;
sl@0
   374
	process.Logon(logon);
sl@0
   375
	process.Resume();
sl@0
   376
	User::WaitForRequest(logon);
sl@0
   377
	test(process.ExitType()==EExitKill);
sl@0
   378
	r=logon.Int();
sl@0
   379
	CLOSE_AND_WAIT(process);
sl@0
   380
	if(PlatSecEnforcement)
sl@0
   381
		test(r==KErrPermissionDenied);
sl@0
   382
	else
sl@0
   383
		test(r==KErrNone);
sl@0
   384
sl@0
   385
	test.Next(_L("Check static linkage without required capabilities"));
sl@0
   386
	r=process.Create(_L("T_PSC_STATIC"),_L(""));
sl@0
   387
	if(PlatSecEnforcement)
sl@0
   388
		test(r==KErrPermissionDenied);
sl@0
   389
	else
sl@0
   390
		{
sl@0
   391
		test(r==KErrNone);
sl@0
   392
		process.Kill(0);
sl@0
   393
		CLOSE_AND_WAIT(process);
sl@0
   394
		}
sl@0
   395
sl@0
   396
	test.End();
sl@0
   397
	}
sl@0
   398
sl@0
   399
#include <e32svr.h>
sl@0
   400
IMPORT_C void dummyExport();
sl@0
   401
sl@0
   402
GLDEF_C TInt E32Main()
sl@0
   403
    {
sl@0
   404
#ifdef STATIC_TEST_LINK
sl@0
   405
	dummyExport(); // Use dummy export from staticly linked DLL
sl@0
   406
#endif
sl@0
   407
	TBuf16<512> cmd;
sl@0
   408
	User::CommandLine(cmd);
sl@0
   409
	if(cmd.Length() && TChar(cmd[0]).IsDigit())
sl@0
   410
		{
sl@0
   411
		TInt function = -1;
sl@0
   412
		TInt arg1 = -1;
sl@0
   413
		TInt arg2 = -1;
sl@0
   414
		TLex lex(cmd);
sl@0
   415
sl@0
   416
		lex.Val(function);
sl@0
   417
		lex.SkipSpace();
sl@0
   418
		lex.Val(arg1);
sl@0
   419
		lex.SkipSpace();
sl@0
   420
		lex.Val(arg2);
sl@0
   421
		return DoTestProcess(function,arg1,arg2);
sl@0
   422
		}
sl@0
   423
sl@0
   424
	test.Title();
sl@0
   425
sl@0
   426
	test.Start(_L("Starting test server"));
sl@0
   427
	RTestProcess server;
sl@0
   428
	TRequestStatus rendezvous;
sl@0
   429
	TBuf<10> arg;
sl@0
   430
	arg.Num((TInt)ETestProcessServer);
sl@0
   431
	TInt r=server.RProcess::Create(KRomExe,arg);
sl@0
   432
	test(r==KErrNone);
sl@0
   433
	server.Rendezvous(rendezvous);
sl@0
   434
	server.Resume();
sl@0
   435
	User::WaitForRequest(rendezvous);
sl@0
   436
	test(rendezvous==KServerRendezvous);
sl@0
   437
sl@0
   438
	test.Next(_L("Openning server session"));
sl@0
   439
	r = Session.Connect();
sl@0
   440
	RDebug::Print(_L("%d"),r);
sl@0
   441
	test(r==KErrNone);
sl@0
   442
sl@0
   443
	test.Next(_L("Test PlatSecDisabledCaps"));
sl@0
   444
	TestPlatSecDisabledCaps();
sl@0
   445
sl@0
   446
	test.Next(_L("Test PlatSecEnforcement"));
sl@0
   447
	TestPlatSecEnforcement();
sl@0
   448
sl@0
   449
	test.Next(_L("Closing server session"));
sl@0
   450
	Session.Send(CTestSession::EShutdown);
sl@0
   451
	Session.Close();
sl@0
   452
	CLOSE_AND_WAIT(server);
sl@0
   453
sl@0
   454
	// Show results requiring manual inspection
sl@0
   455
	_LIT(KSeperatorText,"----------------------------------------------------------------------------\n"); 
sl@0
   456
	test.Printf(_L("\n"));
sl@0
   457
	test.Printf(_L("RESULTS (To be checked against expected values)\n")); 
sl@0
   458
	test.Printf(KSeperatorText);
sl@0
   459
	test.Printf(_L("*  PlatSecEnforcement is %S\n"),PlatSecEnforcement?&KOn:&KOff);
sl@0
   460
	test.Printf(KSeperatorText);
sl@0
   461
	TCapabilitySet disabled;
sl@0
   462
	disabled.SetDisabled();
sl@0
   463
	TPtrC16 list(CapabilityList(disabled));
sl@0
   464
	test.Printf(_L("*  Disabled Capabilites: %S\n"),&list);
sl@0
   465
	test.Printf(KSeperatorText);
sl@0
   466
sl@0
   467
	// Wait for a while, or for a key press
sl@0
   468
	test.Printf(_L("Waiting a short while for key press...\n"));
sl@0
   469
	TRequestStatus keyStat;
sl@0
   470
	test.Console()->Read(keyStat);
sl@0
   471
	RTimer timer;
sl@0
   472
	test(timer.CreateLocal()==KErrNone);
sl@0
   473
	TRequestStatus timerStat;
sl@0
   474
	timer.After(timerStat,20*1000000);
sl@0
   475
	User::WaitForRequest(timerStat,keyStat);
sl@0
   476
	TInt key = 0;
sl@0
   477
	if(keyStat!=KRequestPending)
sl@0
   478
		key = test.Console()->KeyCode();
sl@0
   479
	timer.Cancel();
sl@0
   480
	test.Console()->ReadCancel();
sl@0
   481
	User::WaitForAnyRequest();
sl@0
   482
sl@0
   483
	test.End();
sl@0
   484
	return(0);
sl@0
   485
    }
sl@0
   486