os/persistentdata/loggingservices/eventlogger/test/src/t_logfile.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include <s32file.h>
    17 #include "t_logutil2.h"
    18 
    19 /*
    20 This test may fail occasionally, especially after changing the LogEng server code. The reported error is KErrCorrupt.
    21 The typical scenario when the test fails is:
    22 1) Some of the test functions calls "__FILE_FAILNEXT(failCount++)"
    23 2) The test calls some CLogClient method, typically "aClient.GetEventType()".
    24 3) The statement "test(active->iStatus == KErrNone)" fails.
    25 This behaviour might be related to INC044553 "DBMS does not handle OOD error 
    26 scenarios correctly when committing a transaction".
    27 "__FILE_FAILNEXT" is a macro, which calls theFs.SetErrorCondition(KErrGeneral, X).
    28 If you perform a search with "SetErrorCondition" keyword in "Programming" database, you will find
    29 some explanations that the programmer has to be careful when using SetErrorCondition() method,
    30 because:
    31 
    32 "You have to be careful if you use this in the same way as you do for heap testing, because you 
    33 can get the file system in a state where it think the file you're working on is corrupted."
    34 
    35 Anyway, LOGENG server internally uses DBMS component. Calling SetErrorCondition() we test DBMS 
    36 component actually not LOGENG component!
    37 There is one addidtional thing in the test, which makes me believing that the problem is not 
    38 in LOGENG but in SetErrorCondition()/DBMS interaction - in many if the test functions a statement
    39 like:
    40 
    41   		if (failCount == 5)
    42 			failCount++;
    43 
    44 may be found. I think that it is there to prevent exactly the problem with 
    45 SetErrorCondition()/DBMS interaction.
    46 */
    47 
    48 RTest TheTest(_L("t_logfile"));
    49 
    50 const TUid KTestEventUid = {0x10005393};
    51 _LIT(KTestEventDesc1, "Event Type Description");
    52 _LIT(KTestEventDesc2, "Changed Event Description");
    53 _LIT(KTestRemoteParty1, "Remote Party");
    54 _LIT(KTestRemoteParty2, "Changed Remote Party");
    55 _LIT(KTestDirection1, "Direction");
    56 _LIT(KTestDirection2, "Changed Direction");
    57 const TLogDurationType KTestDurationType1 = 1;
    58 const TLogDurationType KTestDurationType2 = 2;
    59 const TLogDuration KTestDuration1 = 0x1234;
    60 const TLogDuration KTestDuration2 = 0x1234567;
    61 _LIT(KTestStatus1, "Status");
    62 _LIT(KTestStatus2, "Changed Status");
    63 _LIT(KTestSubject1, "Subject");
    64 _LIT(KTestSubject2, "Changed Subject");
    65 _LIT(KTestNumber1, "Number");
    66 _LIT(KTestNumber2, "Changed Number");
    67 const TLogContactItemId KTestContact1 = 0x1234;
    68 const TLogContactItemId KTestContact2 = 0x1234567;
    69 const TLogLink KTestLink1 = 0x1234;
    70 const TLogLink KTestLink2 = 0x1234567;
    71 _LIT8(KTestData1, "ABCDEFGH");
    72 _LIT8(KTestData2, "IJKLMNOPQRSTUVWXYZ");
    73 const TLogSize KTestMaxLogSize = 0xFFF;
    74 const TLogRecentSize KTestMaxRecentLogSize = 0xF;
    75 const TLogAge KTestMaxEventAge = 0xFFFFFFF;
    76 
    77 /**
    78 @SYMTestCaseID          SYSLIB-LOGENG-CT-1334
    79 @SYMTestCaseDesc	    Basic test to add events
    80 @SYMTestPriority 	    High
    81 @SYMTestActions  	    Tests for CLogClient::AddEvent() function
    82 @SYMTestExpectedResults Test must not fail
    83 @SYMREQ                 REQ0000
    84 */
    85 LOCAL_C void TestBasicL(CLogClient& aClient)
    86 	{
    87 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1334 "));
    88 	CTestActive* active = new(ELeave)CTestActive();
    89 	CleanupStack::PushL(active);
    90 
    91 	CLogEvent* event = CLogEvent::NewL();
    92 	CleanupStack::PushL(event);
    93 
    94 	TTime now;
    95 	now.UniversalTime();
    96 
    97 	event->SetEventType(KLogCallEventTypeUid);
    98 
    99 	active->StartL();
   100 	aClient.AddEvent(*event, active->iStatus);
   101 	CActiveScheduler::Start();
   102 	TEST2(active->iStatus.Int(), KErrNone);
   103 
   104 	TEST(event->EventType() == KLogCallEventTypeUid);
   105 	TEST(event->Description().Length() > 0);
   106 	TEST(event->Time() >= now);
   107 	now = event->Time();
   108 
   109 	TLogId id = event->Id();
   110 
   111 	event->SetRemoteParty(KTestRemoteParty1);
   112 	event->SetDirection(KTestDirection1);
   113 	event->SetDurationType(KTestDurationType1);
   114 	event->SetDuration(KTestDuration1);
   115 	event->SetStatus(KTestStatus1);
   116 	event->SetSubject(KTestSubject1);
   117 	event->SetNumber(KTestNumber1);
   118 	event->SetContact(KTestContact1);
   119 	event->SetLink(KTestLink1);
   120 	event->SetDataL(KTestData1);
   121 
   122 	active->StartL();
   123 	aClient.ChangeEvent(*event, active->iStatus);
   124 	CActiveScheduler::Start();
   125 	TEST2(active->iStatus.Int(), KErrNone);
   126 
   127 	TEST(event->Id() == id);
   128 	TEST(event->EventType() == KLogCallEventTypeUid);
   129 	TEST(event->Description().Length() > 0);
   130 	TEST(event->Time() == now);
   131 	TEST(event->RemoteParty() == KTestRemoteParty1);
   132 	TEST(event->Direction() == KTestDirection1);
   133 	TEST(event->DurationType() == KTestDurationType1);
   134 	TEST(event->Duration() == KTestDuration1);
   135 	TEST(event->Status() == KTestStatus1);
   136 	TEST(event->Subject() == KTestSubject1);
   137 	TEST(event->Number() == KTestNumber1);
   138 	TEST(event->Contact() == KTestContact1);
   139 	TEST(event->Link() == KTestLink1);
   140 	TEST(event->Data() == KTestData1);
   141 
   142 	CleanupStack::PopAndDestroy(); // event;
   143 
   144 	event = CLogEvent::NewL();
   145 	CleanupStack::PushL(event);
   146 
   147 	event->SetId(id);
   148 
   149 	active->StartL();
   150 	aClient.GetEvent(*event, active->iStatus);
   151 	CActiveScheduler::Start();
   152 	TEST2(active->iStatus.Int(),KErrNone);
   153 
   154 	TEST(event->Id() == id);
   155 	TEST(event->EventType() == KLogCallEventTypeUid);
   156 	TEST(event->Description().Length() > 0);
   157 	TEST(event->Time() == now);
   158 	TEST(event->RemoteParty() == KTestRemoteParty1);
   159 	TEST(event->Direction() == KTestDirection1);
   160 	TEST(event->DurationType() == KTestDurationType1);
   161 	TEST(event->Duration() == KTestDuration1);
   162 	TEST(event->Status() == KTestStatus1);
   163 	TEST(event->Subject() == KTestSubject1);
   164 	TEST(event->Number() == KTestNumber1);
   165 	TEST(event->Contact() == KTestContact1);
   166 	TEST(event->Link() == KTestLink1);
   167 	TEST(event->Data() == KTestData1);
   168 
   169 	active->StartL();
   170 	aClient.DeleteEvent(id, active->iStatus);
   171 	CActiveScheduler::Start();
   172 	TEST2(active->iStatus.Int(),KErrNone);
   173 
   174 	active->StartL();
   175 	aClient.GetEvent(*event, active->iStatus);
   176 	CActiveScheduler::Start();
   177 	TEST2(active->iStatus.Int(), KErrNotFound);
   178 
   179 	CleanupStack::PopAndDestroy(2); // event, active
   180 	}
   181 
   182 /**
   183 @SYMTestCaseID          SYSLIB-LOGENG-CT-0911
   184 @SYMTestCaseDesc	    Tests for new CLogClient object creation
   185 @SYMTestPriority 	    High
   186 @SYMTestActions  	    Create a new CLogClient check for memory errors
   187 @SYMTestExpectedResults Test must not fail
   188 @SYMREQ                 REQ0000
   189 */
   190 LOCAL_C void TestConstructionL()
   191 	{
   192 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0911 "));
   193 	CLogClient* client = NULL;
   194 
   195 	TInt failCount = 0;
   196 	TBool finished = EFalse;
   197 	TInt error;
   198 
   199 	while(!finished)
   200 		{
   201 		TheTest.Printf(_L("%d\r\n"), failCount);
   202 
   203         if(failCount > 8)
   204             {
   205             TRAP(error, client = CLogClient::NewL(theFs));
   206             TEST2(error, KErrNone);
   207             TestBasicL(*client);
   208             finished = ETrue;
   209             continue;
   210             }
   211 		
   212 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
   213 
   214 		TRAP(error, client = CLogClient::NewL(theFs));
   215 
   216 		__FILE_RESET;
   217 
   218 		if (error == KErrNone)
   219 			{
   220 			finished = ETrue;
   221 			TestBasicL(*client);
   222 			}
   223 		else
   224 			{
   225 			TEST2(error, KErrNoMemory);
   226 			TestUtils::DeleteDatabaseL();
   227 			}
   228 		}
   229 
   230 	delete client;
   231 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   232 	}
   233 
   234 /**
   235 @SYMTestCaseID          SYSLIB-LOGENG-CT-0912
   236 @SYMTestCaseDesc	    Adding an event type test,
   237                         Tests for CLogClient::AddEventType() function
   238 @SYMTestPriority 	    High
   239 @SYMTestActions  	    Check for file failure errors while adding event types
   240 @SYMTestExpectedResults Test must not fail
   241 @SYMREQ                 REQ0000
   242 */
   243 LOCAL_C void TestAddEventTypeL(CLogClient& aClient)
   244 	{
   245 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0912 "));
   246 	CLogEventType* type = CLogEventType::NewL();
   247 	CleanupStack::PushL(type);
   248 
   249 	type->SetUid(KTestEventUid);
   250 	type->SetDescription(KTestEventDesc1);
   251 	type->SetLoggingEnabled(ETrue);
   252 
   253 	CTestActive* active = new(ELeave)CTestActive();
   254 	CleanupStack::PushL(active);
   255 
   256 	TInt failCount = 0;
   257 	TBool finished = EFalse;
   258 	TInt error;
   259 
   260 	while(!finished)
   261 		{
   262 		error = KErrNone;
   263         if(failCount == 8)
   264             {
   265             aClient.AddEventType(*type, active->iStatus);
   266             active->StartL();
   267             CActiveScheduler::Start();
   268             TEST2(active->iStatus.Int(), KErrNone);
   269             finished = ETrue;
   270             continue;
   271             }
   272 
   273 		TheTest.Printf(_L("%d  \r"), failCount);
   274         
   275 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
   276 		
   277 		aClient.AddEventType(*type, active->iStatus);
   278 	
   279 		active->StartL();
   280 		CActiveScheduler::Start();
   281 		
   282 		if (active->iStatus == KErrNone)
   283 			finished = ETrue;
   284 		else
   285 			error = active->iStatus.Int();
   286 
   287 		__FILE_RESET;
   288 
   289 		if (error == KErrNoMemory)
   290 			{
   291 			active->StartL();
   292 			aClient.GetEventType(*type, active->iStatus);
   293 			CActiveScheduler::Start();
   294 			TEST2(active->iStatus.Int(), KErrNotFound);
   295 			}
   296 		else
   297 			TEST2(error, KErrNone);
   298 
   299 		}
   300 
   301 	active->StartL();
   302 	aClient.AddEventType(*type, active->iStatus);
   303 	CActiveScheduler::Start();
   304 	TEST2(active->iStatus.Int(), KErrAlreadyExists);
   305 
   306 	CleanupStack::PopAndDestroy(2); // active, type
   307 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   308 	}
   309 
   310 /**
   311 @SYMTestCaseID          SYSLIB-LOGENG-CT-0913
   312 @SYMTestCaseDesc	    Getting an event type test.
   313                         Tests for CLogClient::GetEventType() function
   314 @SYMTestPriority 	    High
   315 @SYMTestActions  	    Check for file failure errors while getting event types
   316 @SYMTestExpectedResults Test must not fail
   317 @SYMREQ                 REQ0000
   318 */
   319 LOCAL_C void TestGetEventTypeL(CLogClient& aClient)
   320 	{
   321 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0913 "));
   322 	CLogEventType* type = CLogEventType::NewL();
   323 	CleanupStack::PushL(type);
   324 
   325 	type->SetUid(KTestEventUid);
   326 
   327 	CTestActive* active = new(ELeave)CTestActive();
   328 	CleanupStack::PushL(active);
   329 
   330 	TInt failCount = 0;
   331 	TBool finished = EFalse;
   332 
   333 	while(!finished)
   334 		{
   335 		TheTest.Printf(_L("%d  \r"), failCount);
   336 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
   337 
   338 		aClient.GetEventType(*type, active->iStatus);
   339 
   340 		active->StartL();
   341 		CActiveScheduler::Start();
   342 		
   343 		if (active->iStatus == KErrNone)
   344 			finished = ETrue;
   345 		else
   346 			{
   347 			TEST2(active->iStatus.Int(), KErrNoMemory);
   348 			TEST(type->Description() == KNullDesC);
   349 			}
   350 
   351 		__FILE_RESET;
   352 		}
   353 
   354 	TEST(type->Uid() == KTestEventUid);
   355 	TEST(type->Description() == KTestEventDesc1);
   356 	TEST(type->LoggingEnabled());
   357 
   358 	CleanupStack::PopAndDestroy(2); // active, type
   359 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   360 	}
   361 
   362 /**
   363 @SYMTestCaseID          SYSLIB-LOGENG-CT-0914
   364 @SYMTestCaseDesc	    Changing an event type test,
   365                         Tests for CLogClient::ChangeEventType() function
   366 @SYMTestPriority 	    High
   367 @SYMTestActions  	    Check for file failure errors while changing event types
   368 @SYMTestExpectedResults Test must not fail
   369 @SYMREQ                 REQ0000
   370 */
   371 LOCAL_C void TestChangeEventTypeL(CLogClient& aClient)
   372 	{
   373 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0914 "));
   374 	CTestActive* active = new(ELeave)CTestActive();
   375 	CleanupStack::PushL(active);
   376 
   377 	CLogEventType* type = CLogEventType::NewL();
   378 	CleanupStack::PushL(type);
   379 
   380 	type->SetUid(KTestEventUid);
   381 
   382 	TInt failCount = 0;
   383 	TBool finished = EFalse;
   384 	TInt error;
   385 
   386 	while(!finished)
   387 		{
   388 		error = KErrNone;
   389 
   390 		type->SetDescription(KTestEventDesc2);
   391 		type->SetLoggingEnabled(EFalse);
   392 
   393         if(failCount == 8)
   394             {
   395             aClient.ChangeEventType(*type, active->iStatus);
   396             active->StartL();
   397             CActiveScheduler::Start();
   398             TEST2(active->iStatus.Int(), KErrNone);
   399             finished = ETrue;
   400             continue;
   401             }
   402 		
   403 		TheTest.Printf(_L("%d  \r"), failCount);
   404 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
   405 
   406 		aClient.ChangeEventType(*type, active->iStatus);
   407 
   408 		active->StartL();
   409 		CActiveScheduler::Start();
   410 
   411 		if (active->iStatus == KErrNone)
   412 			finished = ETrue;
   413 		else
   414 			error = active->iStatus.Int();
   415 
   416 		__FILE_RESET;
   417 
   418 		if (error == KErrNoMemory)
   419 			{
   420 			active->StartL();
   421 			aClient.GetEventType(*type, active->iStatus);
   422 			CActiveScheduler::Start();
   423 			TEST2(active->iStatus.Int(), KErrNone);
   424 
   425 			TEST(type->Description() == KTestEventDesc1);
   426 			TEST(type->LoggingEnabled());
   427 			}
   428 		else
   429 			TEST2(error, KErrNone);
   430 		}
   431 
   432 	type->SetUid(KTestEventUid);
   433 
   434 	active->StartL();
   435 	aClient.GetEventType(*type, active->iStatus);
   436 	CActiveScheduler::Start();
   437 	TEST2(active->iStatus.Int(), KErrNone);
   438 
   439 	TEST(type->Uid() == KTestEventUid);
   440 	TEST(type->Description() == KTestEventDesc2);
   441 	TEST(type->LoggingEnabled() == EFalse);
   442 
   443 	CleanupStack::PopAndDestroy(2); // type, active
   444 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   445 	}
   446 
   447 /**
   448 @SYMTestCaseID          SYSLIB-LOGENG-CT-0915
   449 @SYMTestCaseDesc	    Deleting an event type test
   450                         Tests for CLogClient::DeleteEventType() function
   451 @SYMTestPriority 	    High
   452 @SYMTestActions  	    Check for file failure errors while deleting event types
   453 @SYMTestExpectedResults Test must not fail
   454 @SYMREQ                 REQ0000
   455 */
   456 LOCAL_C void TestDeleteEventTypeL(CLogClient& aClient)
   457 	{
   458 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0915 "));
   459 	CTestActive* active = new(ELeave)CTestActive();
   460 	CleanupStack::PushL(active);
   461 
   462 	CLogEventType* type = CLogEventType::NewL();
   463 	CleanupStack::PushL(type);
   464 
   465 	type->SetUid(KTestEventUid);
   466 
   467 	TInt failCount = 0;
   468 	TBool finished = EFalse;
   469 	TInt error;
   470 
   471 	while(!finished)
   472 		{
   473 		error = KErrNone;
   474 
   475         if(failCount == 8)
   476             {
   477             aClient.DeleteEventType(KTestEventUid, active->iStatus);
   478             active->StartL();
   479             CActiveScheduler::Start();
   480             TEST2(active->iStatus.Int(), KErrNone);
   481             finished = ETrue;
   482             continue;
   483             }
   484 		
   485 		TheTest.Printf(_L("%d  \r"), failCount);
   486 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
   487 
   488 		aClient.DeleteEventType(KTestEventUid, active->iStatus);
   489 
   490 		active->StartL();
   491 		CActiveScheduler::Start();
   492 
   493 		if (active->iStatus == KErrNone)
   494 			finished = ETrue;
   495 		else
   496 			error = active->iStatus.Int();
   497 
   498 		__FILE_RESET;
   499 
   500 		if (error == KErrNoMemory)
   501 			{
   502 			active->StartL();
   503 			aClient.GetEventType(*type, active->iStatus);
   504 			CActiveScheduler::Start();
   505 			TEST2(active->iStatus.Int(), KErrNone);
   506 			}
   507 		else
   508 			TEST2(error, KErrNone);
   509 		}
   510 
   511 	active->StartL();
   512 	aClient.GetEventType(*type, active->iStatus);
   513 	CActiveScheduler::Start();
   514 	TEST2(active->iStatus.Int(), KErrNotFound);
   515 
   516 	CleanupStack::PopAndDestroy(2); // type, active
   517 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   518 	}
   519 
   520 /**
   521 @SYMTestCaseID          SYSLIB-LOGENG-CT-0916
   522 @SYMTestCaseDesc	    Adding an event test,
   523                         Tests for CLogClient::AddEvent() function
   524 @SYMTestPriority 	    High
   525 @SYMTestActions  	    Check for file failure errors while adding event
   526                         Tests for no error conditons,and the event information 
   527 @SYMTestExpectedResults Test must not fail
   528 @SYMREQ                 REQ0000
   529 */
   530 LOCAL_C void TestAddEventL(CLogClient& aClient)
   531 	{
   532 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0916 "));
   533 	// Ensure we always start from the same state
   534     TestUtils::DeleteDatabaseL();
   535 
   536 	CLogEventType* type = CLogEventType::NewL();
   537 	CleanupStack::PushL(type);
   538 
   539 	type->SetUid(KTestEventUid);
   540 	type->SetDescription(KTestEventDesc1);
   541 	type->SetLoggingEnabled(ETrue);
   542 
   543 	CTestActive* active = new(ELeave)CTestActive();
   544 	CleanupStack::PushL(active);
   545 
   546 	active->StartL();
   547 	aClient.AddEventType(*type, active->iStatus);
   548 	CActiveScheduler::Start();
   549 	TEST2(active->iStatus.Int(), KErrNone);
   550 
   551 	CLogEvent* event = CLogEvent::NewL();
   552 	CleanupStack::PushL(event);
   553 
   554 	TTime now;
   555 	now.UniversalTime();
   556 
   557 	event->SetEventType(KTestEventUid);
   558 	event->SetRemoteParty(KTestRemoteParty1);
   559 	event->SetDirection(KTestDirection1);
   560 	event->SetDurationType(KTestDurationType1);
   561 	event->SetDuration(KTestDuration1);
   562 	event->SetStatus(KTestStatus1);
   563 	event->SetSubject(KTestSubject1);
   564 	event->SetNumber(KTestNumber1);
   565 	event->SetContact(KTestContact1);
   566 	event->SetLink(KTestLink1);
   567 	event->SetDataL(KTestData1);
   568 
   569 	TInt failCount = 0;
   570 	TBool finished = EFalse;
   571 	TInt error;
   572 
   573 	while(!finished)
   574 		{
   575 		error = KErrNone;
   576 
   577         if(failCount == 8)
   578             {
   579             aClient.AddEvent(*event, active->iStatus);
   580             active->StartL();
   581             CActiveScheduler::Start();
   582             TEST2(active->iStatus.Int(), KErrNone);
   583             finished = ETrue;
   584             continue;
   585             }
   586 
   587 		TheTest.Printf(_L("%d  \r"), failCount);
   588 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
   589 		aClient.AddEvent(*event, active->iStatus);
   590 
   591 		active->StartL();
   592 		CActiveScheduler::Start();
   593 
   594 		if (active->iStatus == KErrNone)
   595 			finished = ETrue;
   596 		else
   597 			error = active->iStatus.Int();
   598 
   599 		__FILE_RESET;
   600 
   601 		if (error == KErrNoMemory)
   602 			{
   603 			event->SetId(0);
   604 
   605 			active->StartL();
   606 			aClient.GetEvent(*event, active->iStatus);
   607 			CActiveScheduler::Start();
   608 			TEST2(active->iStatus.Int(), KErrNotFound);
   609 
   610 			event->SetId(KLogNullId);
   611 			}
   612 		else
   613 			TEST2(error, KErrNone);
   614 		}
   615 
   616 	TEST(event->Id() == 0);
   617 	TEST(event->Time() >= now);
   618 	TEST(event->Description() == KTestEventDesc1);
   619 
   620 	active->StartL();
   621 	aClient.GetEvent(*event, active->iStatus);
   622 	CActiveScheduler::Start();
   623 	TEST2(active->iStatus.Int(), KErrNone);
   624 
   625 	CleanupStack::PopAndDestroy(3); // event, active, type
   626 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   627 	}
   628 
   629 /**
   630 @SYMTestCaseID          SYSLIB-LOGENG-CT-0917
   631 @SYMTestCaseDesc	    Get an events' information test
   632                         Tests for CLogClient::GetEvent() function
   633 @SYMTestPriority 	    High
   634 @SYMTestActions  	    Check for file failure errors while getting an event
   635                         Tests for no error conditons,and the event information. 
   636 @SYMTestExpectedResults Test must not fail
   637 @SYMREQ                 REQ0000
   638 */
   639 LOCAL_C void TestGetEventL(CLogClient& aClient)
   640 	{
   641 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0917 "));
   642 	CTestActive* active = new(ELeave)CTestActive();
   643 	CleanupStack::PushL(active);
   644 
   645 	CLogEvent* event = CLogEvent::NewL();
   646 	CleanupStack::PushL(event);
   647 
   648 	event->SetId(0);
   649 
   650 	TInt failCount = 0;
   651 	TBool finished = EFalse;
   652 
   653 	while(!finished)
   654 		{
   655 		TheTest.Printf(_L("%d  \r"), failCount);
   656 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
   657 		aClient.GetEvent(*event, active->iStatus);
   658 
   659 		active->StartL();
   660 		CActiveScheduler::Start();
   661 
   662 		if (active->iStatus == KErrNone)
   663 			finished = ETrue;
   664 		else
   665 			TEST2(active->iStatus.Int(), KErrNoMemory);
   666 
   667 		__FILE_RESET;
   668 		}
   669 
   670 	TEST(event->Id() == 0);
   671 	TEST(event->Time() > TTime(0));
   672 	TEST(event->Description() == KTestEventDesc1);
   673 	TEST(event->EventType() == KTestEventUid);
   674 	TEST(event->RemoteParty() == KTestRemoteParty1);
   675 	TEST(event->Direction() == KTestDirection1);
   676 	TEST(event->DurationType() == KTestDurationType1);
   677 	TEST(event->Duration() == KTestDuration1);
   678 	TEST(event->Status() == KTestStatus1);
   679 	TEST(event->Subject() == KTestSubject1);
   680 	TEST(event->Number() == KTestNumber1);
   681 	TEST(event->Contact() == KTestContact1);
   682 	TEST(event->Link() == KTestLink1);
   683 	TEST(event->Data() == KTestData1);
   684 
   685 	CleanupStack::PopAndDestroy(2); // event, active
   686 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   687 	}
   688 
   689 /**
   690 @SYMTestCaseID          SYSLIB-LOGENG-CT-0918
   691 @SYMTestCaseDesc	    Changing an event type test
   692                         Tests for CLogClient::ChangeEvent() function
   693 @SYMTestPriority 	    High
   694 @SYMTestActions  	    Check for file failure errors while changing an event
   695                         Tests for no error conditons,and the event information for the changed event
   696 @SYMTestExpectedResults Test must not fail
   697 @SYMREQ                 REQ0000
   698 */
   699 LOCAL_C void TestChangeEventL(CLogClient& aClient)
   700 	{
   701 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0918 "));
   702 	CTestActive* active = new(ELeave)CTestActive();
   703 	CleanupStack::PushL(active);
   704 
   705 	CLogEvent* event = CLogEvent::NewL();
   706 	CleanupStack::PushL(event);
   707 
   708 	TTime now;
   709 	now.UniversalTime();
   710 
   711 	TInt failCount = 0;
   712 	TBool finished = EFalse;
   713 	TInt error;
   714 
   715 	while(!finished)
   716 		{
   717 		error = KErrNone;
   718 
   719 		event->SetId(0);
   720 		event->SetTime(now);
   721 		event->SetRemoteParty(KTestRemoteParty2);
   722 		event->SetDirection(KTestDirection2);
   723 		event->SetDurationType(KTestDurationType2);
   724 		event->SetDuration(KTestDuration2);
   725 		event->SetStatus(KTestStatus2);
   726 		event->SetSubject(KTestSubject2);
   727 		event->SetNumber(KTestNumber2);
   728 		event->SetContact(KTestContact2);
   729 		event->SetLink(KTestLink2);
   730 		event->SetDataL(KTestData2);
   731 
   732         if(failCount == 14)
   733             {
   734             aClient.ChangeEvent(*event, active->iStatus);
   735             active->StartL();
   736             CActiveScheduler::Start();
   737             TEST2(active->iStatus.Int(), KErrNone);
   738             finished = ETrue;
   739             continue;
   740             }
   741 		
   742 		TheTest.Printf(_L("%d  \r"), failCount);
   743 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
   744 
   745 		aClient.ChangeEvent(*event, active->iStatus);
   746 
   747 		active->StartL();
   748 		CActiveScheduler::Start();
   749 		if (active->iStatus == KErrNone)
   750 			finished = ETrue;
   751 		else
   752 			error = active->iStatus.Int();
   753 
   754 		__FILE_RESET;
   755 
   756 		if (error == KErrNoMemory)
   757 			{
   758 			active->StartL();
   759 			aClient.GetEvent(*event, active->iStatus);
   760 			CActiveScheduler::Start();
   761 			if (active->iStatus != KErrNone) 
   762 			    TheTest.Printf(_L("\nerror code:%d failcount:%d\n"),active->iStatus.Int(),failCount);
   763 			TEST2(active->iStatus.Int(), KErrNone);
   764 
   765 			TEST(event->Id() == 0);
   766 			TEST(event->Time() > TTime(0));
   767 			TEST(event->Description() == KTestEventDesc1);
   768 			TEST(event->EventType() == KTestEventUid);
   769 			TEST(event->RemoteParty() == KTestRemoteParty1);
   770 			TEST(event->Direction() == KTestDirection1);
   771 			TEST(event->DurationType() == KTestDurationType1);
   772 			TEST(event->Duration() == KTestDuration1);
   773 			TEST(event->Status() == KTestStatus1);
   774 			TEST(event->Subject() == KTestSubject1);
   775 			TEST(event->Number() == KTestNumber1);
   776 			TEST(event->Contact() == KTestContact1);
   777 			TEST(event->Link() == KTestLink1);
   778 			TEST(event->Data() == KTestData1);
   779 			}
   780 		else
   781 			TEST2(error, KErrNone);
   782 		}
   783 
   784 	active->StartL();
   785 	aClient.GetEvent(*event, active->iStatus);
   786 	CActiveScheduler::Start();
   787 	TEST2(active->iStatus.Int(), KErrNone);
   788 
   789 	TEST(event->Id() == 0);
   790 	TEST(event->Time() == now);
   791 	TEST(event->Description() == KTestEventDesc1);
   792 	TEST(event->EventType() == KTestEventUid);
   793 	TEST(event->RemoteParty() == KTestRemoteParty2);
   794 	TEST(event->Direction() == KTestDirection2);
   795 	TEST(event->DurationType() == KTestDurationType2);
   796 	TEST(event->Duration() == KTestDuration2);
   797 	TEST(event->Status() == KTestStatus2);
   798 	TEST(event->Subject() == KTestSubject2);
   799 	TEST(event->Number() == KTestNumber2);
   800 	TEST(event->Contact() == KTestContact2);
   801 	TEST(event->Link() == KTestLink2);
   802 	TEST(event->Data() == KTestData2);
   803 
   804 	CleanupStack::PopAndDestroy(2); // event, active
   805 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   806 	}
   807 
   808 /**
   809 @SYMTestCaseID          SYSLIB-LOGENG-CT-0919
   810 @SYMTestCaseDesc	    Deleting an event test,
   811                         Tests for CLogClient::DeleteEvent() function
   812 @SYMTestPriority 	    High
   813 @SYMTestActions  	    Check for file failure errors while deleting an event
   814                         Tests for ErrNone flag.
   815 @SYMTestExpectedResults Test must not fail
   816 @SYMREQ                 REQ0000
   817 */
   818 LOCAL_C void TestDeleteEventL(CLogClient& aClient)
   819 	{
   820 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0919 "));
   821 	CTestActive* active = new(ELeave)CTestActive();
   822 	CleanupStack::PushL(active);
   823 
   824 	CLogEvent* event = CLogEvent::NewL();
   825 	CleanupStack::PushL(event);
   826 
   827 	event->SetId(0);
   828 
   829 	TInt failCount = 0;
   830 	TBool finished = EFalse;
   831 	TInt error;
   832 
   833 	while(!finished)
   834 		{
   835 		error = KErrNone;
   836 
   837         if(failCount == 10)
   838             {
   839             aClient.DeleteEvent(0, active->iStatus);
   840             active->StartL();
   841             CActiveScheduler::Start();
   842             TEST2(active->iStatus.Int(), KErrNone);
   843             finished = ETrue;
   844             continue;
   845             }
   846 		
   847 		TheTest.Printf(_L("%d  \r"), failCount);
   848 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
   849 
   850 		aClient.DeleteEvent(0, active->iStatus);
   851 
   852 		active->StartL();
   853 		CActiveScheduler::Start();
   854 
   855 		if (active->iStatus == KErrNone)
   856 			finished = ETrue;
   857 		else
   858 			error = active->iStatus.Int();
   859 
   860 		__FILE_RESET;
   861 
   862 		if (error == KErrNoMemory)
   863 			{
   864 			active->StartL();
   865 			aClient.GetEvent(*event, active->iStatus);
   866 			CActiveScheduler::Start();
   867 			TEST2(active->iStatus.Int(), KErrNone);
   868 			}
   869 		else
   870 			TEST2(error, KErrNone);
   871 		}
   872 
   873 	active->StartL();
   874 	aClient.GetEvent(*event, active->iStatus);
   875 	CActiveScheduler::Start();
   876 	TEST2(active->iStatus.Int(), KErrNotFound);
   877 
   878 	CleanupStack::PopAndDestroy(2); // event, active
   879 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   880 	}
   881 
   882 /**
   883 @SYMTestCaseID          SYSLIB-LOGENG-CT-0920
   884 @SYMTestCaseDesc	    Getting the Log Engine configuration information test
   885                         Tests for CLogClient::GetConfig() function
   886 @SYMTestPriority 	    High
   887 @SYMTestActions  	    Check for file failure errors while getting the configuration data
   888                         Tests for ErrNone flag.Tests for the retrieved information
   889 @SYMTestExpectedResults Test must not fail
   890 @SYMREQ                 REQ0000
   891 */
   892 LOCAL_C void TestGetConfigL(CLogClient& aClient)
   893 	{
   894 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0920 "));
   895 	CTestActive* active = new(ELeave)CTestActive();
   896 	CleanupStack::PushL(active);
   897 
   898 	TLogConfig config;
   899 
   900 	TEST(config.iMaxEventAge == 0);
   901 	TEST(config.iMaxLogSize == 0);
   902 	TEST(config.iMaxRecentLogSize == 0);
   903 
   904 	TInt failCount = 0;
   905 	TBool finished = EFalse;
   906 
   907 	while(!finished)
   908 		{
   909 		TheTest.Printf(_L("%d  \r"), failCount);
   910 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
   911 		aClient.GetConfig(config, active->iStatus);
   912 
   913 		active->StartL();
   914 		CActiveScheduler::Start();
   915 
   916 		if (active->iStatus == KErrNone)
   917 			finished = ETrue;
   918 		else
   919 			TEST2(active->iStatus.Int(), KErrNoMemory);
   920 
   921 		__FILE_RESET;
   922 		}
   923 
   924 	TEST(config.iMaxEventAge > 0);
   925 	TEST(config.iMaxLogSize > 0);
   926 	TEST(config.iMaxRecentLogSize > 0);
   927 
   928 	CleanupStack::PopAndDestroy(); // active
   929 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   930 	}
   931 
   932 /**
   933 @SYMTestCaseID          SYSLIB-LOGENG-CT-0921
   934 @SYMTestCaseDesc	    Changing the configuration of Log Engine test,
   935                         Tests for CLogClient::ChangeConfig() function
   936 @SYMTestPriority 	    High
   937 @SYMTestActions  	    Check for file failure errors while changing the log engine configuration data
   938                         Tests for ErrNone error conditons.Tests for the changed configuration data
   939 @SYMTestExpectedResults Test must not fail
   940 @SYMREQ                 REQ0000
   941 */
   942 LOCAL_C void TestChangeConfigL(CLogClient& aClient)
   943 	{
   944 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0921 "));
   945 	CTestActive* active = new(ELeave)CTestActive();
   946 	CleanupStack::PushL(active);
   947 
   948 	TLogConfig configOld;
   949 
   950 	active->StartL();
   951 	aClient.GetConfig(configOld, active->iStatus);
   952 	CActiveScheduler::Start();
   953 	TEST2(active->iStatus.Int(), KErrNone);
   954 
   955 	TLogConfig config;
   956 
   957 	TInt failCount = 0;
   958 	TBool finished = EFalse;
   959 	TInt error;
   960 
   961 	while(!finished)
   962 		{
   963 		error = KErrNone;
   964 
   965 		config.iMaxLogSize = KTestMaxLogSize;
   966 		config.iMaxRecentLogSize = KTestMaxRecentLogSize;
   967 		config.iMaxEventAge = KTestMaxEventAge;
   968 
   969         if(failCount == 11)
   970             {
   971             aClient.ChangeConfig(config, active->iStatus);
   972             active->StartL();
   973             CActiveScheduler::Start();
   974             TEST2(active->iStatus.Int(), KErrNone);
   975             finished = ETrue;
   976             continue;
   977             }
   978 		
   979 		TheTest.Printf(_L("%d  \r"), failCount);
   980 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
   981 
   982 		aClient.ChangeConfig(config, active->iStatus);
   983 
   984 		active->StartL();
   985 		CActiveScheduler::Start();
   986 
   987 		if (active->iStatus == KErrNone)
   988 			finished = ETrue;
   989 		else
   990 			error = active->iStatus.Int();
   991 		
   992 		__FILE_RESET;
   993 
   994 		if (error == KErrNoMemory)
   995 			{
   996 			active->StartL();
   997 			aClient.GetConfig(config, active->iStatus);
   998 			CActiveScheduler::Start();
   999 			TEST2(active->iStatus.Int(), KErrNone);
  1000 
  1001 			TEST(config.iMaxLogSize == configOld.iMaxLogSize);
  1002 			TEST(config.iMaxRecentLogSize == configOld.iMaxRecentLogSize);
  1003 			TEST(config.iMaxEventAge == configOld.iMaxEventAge);
  1004 			}
  1005 		else
  1006 			TEST2(error, KErrNone);		
  1007 		}
  1008 
  1009 	TEST(config.iMaxLogSize == KTestMaxLogSize);
  1010 	TEST(config.iMaxRecentLogSize == KTestMaxRecentLogSize);
  1011 	TEST(config.iMaxEventAge == KTestMaxEventAge);
  1012 
  1013 	CleanupStack::PopAndDestroy(); // active
  1014 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
  1015 	}
  1016 
  1017 /**
  1018 @SYMTestCaseID          SYSLIB-LOGENG-CT-0922
  1019 @SYMTestCaseDesc	    Getting a standard string from the specified resource file test
  1020                         Tests for CLogClient::GetString() function
  1021 @SYMTestPriority 	    High
  1022 @SYMTestActions  	    Check for file failure errors while changing the log engine configuration data
  1023                         Check for ErrNone flag.Tests for general errors,and retrieved string length. 
  1024 @SYMTestExpectedResults Test must not fail
  1025 @SYMREQ                 REQ0000
  1026 */
  1027 LOCAL_C void TestGetStringL(CLogClient& aClient)
  1028 	{
  1029 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0922 "));
  1030 	TBuf<KLogMaxSharedStringLength> str;
  1031 	
  1032 	TInt failCount = 0;
  1033 	TBool finished = EFalse;
  1034 	TInt error;
  1035 
  1036 	while(!finished)
  1037 		{
  1038 		TheTest.Printf(_L("%d  \r"), failCount);
  1039 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
  1040 
  1041 		error = aClient.GetString(str, R_LOG_DIR_IN);
  1042 
  1043 		__FILE_RESET;
  1044 
  1045 		if (error == KErrNone)
  1046 			{
  1047 			finished = ETrue;
  1048 			TEST(str.Length() > 0);
  1049 			}
  1050 		else
  1051 			{
  1052 			TEST2(error, KErrNoMemory);
  1053 			TEST(str.Length() == 0);
  1054 			}
  1055 		}
  1056 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
  1057 	}
  1058 
  1059 /**
  1060 @SYMTestCaseID          SYSLIB-LOGENG-CT-0923
  1061 @SYMTestCaseDesc	    Clearing the Log Event test.
  1062                         Tests for CLogClient::ClearLog() function
  1063 @SYMTestPriority 	    High
  1064 @SYMTestActions  	    Add 4 events to the event log,check for ErrNone flag
  1065                         Clear the log by calling CLogClient::ClearLog() function.
  1066 						Try for getting the added 4 events.Check for not found error.
  1067 @SYMTestExpectedResults Test must not fail
  1068 @SYMREQ                 REQ12748
  1069 */
  1070 LOCAL_C void TestClearEventLogL(CLogClient& aClient
  1071 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
  1072 		, TBool aUseSimId = EFalse
  1073 #endif		
  1074 		)
  1075 	{
  1076 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0923 "));
  1077 	TTime now;
  1078 	now.UniversalTime();
  1079 	
  1080 	TDateTime dt(now.DateTime());
  1081 	dt.SetYear(dt.Year() - 1);
  1082 	TTime date1(dt);
  1083 
  1084 	dt.SetYear(dt.Year() - 1);
  1085 	TTime date2(dt);
  1086 
  1087 	CTestActive* active = new(ELeave)CTestActive();
  1088 	CleanupStack::PushL(active);
  1089 
  1090 	CLogEvent* event1 = CLogEvent::NewL();
  1091 	CleanupStack::PushL(event1);
  1092 	event1->SetEventType(KTestEventUid);
  1093 
  1094 	active->StartL();
  1095 	aClient.AddEvent(*event1, active->iStatus);
  1096 	CActiveScheduler::Start();
  1097 	TEST2(active->iStatus.Int(), KErrNone);
  1098 
  1099 	event1->SetTime(date1);
  1100 
  1101 	active->StartL();
  1102 	aClient.ChangeEvent(*event1, active->iStatus);
  1103 	CActiveScheduler::Start();
  1104 	TEST2(active->iStatus.Int(), KErrNone);
  1105 
  1106 	CLogEvent* event2 = CLogEvent::NewL();
  1107 	CleanupStack::PushL(event2);
  1108 	event2->SetEventType(KTestEventUid);
  1109 
  1110 	active->StartL();
  1111 	aClient.AddEvent(*event2, active->iStatus);
  1112 	CActiveScheduler::Start();
  1113 	TEST2(active->iStatus.Int(), KErrNone);
  1114 
  1115 	event2->SetTime(date1);
  1116 
  1117 	active->StartL();
  1118 	aClient.ChangeEvent(*event2, active->iStatus);
  1119 	CActiveScheduler::Start();
  1120 	TEST2(active->iStatus.Int(), KErrNone);
  1121 
  1122 	CLogEvent* event3 = CLogEvent::NewL();
  1123 	CleanupStack::PushL(event3);
  1124 	event3->SetEventType(KTestEventUid);
  1125 
  1126 	active->StartL();
  1127 	aClient.AddEvent(*event3, active->iStatus);
  1128 	CActiveScheduler::Start();
  1129 	TEST2(active->iStatus.Int(), KErrNone);
  1130 
  1131 	event3->SetTime(date2);
  1132 
  1133 	active->StartL();
  1134 	aClient.ChangeEvent(*event3, active->iStatus);
  1135 	CActiveScheduler::Start();
  1136 	TEST2(active->iStatus.Int(), KErrNone);
  1137 
  1138 	CLogEvent* event4 = CLogEvent::NewL();
  1139 	CleanupStack::PushL(event4);
  1140 	event4->SetEventType(KTestEventUid);
  1141 
  1142 	active->StartL();
  1143 	aClient.AddEvent(*event4, active->iStatus);
  1144 	CActiveScheduler::Start();
  1145 	TEST2(active->iStatus.Int(), KErrNone);
  1146 
  1147 	event4->SetTime(date2);
  1148 
  1149 	active->StartL();
  1150 	aClient.ChangeEvent(*event4, active->iStatus);
  1151 	CActiveScheduler::Start();
  1152 	TEST2(active->iStatus.Int(), KErrNone);
  1153 
  1154 	TInt failCount = 0;
  1155 	TBool finished = EFalse;
  1156 
  1157 	while(!finished)
  1158 		{
  1159 		TheTest.Printf(_L("%d  \r"), failCount);
  1160 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
  1161 
  1162 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
  1163 		if(aUseSimId)
  1164 			{
  1165 			aClient.ClearLog(date1, KLogNullSimId, active->iStatus);
  1166 			}
  1167 		else
  1168 #endif			
  1169 			{
  1170 			aClient.ClearLog(date1, active->iStatus);
  1171 			}
  1172 
  1173 		__FILE_RESET;
  1174 
  1175 		active->StartL();	
  1176 		CActiveScheduler::Start();
  1177 
  1178 		if (active->iStatus == KErrNone)
  1179 			finished = ETrue;
  1180 		else
  1181 			TEST2(active->iStatus.Int(), KErrNoMemory);
  1182 		}
  1183 
  1184 	active->StartL();
  1185 	aClient.GetEvent(*event1, active->iStatus);
  1186 	CActiveScheduler::Start();
  1187 	if (active->iStatus != KErrNone) 
  1188 	    TheTest.Printf(_L("error code:%d\n"),active->iStatus.Int());
  1189 	TEST2(active->iStatus.Int(), KErrNone);
  1190 
  1191 	active->StartL();
  1192 	aClient.GetEvent(*event2, active->iStatus);
  1193 	CActiveScheduler::Start();
  1194 	TEST2(active->iStatus.Int(), KErrNone);
  1195 
  1196 	active->StartL();
  1197 	aClient.GetEvent(*event3, active->iStatus);
  1198 	CActiveScheduler::Start();
  1199 	TEST2(active->iStatus.Int(), KErrNotFound);
  1200 
  1201 	active->StartL();
  1202 	aClient.GetEvent(*event4, active->iStatus);
  1203 	CActiveScheduler::Start();
  1204 	TEST2(active->iStatus.Int(), KErrNotFound);
  1205 
  1206 	active->StartL();
  1207 	aClient.ClearLog(now, active->iStatus);
  1208 	CActiveScheduler::Start();
  1209 	TEST2(active->iStatus.Int(), KErrNone);
  1210 
  1211 	active->StartL();
  1212 	aClient.GetEvent(*event1, active->iStatus);
  1213 	CActiveScheduler::Start();
  1214 	TEST2(active->iStatus.Int(), KErrNotFound);
  1215 
  1216 	active->StartL();
  1217 	aClient.GetEvent(*event2, active->iStatus);
  1218 	CActiveScheduler::Start();
  1219 	TEST2(active->iStatus.Int(), KErrNotFound);
  1220 
  1221 	CleanupStack::PopAndDestroy(5); // event4, event3, event2, event1, active
  1222 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
  1223 	}
  1224 
  1225 void doTestsL()
  1226 	{
  1227 	TestUtils::Initialize(_L("t_logfile"));
  1228 
  1229     TheTest.Start(_L("Construction + create db"));
  1230 	TestUtils::DeleteDatabaseL();
  1231 	TestConstructionL(); // Creates database
  1232 	TheTest.Next(_L("Construction + open db"));
  1233 	TestConstructionL(); // Opens existing database
  1234 	TestUtils::DeleteDatabaseL();
  1235 	theLog.Write(_L8("Test 1 OK\n"));
  1236 
  1237 	CLogClient* client = CLogClient::NewL(theFs);
  1238 	CleanupStack::PushL(client);
  1239 
  1240 	TheTest.Next(_L("Add Event Type"));
  1241 	TestAddEventTypeL(*client);
  1242 	theLog.Write(_L8("Test 2 OK\n"));
  1243 
  1244 	TheTest.Next(_L("Get Event Type"));
  1245 	TestGetEventTypeL(*client);
  1246 	theLog.Write(_L8("Test 3 OK\n"));
  1247 
  1248 	TheTest.Next(_L("Change Event Type"));
  1249 	TestChangeEventTypeL(*client);
  1250 	theLog.Write(_L8("Test 4 OK\n"));
  1251 
  1252 	TheTest.Next(_L("Delete Event Type"));
  1253 	TestDeleteEventTypeL(*client);
  1254 	theLog.Write(_L8("Test 5 OK\n"));
  1255 
  1256 	TestUtils::DeleteDatabaseL();
  1257 
  1258 	TheTest.Next(_L("Add Event"));
  1259 	TestAddEventL(*client);
  1260 	theLog.Write(_L8("Test 6 OK\n"));
  1261 
  1262 	TheTest.Next(_L("Get Event"));
  1263 	TestGetEventL(*client);
  1264 	theLog.Write(_L8("Test 7 OK\n"));
  1265 
  1266 	TheTest.Next(_L("Change Event"));
  1267 	TestChangeEventL(*client);
  1268 	theLog.Write(_L8("Test 8 OK\n"));
  1269 
  1270 	TheTest.Next(_L("Delete Event"));
  1271 	TestDeleteEventL(*client);
  1272 	theLog.Write(_L8("Test 9 OK\n"));
  1273 
  1274 	TheTest.Next(_L("Get Config"));
  1275 	TestGetConfigL(*client);
  1276 	theLog.Write(_L8("Test 10 OK\n"));
  1277 
  1278 	TheTest.Next(_L("Change Config"));
  1279 	TestChangeConfigL(*client);
  1280 	theLog.Write(_L8("Test 11 OK\n"));
  1281 
  1282 	TheTest.Next(_L("Get String"));
  1283 	TestGetStringL(*client);
  1284 	theLog.Write(_L8("Test 12 OK\n"));
  1285 
  1286 	TheTest.Next(_L("Clear Event Log"));
  1287 	TestClearEventLogL(*client);
  1288 	theLog.Write(_L8("Test 13 OK\n"));
  1289 
  1290 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
  1291 	TheTest.Next(_L("Clear Event Log + SimId"));
  1292 	TestClearEventLogL(*client, ETrue);
  1293 	theLog.Write(_L8("Test 14 OK\n"));
  1294 #endif	
  1295 
  1296 	CleanupStack::PopAndDestroy(); // client
  1297 	}