0
|
1 |
// Copyright (c) 2002-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 |
#ifndef __PARSELINE_H__
|
|
17 |
#define __PARSELINE_H__
|
|
18 |
|
|
19 |
/**
|
|
20 |
*
|
|
21 |
* Max len of string buffers
|
|
22 |
*
|
|
23 |
* @xxxx
|
|
24 |
*
|
|
25 |
*/
|
|
26 |
const TInt KMaxLenStepData = 256;
|
|
27 |
const TInt KMaxLenScriptLine = 2000;
|
|
28 |
|
|
29 |
/**
|
|
30 |
*
|
|
31 |
* Guard timer default
|
|
32 |
*
|
|
33 |
* @xxxx
|
|
34 |
*
|
|
35 |
*/
|
|
36 |
const TInt KNoGuardTimer = -1L;
|
|
37 |
|
|
38 |
/**
|
|
39 |
* constant that indicates that the panic reason should be ignored
|
|
40 |
*/
|
|
41 |
const TInt KNoPanicReason = -1;
|
|
42 |
|
|
43 |
/**
|
|
44 |
*
|
|
45 |
* This class is used for storing information on
|
|
46 |
* test suite DLLs currently loaded
|
|
47 |
*
|
|
48 |
* @xxxx
|
|
49 |
*
|
|
50 |
*/
|
|
51 |
class CSuiteDll : public CBase
|
|
52 |
{
|
|
53 |
public:
|
|
54 |
|
|
55 |
static CSuiteDll* NewL(const TDesC& aName, CLog* aLog);
|
|
56 |
void ConstructL(const TDesC& aName, CLog* aLog);
|
|
57 |
~CSuiteDll();
|
|
58 |
|
|
59 |
// accessors
|
|
60 |
CTestSuite* Suite() const;
|
|
61 |
TPtrC Name() const;
|
|
62 |
|
|
63 |
private:
|
|
64 |
CLog* iLog;
|
|
65 |
RLibrary iLibrary; // DLL Library
|
|
66 |
CTestSuite* iTestSuite; // pointer to Test suite object
|
|
67 |
TBuf<KMaxLenTestSuiteName> iName; // name of the test suite
|
|
68 |
};
|
|
69 |
|
|
70 |
/**
|
|
71 |
*
|
|
72 |
* CStepData class used for passing test step data to the step thread
|
|
73 |
* JW 03-01-03 : rewritten from TStepData to use heap - avoiding stack overflow
|
|
74 |
*
|
|
75 |
* @xxxx
|
|
76 |
*
|
|
77 |
*/
|
|
78 |
class CStepData
|
|
79 |
{
|
|
80 |
public:
|
|
81 |
// constructor
|
|
82 |
static CStepData* NewL(const TDesC& aStep, const TDesC& aConfig, CSuiteDll* aSuite);
|
|
83 |
static CStepData* NewL(const TDesC& aStep, const TDesC& aConfig, const TDesC& aParamSet, CSuiteDll* aSuite);
|
|
84 |
~CStepData();
|
|
85 |
CStepData();
|
|
86 |
void ConstructL(const TDesC& aStep, const TDesC& aConfig, const TDesC& aParamSet, CSuiteDll* aSuite);
|
|
87 |
|
|
88 |
// accessors
|
|
89 |
TPtrC Step() const;
|
|
90 |
TPtrC Config() const;
|
|
91 |
const TDesC& ParamSet() const;
|
|
92 |
CSuiteDll* SuiteDll() const;
|
|
93 |
private:
|
|
94 |
TBuf<KMaxLenStepData> iStep;
|
|
95 |
TBuf<KMaxLenStepData> iConfig;
|
|
96 |
TBuf<KMaxLenStepData> iParamSet;
|
|
97 |
CSuiteDll* iSuite;
|
|
98 |
};
|
|
99 |
|
|
100 |
/**
|
|
101 |
*
|
|
102 |
* CParseLine - the main test script interpreter
|
|
103 |
*
|
|
104 |
* @xxxx
|
|
105 |
*
|
|
106 |
*/
|
|
107 |
class CParseLine : public CBase
|
|
108 |
{
|
|
109 |
public:
|
|
110 |
static CParseLine* NewL(CScript* aScript, CTestUtils* aTestUtils, CLog* aLog, TInt64 aGuardTimer, const TDesC& aMatchString);
|
|
111 |
~CParseLine();
|
|
112 |
CParseLine(const TDesC& aMatchString);
|
|
113 |
void ConstructL(CScript* aScript, CTestUtils* aTestUtils, CLog* aLog, TInt64 aGuardTimer);
|
|
114 |
|
|
115 |
void ProcessLineL(const TDesC8& aNarrowline, TInt aLineNo); // process a line of script
|
|
116 |
|
|
117 |
// accessors
|
|
118 |
TPtrC CurrentSuiteName() const;
|
|
119 |
TPtrC CurrentStepName() const;
|
|
120 |
|
|
121 |
private:
|
|
122 |
|
|
123 |
// thread functions
|
|
124 |
static TInt ThreadFunctionL (TAny* aPtr);
|
|
125 |
static TInt ThreadTrapFunctionL (TAny* aPtr);
|
|
126 |
|
|
127 |
// script keyword commands
|
|
128 |
void ScriptPrint(const TDesC& aText);
|
|
129 |
void RunScriptL(const TDesC& aText);
|
|
130 |
void RunTestStep(const TDesC& aText);
|
|
131 |
void RunPanicTestStep(const TDesC& aText);
|
|
132 |
void RunTerminationTestStep(const TDesC& aText);
|
|
133 |
void RunUtil(const TDesC& aText);
|
|
134 |
void LoadSuiteL(const TDesC& aText);
|
|
135 |
void Reboot();
|
|
136 |
TVerdict DoTestNewThread(const TDesC& aSuite, const TDesC& aStep,
|
|
137 |
TInt64 aGuardTimerValue, const TDesC& aConfig, const TDesC& aParamSet);
|
|
138 |
TVerdict DoPanicTest(const TDesC& aSuite, const TDesC& aStep, TInt64 aGuardTimerValue, const TExitCategoryName aExitCategory, TInt aExitReason, const TDesC& aConfig, const TDesC& aParamSet);
|
|
139 |
TVerdict DoTerminationTest(const TDesC& aSuite, const TDesC& aStep, TInt64 aGuardTimerValue, TInt aExitReason, const TDesC& aConfig);
|
|
140 |
void GetHeapAndStackSize(const CStepData* aStepData, TInt* aHeapSize, TInt* aStackSize);
|
|
141 |
void Unload();
|
|
142 |
void HeapMark();
|
|
143 |
void HeapCheck();
|
|
144 |
void RequestMark();
|
|
145 |
void RequestCheck();
|
|
146 |
void HandlesMark();
|
|
147 |
void HandlesCheck();
|
|
148 |
void RunProgram(const TDesC& aText);
|
|
149 |
void TestComplete(const TDesC& aText);
|
|
150 |
void Delay(const TDesC& aText);
|
|
151 |
void SetSeverity(const TDesC& aText);
|
|
152 |
void LogSettings(const TDesC& aText);
|
|
153 |
// logger - use only with macros
|
|
154 |
void LogExtra(const TText8* aFile, TInt aLine, TInt aSeverity,
|
|
155 |
TRefByValue<const TDesC16> aFmt, ...);
|
|
156 |
void CreateUniqueTestThreadL(const TDesC& aBaseName, TDes& aThreadName, RThread& aTestThread, TThreadFunction aFunction, TInt aStackSize, TInt aHeapMinSize, TInt aHeapMaxSize, TAny *aPtr);
|
|
157 |
private:
|
|
158 |
// record of the current test suite / step name
|
|
159 |
TBuf<KMaxLenTestSuiteName> iCurrentSuiteName;
|
|
160 |
TBuf<KMaxLenTestStepName> iCurrentStepName;
|
|
161 |
|
|
162 |
// data members
|
|
163 |
TPath iTheTestPath; // test path
|
|
164 |
TInt iReqsAtStart;
|
|
165 |
TInt iProcessHandleCountBefore;
|
|
166 |
TInt iThreadHandleCountBefore;
|
|
167 |
|
|
168 |
// the current test result
|
|
169 |
TVerdict iTestVerdict;
|
|
170 |
// owner script
|
|
171 |
CScript* iScript;
|
|
172 |
// test utils
|
|
173 |
CTestUtils* iTestUtils;
|
|
174 |
// log
|
|
175 |
CLog* iLog;
|
|
176 |
// default guard timer, if any
|
|
177 |
TInt64 iGuardTimer;
|
|
178 |
// severity level
|
|
179 |
TInt iSeverity;
|
|
180 |
|
|
181 |
const TDesC& iMatchString;
|
|
182 |
TBool iSkip;
|
|
183 |
|
|
184 |
// array of CSuiteDll objects which contain
|
|
185 |
// information on the current loaded test suite DLLs
|
|
186 |
CArrayPtr<CSuiteDll>* iArrayLoadedSuiteDll;
|
|
187 |
|
|
188 |
// Flag to indicate that there has been an error
|
|
189 |
// and the user has selected to skip the rest of the script until a
|
|
190 |
// test result statement is found in the log
|
|
191 |
TBool iBreakOnError;
|
|
192 |
};
|
|
193 |
|
|
194 |
#endif // __PARSELINE_H__
|