|
1 // Copyright (c) 2009 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 /** |
|
17 @file |
|
18 @test |
|
19 */ |
|
20 #ifndef EGLTEST_SYNCOBJECT_H |
|
21 #define EGLTEST_SYNCOBJECT_H |
|
22 |
|
23 #include "eglteststep.h" |
|
24 #include <test/egltestcommonsession.h> |
|
25 |
|
26 |
|
27 _LIT(KSyncObject_Positive_Base, "SyncObject_Base"); |
|
28 NONSHARABLE_CLASS(CEglTest_SyncObject_Base) : public CEglTestStep |
|
29 { |
|
30 public: |
|
31 CEglTest_SyncObject_Base(); |
|
32 ~CEglTest_SyncObject_Base(); |
|
33 TBool GetProcAddress(); |
|
34 void CreateEglSessionL(); |
|
35 void CheckSyncAttrib(EGLint attribute, EGLint expectedValue); |
|
36 void CleanAll(); |
|
37 |
|
38 /** |
|
39 @param aEndTime End time obtained from the user nano kernel tick counter |
|
40 @param aStartTime Start time obtained from the user nano kernel tick counter |
|
41 @return elapsed time in microsecond |
|
42 */ |
|
43 inline TInt ElapsedTime(TUint32 aEndTime, TUint32 aStartTime) const |
|
44 { |
|
45 return ((aEndTime - aStartTime) * iTickPeriodMicroSeconds); |
|
46 } |
|
47 |
|
48 // from CTestStep |
|
49 TVerdict doTestStepPreambleL(); |
|
50 |
|
51 protected: |
|
52 CTestEglSession* iEglSess; |
|
53 EGLSyncKHR iSyncObject; |
|
54 EGLSyncKHR iSyncObject1; |
|
55 EGLSyncKHR iSyncObject2; |
|
56 |
|
57 TBool iIsSyncObjectExtensionSupported; //sync object API, defined in EGL Khronos API spec with the name KHR_reusable_sync |
|
58 TBool iIsSyncObjectPrivateExtensionSupported; //internal NOKIA extension which is not the part of the Khronos API spec |
|
59 |
|
60 TInt iThreshold; //level of tolerance |
|
61 TInt iDelaySignalling; //delay before the signal occurs |
|
62 TInt iWaitSyncTimeout; //timeout client waits on sync object, must be greater than iDelaySignalling |
|
63 TInt iLongDelaySignalling; //long delay before signalling occurs, must be greater than iWaitSyncTimeout |
|
64 TInt iNumStressIterations; //number of iterations before stress test exits |
|
65 TInt iTimeOverhead; |
|
66 |
|
67 TFPtrEglCreateSyncKhr iPfnEglCreateSyncKHR; |
|
68 TFPtrEglDestroySyncKhr iPfnEglDestroySyncKHR; |
|
69 TFPtrEglClientWaitSyncKhr iPfnEglClientWaitSyncKHR; |
|
70 TFPtrEglSignalSyncKhr iPfnEglSignalSyncKHR; |
|
71 TFPtrEglGetSyncAttribKhr iPfnEglGetSyncAttribKHR; |
|
72 TFPtrEglPrivateSignalSyncNok iPfnEglPrivateSignalSyncNOK; |
|
73 |
|
74 TInt iTickPeriodMicroSeconds; //nanokernel ticks, in microseconds |
|
75 }; |
|
76 |
|
77 _LIT(KSyncObject_Positive_GetProcAddress, "SyncObject_Positive_GetProcAddress"); |
|
78 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_GetProcAddress) : public CEglTest_SyncObject_Base |
|
79 { |
|
80 public: |
|
81 TVerdict doTestStepL(); |
|
82 }; |
|
83 |
|
84 _LIT(KSyncObject_Positive_CreateDestroy, "SyncObject_Positive_CreateDestroy"); |
|
85 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_CreateDestroy) : public CEglTest_SyncObject_Base |
|
86 { |
|
87 public: |
|
88 TVerdict doTestStepL(); |
|
89 }; |
|
90 |
|
91 _LIT(KSyncObject_Positive_WaitSignal, "SyncObject_Positive_WaitSignal"); |
|
92 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_WaitSignal) : public CEglTest_SyncObject_Base |
|
93 { |
|
94 public: |
|
95 TVerdict doTestStepL(); |
|
96 protected: |
|
97 // from CEglTestStep |
|
98 void doThreadFunctionL(TInt aIdx); |
|
99 }; |
|
100 |
|
101 _LIT(KSyncObject_Positive_WaitSignal2, "SyncObject_Positive_WaitSignal2"); |
|
102 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_WaitSignal2) : public CEglTest_SyncObject_Base |
|
103 { |
|
104 public: |
|
105 TVerdict doTestStepL(); |
|
106 protected: |
|
107 // from CEglTestStep |
|
108 void doThreadFunctionL(TInt aIdx); |
|
109 }; |
|
110 |
|
111 _LIT(KSyncObject_Positive_WaitDelete, "SyncObject_Positive_WaitDelete"); |
|
112 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_WaitDelete) : public CEglTest_SyncObject_Base |
|
113 { |
|
114 public: |
|
115 TVerdict doTestStepL(); |
|
116 protected: |
|
117 // from CEglTestStep |
|
118 void doThreadFunctionL(TInt aIdx); |
|
119 }; |
|
120 |
|
121 _LIT(KSyncObject_Positive_WaitWithTimeoutExpired, "SyncObject_Positive_WaitWithTimeoutExpired"); |
|
122 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_WaitWithTimeoutExpired) : public CEglTest_SyncObject_Base |
|
123 { |
|
124 public: |
|
125 TVerdict doTestStepL(); |
|
126 }; |
|
127 |
|
128 _LIT(KSyncObject_Positive_SignalBeforeTimeoutExpired, "SyncObject_Positive_SignalBeforeTimeoutExpired"); |
|
129 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_SignalBeforeTimeoutExpired) : public CEglTest_SyncObject_Base |
|
130 { |
|
131 public: |
|
132 TVerdict doTestStepL(); |
|
133 protected: |
|
134 // from CEglTestStep |
|
135 void doThreadFunctionL(TInt aIdx); |
|
136 }; |
|
137 |
|
138 _LIT(KSyncObject_Positive_DeleteBeforeTimeoutExpired, "SyncObject_Positive_DeleteBeforeTimeoutExpired"); |
|
139 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_DeleteBeforeTimeoutExpired) : public CEglTest_SyncObject_Base |
|
140 { |
|
141 public: |
|
142 TVerdict doTestStepL(); |
|
143 protected: |
|
144 // from CEglTestStep |
|
145 void doThreadFunctionL(TInt aIdx); |
|
146 }; |
|
147 |
|
148 _LIT(KSyncObject_Positive_Multithread_SignalBeforeTimeout, "SyncObject_Positive_Multithread_SignalBeforeTimeout"); |
|
149 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_Multithread_SignalBeforeTimeout) : public CEglTest_SyncObject_Base |
|
150 { |
|
151 public: |
|
152 TVerdict doTestStepL(); |
|
153 protected: |
|
154 // from CEglTestStep |
|
155 void doThreadFunctionL(TInt aIdx); |
|
156 }; |
|
157 |
|
158 _LIT(KSyncObject_Positive_Multithread_SignalAfterTimeout, "SyncObject_Positive_Multithread_SignalAfterTimeout"); |
|
159 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_Multithread_SignalAfterTimeout) : public CEglTest_SyncObject_Base |
|
160 { |
|
161 public: |
|
162 TVerdict doTestStepL(); |
|
163 protected: |
|
164 // from CEglTestStep |
|
165 void doThreadFunctionL(TInt aIdx); |
|
166 }; |
|
167 |
|
168 _LIT(KSyncObject_Positive_Multithread_WaitOnTwoSyncObject, "SyncObject_Positive_Multithread_WaitOnTwoSyncObject"); |
|
169 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_Multithread_WaitOnTwoSyncObject) : public CEglTest_SyncObject_Base |
|
170 { |
|
171 public: |
|
172 TVerdict doTestStepL(); |
|
173 protected: |
|
174 // from CEglTestStep |
|
175 void doThreadFunctionL(TInt aIdx); |
|
176 }; |
|
177 |
|
178 _LIT(KSyncObject_Positive_Wait_TestMode, "SyncObject_Positive_Wait_TestMode"); |
|
179 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_Wait_TestMode) : public CEglTest_SyncObject_Base |
|
180 { |
|
181 public: |
|
182 TVerdict doTestStepL(); |
|
183 }; |
|
184 |
|
185 _LIT(KSyncObject_Positive_Multithread_Deletion, "SyncObject_Positive_Multithread_Deletion"); |
|
186 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_Multithread_Deletion) : public CEglTest_SyncObject_Base |
|
187 { |
|
188 public: |
|
189 TVerdict doTestStepL(); |
|
190 protected: |
|
191 // from CEglTestStep |
|
192 void doThreadFunctionL(TInt aIdx); |
|
193 }; |
|
194 |
|
195 _LIT(KSyncObject_Positive_Stress, "SyncObject_Positive_Stress"); |
|
196 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_Stress) : public CEglTest_SyncObject_Base |
|
197 { |
|
198 public: |
|
199 TVerdict doTestStepL(); |
|
200 protected: |
|
201 // from CEglTestStep |
|
202 void doThreadFunctionL(TInt aIdx); |
|
203 private: |
|
204 TBool iStopTest; //to ensure that we are not going to signal on deleted sync objects |
|
205 TInt iLastThreadToSignal; //varies from 0..2, where 2 is the main client thread |
|
206 }; |
|
207 |
|
208 _LIT(KSyncObject_Positive_WaitFlush, "SyncObject_Positive_WaitFlush"); |
|
209 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_WaitFlush) : public CEglTest_SyncObject_Base |
|
210 { |
|
211 public: |
|
212 TVerdict doTestStepL(); |
|
213 protected: |
|
214 // from CEglTestStep |
|
215 void doThreadFunctionL(TInt aIdx); |
|
216 }; |
|
217 |
|
218 _LIT(KSyncObject_Positive_Terminate, "SyncObject_Positive_Terminate"); |
|
219 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_Terminate) : public CEglTest_SyncObject_Base |
|
220 { |
|
221 public: |
|
222 TVerdict doTestStepL(); |
|
223 }; |
|
224 |
|
225 _LIT(KSyncObject_Positive_TerminateBeforeTimeoutExpired, "SyncObject_Positive_TerminateBeforeTimeoutExpired"); |
|
226 NONSHARABLE_CLASS(CEglTest_SyncObject_Positive_TerminateBeforeTimeoutExpired) : public CEglTest_SyncObject_Base |
|
227 { |
|
228 public: |
|
229 TVerdict doTestStepL(); |
|
230 protected: |
|
231 // from CEglTestStep |
|
232 void doThreadFunctionL(TInt aIdx); |
|
233 }; |
|
234 |
|
235 _LIT(KSyncObject_Negative_WrongParameters, "SyncObject_Negative_WrongParameters"); |
|
236 NONSHARABLE_CLASS(CEglTest_SyncObject_Negative_WrongParameters) : public CEglTest_SyncObject_Base |
|
237 { |
|
238 public: |
|
239 TVerdict doTestStepL(); |
|
240 }; |
|
241 |
|
242 _LIT(KSyncObject_Negative_SignalImpl, "SyncObject_Negative_SignalImpl"); |
|
243 NONSHARABLE_CLASS(CEglTest_SyncObject_Negative_SignalImpl) : public CEglTest_SyncObject_Base |
|
244 { |
|
245 public: |
|
246 TVerdict doTestStepL(); |
|
247 }; |
|
248 |
|
249 _LIT(KSyncObject_Negative_OOM, "SyncObject_Negative_OOM"); |
|
250 NONSHARABLE_CLASS(CEglTest_SyncObject_Negative_OOM) : public CEglTest_SyncObject_Base |
|
251 { |
|
252 public: |
|
253 TVerdict doTestStepL(); |
|
254 protected: |
|
255 // from CEglTestStep |
|
256 void doThreadFunctionL(TInt aIdx); |
|
257 }; |
|
258 |
|
259 #endif // EGLTEST_SYNCOBJECT_H |