os/graphics/egl/egltest/endpointtestsuite/automated/src/localtestbase.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "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
/** @file
sl@0
    18
    @internalComponent - Internal Symbian test code */
sl@0
    19
sl@0
    20
sl@0
    21
#include <e32base.h>
sl@0
    22
#include <e32debug.h>
sl@0
    23
#include <e32msgqueue.h>
sl@0
    24
#include <ecom/ecom.h>
sl@0
    25
#include <test/testexecuteserverbase.h>
sl@0
    26
#include <e32math.h>
sl@0
    27
#include "localtestbase.h"
sl@0
    28
#include "egltest_commscommon.h"
sl@0
    29
#include "egltest_endpoint_util.h"
sl@0
    30
sl@0
    31
sl@0
    32
_LIT(KEglEndpointTestServerName,"eglendpointtestserver");
sl@0
    33
sl@0
    34
sl@0
    35
CLocalTestStepBase::CLocalTestStepBase(enum TTestUid aUid) :
sl@0
    36
    iTestId(aUid),
sl@0
    37
    iIsInTestStep(EFalse)
sl@0
    38
    {
sl@0
    39
    }
sl@0
    40
sl@0
    41
void CLocalTestStepBase::DoPreambleL()
sl@0
    42
    {
sl@0
    43
    //null implmentation for base class
sl@0
    44
    }
sl@0
    45
sl@0
    46
void CLocalTestStepBase::DoPostambleL()
sl@0
    47
    {
sl@0
    48
    //null implmentation for base class
sl@0
    49
    }
sl@0
    50
sl@0
    51
//function used for creating the queues.
sl@0
    52
TVerdict CLocalTestStepBase::doTestStepPreambleL()
sl@0
    53
    {
sl@0
    54
    //Open the queues.
sl@0
    55
    User::LeaveIfError(iResultOutQueue.OpenGlobal(KResultQueueName));
sl@0
    56
    User::LeaveIfError(iParamsInQueue.OpenGlobal(KParamsQueueName));
sl@0
    57
    SetTestStepResult(EPass);
sl@0
    58
    iHasCurrentTestIds = EFalse;
sl@0
    59
    iResultLog = CTestIdResultLogger::NewL(Logger());
sl@0
    60
    DoPreambleL();
sl@0
    61
    return EPass;
sl@0
    62
    }
sl@0
    63
sl@0
    64
TVerdict CLocalTestStepBase::doTestStepPostambleL()
sl@0
    65
    {
sl@0
    66
    //Log the result of the current tests.
sl@0
    67
    if(iHasCurrentTestIds)
sl@0
    68
        {
sl@0
    69
        iResultLog->LogResult(iTestIdVerdict);
sl@0
    70
        }
sl@0
    71
    
sl@0
    72
    DoPostambleL();
sl@0
    73
    delete iResultLog;
sl@0
    74
    iResultLog = NULL;
sl@0
    75
    iResultOutQueue.Close();
sl@0
    76
    iParamsInQueue.Close();
sl@0
    77
    return EPass;
sl@0
    78
    }
sl@0
    79
sl@0
    80
CLocalTestStepBase::~CLocalTestStepBase()
sl@0
    81
    {
sl@0
    82
    //closing an already closed handle is harmless
sl@0
    83
    iResultOutQueue.Close();
sl@0
    84
    iParamsInQueue.Close();
sl@0
    85
    }
sl@0
    86
sl@0
    87
TVerdict CLocalTestStepBase::StartRemoteTestStep(const TRemoteTestParams& aMessageIn)
sl@0
    88
    {
sl@0
    89
    //Starting the remote test step is implemented as a special case
sl@0
    90
    //of running a test case, with TestCase = KStartTestStepCaseNumber.
sl@0
    91
    iIsInTestStep = ETrue;
sl@0
    92
    TVerdict retVal = RunRemoteTestCase(KStartTestStepCaseNumber, aMessageIn);
sl@0
    93
    if(retVal != EPass)
sl@0
    94
        {
sl@0
    95
        iIsInTestStep = EFalse;
sl@0
    96
        }
sl@0
    97
    return retVal;
sl@0
    98
    }
sl@0
    99
sl@0
   100
TVerdict CLocalTestStepBase::EndRemoteTestStep(const TRemoteTestParams& aMessageIn)
sl@0
   101
    {
sl@0
   102
    //Ending the remote test step is implemented as a special case
sl@0
   103
    //of running a test case, with TestCase = KEndTestStepCaseNumber.
sl@0
   104
    TVerdict retVal = RunRemoteTestCase(KEndTestStepCaseNumber, aMessageIn);
sl@0
   105
    iIsInTestStep = EFalse;
sl@0
   106
    return retVal;
sl@0
   107
    }
sl@0
   108
sl@0
   109
TVerdict CLocalTestStepBase::RunRemoteTestCase(TInt aTestCase, const TRemoteTestParams& aMessageIn)
sl@0
   110
    {
sl@0
   111
    //Don't attempt to run any test cases if we are not in a test step.
sl@0
   112
    if(!iIsInTestStep)
sl@0
   113
        {
sl@0
   114
        SetTestStepResult(EFail);
sl@0
   115
        return TestStepResult();
sl@0
   116
        }
sl@0
   117
sl@0
   118
    //send the message
sl@0
   119
    TRemoteTestParamsPacket message(iTestId, aTestCase, aMessageIn);
sl@0
   120
    iParamsInQueue.SendBlocking(message);
sl@0
   121
sl@0
   122
    TRemoteTestResult result;
sl@0
   123
    do
sl@0
   124
        {
sl@0
   125
        //relying on TEF timeout if there are problems such as the render stage not loaded.
sl@0
   126
        iResultOutQueue.ReceiveBlocking(result);
sl@0
   127
sl@0
   128
        //if uid and test case doesn't match something has gone badly wrong
sl@0
   129
        if (result.iUid != iTestId || result.iTestCase != aTestCase)
sl@0
   130
            {
sl@0
   131
            //test is out of Sync
sl@0
   132
            User::Panic(_L("Test out of sync with render stage"), KErrGeneral);
sl@0
   133
            }
sl@0
   134
sl@0
   135
        //log the message if there is one
sl@0
   136
        if (!result.iFinished)
sl@0
   137
            {
sl@0
   138
            //Convert the filename to a C string. The remote test env guarantees
sl@0
   139
            //that there is a free space at the end of the descriptor to add NULL.
sl@0
   140
            const TText8* file = result.iFile.PtrZ();
sl@0
   141
sl@0
   142
            //Convert the message to unicode and log the message.
sl@0
   143
            TBuf<KRSLogMessageLength> message;
sl@0
   144
            message.Copy(result.iMessage);
sl@0
   145
            Logger().LogExtra(file, result.iLine, result.iSeverity, _L("%S"), &message);
sl@0
   146
            }
sl@0
   147
        }while (!result.iFinished);
sl@0
   148
sl@0
   149
    //Translate the RemoteTestStep verdict to a TVerdict.
sl@0
   150
    TVerdict retVal = EPass;
sl@0
   151
    switch (result.iVerdict)
sl@0
   152
        {
sl@0
   153
        case ERtvPass:
sl@0
   154
            retVal = EPass;
sl@0
   155
            break;
sl@0
   156
sl@0
   157
        case ERtvFail:
sl@0
   158
            retVal = EFail;
sl@0
   159
            break;
sl@0
   160
sl@0
   161
        case ERtvInconclusive:
sl@0
   162
            retVal = EInconclusive;
sl@0
   163
            break;
sl@0
   164
sl@0
   165
        case ERtvAbort:
sl@0
   166
            retVal = EAbort;
sl@0
   167
            break;
sl@0
   168
sl@0
   169
        case ERtvPanic:
sl@0
   170
            //The remote test paniced, so we panic too.
sl@0
   171
            //This means the output log relects what actually happened.
sl@0
   172
            User::Panic(_L("Remote Test Step Paniced!"), KErrGeneral);
sl@0
   173
            break;
sl@0
   174
sl@0
   175
        case ERtvTimeout:
sl@0
   176
            //The remote test timedout, so we sleep so that tef times us out too.
sl@0
   177
            //This means the output log relects what actually happened.
sl@0
   178
            User::After(KMaxTInt);
sl@0
   179
            break;
sl@0
   180
sl@0
   181
        case ERtvUnknownTestUid:
sl@0
   182
            retVal = EIgnore;
sl@0
   183
            break;
sl@0
   184
sl@0
   185
        default:
sl@0
   186
            User::Panic(_L("Invalid verdict returned from the remote test step!"), KErrGeneral);
sl@0
   187
            break;
sl@0
   188
        }
sl@0
   189
sl@0
   190
    if(retVal != EPass)
sl@0
   191
        {
sl@0
   192
        SetTestStepResult(retVal);
sl@0
   193
        }
sl@0
   194
sl@0
   195
    return retVal;
sl@0
   196
    }
sl@0
   197
sl@0
   198
sl@0
   199
void CLocalTestStepBase::RegisterTestIdsL(const TDesC& aTestString)
sl@0
   200
    {
sl@0
   201
    iResultLog->RegisterTestIdsL(aTestString);
sl@0
   202
    }
sl@0
   203
sl@0
   204
sl@0
   205
void CLocalTestStepBase::SetCurrentTestIds(const TDesC& aTestString)
sl@0
   206
    {
sl@0
   207
    if(iHasCurrentTestIds)
sl@0
   208
        {
sl@0
   209
        iResultLog->LogResult(iTestIdVerdict);
sl@0
   210
        }
sl@0
   211
    
sl@0
   212
    iResultLog->SetCurrentTestIds(aTestString);
sl@0
   213
    iHasCurrentTestIds = ETrue;
sl@0
   214
    iTestIdVerdict = EPass;
sl@0
   215
    }
sl@0
   216
sl@0
   217
sl@0
   218
void CLocalTestStepBase::SetTestStepResult(TVerdict aVerdict)
sl@0
   219
    {
sl@0
   220
    iTestIdVerdict = aVerdict;
sl@0
   221
    CTestStep::SetTestStepResult(aVerdict);
sl@0
   222
    }
sl@0
   223
sl@0
   224
sl@0
   225
//Used by the result logger to delimit the csv test id strings.
sl@0
   226
class TCommaDelimiter
sl@0
   227
    {
sl@0
   228
private:
sl@0
   229
    mutable TPtrC iRemaining;
sl@0
   230
    
sl@0
   231
public:
sl@0
   232
    TCommaDelimiter(const TDesC& aString)
sl@0
   233
        {
sl@0
   234
        //Set our remaining string to the whole string, or NULL if empty.
sl@0
   235
        if(aString.Length() == 0)
sl@0
   236
            {
sl@0
   237
            iRemaining.Set(NULL, 0);
sl@0
   238
            }
sl@0
   239
        else
sl@0
   240
            {
sl@0
   241
            iRemaining.Set(aString);
sl@0
   242
            }
sl@0
   243
        }
sl@0
   244
    
sl@0
   245
    
sl@0
   246
    TInt GetNext(TPtrC& aSegment) const
sl@0
   247
        {
sl@0
   248
        //Trim off any leading commas.
sl@0
   249
        while(iRemaining.Length() >= 2 && iRemaining[0] == ',')
sl@0
   250
            {
sl@0
   251
            iRemaining.Set(&iRemaining[1], iRemaining.Length() - 1);
sl@0
   252
            }
sl@0
   253
        
sl@0
   254
        //If remaining string is empty or has one remaining comma, return.
sl@0
   255
        if(iRemaining.Length() == 0 || iRemaining[0] == ',')
sl@0
   256
            {
sl@0
   257
            iRemaining.Set(NULL, 0);
sl@0
   258
            return KErrNotFound;
sl@0
   259
            }
sl@0
   260
        
sl@0
   261
        //Find the first comma.
sl@0
   262
        TInt pos = iRemaining.Locate(',');
sl@0
   263
        
sl@0
   264
        //If comma not found, return all remaining string.
sl@0
   265
        if(pos == KErrNotFound)
sl@0
   266
            {
sl@0
   267
            aSegment.Set(iRemaining);
sl@0
   268
            iRemaining.Set(NULL, 0);
sl@0
   269
            return KErrNone;
sl@0
   270
            }
sl@0
   271
        
sl@0
   272
        //Comma found. There must be non-comma chars between 0 
sl@0
   273
        //and pos since we trimmed leading commas previously.
sl@0
   274
        aSegment.Set(&iRemaining[0], pos);
sl@0
   275
        iRemaining.Set(&iRemaining[pos], iRemaining.Length() - pos);
sl@0
   276
        return KErrNone;
sl@0
   277
        }
sl@0
   278
    
sl@0
   279
    
sl@0
   280
    TInt GetNextTrimmed(TPtrC& aSegment) const
sl@0
   281
        {
sl@0
   282
        //Keep calling GetNext() until we get a segment that has 
sl@0
   283
        //chars other than spaces or there are no more segments.
sl@0
   284
        while(1)
sl@0
   285
            {
sl@0
   286
            TPtrC segment;
sl@0
   287
            TInt err = GetNext(segment);
sl@0
   288
            if(err != KErrNone)
sl@0
   289
                {
sl@0
   290
                return err;
sl@0
   291
                }
sl@0
   292
            
sl@0
   293
            TInt front;
sl@0
   294
            TInt back;
sl@0
   295
            for(front = 0; front < segment.Length() && segment[front] == ' '; front++) {}
sl@0
   296
            for(back = segment.Length() - 1; back >= 0 && segment[back] == ' '; back--) {}
sl@0
   297
            
sl@0
   298
            TInt length = (back + 1) - front;
sl@0
   299
            if(length > 0 && segment[front] != ' ' && segment[back] != ' ')
sl@0
   300
                {
sl@0
   301
                aSegment.Set(&segment[front], length);
sl@0
   302
                return KErrNone;
sl@0
   303
                }
sl@0
   304
            }
sl@0
   305
        }
sl@0
   306
    };
sl@0
   307
sl@0
   308
sl@0
   309
CTestIdResultLogger* CTestIdResultLogger::NewL(CTestExecuteLogger& aLogger)
sl@0
   310
    {
sl@0
   311
    CTestIdResultLogger* self = new (ELeave) CTestIdResultLogger(aLogger);
sl@0
   312
    CleanupStack::PushL(self);
sl@0
   313
    self->ConstructL();
sl@0
   314
    CleanupStack::Pop(self);
sl@0
   315
    return self;
sl@0
   316
    }
sl@0
   317
sl@0
   318
sl@0
   319
CTestIdResultLogger::CTestIdResultLogger(CTestExecuteLogger& aLogger) :
sl@0
   320
    iOriginalThread(RThread().Id()),
sl@0
   321
    iLogger(aLogger)
sl@0
   322
    {
sl@0
   323
    }
sl@0
   324
sl@0
   325
sl@0
   326
void CTestIdResultLogger::ConstructL()
sl@0
   327
    {
sl@0
   328
    //Create panic monitor thread. Note that we share the heap with this 
sl@0
   329
    //thread so that the arrays remain in scope if this thread panics.
sl@0
   330
    //Note also no need for explicit locking of arrays since the panic 
sl@0
   331
    //monitor will only access them if a panic occurs here.
sl@0
   332
    static const TInt KStackSize =   0x2000;      //  8KB
sl@0
   333
    TUint32 random = Math::Random();
sl@0
   334
    TName threadName;
sl@0
   335
    _LIT(KThreadNameFormat, "%S-%u");
sl@0
   336
    _LIT(KEnvName, "EpTestIdLogger");
sl@0
   337
    threadName.Format(KThreadNameFormat, &KEnvName, random);
sl@0
   338
    User::LeaveIfError(iPanicMonitor.Create(threadName, PanicMonitorMain, KStackSize, &User::Heap(), this, EOwnerThread));
sl@0
   339
    
sl@0
   340
    //Rendezvous with panic thread.
sl@0
   341
    TRequestStatus rendStat;
sl@0
   342
    iPanicMonitor.Rendezvous(rendStat);
sl@0
   343
    iPanicMonitor.Resume();
sl@0
   344
    User::WaitForRequest(rendStat);
sl@0
   345
    }
sl@0
   346
sl@0
   347
sl@0
   348
CTestIdResultLogger::~CTestIdResultLogger()
sl@0
   349
    {
sl@0
   350
    TRequestStatus logonStat;
sl@0
   351
    iPanicMonitor.Logon(logonStat);
sl@0
   352
    iPanicMonitor.RequestComplete(iCloseMonitor, KErrNone);
sl@0
   353
    User::WaitForRequest(logonStat);
sl@0
   354
    iPanicMonitor.Close();
sl@0
   355
    iRegisteredTestIds.Close();
sl@0
   356
    iCurrentTestIds.Close();
sl@0
   357
    }
sl@0
   358
sl@0
   359
sl@0
   360
void CTestIdResultLogger::RegisterTestIdsL(const TDesC& aTestString)
sl@0
   361
    {
sl@0
   362
    //Set up delimitter.
sl@0
   363
    TCommaDelimiter delimit(aTestString);
sl@0
   364
    
sl@0
   365
    //Get every test id from the string and add it to the registered test ids array.
sl@0
   366
    TPtrC testIdPtr;
sl@0
   367
    while(delimit.GetNextTrimmed(testIdPtr) == KErrNone)
sl@0
   368
        {
sl@0
   369
        TTestId testId(testIdPtr);
sl@0
   370
        iRegisteredTestIds.AppendL(testId);
sl@0
   371
        }
sl@0
   372
    
sl@0
   373
    //Reserve enough space in the current test ids array so that SCurrentTestIds() can not fail.
sl@0
   374
    iCurrentTestIds.ReserveL(iRegisteredTestIds.Count());
sl@0
   375
    }
sl@0
   376
sl@0
   377
sl@0
   378
void CTestIdResultLogger::SetCurrentTestIds(const TDesC& aTestString)
sl@0
   379
    {
sl@0
   380
    ASSERT(iCurrentTestIds.Count() == 0);
sl@0
   381
    
sl@0
   382
    //Set up delimitter.
sl@0
   383
    TCommaDelimiter delimit(aTestString);
sl@0
   384
    
sl@0
   385
    //Get every test id from the string and add it to the registered test ids array.
sl@0
   386
    TPtrC testIdPtr;
sl@0
   387
    while(delimit.GetNextTrimmed(testIdPtr) == KErrNone)
sl@0
   388
        {
sl@0
   389
        TTestId testId(testIdPtr);
sl@0
   390
		
sl@0
   391
		//This cannot fail under legitimate circumstances, since enough 
sl@0
   392
		//space is reserved in this array when registering TestIds.
sl@0
   393
        TInt err = iCurrentTestIds.Append(testId);
sl@0
   394
		ASSERT(err == KErrNone);
sl@0
   395
        }
sl@0
   396
    
sl@0
   397
    //Make sure these tests were registered and remove from the registered array.
sl@0
   398
    for(TInt i=0; i < iCurrentTestIds.Count(); i++)
sl@0
   399
        {
sl@0
   400
        TInt idx = iRegisteredTestIds.Find(iCurrentTestIds[i]);
sl@0
   401
        ASSERT(idx != KErrNotFound);
sl@0
   402
        iRegisteredTestIds.Remove(idx);
sl@0
   403
        }
sl@0
   404
    }
sl@0
   405
sl@0
   406
sl@0
   407
void CTestIdResultLogger::LogResult(TVerdict aVerdict)
sl@0
   408
    {
sl@0
   409
    const TInt KMaxVerdictLength = 20;
sl@0
   410
    TBuf<KMaxVerdictLength> verdict;
sl@0
   411
    switch(aVerdict)
sl@0
   412
        {
sl@0
   413
        case EPass:           verdict.Append(_L("PASS"));            break;
sl@0
   414
        case EFail:           verdict.Append(_L("FAIL"));            break;
sl@0
   415
        case EInconclusive:   verdict.Append(_L("INCONCLUSIVE"));    break;
sl@0
   416
        case ETestSuiteError: verdict.Append(_L("TEST SUTE ERROR")); break;
sl@0
   417
        case EAbort:          verdict.Append(_L("ABORT"));           break;
sl@0
   418
        case EIgnore:         verdict.Append(_L("IGNORE"));          break;
sl@0
   419
        }
sl@0
   420
    
sl@0
   421
    while(iCurrentTestIds.Count())
sl@0
   422
        {
sl@0
   423
        LogResult(iLogger, iCurrentTestIds[0], verdict);
sl@0
   424
        iCurrentTestIds.Remove(0);
sl@0
   425
        }
sl@0
   426
    }
sl@0
   427
sl@0
   428
sl@0
   429
void CTestIdResultLogger::LogResult(CTestExecuteLogger& aLogger, const TTestId& aTestId, const TDesC& aVerdict)
sl@0
   430
    {
sl@0
   431
    aLogger.LogExtra(((TText8*)"EGL ENDPOINT TEST RESULT >>>"), 0, ESevrInfo, _L("GRAPHICS-EGL-%S: %S"), &aTestId, &aVerdict);
sl@0
   432
    }
sl@0
   433
sl@0
   434
sl@0
   435
TInt CTestIdResultLogger::PanicMonitorMain(TAny* aSelf)
sl@0
   436
    {
sl@0
   437
    CTestIdResultLogger* self = static_cast<CTestIdResultLogger*>(aSelf);
sl@0
   438
    
sl@0
   439
    //Create cleanup stack.
sl@0
   440
    CTrapCleanup* cleanup = CTrapCleanup::New();
sl@0
   441
    ASSERT(cleanup);
sl@0
   442
    
sl@0
   443
    //Create active scheduler.
sl@0
   444
    CActiveScheduler* scheduler = new CActiveScheduler();
sl@0
   445
    ASSERT(scheduler);
sl@0
   446
    CActiveScheduler::Install(scheduler);
sl@0
   447
    
sl@0
   448
    TRAPD(err,  self->PanicMonitorMainL());
sl@0
   449
    __ASSERT_ALWAYS(err == KErrNone, User::Invariant());
sl@0
   450
    
sl@0
   451
    delete scheduler;
sl@0
   452
    delete cleanup;
sl@0
   453
    return KErrNone;
sl@0
   454
    }
sl@0
   455
    
sl@0
   456
sl@0
   457
void CTestIdResultLogger::PanicMonitorMainL()
sl@0
   458
    {
sl@0
   459
    //Setup logging.
sl@0
   460
    CTestExecuteLogger logger;
sl@0
   461
    TEndpointUtil::SetLoggerForProcessWrapperL(logger);
sl@0
   462
    
sl@0
   463
    //Tell parent how to close us.
sl@0
   464
    TRequestStatus closeStatus = KRequestPending;
sl@0
   465
    iCloseMonitor = &closeStatus;
sl@0
   466
    
sl@0
   467
    //Open parent thread and logon.
sl@0
   468
    RThread origThread;
sl@0
   469
    User::LeaveIfError(origThread.Open(iOriginalThread, EOwnerThread));
sl@0
   470
    TRequestStatus origStatus;
sl@0
   471
    origThread.Logon(origStatus);
sl@0
   472
    
sl@0
   473
    //Rendevous with our parent then wait for thread to exit or close command.
sl@0
   474
    RThread().Rendezvous(KErrNone);
sl@0
   475
    User::WaitForRequest(closeStatus, origStatus);
sl@0
   476
    
sl@0
   477
    if (closeStatus != KRequestPending)
sl@0
   478
        {
sl@0
   479
        //Parent is shutting us down. Just cancel our outstanding request and exit.
sl@0
   480
        origThread.LogonCancel(origStatus);
sl@0
   481
        User::WaitForRequest(origStatus);
sl@0
   482
        }
sl@0
   483
    else if (origStatus != KRequestPending)
sl@0
   484
        {
sl@0
   485
        //We can only get here if parent panicked.
sl@0
   486
        //Log that all current tests were panicked and all registered tests were not run.
sl@0
   487
        _LIT(KPanicked, "PANIC");
sl@0
   488
        _LIT(KNotRun, "NOT RUN DUE TO PREVIOUS PANIC");
sl@0
   489
        while(iCurrentTestIds.Count())
sl@0
   490
            {
sl@0
   491
            LogResult(logger, iCurrentTestIds[0], KPanicked);
sl@0
   492
            iCurrentTestIds.Remove(0);
sl@0
   493
            }
sl@0
   494
        while(iRegisteredTestIds.Count())
sl@0
   495
            {
sl@0
   496
            LogResult(logger, iRegisteredTestIds[0], KNotRun);
sl@0
   497
            iRegisteredTestIds.Remove(0);
sl@0
   498
            }
sl@0
   499
        }
sl@0
   500
    
sl@0
   501
    origThread.Close();
sl@0
   502
    }
sl@0
   503
sl@0
   504
sl@0
   505
CEglEndpointTestServer* CEglEndpointTestServer::NewL()
sl@0
   506
	{
sl@0
   507
	CEglEndpointTestServer* server = new(ELeave) CEglEndpointTestServer();
sl@0
   508
	CleanupStack::PushL(server);
sl@0
   509
	// CServer base class call
sl@0
   510
	TParsePtrC serverName(RProcess().FileName());
sl@0
   511
	server->StartL(serverName.Name());
sl@0
   512
	CleanupStack::Pop(server);
sl@0
   513
	return server;
sl@0
   514
	}
sl@0
   515
sl@0
   516
static void MainL()
sl@0
   517
	{
sl@0
   518
	CActiveScheduler* sched=NULL;
sl@0
   519
	sched=new(ELeave) CActiveScheduler;
sl@0
   520
	CActiveScheduler::Install(sched);
sl@0
   521
sl@0
   522
	CEglEndpointTestServer* server = NULL;
sl@0
   523
	// Create the CTestServer derived server
sl@0
   524
	TRAPD(err, server = CEglEndpointTestServer::NewL());
sl@0
   525
	if(!err)
sl@0
   526
		{
sl@0
   527
		// Sync with the client and enter the active scheduler
sl@0
   528
		RProcess::Rendezvous(KErrNone);
sl@0
   529
		sched->Start();
sl@0
   530
		}
sl@0
   531
	delete server;
sl@0
   532
	delete sched;
sl@0
   533
	}
sl@0
   534
sl@0
   535
/**
sl@0
   536
  @return Standard Epoc error code on process exit
sl@0
   537
  Process entry point. Called by client using RProcess API
sl@0
   538
  */
sl@0
   539
TInt E32Main()
sl@0
   540
	{
sl@0
   541
	__UHEAP_MARK;
sl@0
   542
	CTrapCleanup* cleanup = CTrapCleanup::New();
sl@0
   543
	if(!cleanup)
sl@0
   544
		{
sl@0
   545
		return KErrNoMemory;
sl@0
   546
		}
sl@0
   547
	TRAPD(err,MainL());
sl@0
   548
sl@0
   549
	if (err)
sl@0
   550
		{
sl@0
   551
		RDebug::Print(_L("CEglEndpointTestServer::MainL - Error: %d"), err);
sl@0
   552
	   	User::Panic(KEglEndpointTestServerName, err);
sl@0
   553
		}
sl@0
   554
sl@0
   555
	delete cleanup;
sl@0
   556
	REComSession::FinalClose();
sl@0
   557
	__UHEAP_MARKEND;
sl@0
   558
	return KErrNone;
sl@0
   559
    }