0
|
1 |
// All rights reserved.
|
|
2 |
// This component and the accompanying materials are made available
|
|
3 |
// under the terms of "Eclipse Public License v1.0"
|
|
4 |
// which accompanies this distribution, and is available
|
|
5 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
6 |
//
|
|
7 |
// Initial Contributors:
|
|
8 |
// Nokia Corporation - initial contribution.
|
|
9 |
//
|
|
10 |
// Contributors:
|
|
11 |
//
|
|
12 |
// Description:
|
|
13 |
//
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
/**
|
|
18 |
@file t_crash_board.cpp
|
|
19 |
@internalTechnology
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include <coredumpinterface.h>
|
|
23 |
#include "t_crash_board.h"
|
|
24 |
|
|
25 |
//Names of functions to be tested - referenced from script file
|
|
26 |
_LIT(KCrashBoard, "CrashBoard");
|
|
27 |
_LIT(KCleanFlashPartition, "CleanFlashPartition");
|
|
28 |
_LIT(KCleanEntireFlashPartition, "CleanEntireFlashPartition");
|
|
29 |
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Constructor for test wrapper
|
|
33 |
*/
|
|
34 |
CCrashBoardWrapper::CCrashBoardWrapper()
|
|
35 |
{
|
|
36 |
}
|
|
37 |
|
|
38 |
/**
|
|
39 |
* Destructor
|
|
40 |
*/
|
|
41 |
CCrashBoardWrapper::~CCrashBoardWrapper()
|
|
42 |
{
|
|
43 |
}
|
|
44 |
|
|
45 |
/**
|
|
46 |
* Two phase constructor for CCrashBoardWrapper
|
|
47 |
* @return CCrashBoardWrapper object
|
|
48 |
* @leave
|
|
49 |
*/
|
|
50 |
CCrashBoardWrapper* CCrashBoardWrapper::NewL()
|
|
51 |
{
|
|
52 |
CCrashBoardWrapper* ret = new (ELeave) CCrashBoardWrapper();
|
|
53 |
CleanupStack::PushL(ret);
|
|
54 |
ret->ConstructL();
|
|
55 |
CleanupStack::Pop(ret);
|
|
56 |
return ret;
|
|
57 |
}
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Safe construction
|
|
61 |
* @leave
|
|
62 |
*/
|
|
63 |
void CCrashBoardWrapper::ConstructL()
|
|
64 |
{
|
|
65 |
}
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Assign the object
|
|
69 |
*
|
|
70 |
* @param aObject TAny* to the object to test
|
|
71 |
* @leave
|
|
72 |
*/
|
|
73 |
void CCrashBoardWrapper::SetObjectL(TAny* aObject)
|
|
74 |
{
|
|
75 |
INFO_PRINTF1(_L("GETS CALLED CCrashBoardWrapper::SetObjectL"));
|
|
76 |
}
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Runs a test preamble
|
|
80 |
*/
|
|
81 |
void CCrashBoardWrapper::PrepareTestL()
|
|
82 |
{
|
|
83 |
SetBlockResult(EPass);
|
|
84 |
|
|
85 |
INFO_PRINTF1(_L("Ready to start test"));
|
|
86 |
}
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Process command to see what test to run
|
|
90 |
*/
|
|
91 |
TBool CCrashBoardWrapper::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
|
|
92 |
{
|
|
93 |
__UHEAP_MARK;
|
|
94 |
|
|
95 |
PrepareTestL();
|
|
96 |
|
|
97 |
if (KCrashBoard() == aCommand)
|
|
98 |
{
|
|
99 |
INFO_PRINTF1(_L("CCrashBoardWrapper::DoCommandL: Inside Command KCrashBoard"));
|
|
100 |
DoCmdCrashBoardL(aSection);
|
|
101 |
}
|
|
102 |
else if (KCleanFlashPartition() == aCommand)
|
|
103 |
{
|
|
104 |
INFO_PRINTF1(_L("CCrashBoardWrapper::DoCommandL: Inside Command KCleanFlashPartition"));
|
|
105 |
DoCmdCleanCrashPartition();
|
|
106 |
}
|
|
107 |
else if (KCleanEntireFlashPartition() == aCommand)
|
|
108 |
{
|
|
109 |
INFO_PRINTF1(_L("CCrashBoardWrapper::DoCommandL: Inside Command KCleanEntireFlashPartition"));
|
|
110 |
DoCmdCleanEntireCrashPartitionL();
|
|
111 |
}
|
|
112 |
else
|
|
113 |
{
|
|
114 |
INFO_PRINTF1(_L("CCrashBoardWrapper::DoCommandL: NOT ** Inside Any Command"));
|
|
115 |
return EFalse;
|
|
116 |
}
|
|
117 |
RDebug::Printf("Returnng from DoCommandL");
|
|
118 |
__UHEAP_MARKEND;
|
|
119 |
|
|
120 |
return ETrue;
|
|
121 |
}
|
|
122 |
|
|
123 |
void CCrashBoardWrapper::DoCmdCleanCrashPartition()
|
|
124 |
{
|
|
125 |
INFO_PRINTF1(_L("CCrashBoardWrapper::DoCmdCleanCrashPartition - Deleting entire crash flash partition"));
|
|
126 |
|
|
127 |
RCoreDumpSession session;
|
|
128 |
session.Connect();
|
|
129 |
CleanupClosePushL(session);
|
|
130 |
|
|
131 |
session.DeleteCrashPartitionL();
|
|
132 |
|
|
133 |
INFO_PRINTF1(_L("CCrashBoardWrapper::DoCmdCleanCrashPartition - Deleting entire crash flash partition succesful"));
|
|
134 |
|
|
135 |
CleanupStack::PopAndDestroy(&session);
|
|
136 |
}
|
|
137 |
|
|
138 |
/**
|
|
139 |
* This tests deletes the entire crash flash partition using the DSS
|
|
140 |
* @leave
|
|
141 |
*/
|
|
142 |
void CCrashBoardWrapper::DoCmdCleanEntireCrashPartitionL()
|
|
143 |
{
|
|
144 |
INFO_PRINTF1(_L("CCrashBoardWrapper::DoCmdCleanEntireCrashPartitionL - Deleting entire crash flash partition using the DSS"));
|
|
145 |
TVersion secVers(Debug::KDebugServMajorVersionNumber, Debug::KDebugServMinorVersionNumber, Debug::KDebugServPatchVersionNumber);
|
|
146 |
User::LeaveIfError(iSecSess.Connect(secVers));
|
|
147 |
|
|
148 |
INFO_PRINTF1(_L("Erasing the flash EraseCrashFlashPartition using DSS"));
|
|
149 |
iSecSess.EraseCrashFlashPartition();
|
|
150 |
|
|
151 |
INFO_PRINTF1(_L("Erasing the flash EraseCrashFlashPartition using DSS Successful"));
|
|
152 |
iSecSess.Close();
|
|
153 |
|
|
154 |
}
|
|
155 |
/**
|
|
156 |
* This tests that we can succesfully construct
|
|
157 |
* @leave
|
|
158 |
*/
|
|
159 |
void CCrashBoardWrapper::DoCmdCrashBoardL(const TDesC& aSection)
|
|
160 |
{
|
|
161 |
TPtrC crashAppParam;
|
|
162 |
|
|
163 |
//read from the INI for crashapp paramemters
|
|
164 |
if(!GetStringFromConfig(aSection, KTe_CrashAppParam, crashAppParam))
|
|
165 |
{
|
|
166 |
ERR_PRINTF1(_L("Failed to get data from ini file"));
|
|
167 |
SetBlockResult(EFail);
|
|
168 |
User::Leave(KErrGeneral);
|
|
169 |
}
|
|
170 |
|
|
171 |
INFO_PRINTF2(_L("The CrashApp Parameters are: crashapp %S, "), &crashAppParam); // print it to check
|
|
172 |
|
|
173 |
RProcess crashProcess;
|
|
174 |
CleanupClosePushL(crashProcess);
|
|
175 |
|
|
176 |
TInt ret = crashProcess.Create( KCrashAppFileName, crashAppParam);
|
|
177 |
if(ret != KErrNone)
|
|
178 |
{
|
|
179 |
ERR_PRINTF2( _L("Failed to create process CRASHAPP ret=%d\n"), ret );
|
|
180 |
SetBlockResult(EFail);
|
|
181 |
User::Leave(ret);
|
|
182 |
}
|
|
183 |
|
|
184 |
//resume the crashapp process
|
|
185 |
crashProcess.Resume();
|
|
186 |
|
|
187 |
CleanupStack::PopAndDestroy(&crashProcess); //RProcess crashProcess
|
|
188 |
|
|
189 |
INFO_PRINTF1(_L("DoCmdCrashL DONE"));
|
|
190 |
}
|
|
191 |
//eof
|
|
192 |
|