sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// f32test\server\T_Fatcharsetconv_Aux.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <f32dbg.h>
|
sl@0
|
19 |
#include "T_fatcharsetconv_Aux.h"
|
sl@0
|
20 |
|
sl@0
|
21 |
CFileMan* gFileMan = NULL;
|
sl@0
|
22 |
RPointerArray<RFile>* gFileHandles = NULL;
|
sl@0
|
23 |
TTestLogFailureData gLogFailureData;
|
sl@0
|
24 |
RRawDisk TheDisk;
|
sl@0
|
25 |
TFatBootSector gBootSector;
|
sl@0
|
26 |
TBool gIOTesting;
|
sl@0
|
27 |
TBool gAutoTest; // is BTB test
|
sl@0
|
28 |
|
sl@0
|
29 |
RFs TheFs;
|
sl@0
|
30 |
RFile TheFile;
|
sl@0
|
31 |
RDir TheDir;
|
sl@0
|
32 |
|
sl@0
|
33 |
TFileName gSessionPath;
|
sl@0
|
34 |
TInt gAllocFailOff=KAllocFailureOff;
|
sl@0
|
35 |
TInt gAllocFailOn=KAllocFailureOff;
|
sl@0
|
36 |
TChar gDriveToTest;
|
sl@0
|
37 |
TFileName gFileName;
|
sl@0
|
38 |
|
sl@0
|
39 |
TTCType gTCType;
|
sl@0
|
40 |
TUint gTCId;
|
sl@0
|
41 |
|
sl@0
|
42 |
GLDEF_C void Format(TInt aDrive)
|
sl@0
|
43 |
//
|
sl@0
|
44 |
// Format current drive
|
sl@0
|
45 |
//
|
sl@0
|
46 |
{
|
sl@0
|
47 |
test.Next(_L("Format"));
|
sl@0
|
48 |
TBuf<4> driveBuf=_L("?:\\");
|
sl@0
|
49 |
driveBuf[0]=(TText)(aDrive+'A');
|
sl@0
|
50 |
RFormat format;
|
sl@0
|
51 |
TInt count;
|
sl@0
|
52 |
TInt r=format.Open(TheFs,driveBuf,EQuickFormat,count);
|
sl@0
|
53 |
test(r==KErrNone);
|
sl@0
|
54 |
while(count)
|
sl@0
|
55 |
{
|
sl@0
|
56 |
TInt r=format.Next(count);
|
sl@0
|
57 |
test(r==KErrNone);
|
sl@0
|
58 |
}
|
sl@0
|
59 |
format.Close();
|
sl@0
|
60 |
}
|
sl@0
|
61 |
|
sl@0
|
62 |
void MakeDir(const TDesC& aDirName)
|
sl@0
|
63 |
//
|
sl@0
|
64 |
// Make a directory
|
sl@0
|
65 |
//
|
sl@0
|
66 |
{
|
sl@0
|
67 |
TInt r=TheFs.MkDirAll(aDirName);
|
sl@0
|
68 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
69 |
}
|
sl@0
|
70 |
|
sl@0
|
71 |
|
sl@0
|
72 |
void ReportCheckDiskFailure(TInt aRet)
|
sl@0
|
73 |
//
|
sl@0
|
74 |
// Report the failure of checkdisk
|
sl@0
|
75 |
//
|
sl@0
|
76 |
{
|
sl@0
|
77 |
test.Printf(_L("CHECKDISK FAILED: "));
|
sl@0
|
78 |
switch(aRet)
|
sl@0
|
79 |
{
|
sl@0
|
80 |
case 1: test.Printf(_L("File cluster chain contains a bad value (<2 or >maxCluster)\n")); break;
|
sl@0
|
81 |
case 2: test.Printf(_L("Two files are linked to the same cluster\n")); break;
|
sl@0
|
82 |
case 3: test.Printf(_L("Unallocated cluster contains a value != 0\n")); break;
|
sl@0
|
83 |
case 4: test.Printf(_L("Size of file != number of clusters in chain\n")); break;
|
sl@0
|
84 |
default: test.Printf(_L("Undefined Error value %d\n"),aRet);
|
sl@0
|
85 |
}
|
sl@0
|
86 |
test(EFalse);
|
sl@0
|
87 |
}
|
sl@0
|
88 |
|
sl@0
|
89 |
void CreateTestDirectory(const TDesC& aSessionPath)
|
sl@0
|
90 |
//
|
sl@0
|
91 |
// Create directory for test
|
sl@0
|
92 |
//
|
sl@0
|
93 |
{
|
sl@0
|
94 |
TParsePtrC path(aSessionPath);
|
sl@0
|
95 |
test(path.DrivePresent()==EFalse);
|
sl@0
|
96 |
TInt r=TheFs.SetSessionPath(aSessionPath);
|
sl@0
|
97 |
test(r==KErrNone);
|
sl@0
|
98 |
r=TheFs.SessionPath(gSessionPath);
|
sl@0
|
99 |
test(r==KErrNone);
|
sl@0
|
100 |
r=TheFs.MkDirAll(gSessionPath);
|
sl@0
|
101 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
102 |
}
|
sl@0
|
103 |
|
sl@0
|
104 |
TInt CurrentDrive(TChar aDriveChar)
|
sl@0
|
105 |
//
|
sl@0
|
106 |
// Return the current drive number
|
sl@0
|
107 |
//
|
sl@0
|
108 |
{
|
sl@0
|
109 |
TInt driveNum;
|
sl@0
|
110 |
TInt r = TheFs.CharToDrive(aDriveChar,driveNum);
|
sl@0
|
111 |
test(r==KErrNone);
|
sl@0
|
112 |
gDriveToTest = gSessionPath[0] = (TText)aDriveChar;
|
sl@0
|
113 |
return(driveNum);
|
sl@0
|
114 |
}
|
sl@0
|
115 |
|
sl@0
|
116 |
TInt CurrentDrive()
|
sl@0
|
117 |
//
|
sl@0
|
118 |
// Return the current drive number
|
sl@0
|
119 |
//
|
sl@0
|
120 |
{
|
sl@0
|
121 |
TInt driveNum;
|
sl@0
|
122 |
TInt r = TheFs.CharToDrive(gSessionPath[0],driveNum);
|
sl@0
|
123 |
test(r==KErrNone);
|
sl@0
|
124 |
return(driveNum);
|
sl@0
|
125 |
}
|
sl@0
|
126 |
|
sl@0
|
127 |
void MakeFile(const TDesC& aFileName,const TUidType& aUidType,const TDesC8& aFileContents)
|
sl@0
|
128 |
//
|
sl@0
|
129 |
// Make a file and write uid and data
|
sl@0
|
130 |
//
|
sl@0
|
131 |
{
|
sl@0
|
132 |
RFile file;
|
sl@0
|
133 |
TInt r=file.Replace(TheFs,aFileName,0);
|
sl@0
|
134 |
test(r==KErrNone || r==KErrPathNotFound);
|
sl@0
|
135 |
if (r==KErrPathNotFound)
|
sl@0
|
136 |
{
|
sl@0
|
137 |
r=TheFs.MkDirAll(aFileName);
|
sl@0
|
138 |
test(r==KErrNone);
|
sl@0
|
139 |
r=file.Replace(TheFs,aFileName,0);
|
sl@0
|
140 |
test(r==KErrNone);
|
sl@0
|
141 |
}
|
sl@0
|
142 |
TCheckedUid checkedUid(aUidType);
|
sl@0
|
143 |
TPtrC8 uidData((TUint8*)&checkedUid,sizeof(TCheckedUid));
|
sl@0
|
144 |
r=file.Write(uidData);
|
sl@0
|
145 |
test(r==KErrNone);
|
sl@0
|
146 |
r=file.Write(aFileContents);
|
sl@0
|
147 |
test(r==KErrNone);
|
sl@0
|
148 |
file.Close();
|
sl@0
|
149 |
}
|
sl@0
|
150 |
|
sl@0
|
151 |
void MakeFile(const TDesC& aFileName,const TDesC8& aFileContents)
|
sl@0
|
152 |
//
|
sl@0
|
153 |
// Make a file and write something in it
|
sl@0
|
154 |
//
|
sl@0
|
155 |
{
|
sl@0
|
156 |
RFile file;
|
sl@0
|
157 |
TInt r=file.Replace(TheFs,aFileName,0);
|
sl@0
|
158 |
if(r!=KErrNone && r!=KErrPathNotFound)
|
sl@0
|
159 |
{
|
sl@0
|
160 |
test.Printf(_L("ERROR: r=%d"),r);
|
sl@0
|
161 |
test(EFalse);
|
sl@0
|
162 |
}
|
sl@0
|
163 |
test(r==KErrNone || r==KErrPathNotFound);
|
sl@0
|
164 |
if (r==KErrPathNotFound)
|
sl@0
|
165 |
{
|
sl@0
|
166 |
r=TheFs.MkDirAll(aFileName);
|
sl@0
|
167 |
test(r==KErrNone);
|
sl@0
|
168 |
r=file.Replace(TheFs,aFileName,0);
|
sl@0
|
169 |
test(r==KErrNone);
|
sl@0
|
170 |
}
|
sl@0
|
171 |
r=file.Write(aFileContents);
|
sl@0
|
172 |
test(r==KErrNone);
|
sl@0
|
173 |
file.Close();
|
sl@0
|
174 |
}
|
sl@0
|
175 |
|
sl@0
|
176 |
void MakeFile(const TDesC& aFileName,TInt anAttributes)
|
sl@0
|
177 |
//
|
sl@0
|
178 |
// Make a file and write something in it
|
sl@0
|
179 |
//
|
sl@0
|
180 |
{
|
sl@0
|
181 |
RFile file;
|
sl@0
|
182 |
TInt r=file.Replace(TheFs,aFileName,0);
|
sl@0
|
183 |
test(r==KErrNone || r==KErrPathNotFound);
|
sl@0
|
184 |
if (r==KErrPathNotFound)
|
sl@0
|
185 |
{
|
sl@0
|
186 |
r=TheFs.MkDirAll(aFileName);
|
sl@0
|
187 |
test(r==KErrNone);
|
sl@0
|
188 |
r=file.Replace(TheFs,aFileName,0);
|
sl@0
|
189 |
test(r==KErrNone);
|
sl@0
|
190 |
}
|
sl@0
|
191 |
file.Close();
|
sl@0
|
192 |
r=TheFs.SetAtt(aFileName,anAttributes,0);
|
sl@0
|
193 |
test(r==KErrNone);
|
sl@0
|
194 |
}
|
sl@0
|
195 |
|
sl@0
|
196 |
void MakeFile(const TDesC& aFileName)
|
sl@0
|
197 |
//
|
sl@0
|
198 |
// Make a file
|
sl@0
|
199 |
//
|
sl@0
|
200 |
{
|
sl@0
|
201 |
MakeFile(aFileName,_L8(""));
|
sl@0
|
202 |
}
|
sl@0
|
203 |
|
sl@0
|
204 |
#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
|
sl@0
|
205 |
void QuickFormat()
|
sl@0
|
206 |
{
|
sl@0
|
207 |
FormatFatDrive(TheFs, CurrentDrive(), ETrue);
|
sl@0
|
208 |
}
|
sl@0
|
209 |
|
sl@0
|
210 |
void ReadBootSector(TFatBootSector& aBootSector)
|
sl@0
|
211 |
{
|
sl@0
|
212 |
TInt r = ReadBootSector(TheFs, CurrentDrive(), KBootSectorNum<<KDefaultSectorLog2, aBootSector);
|
sl@0
|
213 |
test(r==KErrNone);
|
sl@0
|
214 |
|
sl@0
|
215 |
if(!aBootSector.IsValid())
|
sl@0
|
216 |
{
|
sl@0
|
217 |
test.Printf(_L("Wrong bootsector! Dump:\n"));
|
sl@0
|
218 |
aBootSector.PrintDebugInfo();
|
sl@0
|
219 |
test(0);
|
sl@0
|
220 |
}
|
sl@0
|
221 |
}
|
sl@0
|
222 |
|
sl@0
|
223 |
void GetBootInfo()
|
sl@0
|
224 |
{
|
sl@0
|
225 |
QuickFormat();
|
sl@0
|
226 |
ReadBootSector(gBootSector);
|
sl@0
|
227 |
}
|
sl@0
|
228 |
#endif
|
sl@0
|
229 |
|
sl@0
|
230 |
void CheckIfIOTesting(TTestSwitches& aSwitches)
|
sl@0
|
231 |
{
|
sl@0
|
232 |
if( ((aSwitches.iExeOnSymbian || aSwitches.iExeOnWindows) && !(aSwitches.iVerOnSymbian || aSwitches.iVerOnWindows))
|
sl@0
|
233 |
||((aSwitches.iVerOnSymbian || aSwitches.iVerOnWindows) && !(aSwitches.iExeOnSymbian || aSwitches.iExeOnWindows))
|
sl@0
|
234 |
)
|
sl@0
|
235 |
{
|
sl@0
|
236 |
gIOTesting = ETrue;
|
sl@0
|
237 |
}
|
sl@0
|
238 |
}
|
sl@0
|
239 |
|
sl@0
|
240 |
void CheckDisk()
|
sl@0
|
241 |
{
|
sl@0
|
242 |
TInt r=TheFs.CheckDisk(gSessionPath);
|
sl@0
|
243 |
if (r!=KErrNone && r!=KErrNotSupported)
|
sl@0
|
244 |
ReportCheckDiskFailure(r);
|
sl@0
|
245 |
r = TheFs.ScanDrive(gSessionPath);
|
sl@0
|
246 |
if (r!=KErrNone && r!=KErrNotSupported && r!=KErrInUse)
|
sl@0
|
247 |
ReportCheckDiskFailure(r);
|
sl@0
|
248 |
}
|
sl@0
|
249 |
|
sl@0
|
250 |
void InitLogData()
|
sl@0
|
251 |
{
|
sl@0
|
252 |
gLogFailureData.iExeOsName = KNone;
|
sl@0
|
253 |
gLogFailureData.iVerOsName = KNone;
|
sl@0
|
254 |
gLogFailureData.iExeDrive = 'A';
|
sl@0
|
255 |
gLogFailureData.iVerDrive = 'A';
|
sl@0
|
256 |
}
|
sl@0
|
257 |
|
sl@0
|
258 |
void ClearTCLogData()
|
sl@0
|
259 |
{
|
sl@0
|
260 |
gLogFailureData.iTCTypeName.SetLength(0);
|
sl@0
|
261 |
gLogFailureData.iTCFailureOn.SetLength(0);
|
sl@0
|
262 |
gLogFailureData.iTCId = 0;
|
sl@0
|
263 |
gLogFailureData.iTCUniquePath.SetLength(0);
|
sl@0
|
264 |
gLogFailureData.iAPIName.SetLength(0);
|
sl@0
|
265 |
gLogFailureData.iLineNum = 0;
|
sl@0
|
266 |
// gLogFailureData.iFileName.SetLength(0);
|
sl@0
|
267 |
}
|
sl@0
|
268 |
|
sl@0
|
269 |
/*
|
sl@0
|
270 |
* Search test cases by the index of the array of test case group, overloaded version for basic unitary cases.
|
sl@0
|
271 |
* @param aIdx the test case index in search
|
sl@0
|
272 |
* @param aBasicUnitaryTestCaseGroup the input test group, should always be gBasicUnitaryTestCases[]
|
sl@0
|
273 |
* @param aTestCaseFound contains params of the test case found by the test case Id.
|
sl@0
|
274 |
* @return KErrNone if only one test case on the id is found
|
sl@0
|
275 |
* KErrNotFound if no test case is found
|
sl@0
|
276 |
*/
|
sl@0
|
277 |
TInt SearchTestCaseByArrayIdx(TUint aIdx, const TTestCaseUnitaryBasic aBasicUnitaryTestCaseGroup[],
|
sl@0
|
278 |
TTestParamAll& aTestCaseFound, TBool aIsWithDLL=EFalse)
|
sl@0
|
279 |
{
|
sl@0
|
280 |
if (aBasicUnitaryTestCaseGroup[aIdx].iBasic.iTestCaseID != 0)
|
sl@0
|
281 |
{
|
sl@0
|
282 |
aTestCaseFound.iTestCaseID = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iTestCaseID;
|
sl@0
|
283 |
aTestCaseFound.iAPI = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iAPI;
|
sl@0
|
284 |
|
sl@0
|
285 |
aTestCaseFound.iSrcDrvChar = aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iDrvChar;
|
sl@0
|
286 |
aTestCaseFound.iSrcCmdPath.Copy(aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmdPath);
|
sl@0
|
287 |
aTestCaseFound.iSrcPrsPath.Copy(aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsPath);
|
sl@0
|
288 |
aTestCaseFound.iSrcPrsFiles = aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsFiles;
|
sl@0
|
289 |
|
sl@0
|
290 |
aTestCaseFound.iIsWithDLL = aIsWithDLL;
|
sl@0
|
291 |
|
sl@0
|
292 |
// To make every test case uniquely indentified for interOP
|
sl@0
|
293 |
// update the test case id and its path correspondingly
|
sl@0
|
294 |
TBuf<15> tempName = _L("_");
|
sl@0
|
295 |
if(aTestCaseFound.iIsWithDLL)
|
sl@0
|
296 |
tempName.Append(_L("DLL"));
|
sl@0
|
297 |
else
|
sl@0
|
298 |
tempName.Append(_L("NDLL"));
|
sl@0
|
299 |
|
sl@0
|
300 |
TInt idx = aTestCaseFound.iSrcCmdPath.Find(_L("\\Src\\"));
|
sl@0
|
301 |
aTestCaseFound.iSrcCmdPath.Insert(idx, tempName);
|
sl@0
|
302 |
aTestCaseFound.iSrcPrsPath.Insert(idx, tempName);
|
sl@0
|
303 |
}
|
sl@0
|
304 |
else
|
sl@0
|
305 |
return KErrNotFound;
|
sl@0
|
306 |
|
sl@0
|
307 |
return KErrNone;
|
sl@0
|
308 |
}
|
sl@0
|
309 |
/*
|
sl@0
|
310 |
* Search test cases by the index of the array of test case group, overloaded version for basic binary cases.
|
sl@0
|
311 |
* @param aIdx the test case index in search
|
sl@0
|
312 |
* @param aBasicUnitaryTestCaseGroup the input test group, should always be gBasicBinaryTestCases[]
|
sl@0
|
313 |
* @param aTestCaseFound contains params of the test case found by the test case Id.
|
sl@0
|
314 |
* @return KErrNone if only one test case on the id is found
|
sl@0
|
315 |
* KErrNotFound if no test case is found
|
sl@0
|
316 |
*/
|
sl@0
|
317 |
TInt SearchTestCaseByArrayIdx(TUint aIdx, const TTestCaseBinaryBasic aBasicBinaryTestCaseGroup[],
|
sl@0
|
318 |
TTestParamAll& aTestCaseFound, TBool aIsWithDLL=EFalse)
|
sl@0
|
319 |
{
|
sl@0
|
320 |
if (aBasicBinaryTestCaseGroup[aIdx].iBasic.iTestCaseID != 0)
|
sl@0
|
321 |
{
|
sl@0
|
322 |
aTestCaseFound.iTestCaseID = aBasicBinaryTestCaseGroup[aIdx].iBasic.iTestCaseID;
|
sl@0
|
323 |
aTestCaseFound.iAPI = aBasicBinaryTestCaseGroup[aIdx].iBasic.iAPI;
|
sl@0
|
324 |
|
sl@0
|
325 |
aTestCaseFound.iSrcDrvChar = aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iDrvChar;
|
sl@0
|
326 |
aTestCaseFound.iSrcCmdPath.Copy(aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmdPath);
|
sl@0
|
327 |
aTestCaseFound.iSrcPrsPath.Copy(aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsPath);
|
sl@0
|
328 |
aTestCaseFound.iSrcPrsFiles = aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsFiles;
|
sl@0
|
329 |
|
sl@0
|
330 |
aTestCaseFound.iTrgDrvChar = aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iDrvChar;
|
sl@0
|
331 |
aTestCaseFound.iTrgCmdPath.Copy(aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iCmdPath);
|
sl@0
|
332 |
|
sl@0
|
333 |
aTestCaseFound.iIsWithDLL = aIsWithDLL;
|
sl@0
|
334 |
// To make every test case uniquely indentified for interOP
|
sl@0
|
335 |
// update the test case id and its path correspondingly
|
sl@0
|
336 |
TBuf<15> tempBuf;
|
sl@0
|
337 |
TInt idx = aTestCaseFound.iSrcCmdPath.Find(_L("\\T_FCSC\\")) + 8 /* Len of \\T_FCSC\\ */;
|
sl@0
|
338 |
TInt i = 0;
|
sl@0
|
339 |
while(aTestCaseFound.iSrcCmdPath[idx] != '\\')
|
sl@0
|
340 |
{
|
sl@0
|
341 |
tempBuf.SetLength(i+1);
|
sl@0
|
342 |
tempBuf[i++] = aTestCaseFound.iSrcCmdPath[idx++];
|
sl@0
|
343 |
}
|
sl@0
|
344 |
tempBuf.Append(_L("_"));
|
sl@0
|
345 |
if(aTestCaseFound.iIsWithDLL)
|
sl@0
|
346 |
tempBuf.Append(_L("DLL"));
|
sl@0
|
347 |
else
|
sl@0
|
348 |
tempBuf.Append(_L("NDLL"));
|
sl@0
|
349 |
|
sl@0
|
350 |
TInt len = 0;
|
sl@0
|
351 |
idx = aTestCaseFound.iSrcCmdPath.Find(_L("\\T_FCSC\\")) + 8;
|
sl@0
|
352 |
while(aTestCaseFound.iSrcCmdPath[idx] != '\\')
|
sl@0
|
353 |
{
|
sl@0
|
354 |
len++;
|
sl@0
|
355 |
aTestCaseFound.iSrcCmdPath[idx++];
|
sl@0
|
356 |
}
|
sl@0
|
357 |
aTestCaseFound.iSrcCmdPath.Replace(idx-len, len, tempBuf);
|
sl@0
|
358 |
|
sl@0
|
359 |
len =0;
|
sl@0
|
360 |
idx = aTestCaseFound.iSrcPrsPath.Find(_L("\\T_FCSC\\")) + 8;
|
sl@0
|
361 |
while(aTestCaseFound.iSrcPrsPath[idx] != '\\')
|
sl@0
|
362 |
{
|
sl@0
|
363 |
len++;
|
sl@0
|
364 |
aTestCaseFound.iSrcCmdPath[idx++];
|
sl@0
|
365 |
}
|
sl@0
|
366 |
aTestCaseFound.iSrcPrsPath.Replace(idx-len, len, tempBuf);
|
sl@0
|
367 |
|
sl@0
|
368 |
len =0;
|
sl@0
|
369 |
idx = aTestCaseFound.iTrgCmdPath.Find(_L("\\T_FCSC\\")) + 8;
|
sl@0
|
370 |
while(aTestCaseFound.iTrgCmdPath[idx] != '\\')
|
sl@0
|
371 |
{
|
sl@0
|
372 |
len++;
|
sl@0
|
373 |
aTestCaseFound.iTrgCmdPath[idx++];
|
sl@0
|
374 |
}
|
sl@0
|
375 |
aTestCaseFound.iTrgCmdPath.Replace(idx-len, len, tempBuf);
|
sl@0
|
376 |
}
|
sl@0
|
377 |
else
|
sl@0
|
378 |
{
|
sl@0
|
379 |
return KErrNotFound;
|
sl@0
|
380 |
}
|
sl@0
|
381 |
return KErrNone;
|
sl@0
|
382 |
}
|
sl@0
|
383 |
|
sl@0
|
384 |
void Help()
|
sl@0
|
385 |
{
|
sl@0
|
386 |
RDebug::Print(_L("t_fatcharsetconv [-x {s,w}] [-d {dt}][-v {sw}]"));
|
sl@0
|
387 |
RDebug::Print(_L("\t-x : for executing tests"));
|
sl@0
|
388 |
RDebug::Print(_L("\t\t s or S for execution on Symbian"));
|
sl@0
|
389 |
RDebug::Print(_L("\t\t w or W for execution on Windows"));
|
sl@0
|
390 |
RDebug::Print(_L("\t-d: drive to test for execution/verification"));
|
sl@0
|
391 |
RDebug::Print(_L("\t\t This test runs on FAT or Win32 file systems only"));
|
sl@0
|
392 |
RDebug::Print(_L("\t\t d or D for test drive on Symbian (FAT file system)"));
|
sl@0
|
393 |
RDebug::Print(_L("\t\t Any FAT/Win32 file system drive on emulator i.e. T, X etc"));
|
sl@0
|
394 |
RDebug::Print(_L("\t-v : for validating tests"));
|
sl@0
|
395 |
RDebug::Print(_L("\t\t s or S for verification on symbian"));
|
sl@0
|
396 |
RDebug::Print(_L("\t\t w or W for verification on Windows"));
|
sl@0
|
397 |
}
|
sl@0
|
398 |
|
sl@0
|
399 |
void ClearSwitches(TTestSwitches& aSwitches)
|
sl@0
|
400 |
{
|
sl@0
|
401 |
// clear the switches
|
sl@0
|
402 |
aSwitches.iExeOnSymbian = EFalse;
|
sl@0
|
403 |
aSwitches.iVerOnSymbian = EFalse;
|
sl@0
|
404 |
aSwitches.iExeOnWindows = EFalse;
|
sl@0
|
405 |
aSwitches.iVerOnWindows = EFalse;
|
sl@0
|
406 |
aSwitches.iExeDriveChar =' ';
|
sl@0
|
407 |
aSwitches.iVerDriveChar =' ';
|
sl@0
|
408 |
aSwitches.iExeDriveNum =0;
|
sl@0
|
409 |
aSwitches.iVerDriveNum =0;
|
sl@0
|
410 |
aSwitches.iMountedFSName.SetLength(0);
|
sl@0
|
411 |
}
|
sl@0
|
412 |
|
sl@0
|
413 |
|
sl@0
|
414 |
void ParseCommandArguments(TTestSwitches& aSwitches)
|
sl@0
|
415 |
{
|
sl@0
|
416 |
TBuf<256> cmd;
|
sl@0
|
417 |
User::CommandLine(cmd);
|
sl@0
|
418 |
RDebug::Print(_L("Command Line : %S"), &cmd);
|
sl@0
|
419 |
TChar testDrive = 'C';
|
sl@0
|
420 |
|
sl@0
|
421 |
InitLogData();
|
sl@0
|
422 |
ClearSwitches(aSwitches);
|
sl@0
|
423 |
|
sl@0
|
424 |
TFileName currentFile=RProcess().FileName();
|
sl@0
|
425 |
TLex lex(cmd);
|
sl@0
|
426 |
TPtrC token=lex.NextToken();
|
sl@0
|
427 |
if (token.MatchF(currentFile)==0)
|
sl@0
|
428 |
{
|
sl@0
|
429 |
token.Set(lex.NextToken());
|
sl@0
|
430 |
}
|
sl@0
|
431 |
if (token.Length()==0)
|
sl@0
|
432 |
{
|
sl@0
|
433 |
testDrive = 'C'; // default drives
|
sl@0
|
434 |
gAutoTest = ETrue;
|
sl@0
|
435 |
}
|
sl@0
|
436 |
else if((token[0] >='A' && token[0]<='Z') || (token[0] >='a' && token[0]<='z'))
|
sl@0
|
437 |
{
|
sl@0
|
438 |
testDrive = token[0];
|
sl@0
|
439 |
gAutoTest = ETrue;
|
sl@0
|
440 |
}
|
sl@0
|
441 |
else
|
sl@0
|
442 |
{
|
sl@0
|
443 |
while (!lex.Eos())
|
sl@0
|
444 |
{
|
sl@0
|
445 |
if (token.Length()==0)
|
sl@0
|
446 |
{
|
sl@0
|
447 |
continue; // ignore trailing whitespace
|
sl@0
|
448 |
}
|
sl@0
|
449 |
if (token==_L("-x") || token==_L("-X"))
|
sl@0
|
450 |
{
|
sl@0
|
451 |
token.Set(lex.NextToken());
|
sl@0
|
452 |
if((token==_L("s")) || (token==_L("S")))
|
sl@0
|
453 |
{
|
sl@0
|
454 |
aSwitches.iExeOnSymbian = ETrue;
|
sl@0
|
455 |
gLogFailureData.iExeOsName = KSymbian;
|
sl@0
|
456 |
}
|
sl@0
|
457 |
else if((token==_L("w")) || (token==_L("W")))
|
sl@0
|
458 |
{
|
sl@0
|
459 |
aSwitches.iExeOnWindows = ETrue;
|
sl@0
|
460 |
gLogFailureData.iExeOsName = KWindows;
|
sl@0
|
461 |
}
|
sl@0
|
462 |
token.Set(lex.NextToken());
|
sl@0
|
463 |
continue;
|
sl@0
|
464 |
}
|
sl@0
|
465 |
if (token==_L("-d") || token==_L("-D"))
|
sl@0
|
466 |
{
|
sl@0
|
467 |
token.Set(lex.NextToken());
|
sl@0
|
468 |
testDrive = token[0];
|
sl@0
|
469 |
token.Set(lex.NextToken());
|
sl@0
|
470 |
continue;
|
sl@0
|
471 |
}
|
sl@0
|
472 |
if (token==_L("-v") || token==_L("-V"))
|
sl@0
|
473 |
{
|
sl@0
|
474 |
token.Set(lex.NextToken());
|
sl@0
|
475 |
if((token==_L("s")) || (token==_L("S")))
|
sl@0
|
476 |
{
|
sl@0
|
477 |
aSwitches.iVerOnSymbian = ETrue;
|
sl@0
|
478 |
gLogFailureData.iVerOsName = KSymbian;
|
sl@0
|
479 |
}
|
sl@0
|
480 |
else if((token==_L("w")) || (token==_L("W")))
|
sl@0
|
481 |
{
|
sl@0
|
482 |
aSwitches.iVerOnWindows = ETrue;
|
sl@0
|
483 |
gLogFailureData.iVerOsName = KWindows;
|
sl@0
|
484 |
}
|
sl@0
|
485 |
token.Set(lex.NextToken());
|
sl@0
|
486 |
continue;
|
sl@0
|
487 |
}
|
sl@0
|
488 |
RDebug::Print(_L("Unknown option %S"), &token);
|
sl@0
|
489 |
Help();
|
sl@0
|
490 |
return;
|
sl@0
|
491 |
}
|
sl@0
|
492 |
}
|
sl@0
|
493 |
|
sl@0
|
494 |
CheckIfIOTesting(aSwitches);
|
sl@0
|
495 |
|
sl@0
|
496 |
if(gIOTesting)
|
sl@0
|
497 |
{
|
sl@0
|
498 |
gAutoTest = EFalse;
|
sl@0
|
499 |
}
|
sl@0
|
500 |
else
|
sl@0
|
501 |
{
|
sl@0
|
502 |
gAutoTest = ETrue;
|
sl@0
|
503 |
}
|
sl@0
|
504 |
|
sl@0
|
505 |
testDrive.UpperCase();
|
sl@0
|
506 |
if (gAutoTest)
|
sl@0
|
507 |
{
|
sl@0
|
508 |
#if defined (__WINS__)
|
sl@0
|
509 |
//execution phase
|
sl@0
|
510 |
aSwitches.iExeOnWindows = ETrue;
|
sl@0
|
511 |
aSwitches.iExeDriveChar = testDrive;
|
sl@0
|
512 |
aSwitches.iExeDriveNum = CurrentDrive(aSwitches.iExeDriveChar);
|
sl@0
|
513 |
gLogFailureData.iExeDrive = aSwitches.iExeDriveChar;
|
sl@0
|
514 |
gLogFailureData.iExeOsName = KWindows;
|
sl@0
|
515 |
//verification phase
|
sl@0
|
516 |
aSwitches.iVerOnWindows = ETrue;
|
sl@0
|
517 |
aSwitches.iVerDriveChar = testDrive;
|
sl@0
|
518 |
aSwitches.iVerDriveNum = CurrentDrive(aSwitches.iVerDriveChar);
|
sl@0
|
519 |
gLogFailureData.iVerDrive = aSwitches.iVerDriveChar;
|
sl@0
|
520 |
gLogFailureData.iVerOsName = KWindows;
|
sl@0
|
521 |
#else
|
sl@0
|
522 |
//execution phase
|
sl@0
|
523 |
aSwitches.iExeOnSymbian = ETrue;
|
sl@0
|
524 |
aSwitches.iExeDriveChar = testDrive;
|
sl@0
|
525 |
aSwitches.iExeDriveNum = CurrentDrive(aSwitches.iExeDriveChar);
|
sl@0
|
526 |
gLogFailureData.iExeDrive = aSwitches.iExeDriveChar;
|
sl@0
|
527 |
gLogFailureData.iExeOsName = KSymbian;
|
sl@0
|
528 |
//verification phase
|
sl@0
|
529 |
aSwitches.iVerOnSymbian = ETrue;
|
sl@0
|
530 |
aSwitches.iVerDriveChar = testDrive;
|
sl@0
|
531 |
aSwitches.iVerDriveNum = CurrentDrive(aSwitches.iVerDriveChar);
|
sl@0
|
532 |
gLogFailureData.iVerDrive = aSwitches.iVerDriveChar;
|
sl@0
|
533 |
gLogFailureData.iVerOsName = KSymbian;
|
sl@0
|
534 |
#endif
|
sl@0
|
535 |
}
|
sl@0
|
536 |
|
sl@0
|
537 |
if(aSwitches.iExeOnWindows || aSwitches.iExeOnSymbian)
|
sl@0
|
538 |
{
|
sl@0
|
539 |
aSwitches.iExeDriveChar = testDrive;
|
sl@0
|
540 |
aSwitches.iExeDriveNum = CurrentDrive(aSwitches.iExeDriveChar);
|
sl@0
|
541 |
gLogFailureData.iExeDrive = aSwitches.iExeDriveChar;
|
sl@0
|
542 |
}
|
sl@0
|
543 |
if(aSwitches.iVerOnWindows || aSwitches.iVerOnSymbian)
|
sl@0
|
544 |
{
|
sl@0
|
545 |
aSwitches.iVerDriveChar = testDrive;
|
sl@0
|
546 |
aSwitches.iVerDriveNum = CurrentDrive(aSwitches.iVerDriveChar);
|
sl@0
|
547 |
gLogFailureData.iVerDrive = aSwitches.iVerDriveChar;
|
sl@0
|
548 |
}
|
sl@0
|
549 |
}
|
sl@0
|
550 |
|
sl@0
|
551 |
void InitialiseL()
|
sl@0
|
552 |
{
|
sl@0
|
553 |
gFileMan=CFileMan::NewL(TheFs);
|
sl@0
|
554 |
}
|
sl@0
|
555 |
|
sl@0
|
556 |
void RmDir(const TDesC& aDirName)
|
sl@0
|
557 |
{
|
sl@0
|
558 |
TFileName filename_dir = aDirName;
|
sl@0
|
559 |
TInt r = 0;
|
sl@0
|
560 |
r = TheFs.SetAtt(filename_dir, 0, KEntryAttReadOnly);
|
sl@0
|
561 |
test(r==KErrNone);
|
sl@0
|
562 |
r=gFileMan->RmDir(filename_dir);
|
sl@0
|
563 |
test(r==KErrNone || r==KErrNotFound || r==KErrPathNotFound || r==KErrInUse);
|
sl@0
|
564 |
}
|
sl@0
|
565 |
|
sl@0
|
566 |
// Cleanup test variables
|
sl@0
|
567 |
void Cleanup()
|
sl@0
|
568 |
{
|
sl@0
|
569 |
delete gFileMan;
|
sl@0
|
570 |
}
|
sl@0
|
571 |
|
sl@0
|
572 |
/**
|
sl@0
|
573 |
Parsing Dir Data Block
|
sl@0
|
574 |
@param aDataBlock data block in TInt[] for parsing
|
sl@0
|
575 |
@param aDirDataArray returning dir data array after parsing
|
sl@0
|
576 |
|
sl@0
|
577 |
@panic if data setup error
|
sl@0
|
578 |
*/
|
sl@0
|
579 |
void ParsingDirDataBlock(const TInt aDataBlock[], RArray<TInt>& aDirDataArray)
|
sl@0
|
580 |
{
|
sl@0
|
581 |
TInt err = KErrNone;
|
sl@0
|
582 |
aDirDataArray.Reset();
|
sl@0
|
583 |
|
sl@0
|
584 |
if (aDataBlock[0] == EOB)
|
sl@0
|
585 |
{
|
sl@0
|
586 |
return;
|
sl@0
|
587 |
}
|
sl@0
|
588 |
|
sl@0
|
589 |
TInt i = 1;
|
sl@0
|
590 |
FOREVER
|
sl@0
|
591 |
{
|
sl@0
|
592 |
TInt lastItem = aDataBlock[i-1];
|
sl@0
|
593 |
TInt currentItem = aDataBlock[i];
|
sl@0
|
594 |
|
sl@0
|
595 |
// check currentItem
|
sl@0
|
596 |
if (currentItem == EOB)
|
sl@0
|
597 |
{
|
sl@0
|
598 |
if (lastItem == CON || lastItem > LAST)
|
sl@0
|
599 |
//check last
|
sl@0
|
600 |
{
|
sl@0
|
601 |
test.Printf(_L("ERROR<SetupDir>: wrong dir data setup! err=%d\n"), err);
|
sl@0
|
602 |
test(EFalse);
|
sl@0
|
603 |
}
|
sl@0
|
604 |
else
|
sl@0
|
605 |
// passed, insert last, break
|
sl@0
|
606 |
{
|
sl@0
|
607 |
err = aDirDataArray.InsertInOrder(lastItem);
|
sl@0
|
608 |
if (err != KErrNone && err != KErrAlreadyExists)
|
sl@0
|
609 |
{
|
sl@0
|
610 |
test.Printf(_L("ERROR<SetupDir>: wrong dir data setup! err=%d\n"), err);
|
sl@0
|
611 |
test(EFalse);
|
sl@0
|
612 |
}
|
sl@0
|
613 |
break;
|
sl@0
|
614 |
}
|
sl@0
|
615 |
}
|
sl@0
|
616 |
else if (currentItem == CON)
|
sl@0
|
617 |
// if current == CON
|
sl@0
|
618 |
{
|
sl@0
|
619 |
if (lastItem == CON || lastItem >= LAST)
|
sl@0
|
620 |
// check last item
|
sl@0
|
621 |
{
|
sl@0
|
622 |
test.Printf(_L("ERROR<SetupDir>: wrong dir data setup! err=%d\n"), err);
|
sl@0
|
623 |
test(EFalse);
|
sl@0
|
624 |
}
|
sl@0
|
625 |
else // last < LAST, last != CON
|
sl@0
|
626 |
{
|
sl@0
|
627 |
// check next item
|
sl@0
|
628 |
TInt nextItem = aDataBlock[i+1];
|
sl@0
|
629 |
if (nextItem <= 0 || nextItem > LAST || lastItem >= nextItem)
|
sl@0
|
630 |
{
|
sl@0
|
631 |
test.Printf(_L("ERROR<SetupDir>: wrong dir data setup! err=%d\n"), err);
|
sl@0
|
632 |
test(EFalse);
|
sl@0
|
633 |
}
|
sl@0
|
634 |
else
|
sl@0
|
635 |
{
|
sl@0
|
636 |
// all valid
|
sl@0
|
637 |
for (TInt j = lastItem; j < nextItem; j++)
|
sl@0
|
638 |
{
|
sl@0
|
639 |
err = aDirDataArray.InsertInOrder(j);
|
sl@0
|
640 |
if (err != KErrNone && err != KErrAlreadyExists)
|
sl@0
|
641 |
{
|
sl@0
|
642 |
test.Printf(_L("ERROR<SetupDir>: wrong dir data setup! err=%d\n"), err);
|
sl@0
|
643 |
test(EFalse);
|
sl@0
|
644 |
}
|
sl@0
|
645 |
}
|
sl@0
|
646 |
}
|
sl@0
|
647 |
}
|
sl@0
|
648 |
i++;
|
sl@0
|
649 |
}
|
sl@0
|
650 |
else if (0 <= currentItem && currentItem <= LAST)
|
sl@0
|
651 |
// if current == normal item
|
sl@0
|
652 |
{
|
sl@0
|
653 |
if (lastItem == CON)
|
sl@0
|
654 |
{
|
sl@0
|
655 |
i++;
|
sl@0
|
656 |
continue;
|
sl@0
|
657 |
}
|
sl@0
|
658 |
else if (lastItem >= LAST)
|
sl@0
|
659 |
// check last item
|
sl@0
|
660 |
{
|
sl@0
|
661 |
test.Printf(_L("ERROR<SetupDir>: wrong dir data setup! err=%d\n"), err);
|
sl@0
|
662 |
test(EFalse);
|
sl@0
|
663 |
}
|
sl@0
|
664 |
else
|
sl@0
|
665 |
// passed, insert last
|
sl@0
|
666 |
{
|
sl@0
|
667 |
err = aDirDataArray.InsertInOrder(lastItem);
|
sl@0
|
668 |
if (err != KErrNone && err != KErrAlreadyExists)
|
sl@0
|
669 |
{
|
sl@0
|
670 |
test.Printf(_L("ERROR<SetupDir>: wrong dir data setup! err=%d\n"), err);
|
sl@0
|
671 |
test(EFalse);
|
sl@0
|
672 |
}
|
sl@0
|
673 |
}
|
sl@0
|
674 |
i++;
|
sl@0
|
675 |
}
|
sl@0
|
676 |
else // invalid input
|
sl@0
|
677 |
{
|
sl@0
|
678 |
test.Printf(_L("ERROR<SetupDir>: wrong dir data setup! err=%d\n"), err);
|
sl@0
|
679 |
test(EFalse);
|
sl@0
|
680 |
}
|
sl@0
|
681 |
}
|
sl@0
|
682 |
}
|
sl@0
|
683 |
|
sl@0
|
684 |
/**
|
sl@0
|
685 |
Setup dir structure for testing and verifying functional results
|
sl@0
|
686 |
@param datastr data structure to setup directory
|
sl@0
|
687 |
@param iOperation Operation to be performed
|
sl@0
|
688 |
@param SrcDrive Source drive
|
sl@0
|
689 |
@param Targetdrive Target drive input
|
sl@0
|
690 |
@panic if data structure definition is incorrect
|
sl@0
|
691 |
*/
|
sl@0
|
692 |
void SetupDirFiles(const TDesC& aPath, const TDirSetupFiles& aDirFiles)
|
sl@0
|
693 |
{
|
sl@0
|
694 |
TFileName path = aPath;
|
sl@0
|
695 |
if (path.Length() == 0)
|
sl@0
|
696 |
{
|
sl@0
|
697 |
test.Printf(_L("ERROR<SetupDirFiles()>: Zero length src path!\n"));
|
sl@0
|
698 |
test(EFalse);
|
sl@0
|
699 |
}
|
sl@0
|
700 |
|
sl@0
|
701 |
MakeDir(path);
|
sl@0
|
702 |
|
sl@0
|
703 |
RArray<TInt> addBlockDataArray;
|
sl@0
|
704 |
RArray<TInt> deductBlockDataArray;
|
sl@0
|
705 |
|
sl@0
|
706 |
ParsingDirDataBlock(aDirFiles.iAddingBlock, addBlockDataArray);
|
sl@0
|
707 |
ParsingDirDataBlock(aDirFiles.iDeductBlock, deductBlockDataArray);
|
sl@0
|
708 |
|
sl@0
|
709 |
if (addBlockDataArray.Count() == 0)
|
sl@0
|
710 |
// empty dir setup
|
sl@0
|
711 |
{
|
sl@0
|
712 |
return;
|
sl@0
|
713 |
}
|
sl@0
|
714 |
for (TInt i = 0; i < deductBlockDataArray.Count(); ++i)
|
sl@0
|
715 |
{
|
sl@0
|
716 |
TInt idxToDelete = addBlockDataArray.FindInOrder(deductBlockDataArray[i]);
|
sl@0
|
717 |
if (idxToDelete >= 0)
|
sl@0
|
718 |
{
|
sl@0
|
719 |
addBlockDataArray.Remove(idxToDelete);
|
sl@0
|
720 |
}
|
sl@0
|
721 |
else if (idxToDelete == KErrNotFound)
|
sl@0
|
722 |
{
|
sl@0
|
723 |
continue;
|
sl@0
|
724 |
}
|
sl@0
|
725 |
else
|
sl@0
|
726 |
{
|
sl@0
|
727 |
test.Printf(_L("ERROR<<SetupDir>>: wrong dir data setup! err=%d\n"), idxToDelete);
|
sl@0
|
728 |
test(EFalse);
|
sl@0
|
729 |
}
|
sl@0
|
730 |
}
|
sl@0
|
731 |
if (addBlockDataArray.Count() > 0)
|
sl@0
|
732 |
{
|
sl@0
|
733 |
for (TInt i = 0; i < addBlockDataArray.Count(); ++i)
|
sl@0
|
734 |
{
|
sl@0
|
735 |
TInt idx = addBlockDataArray[i];
|
sl@0
|
736 |
path = aPath;
|
sl@0
|
737 |
path += gDirPatterns[idx];
|
sl@0
|
738 |
if (path[path.Length() - 1] == '\\')
|
sl@0
|
739 |
{
|
sl@0
|
740 |
MakeDir(path);
|
sl@0
|
741 |
}
|
sl@0
|
742 |
else
|
sl@0
|
743 |
{
|
sl@0
|
744 |
MakeFile(path, _L8("blahblah"));
|
sl@0
|
745 |
}
|
sl@0
|
746 |
}
|
sl@0
|
747 |
}
|
sl@0
|
748 |
|
sl@0
|
749 |
addBlockDataArray.Reset();
|
sl@0
|
750 |
deductBlockDataArray.Reset();
|
sl@0
|
751 |
}
|
sl@0
|
752 |
|
sl@0
|
753 |
void LogTestFailureData(TTCType tcType, TFileName failedOn,
|
sl@0
|
754 |
TUint tcId, TFileName tcUniquePath, TInt line)
|
sl@0
|
755 |
{
|
sl@0
|
756 |
if(tcType == EUnitaryTest)
|
sl@0
|
757 |
gLogFailureData.iTCTypeName = KUnitary;
|
sl@0
|
758 |
else if(tcType == EBinaryTest)
|
sl@0
|
759 |
gLogFailureData.iTCTypeName = KBinary;
|
sl@0
|
760 |
gLogFailureData.iTCFailureOn = failedOn;
|
sl@0
|
761 |
gLogFailureData.iTCId = tcId;
|
sl@0
|
762 |
gLogFailureData.iTCUniquePath.Copy(tcUniquePath);
|
sl@0
|
763 |
gLogFailureData.iLineNum = line;
|
sl@0
|
764 |
gLogFailureData.iFileName.Copy(gFileName);
|
sl@0
|
765 |
|
sl@0
|
766 |
RFile file;
|
sl@0
|
767 |
TBuf8<256> tempBuf;
|
sl@0
|
768 |
|
sl@0
|
769 |
TFileName logFileName;
|
sl@0
|
770 |
if(gIOTesting)
|
sl@0
|
771 |
{
|
sl@0
|
772 |
if(failedOn == KExecution)
|
sl@0
|
773 |
{
|
sl@0
|
774 |
logFileName.Append(KExeLogFileName);
|
sl@0
|
775 |
}
|
sl@0
|
776 |
else
|
sl@0
|
777 |
{
|
sl@0
|
778 |
logFileName.Append(KVerLogFileName);
|
sl@0
|
779 |
}
|
sl@0
|
780 |
}
|
sl@0
|
781 |
else
|
sl@0
|
782 |
{
|
sl@0
|
783 |
logFileName.Append(KLogFileName);
|
sl@0
|
784 |
}
|
sl@0
|
785 |
|
sl@0
|
786 |
logFileName.Append(KUnderScore);
|
sl@0
|
787 |
logFileName.Append(gDriveToTest);
|
sl@0
|
788 |
logFileName.Append(KExtension);
|
sl@0
|
789 |
|
sl@0
|
790 |
TInt r = file.Create(TheFs, logFileName, EFileRead|EFileWrite);
|
sl@0
|
791 |
test(r == KErrNone || r == KErrAlreadyExists);
|
sl@0
|
792 |
|
sl@0
|
793 |
if (r == KErrNone)
|
sl@0
|
794 |
{
|
sl@0
|
795 |
tempBuf.Append(KLogFileHeader);
|
sl@0
|
796 |
file.Write(tempBuf);
|
sl@0
|
797 |
}
|
sl@0
|
798 |
|
sl@0
|
799 |
if (r == KErrAlreadyExists)
|
sl@0
|
800 |
{
|
sl@0
|
801 |
r = file.Open(TheFs, logFileName, EFileRead|EFileWrite);
|
sl@0
|
802 |
test(r == KErrNone);
|
sl@0
|
803 |
TInt start = 0;
|
sl@0
|
804 |
r=file.Seek(ESeekEnd,start);
|
sl@0
|
805 |
test(r == KErrNone);
|
sl@0
|
806 |
}
|
sl@0
|
807 |
|
sl@0
|
808 |
tempBuf.SetLength(0);
|
sl@0
|
809 |
tempBuf.Append(KNewLine);
|
sl@0
|
810 |
if(gIOTesting)
|
sl@0
|
811 |
tempBuf.Append(KYes);
|
sl@0
|
812 |
else
|
sl@0
|
813 |
tempBuf.Append(KNo);
|
sl@0
|
814 |
tempBuf.Append(KComma);
|
sl@0
|
815 |
file.Write(tempBuf);
|
sl@0
|
816 |
|
sl@0
|
817 |
tempBuf.SetLength(0);
|
sl@0
|
818 |
tempBuf.Append(gLogFailureData.iTCTypeName);
|
sl@0
|
819 |
tempBuf.Append(KComma);
|
sl@0
|
820 |
file.Write(tempBuf);
|
sl@0
|
821 |
|
sl@0
|
822 |
tempBuf.SetLength(0);
|
sl@0
|
823 |
tempBuf.Append(gLogFailureData.iTCFailureOn);
|
sl@0
|
824 |
tempBuf.Append(KComma);
|
sl@0
|
825 |
file.Write(tempBuf);
|
sl@0
|
826 |
|
sl@0
|
827 |
tempBuf.SetLength(0);
|
sl@0
|
828 |
tempBuf.AppendNum(gLogFailureData.iTCId);
|
sl@0
|
829 |
tempBuf.Append(KComma);
|
sl@0
|
830 |
file.Write(tempBuf);
|
sl@0
|
831 |
|
sl@0
|
832 |
tempBuf.SetLength(0);
|
sl@0
|
833 |
tempBuf.Append(gLogFailureData.iTCUniquePath);
|
sl@0
|
834 |
tempBuf.Append(KComma);
|
sl@0
|
835 |
file.Write(tempBuf);
|
sl@0
|
836 |
|
sl@0
|
837 |
tempBuf.SetLength(0);
|
sl@0
|
838 |
tempBuf.Append(gLogFailureData.iFSName);
|
sl@0
|
839 |
tempBuf.Append(KComma);
|
sl@0
|
840 |
file.Write(tempBuf);
|
sl@0
|
841 |
|
sl@0
|
842 |
tempBuf.SetLength(0);
|
sl@0
|
843 |
tempBuf.Append(gLogFailureData.iExeOsName);
|
sl@0
|
844 |
tempBuf.Append(KComma);
|
sl@0
|
845 |
file.Write(tempBuf);
|
sl@0
|
846 |
|
sl@0
|
847 |
tempBuf.SetLength(0);
|
sl@0
|
848 |
tempBuf.Append(gLogFailureData.iExeDrive);
|
sl@0
|
849 |
tempBuf.Append(KComma);
|
sl@0
|
850 |
file.Write(tempBuf);
|
sl@0
|
851 |
|
sl@0
|
852 |
tempBuf.SetLength(0);
|
sl@0
|
853 |
tempBuf.Append(gLogFailureData.iVerOsName);
|
sl@0
|
854 |
tempBuf.Append(KComma);
|
sl@0
|
855 |
file.Write(tempBuf);
|
sl@0
|
856 |
|
sl@0
|
857 |
tempBuf.SetLength(0);
|
sl@0
|
858 |
tempBuf.Append(gLogFailureData.iVerDrive);
|
sl@0
|
859 |
tempBuf.Append(KComma);
|
sl@0
|
860 |
file.Write(tempBuf);
|
sl@0
|
861 |
|
sl@0
|
862 |
tempBuf.SetLength(0);
|
sl@0
|
863 |
tempBuf.Append(gLogFailureData.iAPIName);
|
sl@0
|
864 |
tempBuf.Append(KComma);
|
sl@0
|
865 |
file.Write(tempBuf);
|
sl@0
|
866 |
|
sl@0
|
867 |
tempBuf.SetLength(0);
|
sl@0
|
868 |
tempBuf.AppendNum(gLogFailureData.iLineNum);
|
sl@0
|
869 |
tempBuf.Append(KComma);
|
sl@0
|
870 |
file.Write(tempBuf);
|
sl@0
|
871 |
|
sl@0
|
872 |
tempBuf.SetLength(0);
|
sl@0
|
873 |
tempBuf.Append(gLogFailureData.iFuncName);
|
sl@0
|
874 |
tempBuf.Append(KComma);
|
sl@0
|
875 |
file.Write(tempBuf);
|
sl@0
|
876 |
|
sl@0
|
877 |
tempBuf.SetLength(0);
|
sl@0
|
878 |
tempBuf.Append(gLogFailureData.iFileName);
|
sl@0
|
879 |
file.Write(tempBuf);
|
sl@0
|
880 |
|
sl@0
|
881 |
file.Close();
|
sl@0
|
882 |
}
|