0
|
1 |
// Copyright (c) 2005-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 |
// Example CTestStep derived implementation
|
|
15 |
//
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
/**
|
|
20 |
@file SELFStep.cpp
|
|
21 |
@internalTechnology
|
|
22 |
*/
|
|
23 |
#include "SELFUserSideStep.h"
|
|
24 |
#include "tcoredumpserverSuiteDefs.h"
|
|
25 |
#include "tcoredumpserverSuiteServer.h"
|
|
26 |
#include "optionconfig.h"
|
|
27 |
#include <coredumpserverapi.h>
|
|
28 |
#include <e32property.h>
|
|
29 |
#include <crashdatasave.h>
|
|
30 |
|
|
31 |
CSELFUserSideStep::~CSELFUserSideStep()
|
|
32 |
/**
|
|
33 |
* Destructor
|
|
34 |
*/
|
|
35 |
{
|
|
36 |
}
|
|
37 |
|
|
38 |
CSELFUserSideStep::CSELFUserSideStep()
|
|
39 |
/**
|
|
40 |
* Constructor
|
|
41 |
*/
|
|
42 |
{
|
|
43 |
// **MUST** call SetTestStepName in the constructor as the controlling
|
|
44 |
// framework uses the test step name immediately following construction to set
|
|
45 |
// up the step's unique logging ID.
|
|
46 |
SetTestStepName(KSELFUserSideStep);
|
|
47 |
}
|
|
48 |
|
|
49 |
TVerdict CSELFUserSideStep::doTestStepPreambleL()
|
|
50 |
/**
|
|
51 |
* @return - TVerdict code
|
|
52 |
* Override of base class virtual
|
|
53 |
*/
|
|
54 |
{
|
|
55 |
|
|
56 |
TInt ret = KErrNone;
|
|
57 |
ret = iSess.Connect();
|
|
58 |
if(ret != KErrNone)
|
|
59 |
{
|
|
60 |
SetTestStepResult( EFail );
|
|
61 |
INFO_PRINTF2(_L("Error %d from iSess->Connect()/n"), ret);
|
|
62 |
}
|
|
63 |
else
|
|
64 |
{
|
|
65 |
SetTestStepResult(EPass);
|
|
66 |
}
|
|
67 |
|
|
68 |
ret = iFs.Connect();
|
|
69 |
if(ret != KErrNone)
|
|
70 |
{
|
|
71 |
SetTestStepResult( EFail );
|
|
72 |
INFO_PRINTF2(_L("Error %d from iFs->Connect()/n"), ret);
|
|
73 |
}
|
|
74 |
else
|
|
75 |
{
|
|
76 |
SetTestStepResult(EPass);
|
|
77 |
}
|
|
78 |
|
|
79 |
return TestStepResult();
|
|
80 |
}
|
|
81 |
|
|
82 |
|
|
83 |
TVerdict CSELFUserSideStep::doTestStepL()
|
|
84 |
/**
|
|
85 |
* @return - TVerdict code
|
|
86 |
* Override of base class pure virtual
|
|
87 |
* Our implementation only gets called if the base class doTestStepPreambleL() did
|
|
88 |
* not leave. That being the case, the current test result value will be EPass.
|
|
89 |
*/
|
|
90 |
{
|
|
91 |
|
|
92 |
if (TestStepResult()==EPass)
|
|
93 |
{
|
|
94 |
TInt ret = KErrNone;
|
|
95 |
|
|
96 |
__UHEAP_MARK;
|
|
97 |
|
|
98 |
TRAP(ret, ClientAppL());
|
|
99 |
if(KErrNone != ret)
|
|
100 |
{
|
|
101 |
SetTestStepResult(EFail);
|
|
102 |
INFO_PRINTF2(_L("Error %d from CSELFStep->ClientAppL()"), ret);
|
|
103 |
}
|
|
104 |
|
|
105 |
__UHEAP_MARKEND;
|
|
106 |
|
|
107 |
}
|
|
108 |
return TestStepResult();
|
|
109 |
}
|
|
110 |
|
|
111 |
void CSELFUserSideStep::ClientAppL()
|
|
112 |
/**
|
|
113 |
* @return void
|
|
114 |
* This calls each stage of the test
|
|
115 |
*/
|
|
116 |
{
|
|
117 |
INFO_PRINTF1(_L("Starting SELF Test Suite") );
|
|
118 |
HandleCrashL();
|
|
119 |
//CheckParametersL();
|
|
120 |
}
|
|
121 |
|
|
122 |
void CSELFUserSideStep::HandleCrashL()
|
|
123 |
/**
|
|
124 |
* @return void
|
|
125 |
* Tests handling a crash
|
|
126 |
*/
|
|
127 |
{
|
|
128 |
|
|
129 |
if(TestStepResult()==EPass)
|
|
130 |
{
|
|
131 |
|
|
132 |
|
|
133 |
TPtrC crashAppParam;
|
|
134 |
TPtrC crashFileName;
|
|
135 |
TPtrC writerToUse;
|
|
136 |
|
|
137 |
if(!GetStringFromConfig(ConfigSection(), KTe_CrashAppParam, crashAppParam) ||
|
|
138 |
!GetStringFromConfig(ConfigSection(), KTe_CrashFileName, crashFileName) ||
|
|
139 |
!GetStringFromConfig(ConfigSection(), KWriterToUse, writerToUse))
|
|
140 |
{
|
|
141 |
INFO_PRINTF1(_L("Failed to get data from ini file"));
|
|
142 |
SetTestStepResult(EFail);
|
|
143 |
User::Leave(KErrGeneral);
|
|
144 |
}
|
|
145 |
|
|
146 |
INFO_PRINTF4(_L("The CrashApp Param is %S, The Filename is is %S, The writer is %S"), &crashAppParam, &crashFileName,&writerToUse); // Block end
|
|
147 |
|
|
148 |
//Convert writer config to hex
|
|
149 |
TLex luther(writerToUse);
|
|
150 |
TUint32 writer;
|
|
151 |
luther.Val(writer, EHex);
|
|
152 |
|
|
153 |
//Start the process that we intend to crash....
|
|
154 |
RProcess crashProcess;
|
|
155 |
CleanupClosePushL(crashProcess);
|
|
156 |
|
|
157 |
TInt ret = crashProcess.Create( KCrashAppFileName, crashAppParam);
|
|
158 |
if(ret != KErrNone)
|
|
159 |
{
|
|
160 |
INFO_PRINTF2(_L("Error %d from RProcess .Create(z:\\sys\\bin\\crashapp.exe)/n"), ret);
|
|
161 |
SetTestStepResult(EFail);
|
|
162 |
User::Leave(ret);
|
|
163 |
}
|
|
164 |
|
|
165 |
INFO_PRINTF1(_L("Started userside crash app"));
|
|
166 |
|
|
167 |
//Load SELF Formatter
|
|
168 |
LoadSELFFormatterL();
|
|
169 |
|
|
170 |
TPluginRequest req;
|
|
171 |
TUid writerUid = TUid::Uid(writer);
|
|
172 |
req.iUid = writerUid;
|
|
173 |
req.iPluginType = TPluginRequest::EWriter;
|
|
174 |
req.iLoad = ETrue;
|
|
175 |
|
|
176 |
TRAP(ret, iSess.PluginRequestL( req ));
|
|
177 |
if(ret != KErrNone)
|
|
178 |
{
|
|
179 |
INFO_PRINTF2(_L("Failed to load writer plugin, error = %d"), ret);
|
|
180 |
SetTestStepResult(EFail);
|
|
181 |
User::Leave(ret);
|
|
182 |
}
|
|
183 |
|
|
184 |
INFO_PRINTF1(_L("Loaded writer plugin successfully"));
|
|
185 |
|
|
186 |
//Now we configure CDS and writer
|
|
187 |
_LIT( KFilePathPrompt, "not_important" );
|
|
188 |
|
|
189 |
DoConfigureL(2, CDS_UID.iUid, COptionConfig::ECoreDumpServer, COptionConfig::ETUInt, KPostCrashEventActionPrompt,
|
|
190 |
1, KNullDesC, 4, KNullDesC, 0);
|
|
191 |
|
|
192 |
DoConfigureL((TInt)(CCrashDataSave::ECoreFilePath), writerUid.iUid, COptionConfig::EWriterPlugin, COptionConfig::ETFileName,
|
|
193 |
KFilePathPrompt, 1, KNullDesC, 0, crashFileName, 0);
|
|
194 |
|
|
195 |
// Observe the process and wait for a crash
|
|
196 |
TRAP(ret, iSess.ObservationRequestL( KCrashAppFileName, KCrashAppFileName, ETrue) );
|
|
197 |
if(ret != KErrNone)
|
|
198 |
{
|
|
199 |
INFO_PRINTF2(_L("Error %d iSess.ObservationRequestL(z:\\sys\\bin\\crashapp.exe)\n"), ret);
|
|
200 |
SetTestStepResult(EFail);
|
|
201 |
User::Leave( ret );
|
|
202 |
}
|
|
203 |
|
|
204 |
//start the crash process
|
|
205 |
crashProcess.Resume();
|
|
206 |
CleanupStack::PopAndDestroy(&crashProcess); //this is for crashProcess
|
|
207 |
|
|
208 |
//Monitor the progress of the crash file being generated...
|
|
209 |
MonitorProgressL();
|
|
210 |
User::After(5000000);
|
|
211 |
|
|
212 |
//Check dump has been generated...and valid
|
|
213 |
CDir *fileList = NULL;
|
|
214 |
TFindFile fileFinder(iFs);
|
|
215 |
TRAP(ret, fileList = CTe_coredumpserverSuite::DoesFileExistL(crashFileName, fileFinder));
|
|
216 |
|
|
217 |
if((ret != KErrNone) || (fileList == NULL))
|
|
218 |
{
|
|
219 |
INFO_PRINTF2(_L("Expected crash file was not generated: %d"), ret);
|
|
220 |
SetTestStepResult(EFail);
|
|
221 |
User::Leave( ret );
|
|
222 |
}
|
|
223 |
|
|
224 |
CleanupStack::PushL(fileList);
|
|
225 |
for(TInt i = 0; i < fileList->Count(); i++)
|
|
226 |
{
|
|
227 |
TParse fullName;
|
|
228 |
fullName.Set((*fileList)[i].iName, &fileFinder.File(), NULL);
|
|
229 |
User::LeaveIfError(iFs.Delete(fullName.FullName()));
|
|
230 |
}
|
|
231 |
CleanupStack::PopAndDestroy(fileList);
|
|
232 |
|
|
233 |
INFO_PRINTF1(_L("Expected crash file was generated successfully"));
|
|
234 |
|
|
235 |
RProcessPointerList procList;
|
|
236 |
TCleanupItem cleanupProcesses(CTe_coredumpserverSuite::CleanupProcessList, (TAny*)&procList);
|
|
237 |
CleanupStack::PushL(cleanupProcesses);
|
|
238 |
|
|
239 |
iSess.GetProcessesL( procList );
|
|
240 |
|
|
241 |
INFO_PRINTF1(_L("Looking through the procList"));
|
|
242 |
for(TInt i=0; i < procList.Count(); i++ )
|
|
243 |
{
|
|
244 |
if(procList[i]->Name() == KCrashAppFileName)
|
|
245 |
{
|
|
246 |
SetTestStepResult( EFail );
|
|
247 |
INFO_PRINTF1(_L("Crash application was not killed as expected after crash"));
|
|
248 |
User::Leave(KErrGeneral);
|
|
249 |
}
|
|
250 |
}
|
|
251 |
CleanupStack::PopAndDestroy(&procList);
|
|
252 |
}
|
|
253 |
}
|
|
254 |
|
|
255 |
void CSELFUserSideStep::CheckParametersL()
|
|
256 |
/**
|
|
257 |
* This checks the SELF parameters - are we creating a stack file and text file?
|
|
258 |
*/
|
|
259 |
{
|
|
260 |
if(TestStepResult()==EPass)
|
|
261 |
{
|
|
262 |
//Start the process that we intend to crash....
|
|
263 |
RProcess crashProcess;
|
|
264 |
CleanupClosePushL(crashProcess);
|
|
265 |
|
|
266 |
_LIT(KCrashAppParam, "-c4 -d1");
|
|
267 |
TInt ret = crashProcess.Create( KCrashAppFileName, KCrashAppParam);
|
|
268 |
if(ret != KErrNone)
|
|
269 |
{
|
|
270 |
INFO_PRINTF2(_L("Error %d from RProcess .Create(z:\\sys\\bin\\crashapp.exe)/n"), ret);
|
|
271 |
SetTestStepResult(EFail);
|
|
272 |
User::Leave(ret);
|
|
273 |
}
|
|
274 |
|
|
275 |
LoadSELFFormatterL();
|
|
276 |
LoadSELFFormatterL();
|
|
277 |
LoadSELFFormatterL();
|
|
278 |
|
|
279 |
LoadFileWriterL();
|
|
280 |
LoadFileWriterL();
|
|
281 |
LoadFileWriterL();
|
|
282 |
|
|
283 |
BindPluginsL(3);
|
|
284 |
|
|
285 |
_LIT(KTrue, "True");
|
|
286 |
_LIT(KFalse, "False");
|
|
287 |
|
|
288 |
|
|
289 |
//enable system wide
|
|
290 |
DoConfigureL(0, SELF_UID.iUid, COptionConfig::EFormatterPlugin, COptionConfig::ETString,
|
|
291 |
KNullDesC, 1, KNullDesC, 1, KFalse, 0);
|
|
292 |
|
|
293 |
//disable process data
|
|
294 |
DoConfigureL(1, SELF_UID.iUid, COptionConfig::EFormatterPlugin, COptionConfig::ETString,
|
|
295 |
KNullDesC, 1, KNullDesC, 0, KFalse, 1);
|
|
296 |
|
|
297 |
//disable thread segs
|
|
298 |
DoConfigureL(4, SELF_UID.iUid, COptionConfig::EFormatterPlugin, COptionConfig::ETString,
|
|
299 |
KNullDesC, 1, KNullDesC, 0, KTrue, 1);
|
|
300 |
|
|
301 |
//disable process segs
|
|
302 |
DoConfigureL(7, SELF_UID.iUid, COptionConfig::EFormatterPlugin, COptionConfig::ETString,
|
|
303 |
KNullDesC, 1, KNullDesC, 0, KTrue, 1);
|
|
304 |
|
|
305 |
//disable data segs
|
|
306 |
DoConfigureL(2, SELF_UID.iUid, COptionConfig::EFormatterPlugin, COptionConfig::ETString,
|
|
307 |
KNullDesC, 1, KNullDesC, 0, KTrue, 2);
|
|
308 |
|
|
309 |
//disable code segs
|
|
310 |
DoConfigureL(3, SELF_UID.iUid, COptionConfig::EFormatterPlugin, COptionConfig::ETString,
|
|
311 |
KNullDesC, 1, KNullDesC, 0, KTrue, 2);
|
|
312 |
|
|
313 |
//disable register segs
|
|
314 |
DoConfigureL(5, SELF_UID.iUid, COptionConfig::EFormatterPlugin, COptionConfig::ETString,
|
|
315 |
KNullDesC, 1, KNullDesC, 0, KTrue, 2);
|
|
316 |
|
|
317 |
//disable executable segs
|
|
318 |
DoConfigureL(6, SELF_UID.iUid, COptionConfig::EFormatterPlugin, COptionConfig::ETString,
|
|
319 |
KNullDesC, 1, KNullDesC, 0, KTrue, 2);
|
|
320 |
|
|
321 |
|
|
322 |
TUid writerUid = WRITER_UID;//file writer
|
|
323 |
_LIT( KCrashFileName, "c:\\self_chkparam");
|
|
324 |
TBuf<63> fileName;
|
|
325 |
for(TInt i = 0; i < 3; i++)
|
|
326 |
{
|
|
327 |
fileName = KCrashFileName;
|
|
328 |
fileName.AppendFormat(_L("%d"), i);
|
|
329 |
DoConfigureL(CCrashDataSave::ECoreFilePath, writerUid.iUid, COptionConfig::EWriterPlugin, COptionConfig::ETFileName,
|
|
330 |
KNullDesC, 1, KNullDesC, 0, fileName, i);
|
|
331 |
}
|
|
332 |
|
|
333 |
// Observe the process and wait for a crash
|
|
334 |
TRAP(ret, iSess.ObservationRequestL( KCrashAppFileName, KCrashAppFileName, ETrue));
|
|
335 |
if(ret != KErrNone)
|
|
336 |
{
|
|
337 |
ERR_PRINTF2(_L("Error %d iSess.ObservationRequestL(z:\\sys\\bin\\crashapp.exe)\n"), ret);
|
|
338 |
SetTestStepResult(EFail);
|
|
339 |
User::Leave( ret );
|
|
340 |
}
|
|
341 |
|
|
342 |
//start the crash process
|
|
343 |
crashProcess.Resume();
|
|
344 |
INFO_PRINTF1(_L("Started userside crash app"));
|
|
345 |
CleanupStack::PopAndDestroy(&crashProcess);
|
|
346 |
|
|
347 |
//Monitor the progress of the crash file being generated...
|
|
348 |
MonitorProgressL();
|
|
349 |
|
|
350 |
//Check dumps have been generated...
|
|
351 |
CDir *fileList = NULL;
|
|
352 |
TFindFile fileFinder(iFs);
|
|
353 |
TRAP(ret, fileList = CTe_coredumpserverSuite::DoesFileExistL(KCrashFileName, fileFinder));
|
|
354 |
|
|
355 |
if( (ret != KErrNone) || (fileList == NULL) )
|
|
356 |
{
|
|
357 |
ERR_PRINTF2(_L("Expected crash files were not generated: %d"), ret);
|
|
358 |
SetTestStepResult(EFail);
|
|
359 |
User::Leave( ret );
|
|
360 |
}
|
|
361 |
|
|
362 |
TInt validFiles = 0;
|
|
363 |
CleanupStack::PushL(fileList);
|
|
364 |
_LIT(KElfDump, "z:\\sys\\bin\\elfdump.exe");
|
|
365 |
_LIT(KCoreFile, "c:\\core");
|
|
366 |
for(TInt i = 0; i < fileList->Count(); i++)
|
|
367 |
{
|
|
368 |
TParse fullName;
|
|
369 |
fullName.Set((*fileList)[i].iName, &fileFinder.File(), NULL);
|
|
370 |
INFO_PRINTF2(_L("%S"), &fullName.FullName());
|
|
371 |
|
|
372 |
RProcess elfdump;
|
|
373 |
TInt err = elfdump.Create(KElfDump, fullName.FullName());
|
|
374 |
if(err == KErrNone)
|
|
375 |
{
|
|
376 |
TRequestStatus status;
|
|
377 |
elfdump.Rendezvous(status);
|
|
378 |
elfdump.Resume();
|
|
379 |
User::WaitForRequest(status);
|
|
380 |
elfdump.Close();
|
|
381 |
if(status.Int() == KErrNone)
|
|
382 |
{
|
|
383 |
validFiles++;
|
|
384 |
}
|
|
385 |
else
|
|
386 |
{
|
|
387 |
INFO_PRINTF2(_L("elfdump postprocessing finished abnormally:%d"), status.Int());
|
|
388 |
}
|
|
389 |
}
|
|
390 |
else
|
|
391 |
{
|
|
392 |
INFO_PRINTF2(_L("unable to create elfdump process:%d"), err);
|
|
393 |
}
|
|
394 |
|
|
395 |
//Now we validate the trace data
|
|
396 |
|
|
397 |
User::LeaveIfError(iFs.Delete(fullName.FullName()));
|
|
398 |
}
|
|
399 |
User::LeaveIfError(iFs.Delete(KCoreFile));
|
|
400 |
|
|
401 |
if( fileList->Count() != 3 )
|
|
402 |
{
|
|
403 |
ERR_PRINTF1(_L("Expected crash files were not generated"));
|
|
404 |
SetTestStepResult(EFail);
|
|
405 |
User::Leave(KErrNotFound);
|
|
406 |
}
|
|
407 |
CleanupStack::PopAndDestroy(fileList);
|
|
408 |
|
|
409 |
if( validFiles != 3 )
|
|
410 |
{
|
|
411 |
ERR_PRINTF1(_L("Expected crash files were generated but format was not valid"));
|
|
412 |
SetTestStepResult(EFail);
|
|
413 |
User::Leave(KErrCorrupt);
|
|
414 |
}
|
|
415 |
|
|
416 |
RProcessPointerList procList;
|
|
417 |
TCleanupItem cleanupProcesses(CTe_coredumpserverSuite::CleanupProcessList, (TAny*)&procList);
|
|
418 |
CleanupStack::PushL(cleanupProcesses);
|
|
419 |
|
|
420 |
iSess.GetProcessesL( procList );
|
|
421 |
|
|
422 |
INFO_PRINTF1(_L("Looking through the procList"));
|
|
423 |
for(TInt i=0; i < procList.Count(); i++ )
|
|
424 |
{
|
|
425 |
if(procList[i]->Name() == KCrashAppFileName)
|
|
426 |
{
|
|
427 |
SetTestStepResult( EFail );
|
|
428 |
ERR_PRINTF1(_L("Crash application was not killed as expected after crash"));
|
|
429 |
User::Leave(KErrGeneral);
|
|
430 |
}
|
|
431 |
}
|
|
432 |
CleanupStack::PopAndDestroy(&procList);
|
|
433 |
}
|
|
434 |
}
|
|
435 |
|
|
436 |
void CSELFUserSideStep::DoConfigureL(const TUint32& aIndex,
|
|
437 |
const TUint32& aUID,
|
|
438 |
const COptionConfig::TParameterSource& aSource,
|
|
439 |
const COptionConfig::TOptionType& aType,
|
|
440 |
const TDesC& aPrompt,
|
|
441 |
const TUint32& aNumOptions,
|
|
442 |
const TDesC& aOptions,
|
|
443 |
const TInt32& aVal,
|
|
444 |
const TDesC& aStrValue,
|
|
445 |
const TUint aInstance)
|
|
446 |
/**
|
|
447 |
* @return void
|
|
448 |
* @param aIndex Internal index to the component that owns the object
|
|
449 |
* @param aUID UID of the component that owns the object
|
|
450 |
* @param aSource Type of component that owns the object
|
|
451 |
* @param aType Type of parameter
|
|
452 |
* @param aPrompt Prompt to present to user
|
|
453 |
* @param aNumOptions Number of options that the parameter can be set to. Only applies if type is ETMultiEntryEnum.
|
|
454 |
* @param aOptions Comma separated list of options. Applies to ETMultiEntryEnum and ETBool
|
|
455 |
* @param aVal Integer value. Applies to ETInt, ETUInt, ETBool
|
|
456 |
* @param aStrValue String value. Applies to ETString, ETFileName, ETMultiEntry, ETBool
|
|
457 |
*/
|
|
458 |
{
|
|
459 |
COptionConfig * config;
|
|
460 |
|
|
461 |
config = COptionConfig::NewL( aIndex,
|
|
462 |
aUID,
|
|
463 |
aSource,
|
|
464 |
aType,
|
|
465 |
aPrompt,
|
|
466 |
aNumOptions,
|
|
467 |
aOptions,
|
|
468 |
aVal,
|
|
469 |
aStrValue);
|
|
470 |
|
|
471 |
CleanupStack::PushL(config);
|
|
472 |
|
|
473 |
config->Instance(aInstance);
|
|
474 |
|
|
475 |
//Configure now...
|
|
476 |
TRAPD(ret, iSess.SetConfigParameterL(*config) );
|
|
477 |
if(ret != KErrNone)
|
|
478 |
{
|
|
479 |
INFO_PRINTF2(_L("Error %d changing param/n"), ret );
|
|
480 |
SetTestStepResult(EFail);
|
|
481 |
User::Leave(ret);
|
|
482 |
}
|
|
483 |
|
|
484 |
CleanupStack::PopAndDestroy(config);
|
|
485 |
}
|
|
486 |
|
|
487 |
void CSELFUserSideStep::MonitorProgressL()
|
|
488 |
/**
|
|
489 |
* @return void
|
|
490 |
* This method monitors the RProperty for the crash progress. There are several states of this but we are
|
|
491 |
* only interested in the start and finish of these properties
|
|
492 |
*/
|
|
493 |
{
|
|
494 |
RProperty crashProgress;
|
|
495 |
User::LeaveIfError(crashProgress.Attach(KCoreDumpServUid, ECrashProgress));
|
|
496 |
|
|
497 |
TBuf<50> crashProg;
|
|
498 |
|
|
499 |
TRequestStatus status;
|
|
500 |
crashProgress.Subscribe(status);
|
|
501 |
User::WaitForRequest(status);
|
|
502 |
//Subscribe for next one again...
|
|
503 |
crashProgress.Subscribe(status);
|
|
504 |
|
|
505 |
//First one should be the start string = "-"
|
|
506 |
User::LeaveIfError(crashProgress.Get(crashProg ));
|
|
507 |
if(crashProg != KStartOfSELFProc)
|
|
508 |
{
|
|
509 |
INFO_PRINTF1(_L("SELF formatter has not started processing the data"));
|
|
510 |
}
|
|
511 |
|
|
512 |
INFO_PRINTF1(_L("SELF formatters have started processing the data"));
|
|
513 |
INFO_PRINTF1(_L("Waiting to be notified of the timeout of the processing. A timeout here is a fail"));
|
|
514 |
//Now we wait until its finished
|
|
515 |
do
|
|
516 |
{
|
|
517 |
User::WaitForRequest(status);
|
|
518 |
crashProgress.Subscribe(status);
|
|
519 |
|
|
520 |
User::LeaveIfError(crashProgress.Get(crashProg ));
|
|
521 |
}
|
|
522 |
while(crashProg != KEndOfProcessing);
|
|
523 |
|
|
524 |
INFO_PRINTF1(_L("SELF formatter has finished processing the data"));
|
|
525 |
|
|
526 |
}
|
|
527 |
|
|
528 |
void CSELFUserSideStep::LoadSELFFormatterL()
|
|
529 |
/**
|
|
530 |
* @return void
|
|
531 |
* Utility function to load the SELF formatter
|
|
532 |
*/
|
|
533 |
{
|
|
534 |
|
|
535 |
INFO_PRINTF1(_L("Attempting to load SELF Plugin"));
|
|
536 |
|
|
537 |
TPluginRequest req;
|
|
538 |
req.iPluginType = TPluginRequest::EFormatter;
|
|
539 |
req.iLoad = ETrue;
|
|
540 |
req.iUid = SELF_UID;
|
|
541 |
|
|
542 |
// Should be allowed to load Symbian ELF
|
|
543 |
TRAPD(ret, iSess.PluginRequestL( req ));
|
|
544 |
if(ret != KErrNone)
|
|
545 |
{
|
|
546 |
ERR_PRINTF2(_L("Failed to load self formatter plugin, error = %d"), ret);
|
|
547 |
SetTestStepResult(EFail);
|
|
548 |
User::Leave(ret);
|
|
549 |
}
|
|
550 |
|
|
551 |
}
|
|
552 |
|
|
553 |
void CSELFUserSideStep::LoadFileWriterL()
|
|
554 |
{
|
|
555 |
TPluginRequest req;
|
|
556 |
TUid writerUid = WRITER_UID;
|
|
557 |
req.iUid = writerUid;
|
|
558 |
req.iPluginType = TPluginRequest::EWriter;
|
|
559 |
req.iLoad = ETrue;
|
|
560 |
|
|
561 |
TRAPD(ret, iSess.PluginRequestL( req ));
|
|
562 |
if(ret != KErrNone)
|
|
563 |
{
|
|
564 |
ERR_PRINTF2(_L("Failed to load writer plugin, error = %d"), ret);
|
|
565 |
SetTestStepResult(EFail);
|
|
566 |
User::Leave(ret);
|
|
567 |
}
|
|
568 |
|
|
569 |
}
|
|
570 |
|
|
571 |
void CSELFUserSideStep::BindPluginsL(const TInt aCount)
|
|
572 |
/**
|
|
573 |
* @return void
|
|
574 |
* Utility function to load the SELF formatter
|
|
575 |
*/
|
|
576 |
{
|
|
577 |
INFO_PRINTF1(_L("Attempting to bind plugins"));
|
|
578 |
|
|
579 |
TPluginRequest req;
|
|
580 |
req.iPluginType = TPluginRequest::EFormatter;
|
|
581 |
req.iUid = TUid::Uid(0);
|
|
582 |
|
|
583 |
for(TInt i = 0; i < aCount; i++)
|
|
584 |
{
|
|
585 |
req.iIndex = req.iPair = i;
|
|
586 |
TRAPD(ret, iSess.PluginRequestL( req ));
|
|
587 |
|
|
588 |
if(ret != KErrNone)
|
|
589 |
{
|
|
590 |
ERR_PRINTF2(_L("Failed to bind plugin pair=%d"), i);
|
|
591 |
SetTestStepResult(EFail);
|
|
592 |
User::Leave(ret);
|
|
593 |
}
|
|
594 |
}
|
|
595 |
}
|
|
596 |
|
|
597 |
|
|
598 |
TVerdict CSELFUserSideStep::doTestStepPostambleL()
|
|
599 |
/**
|
|
600 |
* @return - TVerdict code
|
|
601 |
* Override of base class virtual
|
|
602 |
*/
|
|
603 |
{
|
|
604 |
iSess.Disconnect();
|
|
605 |
User::After(7000000); //ensure we give enough time for session to close
|
|
606 |
iFs.Close();
|
|
607 |
return EPass;
|
|
608 |
}
|
|
609 |
|
|
610 |
|
|
611 |
|