os/persistentdata/loggingservices/eventlogger/test/src/t_logservIPC.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) 2008-2010 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 "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
//
sl@0
    15
 
sl@0
    16
sl@0
    17
#include <e32test.h>
sl@0
    18
#include <e32math.h>
sl@0
    19
#include "LogCliServShared.h"
sl@0
    20
#include "logservpanic.h"
sl@0
    21
#include "logpackage.h"
sl@0
    22
#include "t_logutil.h"
sl@0
    23
sl@0
    24
RTest	TheTest(_L("t_logservipc"));
sl@0
    25
sl@0
    26
_LIT(KServerName, "!LogServ");
sl@0
    27
_LIT(KServerProcess, "LogServ");
sl@0
    28
sl@0
    29
///////////////////////////////////////////////////////////////////////////////////////
sl@0
    30
//
sl@0
    31
sl@0
    32
struct TTestInfo
sl@0
    33
	{
sl@0
    34
	TInt iFunction;
sl@0
    35
	TInt iType;
sl@0
    36
	TInt iArgCount;
sl@0
    37
	};
sl@0
    38
sl@0
    39
struct TExitDetails
sl@0
    40
	{
sl@0
    41
	TExitCategoryName iCategory;
sl@0
    42
	TExitType iExitType;
sl@0
    43
	TInt iReason;
sl@0
    44
	};
sl@0
    45
sl@0
    46
const TInt KAsynchDelay = 500000;
sl@0
    47
sl@0
    48
const TInt KFunctionNumbers [] = {ELogOperationCancel,
sl@0
    49
								ELogOperationGetResult,
sl@0
    50
								ELogOperationInitiate,
sl@0
    51
								ELogNotify,
sl@0
    52
								ELogNotifyCancel,
sl@0
    53
								ELogViewCreate,
sl@0
    54
								ELogViewDelete,
sl@0
    55
								ELogViewCount,
sl@0
    56
								ELogViewOperationInitiate,
sl@0
    57
								ELogViewChangeNotificationsRequest,
sl@0
    58
								ELogViewChangeNotificationsCancel,
sl@0
    59
								ELogViewFetchChanges,
sl@0
    60
								ELogViewNotifyLockStatusChange,
sl@0
    61
								ELogViewNotifyLockStatusChangeCancel,
sl@0
    62
								ELogNotifyExtended,
sl@0
    63
								ELogNotifyExtendedCancel};
sl@0
    64
sl@0
    65
const TInt KNumFunctions = sizeof(KFunctionNumbers)/sizeof(KFunctionNumbers[0]);
sl@0
    66
sl@0
    67
//===============================================================================
sl@0
    68
sl@0
    69
TBool IsFunctionAsynchronous(TInt aFunc)
sl@0
    70
	{
sl@0
    71
	TBool asynch = EFalse;
sl@0
    72
	switch(aFunc)
sl@0
    73
		{			
sl@0
    74
		case ELogOperationInitiate:
sl@0
    75
		case ELogNotify:
sl@0
    76
		case ELogViewOperationInitiate:
sl@0
    77
		case ELogViewChangeNotificationsRequest:
sl@0
    78
		case ELogViewNotifyLockStatusChange:
sl@0
    79
		case ELogNotifyExtended:
sl@0
    80
			asynch = ETrue;
sl@0
    81
			break;
sl@0
    82
			
sl@0
    83
		default:
sl@0
    84
			break;
sl@0
    85
		}
sl@0
    86
	return asynch;
sl@0
    87
	}
sl@0
    88
sl@0
    89
class RIpcFuzzTest : public RSessionBase
sl@0
    90
{
sl@0
    91
public: // Constructors and destructor
sl@0
    92
sl@0
    93
	/**
sl@0
    94
		* Constructor for performing 1st stage construction
sl@0
    95
		*/
sl@0
    96
	RIpcFuzzTest();
sl@0
    97
sl@0
    98
	/**
sl@0
    99
		* Destructor.
sl@0
   100
		*/
sl@0
   101
	~RIpcFuzzTest();
sl@0
   102
sl@0
   103
	/**
sl@0
   104
		* Performs test steps
sl@0
   105
		*/
sl@0
   106
	
sl@0
   107
	void RunTestL(const TDesC& aTargetSrvName, TInt aFunc, 
sl@0
   108
				TInt aTestType, TInt aArgCount);
sl@0
   109
	
sl@0
   110
private:
sl@0
   111
	TInt Fuzz(TInt aMsg, TInt aArgCount);
sl@0
   112
	TInt FuzzL(TInt aMsg, TInt aArgCount);
sl@0
   113
	TInt Fuzz8L(TInt aMsg, TInt aArgCount);
sl@0
   114
};
sl@0
   115
sl@0
   116
RIpcFuzzTest::RIpcFuzzTest()
sl@0
   117
	{
sl@0
   118
	// No implementation required
sl@0
   119
	}
sl@0
   120
sl@0
   121
sl@0
   122
RIpcFuzzTest::~RIpcFuzzTest()
sl@0
   123
	{
sl@0
   124
	Close();	
sl@0
   125
	}
sl@0
   126
sl@0
   127
TInt RIpcFuzzTest::Fuzz(TInt aMsg, TInt aArgCount)
sl@0
   128
	{
sl@0
   129
	TIpcArgs args;
sl@0
   130
	
sl@0
   131
	for(TInt i = 0; i < aArgCount;i++)
sl@0
   132
		{
sl@0
   133
		args.Set(i,Math::Random());
sl@0
   134
		}	
sl@0
   135
	
sl@0
   136
	TInt ret;
sl@0
   137
	
sl@0
   138
	if(IsFunctionAsynchronous(aMsg))
sl@0
   139
		{
sl@0
   140
		ret = Send(aMsg, args);
sl@0
   141
		User::After(KAsynchDelay);
sl@0
   142
		}
sl@0
   143
	else
sl@0
   144
		{
sl@0
   145
		ret = SendReceive(aMsg, args);
sl@0
   146
		}
sl@0
   147
	return ret;
sl@0
   148
	}
sl@0
   149
sl@0
   150
TInt RIpcFuzzTest::Fuzz8L(TInt aMsg, TInt aArgCount)
sl@0
   151
	{
sl@0
   152
	HBufC8* buf = HBufC8::NewLC(255);
sl@0
   153
	TPtr8 ptr = buf->Des();
sl@0
   154
	ptr.Fill(Math::Random(),255);
sl@0
   155
	
sl@0
   156
	TIpcArgs args;
sl@0
   157
	
sl@0
   158
	for(TInt i = 0; i < aArgCount;i++)
sl@0
   159
		{
sl@0
   160
		args.Set(i,&ptr);
sl@0
   161
		}
sl@0
   162
	
sl@0
   163
	TInt ret;
sl@0
   164
	
sl@0
   165
	if(IsFunctionAsynchronous(aMsg))
sl@0
   166
		{
sl@0
   167
		ret = Send(aMsg, args);
sl@0
   168
		User::After(KAsynchDelay);
sl@0
   169
		}
sl@0
   170
	else
sl@0
   171
		{
sl@0
   172
		ret = SendReceive(aMsg, args);
sl@0
   173
		}
sl@0
   174
sl@0
   175
	CleanupStack::PopAndDestroy(buf);
sl@0
   176
	return ret;
sl@0
   177
	}
sl@0
   178
sl@0
   179
TInt RIpcFuzzTest::FuzzL(TInt aMsg, TInt aArgCount)
sl@0
   180
	{
sl@0
   181
	HBufC* buf = HBufC::NewLC(255);
sl@0
   182
	TPtr ptr = buf->Des();
sl@0
   183
	ptr.Fill(Math::Random(),255);
sl@0
   184
sl@0
   185
	TIpcArgs args;
sl@0
   186
	
sl@0
   187
	for(TInt i = 0; i < aArgCount;i++)
sl@0
   188
		{
sl@0
   189
		args.Set(i,&ptr);
sl@0
   190
		}
sl@0
   191
	
sl@0
   192
	TInt ret;
sl@0
   193
	
sl@0
   194
	if(IsFunctionAsynchronous(aMsg))
sl@0
   195
		{
sl@0
   196
		ret = Send(aMsg, args);
sl@0
   197
		User::After(KAsynchDelay);
sl@0
   198
		}
sl@0
   199
	else
sl@0
   200
		{
sl@0
   201
		ret = SendReceive(aMsg, args);
sl@0
   202
		}
sl@0
   203
sl@0
   204
	CleanupStack::PopAndDestroy(buf);
sl@0
   205
	return ret;
sl@0
   206
	}
sl@0
   207
sl@0
   208
void RIpcFuzzTest::RunTestL(const TDesC& aTargetSrvName, 
sl@0
   209
							TInt aFunc, TInt aTestType, TInt aArgCount)
sl@0
   210
	{
sl@0
   211
		TVersion version(0,0,0);
sl@0
   212
	
sl@0
   213
		TInt err = CreateSession(aTargetSrvName, version);
sl@0
   214
		
sl@0
   215
		LEAVE_IF_ERROR(err);
sl@0
   216
	
sl@0
   217
		switch(aTestType)
sl@0
   218
			{
sl@0
   219
			case 0:
sl@0
   220
				Fuzz(aFunc,aArgCount);
sl@0
   221
				break;
sl@0
   222
				
sl@0
   223
			case 1:
sl@0
   224
				Fuzz8L(aFunc,aArgCount);
sl@0
   225
				break;
sl@0
   226
				
sl@0
   227
			case 2:
sl@0
   228
				FuzzL(aFunc,aArgCount);
sl@0
   229
				break;			
sl@0
   230
			}
sl@0
   231
	}
sl@0
   232
sl@0
   233
TInt FuzzServerL(TAny* aTestInfo)
sl@0
   234
	{
sl@0
   235
   	CTrapCleanup* cleanup=CTrapCleanup::New();
sl@0
   236
   	TInt err=KErrNoMemory;
sl@0
   237
   	if (cleanup)
sl@0
   238
   		{
sl@0
   239
   		
sl@0
   240
		TTestInfo* info = (TTestInfo*)aTestInfo;
sl@0
   241
		RIpcFuzzTest fuzzer;
sl@0
   242
		
sl@0
   243
		TRAP(err,fuzzer.RunTestL(KServerName,info->iFunction
sl@0
   244
				,info->iType, info->iArgCount));
sl@0
   245
		
sl@0
   246
		fuzzer.Close();
sl@0
   247
sl@0
   248
   		delete cleanup;
sl@0
   249
   		}
sl@0
   250
   	return err;
sl@0
   251
	}
sl@0
   252
sl@0
   253
sl@0
   254
void TestServerApi(TInt aFunctionNumber,
sl@0
   255
			TInt aTestType,TInt aArgCount, TExitDetails& aExitDetails)
sl@0
   256
	{
sl@0
   257
    
sl@0
   258
    TTestInfo testInfo;
sl@0
   259
	testInfo.iFunction = aFunctionNumber;
sl@0
   260
	testInfo.iType = aTestType;
sl@0
   261
	testInfo.iArgCount = aArgCount;
sl@0
   262
    
sl@0
   263
    RThread thread;	
sl@0
   264
    _LIT(KThreadName,"FuzzerThread" );
sl@0
   265
	TInt err = thread.Create(KThreadName,&FuzzServerL, KDefaultStackSize, NULL,&testInfo);
sl@0
   266
	TEST2(err, KErrNone);
sl@0
   267
	
sl@0
   268
	TRequestStatus threadStat;
sl@0
   269
	thread.Logon(threadStat);
sl@0
   270
	
sl@0
   271
	TBool jit = User::JustInTime();
sl@0
   272
	User::SetJustInTime(EFalse);
sl@0
   273
	
sl@0
   274
	thread.Resume();
sl@0
   275
	
sl@0
   276
	User::WaitForRequest(threadStat);
sl@0
   277
	
sl@0
   278
	User::SetJustInTime(jit);
sl@0
   279
sl@0
   280
	aExitDetails.iCategory = thread.ExitCategory();
sl@0
   281
	aExitDetails.iReason = thread.ExitReason();
sl@0
   282
	aExitDetails.iExitType = thread.ExitType();
sl@0
   283
	
sl@0
   284
	thread.Close();
sl@0
   285
sl@0
   286
	}
sl@0
   287
sl@0
   288
sl@0
   289
TInt LaunchServer(RProcess& aServer)
sl@0
   290
	{
sl@0
   291
	
sl@0
   292
	TheTest.Printf(_L("Launching LogServer...\n"));
sl@0
   293
	
sl@0
   294
	const TUid KServerUid3 = {0x0101f401d};	
sl@0
   295
	const TUidType serverUid(KNullUid,KNullUid,KServerUid3);
sl@0
   296
	
sl@0
   297
	TInt err = aServer.Create(KServerProcess, _L(""),serverUid);
sl@0
   298
	 
sl@0
   299
	if(err == KErrNone)
sl@0
   300
		{   
sl@0
   301
		aServer.SetPriority(EPriorityForeground);  
sl@0
   302
		 
sl@0
   303
		//Start server and wait until it is running
sl@0
   304
		TRequestStatus serverStat;
sl@0
   305
		aServer.SetJustInTime(false);   
sl@0
   306
		aServer.Resume(); 
sl@0
   307
		    
sl@0
   308
		aServer.Rendezvous(serverStat);
sl@0
   309
		User::WaitForRequest(serverStat);
sl@0
   310
		}
sl@0
   311
	 
sl@0
   312
	 return err;
sl@0
   313
	    
sl@0
   314
	}
sl@0
   315
sl@0
   316
void PrintTestMessage(TInt iFunc, TInt iType, TInt iArgCount)
sl@0
   317
	{
sl@0
   318
	switch(iType)
sl@0
   319
		{
sl@0
   320
		case 0:
sl@0
   321
			TheTest.Printf(_L("\nFuzz Test on function number %d using random Int data. Number of Args = %d"), iFunc, iArgCount);
sl@0
   322
			break;
sl@0
   323
			
sl@0
   324
		case 1:
sl@0
   325
			TheTest.Printf(_L("\nFuzz Test on function number %d using random Des8 data. Number of Args = %d"), iFunc, iArgCount);
sl@0
   326
			break;
sl@0
   327
			
sl@0
   328
		case 2:
sl@0
   329
			TheTest.Printf(_L("\nFuzz Test on function number %d using random Des data. Number of Args = %d"), iFunc, iArgCount);
sl@0
   330
			break;
sl@0
   331
			
sl@0
   332
		}
sl@0
   333
	
sl@0
   334
	}
sl@0
   335
sl@0
   336
/**
sl@0
   337
Invoke the tests
sl@0
   338
*/
sl@0
   339
/**
sl@0
   340
@SYMTestCaseID          SYSLIB-LOGENG-CT-4002
sl@0
   341
@SYMTestCaseDesc	    Tests LogEng APIs for IPC Robustness
sl@0
   342
@SYMTestPriority 	    High
sl@0
   343
@SYMTestActions  	    The function calls each of the Logeng APIs through a custom session object
sl@0
   344
						passing random TInt, Des8 and Des16 data .
sl@0
   345
@SYMTestExpectedResults The server should be robust to all malformed messages and should not
sl@0
   346
						hang or panic.
sl@0
   347
@SYMDEF                	INC114113
sl@0
   348
*/
sl@0
   349
LOCAL_C void DoFuzzTestsL ()
sl@0
   350
    {  
sl@0
   351
    TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-4002 "));
sl@0
   352
    RProcess server;
sl@0
   353
    
sl@0
   354
    LEAVE_IF_ERROR(LaunchServer(server));
sl@0
   355
sl@0
   356
    TExitDetails exitDetails;
sl@0
   357
      
sl@0
   358
    for(TInt i = 0;i< KNumFunctions;i++)
sl@0
   359
    	{
sl@0
   360
    	
sl@0
   361
    	//Carry out each type of test
sl@0
   362
    	for(TInt testType = 0; testType < 3;testType++)
sl@0
   363
    		{
sl@0
   364
       		//Carry out each test with number of arguments 1 - 4
sl@0
   365
    		for(TInt argCount = 1;argCount <= 4;argCount++)
sl@0
   366
    			{
sl@0
   367
    			PrintTestMessage(KFunctionNumbers[i], testType, argCount);
sl@0
   368
sl@0
   369
    			TestServerApi(KFunctionNumbers[i], testType, argCount, exitDetails);
sl@0
   370
		    	//Kill the server process and verify that it was still running
sl@0
   371
		    	//If the server was already dead it would return the reason it exited
sl@0
   372
	    		if(server.ExitType() != EExitPending)
sl@0
   373
	    			{
sl@0
   374
	    			server.Kill(0);
sl@0
   375
	    			TInt exitReason = server.ExitReason();
sl@0
   376
	    			server.Close();
sl@0
   377
	    			TEST2(exitReason, 0);    	
sl@0
   378
	    			LEAVE_IF_ERROR(LaunchServer(server));
sl@0
   379
	    			}
sl@0
   380
    			}
sl@0
   381
	    	
sl@0
   382
    		TheTest.Printf(_L("\nFuzz Test Successful\n"));
sl@0
   383
    		}
sl@0
   384
    	}
sl@0
   385
    }
sl@0
   386
sl@0
   387
sl@0
   388
/*
sl@0
   389
 * SERVER API TESTING
sl@0
   390
 */
sl@0
   391
sl@0
   392
typedef void (*TestFunction)();
sl@0
   393
sl@0
   394
class RClientMessageTestSession : public RSessionBase
sl@0
   395
	{
sl@0
   396
public:
sl@0
   397
	TInt Connect();
sl@0
   398
	
sl@0
   399
	TInt TestMakeTransient(TInt aArg0);
sl@0
   400
	TInt TestMakeTransient(const TDesC8& aArg0);
sl@0
   401
	
sl@0
   402
	TInt TestCliServDataParam(TInt aFunc, TDes8& aArg0);
sl@0
   403
	TInt TestCliServDataParam(TInt aFunc, TDes8& aArg0, TUint32 aArg1);
sl@0
   404
	TInt TestCliServDataParam(TInt aFunc, TDes8& aArg0, TDes8& aArg1, TInt aArg2);
sl@0
   405
	TInt TestCliServDataParam(TInt aFunc, TDes& aArg0, TDes8& aArg1, TInt aArg2);
sl@0
   406
	
sl@0
   407
	TInt TestLogNotify(TInt aArg0);
sl@0
   408
	TInt TestLogNotifyCancel();
sl@0
   409
	
sl@0
   410
	TInt TestLogViewCreate(TInt aArg0, TInt aArg1);	
sl@0
   411
	
sl@0
   412
	TInt TestLogViewIdParam(TInt aFunc, TInt aArg0);
sl@0
   413
	TInt TestLogViewIdParam(TInt aFunc, TDes8& aArg1);
sl@0
   414
	
sl@0
   415
	TInt TestLogViewFetchChanges(TInt aArg0, TInt aArg1, TDes8& aArg2);
sl@0
   416
	TInt TestLogViewFetchChanges(TInt aArg0, TInt aArg1, const TDesC8& aArg2);
sl@0
   417
	
sl@0
   418
	TInt TestLogNotifyExtended(TDes8& aArg0, TDes8& aArg1, TDes8& aArg2,TDes8& aArg3);
sl@0
   419
	TInt TestLogNotifyExtended(TDes& aArg0, TDes& aArg1, TDes& aArg2,TDes& aArg3);
sl@0
   420
	TInt TestLogNotifyExtended(TDes8& aArg0, TInt aArg1, TInt aArg2,const TDesC8& aArg3);
sl@0
   421
	
sl@0
   422
	TInt TestFunction45(TAny* aData);
sl@0
   423
	
sl@0
   424
sl@0
   425
	};
sl@0
   426
sl@0
   427
static TInt LaunchLogServer()
sl@0
   428
	{
sl@0
   429
sl@0
   430
	RProcess process;
sl@0
   431
sl@0
   432
	TInt err = process.Create(KServerProcess,_L(""));
sl@0
   433
	 
sl@0
   434
	if(err == KErrNone)
sl@0
   435
		{
sl@0
   436
		 TRequestStatus serverStat;		
sl@0
   437
		 
sl@0
   438
		 process.SetJustInTime(EFalse);
sl@0
   439
		 process.Resume();
sl@0
   440
		 process.Rendezvous(serverStat);
sl@0
   441
		 User::WaitForRequest(serverStat);
sl@0
   442
		}
sl@0
   443
	
sl@0
   444
	return err;
sl@0
   445
	}
sl@0
   446
sl@0
   447
sl@0
   448
TInt RClientMessageTestSession::Connect()
sl@0
   449
	{
sl@0
   450
	TInt retry = 2;
sl@0
   451
	for(;;)
sl@0
   452
		{
sl@0
   453
		TInt r = CreateSession(KServerName,TVersion(1,0,0));
sl@0
   454
		
sl@0
   455
		if((r != KErrNotFound)&&(r != KErrServerTerminated))
sl@0
   456
			{
sl@0
   457
			return r;
sl@0
   458
			}
sl@0
   459
		
sl@0
   460
		if(--retry == 0)
sl@0
   461
			{
sl@0
   462
			return r;
sl@0
   463
			}
sl@0
   464
		
sl@0
   465
		r = LaunchLogServer();
sl@0
   466
		if((r != KErrNone)&&(r != KErrAlreadyExists))
sl@0
   467
			{
sl@0
   468
			return r;
sl@0
   469
			}	
sl@0
   470
		}
sl@0
   471
	}
sl@0
   472
sl@0
   473
TInt RClientMessageTestSession::TestMakeTransient(TInt aArg0)
sl@0
   474
	{
sl@0
   475
	return SendReceive(ELogMakeTransient,TIpcArgs(aArg0));
sl@0
   476
	}
sl@0
   477
sl@0
   478
TInt RClientMessageTestSession::TestMakeTransient(const TDesC8& aArg0)
sl@0
   479
	{
sl@0
   480
	return SendReceive(ELogMakeTransient,TIpcArgs(&aArg0));
sl@0
   481
	}
sl@0
   482
sl@0
   483
TInt RClientMessageTestSession::TestCliServDataParam(TInt aFunc, TDes8& aArg0)
sl@0
   484
	{
sl@0
   485
	return SendReceive(aFunc,TIpcArgs(&aArg0));
sl@0
   486
	}
sl@0
   487
sl@0
   488
TInt RClientMessageTestSession::TestCliServDataParam(TInt aFunc, TDes8& aArg0, TUint32 aArg1)
sl@0
   489
	{
sl@0
   490
	return SendReceive(aFunc,TIpcArgs(&aArg0, aArg1));
sl@0
   491
	}
sl@0
   492
sl@0
   493
TInt RClientMessageTestSession::TestCliServDataParam(TInt aFunc, TDes8& aArg0, TDes8& aArg1, TInt aArg2)
sl@0
   494
	{
sl@0
   495
	return SendReceive(aFunc,TIpcArgs(&aArg0, &aArg1, aArg2));
sl@0
   496
	}
sl@0
   497
sl@0
   498
TInt RClientMessageTestSession::TestLogNotify(TInt aArg0)
sl@0
   499
	{
sl@0
   500
	return Send(ELogNotify,TIpcArgs(aArg0));
sl@0
   501
	}
sl@0
   502
sl@0
   503
TInt RClientMessageTestSession::TestLogNotifyCancel()
sl@0
   504
	{
sl@0
   505
	return Send(ELogNotifyCancel);
sl@0
   506
	}
sl@0
   507
	
sl@0
   508
TInt RClientMessageTestSession::TestLogViewCreate(TInt aArg0, TInt aArg1)
sl@0
   509
	{
sl@0
   510
	return SendReceive(ELogViewCreate,TIpcArgs(aArg0,aArg1));
sl@0
   511
	}
sl@0
   512
sl@0
   513
sl@0
   514
TInt RClientMessageTestSession::TestLogViewIdParam(TInt aFunc, TInt aArg0)
sl@0
   515
	{
sl@0
   516
	return SendReceive(aFunc,TIpcArgs(aArg0));
sl@0
   517
	}
sl@0
   518
sl@0
   519
TInt RClientMessageTestSession::TestLogViewIdParam(TInt aFunc, TDes8& aArg0)
sl@0
   520
	{
sl@0
   521
	return SendReceive(aFunc,TIpcArgs(&aArg0));
sl@0
   522
	}
sl@0
   523
sl@0
   524
TInt RClientMessageTestSession::TestLogViewFetchChanges(TInt aArg0, TInt aArg1, TDes8& aArg2)
sl@0
   525
	{
sl@0
   526
	return SendReceive(ELogViewFetchChanges,TIpcArgs(aArg0,aArg1, &aArg2));
sl@0
   527
	}
sl@0
   528
sl@0
   529
TInt RClientMessageTestSession::TestLogViewFetchChanges(TInt aArg0, TInt aArg1, const TDesC8& aArg2)
sl@0
   530
	{
sl@0
   531
	return SendReceive(ELogViewFetchChanges,TIpcArgs(aArg0,aArg1, &aArg2));
sl@0
   532
	}
sl@0
   533
sl@0
   534
TInt RClientMessageTestSession::TestLogNotifyExtended(TDes8& aArg0, 
sl@0
   535
								TDes8& aArg1, TDes8& aArg2,TDes8& aArg3)
sl@0
   536
	{
sl@0
   537
	return Send(ELogNotifyExtended,TIpcArgs(&aArg0,&aArg1,&aArg2,&aArg3));
sl@0
   538
	}
sl@0
   539
sl@0
   540
TInt RClientMessageTestSession::TestLogNotifyExtended(TDes& aArg0, 
sl@0
   541
								TDes& aArg1, TDes& aArg2,TDes& aArg3)
sl@0
   542
	{
sl@0
   543
	return Send(ELogNotifyExtended,TIpcArgs(&aArg0,&aArg1,&aArg2,&aArg3));
sl@0
   544
	}
sl@0
   545
sl@0
   546
TInt RClientMessageTestSession::TestLogNotifyExtended(TDes8& aArg0, 
sl@0
   547
								TInt aArg1, TInt aArg2,const TDesC8& aArg3)
sl@0
   548
	{
sl@0
   549
	return Send(ELogNotifyExtended,TIpcArgs(&aArg0,&aArg1,&aArg2,&aArg3));
sl@0
   550
	}
sl@0
   551
sl@0
   552
TInt RClientMessageTestSession::TestFunction45(TAny* aData)
sl@0
   553
	{
sl@0
   554
	return SendReceive(45,TIpcArgs(aData));
sl@0
   555
	}
sl@0
   556
sl@0
   557
sl@0
   558
TInt TestFunctionLauncherL(TAny* aTestFunction)
sl@0
   559
	{
sl@0
   560
   	CTrapCleanup* cleanup=CTrapCleanup::New();
sl@0
   561
   	TInt r=KErrNoMemory;
sl@0
   562
   	if (cleanup)
sl@0
   563
   		{
sl@0
   564
   		TestFunction function = (TestFunction)aTestFunction;
sl@0
   565
sl@0
   566
__UHEAP_MARK;  		
sl@0
   567
 		TRAP(r,function());
sl@0
   568
__UHEAP_MARKEND;
sl@0
   569
 		
sl@0
   570
   		delete cleanup;
sl@0
   571
   		}
sl@0
   572
   	return r;
sl@0
   573
	}
sl@0
   574
sl@0
   575
sl@0
   576
TExitDetails LaunchTestThreadL(const TDesC& aThreadName, TestFunction aFunction)
sl@0
   577
	{
sl@0
   578
	RThread thread;	
sl@0
   579
	TInt err = thread.Create(aThreadName, &TestFunctionLauncherL, KDefaultStackSize, NULL, (TAny*)aFunction);
sl@0
   580
	TEST2(err, KErrNone);
sl@0
   581
	
sl@0
   582
	TRequestStatus threadStat;
sl@0
   583
	thread.Logon(threadStat);
sl@0
   584
	
sl@0
   585
	TBool jit = User::JustInTime();
sl@0
   586
	User::SetJustInTime(EFalse);
sl@0
   587
	
sl@0
   588
	thread.Resume();
sl@0
   589
	User::WaitForRequest(threadStat);
sl@0
   590
	
sl@0
   591
	User::SetJustInTime(jit);
sl@0
   592
	 
sl@0
   593
	TExitDetails exitDetails;
sl@0
   594
	exitDetails.iCategory = thread.ExitCategory();
sl@0
   595
	exitDetails.iReason = thread.ExitReason();
sl@0
   596
	exitDetails.iExitType = thread.ExitType();
sl@0
   597
	
sl@0
   598
	return exitDetails;
sl@0
   599
	}
sl@0
   600
sl@0
   601
/**
sl@0
   602
@SYMTestCaseID          SYSLIB-LOGENG-CT-4003
sl@0
   603
@SYMTestCaseDesc	    Tests Message schema validation for the ELogMakeTransient message.
sl@0
   604
@SYMTestPriority 	    High
sl@0
   605
@SYMTestActions  	    Sends messages to the test server to test the validation of messages
sl@0
   606
                        against the message schema.
sl@0
   607
@SYMTestExpectedResults The server should validate the message and handle bad messages appropriately
sl@0
   608
@SYMDEF                	INC114113
sl@0
   609
*/
sl@0
   610
void TestMakeTransientL()
sl@0
   611
	{
sl@0
   612
	
sl@0
   613
	RClientMessageTestSession session;
sl@0
   614
	
sl@0
   615
	TInt err = session.Connect();
sl@0
   616
	TEST2(err, KErrNone);
sl@0
   617
	
sl@0
   618
	CleanupClosePushL(session);
sl@0
   619
	
sl@0
   620
	err = session.TestMakeTransient(0);	
sl@0
   621
	TEST2(err, KErrNone);
sl@0
   622
	
sl@0
   623
	//anything different from 0 should be considered as ETrue
sl@0
   624
	err = session.TestMakeTransient(1);	
sl@0
   625
	TEST2(err, KErrNone);
sl@0
   626
	
sl@0
   627
	err = session.TestMakeTransient(-5);	
sl@0
   628
	TEST2(err, KErrNone);
sl@0
   629
	
sl@0
   630
	err = session.TestMakeTransient(3);	
sl@0
   631
	TEST2(err, KErrNone);
sl@0
   632
	
sl@0
   633
	err = session.TestMakeTransient( _L8("Des8"));	
sl@0
   634
	TEST2(err, KErrNone);
sl@0
   635
	
sl@0
   636
	CleanupStack::PopAndDestroy(&session);
sl@0
   637
	}
sl@0
   638
sl@0
   639
/**
sl@0
   640
@SYMTestCaseID          SYSLIB-LOGENG-CT-4004
sl@0
   641
@SYMTestCaseDesc	    Tests Message schema validation for the messages accepting
sl@0
   642
 						TLogClientServerData parameters.
sl@0
   643
@SYMTestPriority 	    High
sl@0
   644
@SYMTestActions  	    Sends messages to the test server to test the validation of messages
sl@0
   645
						against the message schema.  The messages contain either valid or invalid 
sl@0
   646
						parameters. 
sl@0
   647
@SYMTestExpectedResults The server should validate the message and handle bad messages appropriately
sl@0
   648
@SYMDEF                	INC114113
sl@0
   649
*/
sl@0
   650
void TestCliServDataParamL()
sl@0
   651
	{
sl@0
   652
	
sl@0
   653
	RClientMessageTestSession session;
sl@0
   654
	
sl@0
   655
	TInt err = session.Connect();
sl@0
   656
    TEST2(err, KErrNone);
sl@0
   657
	
sl@0
   658
	CleanupClosePushL(session);
sl@0
   659
	
sl@0
   660
	TLogClientServerData data;
sl@0
   661
	TPckg<TLogClientServerData> pData(data);
sl@0
   662
	
sl@0
   663
	TBuf8<sizeof(TLogClientServerData)> buf;
sl@0
   664
	
sl@0
   665
	buf.SetLength(sizeof(TLogClientServerData));
sl@0
   666
	
sl@0
   667
	buf.Fill(0xFF);
sl@0
   668
	
sl@0
   669
	data.iOperationType = 	ELogOperationEventAdd; 
sl@0
   670
	data.iOperationId = 1;
sl@0
   671
	err = session.TestCliServDataParam(ELogOperationInitiate,pData);	
sl@0
   672
	TEST2(err, KErrBadDescriptor);
sl@0
   673
	
sl@0
   674
	data.iOperationType = 	ELogOperationViewWindowFetch; 
sl@0
   675
	data.iOperationId = 5;
sl@0
   676
	err = session.TestCliServDataParam(ELogOperationInitiate,pData);	
sl@0
   677
	TEST2(err, KErrArgument);
sl@0
   678
	
sl@0
   679
	data.iOperationType = 	ELogOperationEventAdd; 
sl@0
   680
	data.iOperationId = 0x8FFFFFFF;
sl@0
   681
	err = session.TestCliServDataParam(ELogOperationInitiate,pData);	
sl@0
   682
	TEST2(err, KErrBadDescriptor);
sl@0
   683
sl@0
   684
	data.iOperationType = 	ELogOperationEventAdd; 
sl@0
   685
	data.iOperationId = 0x8FFFFFFF;
sl@0
   686
	err = session.TestCliServDataParam(ELogOperationInitiate,buf);	
sl@0
   687
	TEST2(err, KErrArgument);
sl@0
   688
	
sl@0
   689
	data.iOperationType = 	ELogOperationEventAdd; 
sl@0
   690
	data.iOperationId = 1;
sl@0
   691
	err = session.TestCliServDataParam(ELogOperationCancel,pData);	
sl@0
   692
	TEST2(err, KErrCancel);
sl@0
   693
	
sl@0
   694
	data.iOperationType = 	ELogOperationEventAdd; 
sl@0
   695
	data.iOperationId = 1;
sl@0
   696
	err = session.TestCliServDataParam(ELogOperationCancel,buf);	
sl@0
   697
	TEST2(err, KErrArgument);
sl@0
   698
	
sl@0
   699
	CLogPackage* package = CLogPackage::NewL();
sl@0
   700
	TPtr8 ptr(package->Ptr());
sl@0
   701
	
sl@0
   702
	data.iOperationType = 	ELogOperationEventAdd; 
sl@0
   703
	data.iOperationId = 1;
sl@0
   704
	err = session.TestCliServDataParam(ELogOperationGetResult,buf, ptr, 0);	
sl@0
   705
	TEST2(err, KErrArgument);
sl@0
   706
	
sl@0
   707
	data.iOperationType = 	ELogOperationEventAdd; 
sl@0
   708
	data.iOperationId = 1;
sl@0
   709
	err = session.TestCliServDataParam(ELogOperationGetResult,pData, ptr, -1 );	
sl@0
   710
	TEST2(err, KErrNone);
sl@0
   711
	
sl@0
   712
	delete package;
sl@0
   713
	
sl@0
   714
	TBuf8<8> smallBuf;
sl@0
   715
	data.iOperationType = 	ELogOperationEventAdd; 
sl@0
   716
	data.iOperationId = 1;
sl@0
   717
	err = session.TestCliServDataParam(ELogOperationGetResult,buf, smallBuf, 0);	
sl@0
   718
	TEST2(err, KErrArgument);
sl@0
   719
	
sl@0
   720
	CleanupStack::PopAndDestroy(&session);
sl@0
   721
	}
sl@0
   722
sl@0
   723
/**
sl@0
   724
@SYMTestCaseID          SYSLIB-LOGENG-LEGACY-T_LOGSERVIPC-0001
sl@0
   725
@SYMTestCaseDesc	    Tests Message schema validation for the messages accepting
sl@0
   726
 						TLogClientServerData parameters.
sl@0
   727
@SYMTestPriority 	    High
sl@0
   728
@SYMTestActions  	    Sends messages to the test server to test the validation of messages
sl@0
   729
						against the message schema.  The messages contain either valid or invalid 
sl@0
   730
						parameters. 
sl@0
   731
@SYMTestExpectedResults The server should validate the message and handle bad messages appropriately
sl@0
   732
@SYMDEF                	INC114113
sl@0
   733
*/
sl@0
   734
void TestCliServDataParam2L()
sl@0
   735
	{
sl@0
   736
	RClientMessageTestSession session;
sl@0
   737
	
sl@0
   738
	TInt err = session.Connect();
sl@0
   739
    TEST2(err, KErrNone);
sl@0
   740
	
sl@0
   741
	CleanupClosePushL(session);
sl@0
   742
	
sl@0
   743
	TBuf8<sizeof(TLogClientServerData) - 1> buf;
sl@0
   744
	
sl@0
   745
	buf.FillZ();
sl@0
   746
	
sl@0
   747
	//This should panic with Logserv 63
sl@0
   748
	err = session.TestCliServDataParam(ELogOperationInitiate,buf);	
sl@0
   749
    TEST2(err, KErrNone);
sl@0
   750
	
sl@0
   751
	CleanupStack::PopAndDestroy(&session);
sl@0
   752
	}
sl@0
   753
sl@0
   754
/**
sl@0
   755
@SYMTestCaseID          SYSLIB-LOGENG-LEGACY-T_LOGSERVIPC-0002
sl@0
   756
@SYMTestCaseDesc	    Tests Message schema validation for the messages accepting
sl@0
   757
 						TLogClientServerData parameters.
sl@0
   758
@SYMTestPriority 	    High
sl@0
   759
@SYMTestActions  	    Sends messages to the test server to test the validation of messages
sl@0
   760
						against the message schema.  The messages contain either valid or invalid 
sl@0
   761
						parameters. 
sl@0
   762
@SYMTestExpectedResults The server should validate the message and handle bad messages appropriately
sl@0
   763
@SYMDEF                	INC114113
sl@0
   764
*/
sl@0
   765
void TestCliServDataParam3L()
sl@0
   766
	{
sl@0
   767
	RClientMessageTestSession session;
sl@0
   768
	
sl@0
   769
	TInt err = session.Connect();
sl@0
   770
    TEST2(err, KErrNone);
sl@0
   771
	
sl@0
   772
	CleanupClosePushL(session);
sl@0
   773
	
sl@0
   774
	TBuf8<sizeof(TLogClientServerData) + 1> buf;
sl@0
   775
	
sl@0
   776
	buf.FillZ();
sl@0
   777
	
sl@0
   778
	err = session.TestCliServDataParam(ELogOperationInitiate,buf);	
sl@0
   779
	TEST2(err, KErrArgument);
sl@0
   780
	
sl@0
   781
	CleanupStack::PopAndDestroy(&session);
sl@0
   782
	}
sl@0
   783
sl@0
   784
sl@0
   785
/**
sl@0
   786
@SYMTestCaseID          SYSLIB-LOGENG-CT-4005
sl@0
   787
@SYMTestCaseDesc	    Tests Message schema validation for the ELogNotify message.
sl@0
   788
@SYMTestPriority 	    High
sl@0
   789
@SYMTestActions  	    Sends messages to the test server to test the validation of messages
sl@0
   790
						against the message schema.  The messages contain either valid or invalid 
sl@0
   791
						parameters. 
sl@0
   792
@SYMTestExpectedResults The server should validate the message and handle bad messages appropriately
sl@0
   793
@SYMDEF                	INC114113
sl@0
   794
*/
sl@0
   795
void TestLogNotifyL()
sl@0
   796
	{
sl@0
   797
	
sl@0
   798
	RClientMessageTestSession session;
sl@0
   799
	
sl@0
   800
	TInt err = session.Connect();
sl@0
   801
    TEST2(err, KErrNone);
sl@0
   802
sl@0
   803
    CleanupClosePushL(session);
sl@0
   804
	
sl@0
   805
	err = session.TestLogNotify(0);
sl@0
   806
	TEST2(err, KErrNone);	
sl@0
   807
	
sl@0
   808
	//Cancel the pending notification
sl@0
   809
	err = session.TestLogNotifyCancel();
sl@0
   810
	TEST2(err, KErrNone);
sl@0
   811
	
sl@0
   812
	err = session.TestLogNotify(1000000);
sl@0
   813
	TEST2(err, KErrNone);
sl@0
   814
	
sl@0
   815
	//Cancel the pending notification
sl@0
   816
	err = session.TestLogNotifyCancel();
sl@0
   817
	TEST2(err, KErrNone);
sl@0
   818
	
sl@0
   819
	err = session.TestLogNotify(-1);
sl@0
   820
	TEST2(err, KErrNone);
sl@0
   821
	
sl@0
   822
	CleanupStack::PopAndDestroy(&session);
sl@0
   823
	}
sl@0
   824
sl@0
   825
/**
sl@0
   826
@SYMTestCaseID          SYSLIB-LOGENG-CT-4006
sl@0
   827
@SYMTestCaseDesc	    Tests Message schema validation for the ELogViewCreate message.
sl@0
   828
@SYMTestPriority 	    High
sl@0
   829
@SYMTestActions  	    Sends messages to the test server to test the validation of messages
sl@0
   830
						against the message schema.  The messages contain either valid or invalid 
sl@0
   831
						parameters. 
sl@0
   832
@SYMTestExpectedResults The server should validate the message and handle bad messages appropriately
sl@0
   833
@SYMDEF                	INC114113
sl@0
   834
*/
sl@0
   835
void TestLogViewCreateL()
sl@0
   836
	{
sl@0
   837
	
sl@0
   838
	RClientMessageTestSession session;
sl@0
   839
	
sl@0
   840
	TInt err = session.Connect();
sl@0
   841
    TEST2(err, KErrNone);
sl@0
   842
	
sl@0
   843
	CleanupClosePushL(session);
sl@0
   844
	
sl@0
   845
	err = session.TestLogViewCreate(0,ELogViewTypeEvent);	
sl@0
   846
	TEST2(err, KErrNone);
sl@0
   847
	
sl@0
   848
	err = session.TestLogViewCreate(100000,ELogViewTypeDuplicate);	
sl@0
   849
	TEST2(err, KErrNone);
sl@0
   850
	
sl@0
   851
	err = session.TestLogViewCreate(0,ELogViewTypeDuplicate + 1);	
sl@0
   852
	TEST2(err, KErrArgument);
sl@0
   853
	
sl@0
   854
	err = session.TestLogViewCreate(-1,ELogViewTypeRecent);	
sl@0
   855
	TEST2(err, KErrNone);
sl@0
   856
	
sl@0
   857
	err = session.TestLogViewCreate(20,-1);	
sl@0
   858
	TEST2(err, KErrArgument);
sl@0
   859
sl@0
   860
	CleanupStack::PopAndDestroy(&session);
sl@0
   861
	}
sl@0
   862
sl@0
   863
sl@0
   864
/**
sl@0
   865
@SYMTestCaseID          SYSLIB-LOGENG-CT-4012
sl@0
   866
@SYMTestCaseDesc	    Tests Message schema validation for the ELogNotifyExtended message.
sl@0
   867
@SYMTestPriority 	    High
sl@0
   868
@SYMTestActions  	    Sends a message to the test server to test the validation of messages
sl@0
   869
						against the message schema.  The message contains an invalid descriptor. 
sl@0
   870
@SYMTestExpectedResults The server should panic the client with KErrBadDescriptor
sl@0
   871
@SYMDEF                	INC114113
sl@0
   872
*/
sl@0
   873
void TestLogNotifyExtended2L()
sl@0
   874
	{
sl@0
   875
	
sl@0
   876
	RClientMessageTestSession session;
sl@0
   877
sl@0
   878
	TInt err = session.Connect();
sl@0
   879
    TEST2(err, KErrNone);
sl@0
   880
	
sl@0
   881
	CleanupClosePushL(session);
sl@0
   882
sl@0
   883
	_LIT8(KDes8,"Des8");
sl@0
   884
	TPckgBuf<TInt> int0(0);
sl@0
   885
	
sl@0
   886
	err = session.TestLogNotifyExtended(int0, 0, -1, KDes8);	
sl@0
   887
	TEST2(err, KErrNone);
sl@0
   888
sl@0
   889
	CleanupStack::PopAndDestroy(&session);
sl@0
   890
	}
sl@0
   891
sl@0
   892
/**
sl@0
   893
@SYMTestCaseID          SYSLIB-LOGENG-CT-4013
sl@0
   894
@SYMTestCaseDesc	    Tests Message schema validation for an invalid message
sl@0
   895
@SYMTestPriority 	    High
sl@0
   896
@SYMTestActions  	    Sends a message to the test server with a message number not 
sl@0
   897
						defined in the schema.
sl@0
   898
@SYMTestExpectedResults The server should return KErrInvalidFunction
sl@0
   899
@SYMDEF                	INC114113
sl@0
   900
*/
sl@0
   901
void InvalidMessageTestL()
sl@0
   902
	{
sl@0
   903
	
sl@0
   904
	RClientMessageTestSession session;
sl@0
   905
	
sl@0
   906
	TInt err = session.Connect();
sl@0
   907
    TEST2(err, KErrNone);
sl@0
   908
	
sl@0
   909
	CleanupClosePushL(session);
sl@0
   910
	
sl@0
   911
	//This should cause the server to panic the client
sl@0
   912
	err = session.TestFunction45(0);	
sl@0
   913
	
sl@0
   914
	CleanupStack::PopAndDestroy(&session);
sl@0
   915
	}
sl@0
   916
sl@0
   917
sl@0
   918
sl@0
   919
static void DoAPITestsL()
sl@0
   920
	{
sl@0
   921
	
sl@0
   922
	TExitDetails exitDetails;
sl@0
   923
	
sl@0
   924
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-4004 "));
sl@0
   925
	exitDetails = LaunchTestThreadL(_L("TestCliServDataParamL"), &TestCliServDataParamL);
sl@0
   926
	TEST2(exitDetails.iExitType, EExitKill);
sl@0
   927
	
sl@0
   928
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-LEGACY-T_LOGSERVIPC-0001 "));
sl@0
   929
	exitDetails = LaunchTestThreadL(_L("TestCliServDataParam2L"), &TestCliServDataParam2L);
sl@0
   930
	TEST2(exitDetails.iExitType, EExitPanic);
sl@0
   931
	TEST2(exitDetails.iReason, ELogBadDescriptor);
sl@0
   932
	
sl@0
   933
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-LEGACY-T_LOGSERVIPC-0002 "));
sl@0
   934
	exitDetails = LaunchTestThreadL(_L("TestCliServDataParam3L"), &TestCliServDataParam3L);
sl@0
   935
	TEST2(exitDetails.iExitType, EExitPanic);
sl@0
   936
	TEST2(exitDetails.iReason, ELogBadDescriptor);
sl@0
   937
	
sl@0
   938
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-4005 "));
sl@0
   939
	exitDetails = LaunchTestThreadL(_L("TestLogNotifyL"), &TestLogNotifyL);
sl@0
   940
	TEST2(exitDetails.iExitType, EExitKill);
sl@0
   941
	
sl@0
   942
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-4006 "));
sl@0
   943
	exitDetails = LaunchTestThreadL(_L("TestLogViewCreateL"), &TestLogViewCreateL);
sl@0
   944
	TEST2(exitDetails.iExitType, EExitKill);
sl@0
   945
	
sl@0
   946
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-4012 "));
sl@0
   947
	exitDetails = LaunchTestThreadL(_L("TestLogNotifyExtended2L"), &TestLogNotifyExtended2L);
sl@0
   948
	TEST2(exitDetails.iExitType, EExitKill);
sl@0
   949
	
sl@0
   950
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-4013 "));
sl@0
   951
	exitDetails = LaunchTestThreadL(_L("InvalidMessageTestL"), &InvalidMessageTestL);
sl@0
   952
	TEST2(exitDetails.iExitType, EExitPanic);
sl@0
   953
	TEST2(exitDetails.iReason, ELogIllegalFunction);
sl@0
   954
sl@0
   955
 	//test for debug-only API
sl@0
   956
#ifdef _DEBUG
sl@0
   957
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-4003 "));
sl@0
   958
 	exitDetails = LaunchTestThreadL(_L("TestMakeTransientL"), &TestMakeTransientL);
sl@0
   959
 	TEST2(exitDetails.iExitType, EExitKill);
sl@0
   960
#endif//_DEBUG	
sl@0
   961
	}
sl@0
   962
sl@0
   963
sl@0
   964
sl@0
   965
sl@0
   966
GLDEF_C TInt E32Main ()
sl@0
   967
	{
sl@0
   968
sl@0
   969
	TheTest.Printf (_L ("\n"));
sl@0
   970
	TheTest.Title ();
sl@0
   971
	TheTest.Start (_L("IPC Fuzz Tests"));
sl@0
   972
sl@0
   973
   	CTrapCleanup* cleanup=CTrapCleanup::New();
sl@0
   974
   	TEST(cleanup != NULL);
sl@0
   975
	
sl@0
   976
   	TInt err=KErrNoMemory;
sl@0
   977
   	if (cleanup)
sl@0
   978
   		{
sl@0
   979
   		
sl@0
   980
   		// Construct and install the active scheduler
sl@0
   981
   		CActiveScheduler* scheduler = new CActiveScheduler;
sl@0
   982
   	    TEST(scheduler != NULL);
sl@0
   983
   		CActiveScheduler::Install (scheduler);
sl@0
   984
   		
sl@0
   985
   		KillProcess(KServerProcess);
sl@0
   986
   		User::After(1000000);
sl@0
   987
   				
sl@0
   988
   		TRAP (err, DoFuzzTestsL ());
sl@0
   989
   		TEST2(err, KErrNone);
sl@0
   990
   		
sl@0
   991
   		TheTest.Next(_L("LogServ API Robustness Tests"));
sl@0
   992
   		TRAP (err, DoAPITestsL ());
sl@0
   993
   		TEST2(err, KErrNone);
sl@0
   994
   		
sl@0
   995
   		TheTest.End ();
sl@0
   996
   		TheTest.Close ();
sl@0
   997
   		
sl@0
   998
   		delete scheduler;
sl@0
   999
   		delete cleanup;
sl@0
  1000
   		
sl@0
  1001
   		}
sl@0
  1002
	return err;
sl@0
  1003
	}