os/graphics/egl/egltest/endpointtestsuite/automated/tsrc/egltest_threadedstress_local.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/egl/egltest/endpointtestsuite/automated/tsrc/egltest_threadedstress_local.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,196 @@
1.4 +/*
1.5 +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @test
1.25 + @internalComponent - Internal Symbian test code
1.26 +*/
1.27 +
1.28 +
1.29 +#include "egltest_threadedstress.h"
1.30 +
1.31 +
1.32 +/**
1.33 +@SYMTestCaseID GRAPHICS-EGL-0594
1.34 +
1.35 +@SYMTestPriority 2
1.36 +
1.37 +@SYMPREQ 2670
1.38 +
1.39 +@SYMREQ
1.40 +
1.41 +@SYMTestCaseDesc
1.42 +To ensure thread safety of endpoint implementation
1.43 +
1.44 +@SYMTestActions
1.45 +Create 4 set of threads with each performing following steps:
1.46 +1. Repeat the following steps (2-16) for 60 seconds
1.47 +2. Create surface
1.48 +3. Random Delay
1.49 +4. Create endpoint.
1.50 +5. Random Delay
1.51 +6. Draw content to surface
1.52 +7. Random Delay
1.53 +8. Submit Update
1.54 +9. Random Delay
1.55 +10. Acquire image
1.56 +11. Random Delay
1.57 +12. Compare image with expected value (??)
1.58 +13. Release image
1.59 +14. Random Delay
1.60 +15. Destroy endpoint
1.61 +16. Destroy Surface
1.62 +
1.63 +@SYMTestExpectedResults
1.64 +The test runs to completion.
1.65 +*/
1.66 +
1.67 +
1.68 +CEglTest_LocalTestStep_EndpointCrazyThreading::CEglTest_LocalTestStep_EndpointCrazyThreading() :
1.69 + CLocalTestStepBase(ETestUidEndpointThreadStress)
1.70 + {
1.71 + }
1.72 +
1.73 +
1.74 +CEglTest_LocalTestStep_EndpointCrazyThreading::~CEglTest_LocalTestStep_EndpointCrazyThreading()
1.75 + {
1.76 + }
1.77 +
1.78 +
1.79 +void CEglTest_LocalTestStep_EndpointCrazyThreading::DoPreambleL()
1.80 + {
1.81 + //Register the test id.
1.82 + _LIT(KTestId, "594");
1.83 + RegisterTestIdsL(KTestId);
1.84 + SetCurrentTestIds(KTestId);
1.85 + }
1.86 +
1.87 +
1.88 +void CEglTest_LocalTestStep_EndpointCrazyThreading::DoPostambleL()
1.89 + {
1.90 + }
1.91 +
1.92 +
1.93 +TVerdict CEglTest_LocalTestStep_EndpointCrazyThreading::doTestStepL()
1.94 + {
1.95 + StartRemoteTestStep(TRemoteTestParams());
1.96 + RunRemoteTestCase(0, TRemoteTestParams());
1.97 + EndRemoteTestStep(TRemoteTestParams());
1.98 + return TestStepResult();
1.99 + }
1.100 +
1.101 +
1.102 +/**
1.103 +@SYMTestCaseID GRAPHICS-EGL-0601
1.104 +
1.105 +@SYMTestPriority 2
1.106 +
1.107 +@SYMPREQ 2670
1.108 +
1.109 +@SYMREQ
1.110 +
1.111 +@SYMTestCaseDesc
1.112 +To ensure endpoint operations can succeed in low memory condition.
1.113 +
1.114 +@SYMTestActions
1.115 +Use Method B.
1.116 +1. Thread 1:
1.117 +1.1. Create a heap that can expand to maximum available system memory size
1.118 +1.2. Allocate random sizes of memory on that system heap until failure occurs, recording and counting as N.
1.119 +1.3. Delay
1.120 +1.4. De-allocate last N/4 allocations.
1.121 +1.5. Delay
1.122 +1.6. Go to 1.2
1.123 +2. Thread 2:
1.124 +2.1. Create surface 100x100
1.125 +2.2. Draw content to surface
1.126 +2.3. Submit Update
1.127 +2.4. Create endpoint.
1.128 +2.5. Acquire image
1.129 +2.6. Verify image content with pixel sample
1.130 +2.7. Release image
1.131 +2.8. Destroy endpoint
1.132 +2.9. Destroy Surface
1.133 +3. Repeat Step 2 1000 times. After every 200 iterations check memory usage as described in 7.3.1.
1.134 +4. Destroy thread 2 and 1.
1.135 +
1.136 +@SYMTestExpectedResults
1.137 +The test runs to completion.
1.138 +*/
1.139 +
1.140 +
1.141 +CEglTest_LocalTestStep_EndpointOutOfHeapMemory::CEglTest_LocalTestStep_EndpointOutOfHeapMemory() :
1.142 + CLocalTestStepBase(ETestUidEndpointThreadStress)
1.143 + {
1.144 + }
1.145 +
1.146 +
1.147 +CEglTest_LocalTestStep_EndpointOutOfHeapMemory::~CEglTest_LocalTestStep_EndpointOutOfHeapMemory()
1.148 + {
1.149 + }
1.150 +
1.151 +
1.152 +void CEglTest_LocalTestStep_EndpointOutOfHeapMemory::DoPreambleL()
1.153 + {
1.154 + //Register the test id.
1.155 + _LIT(KTestId, "601, 625");
1.156 + RegisterTestIdsL(KTestId);
1.157 + SetCurrentTestIds(KTestId);
1.158 + }
1.159 +
1.160 +
1.161 +void CEglTest_LocalTestStep_EndpointOutOfHeapMemory::DoPostambleL()
1.162 + {
1.163 + }
1.164 +
1.165 +
1.166 +TVerdict CEglTest_LocalTestStep_EndpointOutOfHeapMemory::doTestStepL()
1.167 + {
1.168 + TRemoteTestParams params;
1.169 + StartRemoteTestStep(TRemoteTestParams());
1.170 +
1.171 + INFO_PRINTF1(_L("Performing out of heap memory test with 1 exercise thread..."));
1.172 + params.iEndpointThreadStress.iNumThreads = 1;
1.173 + TVerdict ret = RunRemoteTestCase(1, params);
1.174 + if(ret == EPass)
1.175 + {
1.176 + INFO_PRINTF1(_L("...done."));
1.177 + }
1.178 + else
1.179 + {
1.180 + ERR_PRINTF1(_L("...Failed, skipping rest of test step."));
1.181 + return ret;
1.182 + }
1.183 +
1.184 + INFO_PRINTF1(_L("Performing out of heap memory test with 10 exercise threads..."));
1.185 + params.iEndpointThreadStress.iNumThreads = 10;
1.186 + ret = RunRemoteTestCase(1, params);
1.187 + if(ret == EPass)
1.188 + {
1.189 + INFO_PRINTF1(_L("...done."));
1.190 + }
1.191 + else
1.192 + {
1.193 + ERR_PRINTF1(_L("...Failed, skipping rest of test step."));
1.194 + return ret;
1.195 + }
1.196 +
1.197 + EndRemoteTestStep(TRemoteTestParams());
1.198 + return TestStepResult();
1.199 + }