0
|
1 |
// Copyright (c) 2007-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 |
// CTestStep derived implementation
|
|
15 |
//
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
/**
|
|
20 |
@file ListsStep.cpp
|
|
21 |
@internalTechnology
|
|
22 |
*/
|
|
23 |
#include "liststep.h"
|
|
24 |
#include "tcoredumpserversuitedefs.h"
|
|
25 |
#include "tcoredumpserversuiteserver.h"
|
|
26 |
|
|
27 |
CListsStep::~CListsStep()
|
|
28 |
/**
|
|
29 |
* Destructor
|
|
30 |
*/
|
|
31 |
{
|
|
32 |
}
|
|
33 |
|
|
34 |
CListsStep::CListsStep()
|
|
35 |
/**
|
|
36 |
* Constructor
|
|
37 |
*/
|
|
38 |
{
|
|
39 |
// **MUST** call SetTestStepName in the constructor as the controlling
|
|
40 |
// framework uses the test step name immediately following construction to set
|
|
41 |
// up the step's unique logging ID.
|
|
42 |
SetTestStepName(KListsStep);
|
|
43 |
}
|
|
44 |
|
|
45 |
TVerdict CListsStep::doTestStepPreambleL()
|
|
46 |
/**
|
|
47 |
* @return - TVerdict code
|
|
48 |
* Override of base class virtual
|
|
49 |
*/
|
|
50 |
{
|
|
51 |
|
|
52 |
TInt ret = KErrNone;
|
|
53 |
ret = iSess.Connect();
|
|
54 |
if(ret != KErrNone)
|
|
55 |
{
|
|
56 |
SetTestStepResult( EFail );
|
|
57 |
ERR_PRINTF2(_L("Error %d from iSess->Connect()"), ret);
|
|
58 |
}
|
|
59 |
else
|
|
60 |
{
|
|
61 |
SetTestStepResult(EPass);
|
|
62 |
}
|
|
63 |
|
|
64 |
return TestStepResult();
|
|
65 |
}
|
|
66 |
|
|
67 |
|
|
68 |
TVerdict CListsStep::doTestStepL()
|
|
69 |
/**
|
|
70 |
* @return - TVerdict code
|
|
71 |
* Override of base class pure virtual
|
|
72 |
* Our implementation only gets called if the base class doTestStepPreambleL() did
|
|
73 |
* not leave. That being the case, the current test result value will be EPass.
|
|
74 |
*/
|
|
75 |
{
|
|
76 |
|
|
77 |
if (TestStepResult()==EPass)
|
|
78 |
{
|
|
79 |
TInt ret = KErrNone;
|
|
80 |
|
|
81 |
__UHEAP_MARK;
|
|
82 |
|
|
83 |
TRAP(ret, ClientAppL());
|
|
84 |
if(KErrNone != ret)
|
|
85 |
{
|
|
86 |
SetTestStepResult(EFail);
|
|
87 |
ERR_PRINTF2(_L("Error %d from CListsStep->ClientAppL()"), ret);
|
|
88 |
}
|
|
89 |
|
|
90 |
__UHEAP_MARKEND;
|
|
91 |
|
|
92 |
}
|
|
93 |
return TestStepResult();
|
|
94 |
|
|
95 |
}
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
TVerdict CListsStep::doTestStepPostambleL()
|
|
100 |
/**
|
|
101 |
* @return - TVerdict code
|
|
102 |
* Override of base class virtual
|
|
103 |
*/
|
|
104 |
{
|
|
105 |
|
|
106 |
iSess.Disconnect();
|
|
107 |
User::After(10000000); //ensure we give enough time for session to close
|
|
108 |
return EPass;
|
|
109 |
}
|
|
110 |
|
|
111 |
|
|
112 |
void CListsStep::ClientAppL()
|
|
113 |
/**
|
|
114 |
* @return void
|
|
115 |
* This calls each stage of the test
|
|
116 |
*/
|
|
117 |
{
|
|
118 |
INFO_PRINTF1(_L("Starting Lists Test Suite") );
|
|
119 |
ListProcessesL();
|
|
120 |
ListThreadsL();
|
|
121 |
ListExecutables();
|
|
122 |
ListPlugins();
|
|
123 |
}
|
|
124 |
|
|
125 |
|
|
126 |
void CListsStep::ListProcessesL()
|
|
127 |
/**
|
|
128 |
* @return void
|
|
129 |
* This tests we can succesfully list the processes and that the returned values make sense
|
|
130 |
*/
|
|
131 |
{
|
|
132 |
INFO_PRINTF1(_L("Lists Test Suite: ListProcesses") );
|
|
133 |
|
|
134 |
if (TestStepResult()==EPass)
|
|
135 |
{
|
|
136 |
|
|
137 |
RProcessPointerList procList;
|
|
138 |
TCleanupItem cleanupProcList(CTe_coredumpserverSuite::CleanupProcessList, (TAny*)&procList);
|
|
139 |
CleanupStack::PushL(cleanupProcList);
|
|
140 |
|
|
141 |
TRAPD( ret, iSess.GetProcessesL( procList ) );
|
|
142 |
|
|
143 |
if( KErrNone != ret )
|
|
144 |
{
|
|
145 |
SetTestStepResult(EFail);
|
|
146 |
ERR_PRINTF2(_L("Error %d from iSess.GetProcessesL()"), ret);
|
|
147 |
return;
|
|
148 |
}
|
|
149 |
|
|
150 |
if( procList.Count() == 0 )
|
|
151 |
{
|
|
152 |
SetTestStepResult(EFail);
|
|
153 |
ERR_PRINTF1(_L("Error : GetProcessesL() returned empty list") );
|
|
154 |
return;
|
|
155 |
}
|
|
156 |
else
|
|
157 |
{
|
|
158 |
RProcess thisProc;
|
|
159 |
TInt i;
|
|
160 |
for( i=0; i < procList.Count(); i++ )
|
|
161 |
{
|
|
162 |
if( procList[i]->Id() == thisProc.Id() )
|
|
163 |
{
|
|
164 |
break;
|
|
165 |
}
|
|
166 |
}
|
|
167 |
|
|
168 |
if( i == procList.Count() )
|
|
169 |
{
|
|
170 |
SetTestStepResult(EFail);
|
|
171 |
ERR_PRINTF1(_L("Error : This process could not be found in GetProcessesL() list") );
|
|
172 |
return;
|
|
173 |
}
|
|
174 |
}
|
|
175 |
|
|
176 |
CleanupStack::PopAndDestroy();
|
|
177 |
}
|
|
178 |
}
|
|
179 |
|
|
180 |
void CListsStep::ListThreadsL()
|
|
181 |
/**
|
|
182 |
* @return void
|
|
183 |
* This checks the threads are listed correctly and the returned values make sense
|
|
184 |
*/
|
|
185 |
{
|
|
186 |
INFO_PRINTF1(_L("Lists Test Suite: ListThreads") );
|
|
187 |
|
|
188 |
if (TestStepResult()==EPass)
|
|
189 |
{
|
|
190 |
|
|
191 |
RThreadPointerList threadList;
|
|
192 |
TCleanupItem cleanupThreadList(CTe_coredumpserverSuite::CleanupPluginList, (TAny*)&threadList);
|
|
193 |
CleanupStack::PushL(cleanupThreadList);
|
|
194 |
|
|
195 |
TRAPD( ret, iSess.GetThreadsL( threadList ) );
|
|
196 |
if( KErrNone != ret )
|
|
197 |
{
|
|
198 |
SetTestStepResult(EFail);
|
|
199 |
ERR_PRINTF2(_L("Error %d from iSess.GetThreadsL()"), ret);
|
|
200 |
return;
|
|
201 |
}
|
|
202 |
|
|
203 |
if( threadList.Count() == 0 )
|
|
204 |
{
|
|
205 |
SetTestStepResult(EFail);
|
|
206 |
ERR_PRINTF1(_L("Error : GetThreadsL() returned empty list") );
|
|
207 |
return;
|
|
208 |
}
|
|
209 |
else
|
|
210 |
{
|
|
211 |
RThread thisThread;
|
|
212 |
TInt i;
|
|
213 |
for( i=0; i < threadList.Count(); i++ )
|
|
214 |
{
|
|
215 |
if( threadList[i]->Id() == thisThread.Id() )
|
|
216 |
{
|
|
217 |
break;
|
|
218 |
}
|
|
219 |
}
|
|
220 |
|
|
221 |
if( i == threadList.Count() )
|
|
222 |
{
|
|
223 |
SetTestStepResult(EFail);
|
|
224 |
ERR_PRINTF1(_L("Error : This thread could not be found in GetThreadsL() list/n") );
|
|
225 |
return;
|
|
226 |
}
|
|
227 |
}
|
|
228 |
|
|
229 |
CleanupStack::PopAndDestroy();
|
|
230 |
|
|
231 |
}
|
|
232 |
}
|
|
233 |
|
|
234 |
void CListsStep::ListExecutables()
|
|
235 |
/**
|
|
236 |
* @return void
|
|
237 |
* This tests we can succesfully list the executables and that the returned values make sense
|
|
238 |
*/
|
|
239 |
{
|
|
240 |
INFO_PRINTF1(_L("Lists Test Suite: ListExecutables") );
|
|
241 |
|
|
242 |
if (TestStepResult()==EPass)
|
|
243 |
{
|
|
244 |
|
|
245 |
RExecutablePointerList execList;
|
|
246 |
|
|
247 |
TRAPD( err, iSess.GetExecutablesL( execList ) );
|
|
248 |
|
|
249 |
if(err != KErrNone)
|
|
250 |
{
|
|
251 |
SetTestStepResult(EFail);
|
|
252 |
INFO_PRINTF2(_L("Error %d from iSess.GetExecutablesL()/n"), err);
|
|
253 |
return;
|
|
254 |
}
|
|
255 |
|
|
256 |
if( execList.Count() == 0 )
|
|
257 |
{
|
|
258 |
SetTestStepResult(EFail);
|
|
259 |
INFO_PRINTF1(_L("Error : GetExecutablesL() returned empty list/n") );
|
|
260 |
return;
|
|
261 |
}
|
|
262 |
else
|
|
263 |
{
|
|
264 |
RProcess thisProc;
|
|
265 |
TInt i;
|
|
266 |
for( i=0; i < execList.Count(); i++ )
|
|
267 |
{
|
|
268 |
if( execList[i]->Name() == thisProc.FileName() )
|
|
269 |
{
|
|
270 |
break;
|
|
271 |
}
|
|
272 |
}
|
|
273 |
|
|
274 |
if( i == execList.Count() )
|
|
275 |
{
|
|
276 |
SetTestStepResult(EFail);
|
|
277 |
INFO_PRINTF1(_L("Error : This executable could not be found in GetExecutablesL() list/n") );
|
|
278 |
return;
|
|
279 |
}
|
|
280 |
}
|
|
281 |
|
|
282 |
execList.ResetAndDestroy();
|
|
283 |
execList.Close();
|
|
284 |
|
|
285 |
}
|
|
286 |
}
|
|
287 |
|
|
288 |
void CListsStep::ListPlugins()
|
|
289 |
/**
|
|
290 |
* @return void
|
|
291 |
* This tests we can succesfully list the executables and that the returned values make sense
|
|
292 |
*/
|
|
293 |
{
|
|
294 |
INFO_PRINTF1(_L("Lists Test Suite: ListPlugins") );
|
|
295 |
|
|
296 |
if (TestStepResult()==EPass)
|
|
297 |
{
|
|
298 |
|
|
299 |
RPluginList pluginList;
|
|
300 |
|
|
301 |
TRAPD( err, iSess.GetPluginListL( pluginList ) );
|
|
302 |
|
|
303 |
if(err != KErrNone)
|
|
304 |
{
|
|
305 |
SetTestStepResult(EFail);
|
|
306 |
INFO_PRINTF2(_L("Error %d from iSess.GetPluginsL()"), err);
|
|
307 |
return;
|
|
308 |
}
|
|
309 |
|
|
310 |
if( pluginList.Count() == 0 )
|
|
311 |
{
|
|
312 |
SetTestStepResult(EFail);
|
|
313 |
INFO_PRINTF1(_L("Error : GetPluginsL() returned empty list") );
|
|
314 |
return;
|
|
315 |
}
|
|
316 |
else
|
|
317 |
{
|
|
318 |
|
|
319 |
TInt i;
|
|
320 |
for( i=0; i < pluginList.Count(); i++ )
|
|
321 |
{
|
|
322 |
if( (pluginList[i].iUid == DEXEC_UID) || (pluginList[i].iUid == SELF_UID) )
|
|
323 |
{
|
|
324 |
break;
|
|
325 |
}
|
|
326 |
}
|
|
327 |
|
|
328 |
if( i == pluginList.Count() )
|
|
329 |
{
|
|
330 |
SetTestStepResult(EFail);
|
|
331 |
INFO_PRINTF1(_L("Error : DEXC nor SELF plugin could not be found in GetPluginsL() list") );
|
|
332 |
return;
|
|
333 |
}
|
|
334 |
}
|
|
335 |
|
|
336 |
pluginList.Reset();
|
|
337 |
pluginList.Close();
|
|
338 |
|
|
339 |
}
|
|
340 |
}
|
|
341 |
|