landmarks/locationlandmarks/tsrc/LandmarkTestModule/src/FT_CPosTp77.cpp
branchRCL_3
changeset 44 2b4ea9893b66
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *   ?description_line
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 //  INCLUDES
       
    21 #include "FT_CPosTp77.h"
       
    22 #include <EPos_CPosLandmarkDatabase.h>
       
    23 
       
    24 // CONSTANTS
       
    25 // _LIT(KTp77Panic, "Timeout Panic");
       
    26 const TInt KTp77PanicNumber = 77;
       
    27 
       
    28 // ================= LOCAL FUNCTIONS =======================
       
    29 
       
    30 // ---------------------------------------------------------
       
    31 // LOCAL_C BadThreadFunction
       
    32 //
       
    33 // (other items were commented in a header).
       
    34 // ---------------------------------------------------------
       
    35 //
       
    36 LOCAL_C TInt BadClientThreadFunction(TAny* aData)
       
    37     {
       
    38     CTrapCleanup* cleanup = CTrapCleanup::New(); 
       
    39     CActiveScheduler* actSch = new (ELeave) CActiveScheduler;
       
    40     CActiveScheduler::Install(actSch);
       
    41 
       
    42     TRAPD(err, CPosTp77::RunBadClientTestL(aData));
       
    43        
       
    44     delete actSch;
       
    45     delete cleanup;
       
    46     return err;
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------
       
    50 // LOCAL_C KillerThreadFunction
       
    51 //
       
    52 // (other items were commented in a header).
       
    53 // ---------------------------------------------------------
       
    54 //
       
    55 LOCAL_C TInt KillerThreadFunction(TAny* aData)
       
    56     {
       
    57     CTrapCleanup* cleanup = CTrapCleanup::New(); 
       
    58     CActiveScheduler* actSch = new (ELeave) CActiveScheduler;
       
    59     CActiveScheduler::Install(actSch);
       
    60 
       
    61     TRAPD(err, CPosTp77::RunThreadKillerL(aData));
       
    62        
       
    63     delete actSch;
       
    64     delete cleanup;
       
    65     return err;
       
    66     }
       
    67 
       
    68 // ================= MEMBER FUNCTIONS =======================
       
    69 
       
    70 // ---------------------------------------------------------
       
    71 // CPosTp77::GetName
       
    72 //
       
    73 // (other items were commented in a header).
       
    74 // ---------------------------------------------------------
       
    75 //
       
    76 void CPosTp77::GetName(TDes& aName) const
       
    77     {
       
    78     _LIT(KTestName, "TP77 - Bad server usage");
       
    79     aName = KTestName;
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------
       
    83 // CPosTp77::InitTestL
       
    84 //
       
    85 // (other items were commented in a header).
       
    86 // ---------------------------------------------------------
       
    87 //
       
    88 void CPosTp77::InitTestL()
       
    89     {
       
    90     MakeSurePanicDebugFileExistsL();
       
    91     }
       
    92 
       
    93 // ---------------------------------------------------------
       
    94 // CPosTp77::CloseTest
       
    95 //
       
    96 // (other items were commented in a header).
       
    97 // ---------------------------------------------------------
       
    98 //
       
    99 void CPosTp77::CloseTest()
       
   100     {
       
   101     iBadThread.Close();
       
   102     }
       
   103 
       
   104 // ---------------------------------------------------------
       
   105 // CPosTp77::StartL
       
   106 //
       
   107 // (other items were commented in a header).
       
   108 // ---------------------------------------------------------
       
   109 //
       
   110 void CPosTp77::StartL()
       
   111     {
       
   112 // Test multiple Notify Db events
       
   113     iLog->Put(_L("1st part, testing multiple notify Db event"));
       
   114     iTestCase = ETestNotifyDbEvent;
       
   115     CPosLandmarkDatabase* db = InitDbLC();
       
   116     iTimeToWait = 3000000;
       
   117     ResumeThreadsAndVerifyExitL();
       
   118     TBool errors = VerifyThreadExitResultsL(KTp77PanicNumber);
       
   119     (errors) ?
       
   120         VerifyLmServerIsAliveL(db) :
       
   121         errors = VerifyLmServerIsAliveL(db);
       
   122     CleanupStack::PopAndDestroy(db);
       
   123 
       
   124 // Test non terminated single Notify Db event
       
   125     iLog->Put(_L("2nd part, testing non terminated sinlge notify Db event"));
       
   126     iTestCase = ETestNotifyDbEvent2;
       
   127     db = InitDbLC();
       
   128     ResumeThreadsAndVerifyExitL();
       
   129     (errors) ?
       
   130         VerifyThreadExitResultsL(0) :
       
   131         errors = VerifyThreadExitResultsL(0);
       
   132     (errors) ?
       
   133         VerifyLmServerIsAliveL(db) :
       
   134         errors = VerifyLmServerIsAliveL(db);
       
   135     CleanupStack::PopAndDestroy(db);
       
   136 
       
   137 // Test non terminated single InitializeL()
       
   138     iLog->Put(_L("3rd part, testing non terminated single Initialize db operations"));
       
   139     iTestCase = ETestInitialize;
       
   140     RemoveDefaultDbL();    
       
   141     db = CPosLandmarkDatabase::OpenL();
       
   142     CleanupStack::PushL(db);
       
   143     ResumeThreadsAndVerifyExitL();
       
   144     (errors) ?
       
   145         VerifyThreadExitResultsL(0) :
       
   146         errors = VerifyThreadExitResultsL(0);
       
   147     CPosLmOperation* initOp = db->InitializeL();
       
   148     CleanupStack::PushL(initOp);
       
   149     TRAPD(err, initOp->ExecuteL());
       
   150     if (err != KErrNone)
       
   151         {
       
   152         _LIT(KError, "Trying to initialize after badThread failed with %d");
       
   153         iBuf.Format(KError, err);
       
   154         iLog->PutError(iBuf);
       
   155         errors = ETrue;
       
   156         }
       
   157     CleanupStack::PopAndDestroy(initOp);
       
   158     (errors) ?
       
   159         VerifyLmServerIsAliveL(db) :
       
   160         errors = VerifyLmServerIsAliveL(db);
       
   161     CleanupStack::PopAndDestroy(db);
       
   162 
       
   163 // Test non terminated multiple InitializeL()
       
   164     iLog->Put(_L("4th part, testing non terminated multiple Initialize db operations"));
       
   165     iTestCase = ETestInitialize2;
       
   166     RemoveDefaultDbL();    
       
   167     db = CPosLandmarkDatabase::OpenL();
       
   168     CleanupStack::PushL(db);
       
   169     ResumeThreadsAndVerifyExitL();
       
   170     (errors) ?
       
   171         VerifyThreadExitResultsL(0) :
       
   172         errors = VerifyThreadExitResultsL(0);
       
   173     initOp = db->InitializeL();
       
   174     CleanupStack::PushL(initOp);
       
   175     TRAP(err, initOp->ExecuteL());
       
   176     if (err != KErrNone)
       
   177         {
       
   178         _LIT(KError, "Trying to initialize after badThread failed with %d");
       
   179         iBuf.Format(KError, err);
       
   180         iLog->PutError(iBuf);
       
   181         errors = ETrue;
       
   182         }
       
   183     CleanupStack::PopAndDestroy(initOp);
       
   184     (errors) ?
       
   185         VerifyLmServerIsAliveL(db) :
       
   186         errors = VerifyLmServerIsAliveL(db);
       
   187     CleanupStack::PopAndDestroy(db);
       
   188 
       
   189 // Test write lock on non terminated import operation
       
   190     iLog->Put(_L("5th part, testing write lock on non terminated import operation"));
       
   191     iTestCase = ETestWriteLock;
       
   192     db = UseGeneratedDbFileL();
       
   193     CleanupStack::PushL(db);
       
   194     ResumeThreadsAndVerifyExitL();
       
   195     (errors) ?
       
   196         VerifyThreadExitResultsL(0) :
       
   197         errors = VerifyThreadExitResultsL(0);
       
   198     (errors) ?
       
   199         VerifyLmServerIsAliveL(db) :
       
   200         errors = VerifyLmServerIsAliveL(db);
       
   201     CleanupStack::PopAndDestroy(db);
       
   202 
       
   203 // The test below should be successful. This is the case on WINS but not in THUMB. On
       
   204 // THUMB it runs for a while and then fails with KErrNoMemory. A duration test is needed!
       
   205 /*
       
   206 // Test RegisterUri (executed during OpenL())
       
   207     iLog->Put(_L("2nd part, testing registering URI..."));
       
   208     iTestCase = ETestRegisterUri;
       
   209     db = InitDbLC();
       
   210 
       
   211     TBool ready = EFalse;
       
   212     TInt diff;
       
   213     iTimeToWait = 3000000;
       
   214     while (!ready)
       
   215         {
       
   216         diff = iTimeToWait.Int() - iLastTimeToWait.Int();
       
   217         iLastTimeToWait = iTimeToWait;
       
   218         ResumeThreadsAndVerifyExitL();
       
   219         VerifyLmServerIsAliveL(db);
       
   220         if (iBadThreadExitReason == KTp77PanicNumber &&
       
   221             iBadThreadExitType == EExitKill)
       
   222             {
       
   223             // Increase iTimeToWait
       
   224             iTimeToWait = iTimeToWait.Int() + Abs(diff / 2);
       
   225             }
       
   226         else if (iBadThreadExitReason == 0 &&
       
   227             iBadThreadExitType == EExitKill)
       
   228             {
       
   229             // Decrease iTimeToWait
       
   230             iTimeToWait = iTimeToWait.Int() - Abs(diff / 2);
       
   231             }
       
   232         else
       
   233             {
       
   234             LogErrorAndLeave(_L("Got unexpected exit code from badThread"));
       
   235             }
       
   236         ready = iTimeToWait == iLastTimeToWait;
       
   237         }
       
   238     iBuf.Format(_L("Estimated critical code after %d microseconds"), iTimeToWait.Int());
       
   239     iLog->Put(buf);
       
   240 
       
   241     // Execute vulnarable code
       
   242     iTimeToWait = iTimeToWait.Int() - 3000;
       
   243     diff = 20;
       
   244     ready = EFalse;
       
   245     TInt i = 0;
       
   246     while (!ready)
       
   247         {
       
   248         iTimeToWait = iTimeToWait.Int() + diff;
       
   249         ResumeThreadsAndVerifyExitL();
       
   250         VerifyLmServerIsAliveL(db);
       
   251         ready = iBadThreadExitReason != KTp77PanicNumber;
       
   252         i++;
       
   253         }
       
   254 
       
   255     buf.Format(_L("Tested %d loops"), i);
       
   256     iLog->Put(buf);
       
   257 
       
   258     CleanupStack::PopAndDestroy(db);*/
       
   259 
       
   260     if (errors)
       
   261         {
       
   262         User::Leave(KErrGeneral);
       
   263         }
       
   264     }
       
   265 
       
   266 // ---------------------------------------------------------
       
   267 // CPosTp77::InitDbLC
       
   268 //
       
   269 // (other items were commented in a header).
       
   270 // ---------------------------------------------------------
       
   271 //
       
   272 CPosLandmarkDatabase* CPosTp77::InitDbLC()
       
   273     {
       
   274     RemoveDefaultDbL();
       
   275     CPosLandmarkDatabase* database = CPosLandmarkDatabase::OpenL();
       
   276     CleanupStack::PushL(database);
       
   277     
       
   278     if (database->IsInitializingNeeded())
       
   279         {
       
   280         ExecuteAndDeleteLD(database->InitializeL());
       
   281         }
       
   282 
       
   283     return database;
       
   284     }
       
   285 
       
   286 // ---------------------------------------------------------
       
   287 // CPosTp77::RunBadClientTestL
       
   288 //
       
   289 // (other items were commented in a header).
       
   290 // ---------------------------------------------------------
       
   291 //
       
   292 void CPosTp77::RunBadClientTestL(TAny* aData)
       
   293     {
       
   294     CPosTp77* tp77 = reinterpret_cast <CPosTp77*> (aData);
       
   295     switch (tp77->iTestCase)
       
   296         {
       
   297         case ETestNotifyDbEvent:
       
   298             {
       
   299             TPosLmEvent event1, event2, event3, event4, event5;
       
   300             TRequestStatus status1 = KErrNone;
       
   301             TRequestStatus status2 = KErrNone; 
       
   302             TRequestStatus status3 = KErrNone;
       
   303             TRequestStatus status4 = KErrNone;
       
   304             TRequestStatus status5 = KErrNone;
       
   305             TRequestStatus status[5] = {status1, status2, status3, status4, status5};
       
   306 
       
   307             CPosLandmarkDatabase* db1 = CPosLandmarkDatabase::OpenL();
       
   308             CleanupStack::PushL(db1);
       
   309             CPosLandmarkDatabase* db2 = CPosLandmarkDatabase::OpenL();
       
   310             CleanupStack::PushL(db2);
       
   311             CPosLandmarkDatabase* db3 = CPosLandmarkDatabase::OpenL();
       
   312             CleanupStack::PushL(db3);
       
   313             CPosLandmarkDatabase* db4 = CPosLandmarkDatabase::OpenL();
       
   314             CleanupStack::PushL(db4);
       
   315             CPosLandmarkDatabase* db5 = CPosLandmarkDatabase::OpenL();
       
   316             CleanupStack::PushL(db5);
       
   317 
       
   318             db1->NotifyDatabaseEvent(event1, status[0]);
       
   319             db2->NotifyDatabaseEvent(event2, status[1]);
       
   320             db3->NotifyDatabaseEvent(event3, status[2]);
       
   321             db4->NotifyDatabaseEvent(event4, status[3]);
       
   322             db5->NotifyDatabaseEvent(event5, status[4]);
       
   323 
       
   324             for (TInt i = 0; i < 5; i++)
       
   325                 {
       
   326                 User::WaitForRequest(status[i]);
       
   327                 }
       
   328 
       
   329             CleanupStack::PopAndDestroy(5, db1);
       
   330             }
       
   331             break;
       
   332 
       
   333         case ETestNotifyDbEvent2:
       
   334             {
       
   335             CPosLandmarkDatabase* db1 = CPosLandmarkDatabase::OpenL();
       
   336             
       
   337             // Observe events
       
   338             TPosLmEvent event1;
       
   339             TRequestStatus status1;
       
   340             db1->NotifyDatabaseEvent(event1, status1);
       
   341             }
       
   342             break;
       
   343 
       
   344         case ETestInitialize:
       
   345             {
       
   346             CPosLandmarkDatabase* db = CPosLandmarkDatabase::OpenL();
       
   347             
       
   348             // Start to initialize db
       
   349             CPosLmOperation* op = db->InitializeL();
       
   350             TRequestStatus status;
       
   351             TReal32 progress;
       
   352             op->NextStep(status, progress);
       
   353             }
       
   354             break;
       
   355 
       
   356         case ETestInitialize2:
       
   357             {
       
   358             TRequestStatus status1, status2, status3, status4, status5;
       
   359             TReal32 progress1, progress2, progress3, progress4, progress5;
       
   360             CPosLandmarkDatabase* db1 = CPosLandmarkDatabase::OpenL();
       
   361             CPosLandmarkDatabase* db2 = CPosLandmarkDatabase::OpenL();
       
   362             CPosLandmarkDatabase* db3 = CPosLandmarkDatabase::OpenL();
       
   363             CPosLandmarkDatabase* db4 = CPosLandmarkDatabase::OpenL();
       
   364             CPosLandmarkDatabase* db5 = CPosLandmarkDatabase::OpenL();
       
   365         
       
   366             // Start to initialize db
       
   367             CPosLmOperation* op1 = db1->InitializeL();
       
   368             CPosLmOperation* op2 = db2->InitializeL();
       
   369             CPosLmOperation* op3 = db3->InitializeL();
       
   370             CPosLmOperation* op4 = db4->InitializeL();
       
   371             CPosLmOperation* op5 = db5->InitializeL();
       
   372             op1->NextStep(status1, progress1);
       
   373             op2->NextStep(status2, progress2);
       
   374             op3->NextStep(status3, progress3);
       
   375             op4->NextStep(status4, progress4);
       
   376             op5->NextStep(status5, progress5);
       
   377             }
       
   378             break;
       
   379 
       
   380         case ETestWriteLock:
       
   381             {
       
   382             CPosLandmarkDatabase* db = CPosLandmarkDatabase::OpenL();
       
   383             CleanupStack::PushL(db);
       
   384             CPosLmOperation* removeOp = db->RemoveAllLandmarksL();
       
   385             TReal32 progress(0);
       
   386             TRequestStatus status;
       
   387             while (progress < 0.4)
       
   388                 {
       
   389                 removeOp->NextStep(status, progress);
       
   390                 User::WaitForRequest(status);
       
   391                 }
       
   392             CleanupStack::Pop(db);
       
   393             }
       
   394             break;
       
   395 
       
   396         case ETestRegisterUri:
       
   397             {
       
   398             CPosLandmarkDatabase* db1 = CPosLandmarkDatabase::OpenL();
       
   399             delete db1;
       
   400             }
       
   401             break;
       
   402 
       
   403         };
       
   404     }
       
   405 
       
   406 // ---------------------------------------------------------
       
   407 // CPosTp77::RunThreadKillerL
       
   408 //
       
   409 // (other items were commented in a header).
       
   410 // ---------------------------------------------------------
       
   411 //
       
   412 void CPosTp77::RunThreadKillerL(TAny* aData)
       
   413     {
       
   414     CPosTp77* tp77 = reinterpret_cast <CPosTp77*>(aData);
       
   415 
       
   416     // Enter a infinite loop. This reason to this is that I want to be sure 
       
   417     // that it is killed by the TP77-thread.
       
   418     TBool forever = ETrue;
       
   419     while (forever)
       
   420         {
       
   421         // Panic badThread if it is still alive
       
   422         if (tp77->iBadThread.ExitType() == EExitPending)
       
   423             {
       
   424             TRequestStatus status;
       
   425             tp77->iBadThread.Logon(status);
       
   426 
       
   427             switch (tp77->iTestCase)
       
   428                 {
       
   429                 case ETestNotifyDbEvent:
       
   430                     {
       
   431                     // Make sure that the badThread has started 5 observers of db events
       
   432                     User::After(tp77->iTimeToWait);
       
   433 
       
   434                     // Generate db event
       
   435                     CPosLandmarkDatabase* db = CPosLandmarkDatabase::OpenL();
       
   436                     CleanupStack::PushL(db);
       
   437                     CPosLandmark* lm = CPosLandmark::NewLC();
       
   438                     db->AddLandmarkL(*lm);
       
   439 
       
   440                     // Kill Event observing thread
       
   441                     tp77->iBadThread.Kill(KTp77PanicNumber);
       
   442                     User::WaitForRequest(status);
       
   443 
       
   444                     CleanupStack::PopAndDestroy(2, db);
       
   445                     }
       
   446                     break;
       
   447 
       
   448                 case ETestNotifyDbEvent2:
       
   449                 case ETestInitialize:
       
   450                 case ETestInitialize2:
       
   451                 case ETestWriteLock:
       
   452                     {
       
   453                     // Do nothing
       
   454                     User::LeaveIfError(tp77->iBadThread.LogonCancel(status));
       
   455                     forever = EFalse;
       
   456                     }
       
   457                     break;
       
   458 
       
   459                 case ETestRegisterUri:
       
   460                     {
       
   461                     User::After(tp77->iTimeToWait);
       
   462 
       
   463                     // Kill Event observing thread
       
   464                     tp77->iBadThread.Kill(KTp77PanicNumber);
       
   465                     User::WaitForRequest(status);
       
   466                     }
       
   467                     break;
       
   468 
       
   469                 };
       
   470             }
       
   471         else
       
   472             {
       
   473             forever = EFalse;
       
   474             }
       
   475         }
       
   476     }
       
   477 
       
   478 // ---------------------------------------------------------
       
   479 // CPosTp77::ResumeThreadsAndVerifyExitL
       
   480 //
       
   481 // (other items were commented in a header).
       
   482 // ---------------------------------------------------------
       
   483 //
       
   484 void CPosTp77::ResumeThreadsAndVerifyExitL()
       
   485     {
       
   486     _LIT(KCreateThreadErr, "Creating thread failed with %d");
       
   487 
       
   488     // Create bad thread
       
   489     _LIT(KBadThreadName, "TP77 - Bad thread");
       
   490     iBadThread.Close();
       
   491     TInt err = iBadThread.Create(KBadThreadName, BadClientThreadFunction, 
       
   492         KDefaultStackSize, KMinHeapSize, KMaxHeapSize, this);
       
   493     AssertTrueSecL(err == KErrNone, KCreateThreadErr, err);
       
   494 
       
   495     // Create killer thread
       
   496     RThread killerThread;
       
   497     CleanupClosePushL(killerThread);
       
   498     _LIT(KKillerThreadName, "TP77 - Killer thread");
       
   499     err = killerThread.Create(KKillerThreadName, KillerThreadFunction, 
       
   500         KDefaultStackSize, KMinHeapSize, KMaxHeapSize, this);
       
   501     AssertTrueSecL(err == KErrNone, KCreateThreadErr, err);
       
   502 
       
   503     // Start threads and wait until either of them exits.
       
   504     TRequestStatus badThreadStatus, killerThreadStatus;
       
   505     iBadThread.Logon(badThreadStatus);
       
   506     iBadThread.Resume();
       
   507     killerThread.Logon(killerThreadStatus);
       
   508     killerThread.Resume();
       
   509     User::WaitForRequest(badThreadStatus);
       
   510     User::WaitForRequest(killerThreadStatus);
       
   511 
       
   512     // Fetch exit data
       
   513     iBadThreadExitType = iBadThread.ExitType();
       
   514     iBadThreadExitCategory = iBadThread.ExitCategory();
       
   515     iBadThreadExitReason = iBadThread.ExitReason();
       
   516     iKillerThreadExitType = killerThread.ExitType();
       
   517     iKillerThreadExitCategory = killerThread.ExitCategory();
       
   518     iKillerThreadExitReason = killerThread.ExitReason();
       
   519 
       
   520     // Log threads' exit results
       
   521     iBuf.Format(
       
   522         _L("BadThread ended with exit type: %d, exit reason: %d, exit category: %S"), 
       
   523         iBadThreadExitType, iBadThreadExitReason, &iBadThreadExitCategory);
       
   524 //    iLog->Put(buf);
       
   525     iBuf.Format(
       
   526         _L("KillerThread ended with exit type: %d, exit reason: %d, exit category: %S"), 
       
   527         iKillerThreadExitType, iKillerThreadExitReason, &iKillerThreadExitCategory);
       
   528 //    iLog->Put(buf);
       
   529 
       
   530     CleanupStack::PopAndDestroy(&killerThread);
       
   531     }
       
   532 
       
   533 // ---------------------------------------------------------
       
   534 // CPosTp77::VerifyThreadExitResultsL
       
   535 //
       
   536 // (other items were commented in a header).
       
   537 // ---------------------------------------------------------
       
   538 //
       
   539 TBool CPosTp77::VerifyThreadExitResultsL(TInt aBadThreadExitReason)
       
   540     {
       
   541     TBool error = EFalse;
       
   542     _LIT(KKillCategory, "Kill");
       
   543 
       
   544     if (iBadThreadExitType != EExitKill)
       
   545         {
       
   546         _LIT(KExitTypeErr, "BadThread was not killed as expected.");
       
   547         iLog->PutError(KExitTypeErr);
       
   548         error = ETrue;
       
   549         }
       
   550     if (iBadThreadExitCategory != KKillCategory)
       
   551         {
       
   552         _LIT(KPanicErr, "BadThread had unexpected exit category");
       
   553         iLog->PutError(KPanicErr);
       
   554         error = ETrue;
       
   555         }
       
   556     if (iBadThreadExitReason != aBadThreadExitReason)
       
   557         {
       
   558         _LIT(KPanicCodeErr, "BadThread had unexpected exit reason");
       
   559         iLog->PutError(KPanicCodeErr);
       
   560         error = ETrue;
       
   561         }
       
   562     if (iKillerThreadExitType != EExitKill)
       
   563         {
       
   564         _LIT(KExitTypeErr, "KillerThread was not killed as expected.");
       
   565         iLog->PutError(KExitTypeErr);
       
   566         error = ETrue;
       
   567         }
       
   568     if (iKillerThreadExitCategory != KKillCategory)
       
   569         {
       
   570         _LIT(KPanicErr, "KillerThread had unexpected exit category");
       
   571         iLog->PutError(KPanicErr);
       
   572         error = ETrue;
       
   573         }
       
   574     if (iKillerThreadExitReason != 0)
       
   575         {
       
   576         _LIT(KPanicCodeErr, "KillerThread had unexpected exit reason");
       
   577         iLog->PutError(KPanicCodeErr);
       
   578         error = ETrue;
       
   579         }
       
   580 
       
   581     return error;
       
   582     }
       
   583 
       
   584 // ---------------------------------------------------------
       
   585 // CPosTp77::VerifyLmServerIsAliveL
       
   586 //
       
   587 // (other items were commented in a header).
       
   588 // ---------------------------------------------------------
       
   589 //
       
   590 TBool CPosTp77::VerifyLmServerIsAliveL(CPosLandmarkDatabase* aDb)
       
   591     {
       
   592     TRAPD(err, aDb->RemoveLandmarkL(1));
       
   593     TBool errorExists = err != KErrNone && err != KErrNotFound;
       
   594     if (errorExists)
       
   595         {
       
   596         _LIT(KError, "Unable to use db instance. Using db failed with %d.");
       
   597         iBuf.Format(KError, err);
       
   598         iLog->PutError(iBuf);
       
   599         }
       
   600 
       
   601     return errorExists;
       
   602     }
       
   603 
       
   604 //  End of File