sl@0
|
1 |
// Copyright (c) 2002-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 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
//! @file f32test\concur\t_csfsoak.cpp
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <f32file.h>
|
sl@0
|
19 |
#include <e32test.h>
|
sl@0
|
20 |
#include <e32math.h>
|
sl@0
|
21 |
#include <f32dbg.h>
|
sl@0
|
22 |
|
sl@0
|
23 |
#include "t_server.h"
|
sl@0
|
24 |
#include "t_chlffs.h"
|
sl@0
|
25 |
#include "t_tdebug.h"
|
sl@0
|
26 |
#include "t_cfssoak.h"
|
sl@0
|
27 |
|
sl@0
|
28 |
GLDEF_D RTest test(_L("T_CFSSOAK"));
|
sl@0
|
29 |
GLDEF_D RFs TheFs;
|
sl@0
|
30 |
|
sl@0
|
31 |
GLREF_D TPtrC gArgV[];
|
sl@0
|
32 |
GLREF_D TInt gArgC;
|
sl@0
|
33 |
|
sl@0
|
34 |
LOCAL_D TFullName gFsName;
|
sl@0
|
35 |
LOCAL_D TFullName gFsName1;
|
sl@0
|
36 |
LOCAL_D TFullName gFsName2;
|
sl@0
|
37 |
LOCAL_D TFullName gOldFsName;
|
sl@0
|
38 |
LOCAL_D TFullName gNewFsName;
|
sl@0
|
39 |
LOCAL_D TBool gNoMedia = ETrue;
|
sl@0
|
40 |
|
sl@0
|
41 |
_LIT(KFsFile, "CFAFSDLY");
|
sl@0
|
42 |
_LIT(KFsName, "DelayFS");
|
sl@0
|
43 |
|
sl@0
|
44 |
LOCAL_D const TInt32 KSecond = 1000000;
|
sl@0
|
45 |
|
sl@0
|
46 |
LOCAL_D TChar gRemFsChr = 0;
|
sl@0
|
47 |
LOCAL_D TInt gRemFsDrv = 0;
|
sl@0
|
48 |
|
sl@0
|
49 |
LOCAL_D TChar gDrvChFill = 0;
|
sl@0
|
50 |
|
sl@0
|
51 |
LOCAL_D TInt gNumRead = 0;
|
sl@0
|
52 |
LOCAL_D TInt gNumFill = 0;
|
sl@0
|
53 |
LOCAL_D TInt gNumRem = 0;
|
sl@0
|
54 |
|
sl@0
|
55 |
GLDEF_D TExtension gPrimaryExtensions[KMaxDrives];
|
sl@0
|
56 |
|
sl@0
|
57 |
inline void TraceError(const char* aFile, TInt aLine, const TDesC& aStr, TInt aRsp)
|
sl@0
|
58 |
//
|
sl@0
|
59 |
// 'Helper' routine to output the file and line of an error as well as a string
|
sl@0
|
60 |
// and a response value.
|
sl@0
|
61 |
//
|
sl@0
|
62 |
{
|
sl@0
|
63 |
TBuf<256> fbuf;
|
sl@0
|
64 |
TPtrC8 fptr((const TUint8*)aFile);
|
sl@0
|
65 |
fbuf.Copy(fptr);
|
sl@0
|
66 |
RDebug::Print(_L("%S:%d %S: r = %d"), &fbuf, aLine, &aStr, aRsp);
|
sl@0
|
67 |
}
|
sl@0
|
68 |
|
sl@0
|
69 |
#define TESTSTR(r,s,cond) if (!(cond)) { TraceError(__FILE__, __LINE__, (s), (r)); test(0); }
|
sl@0
|
70 |
#define TESTLIT(r,s,cond) { _LIT(KStr,s); TESTSTR(r,KStr,cond); }
|
sl@0
|
71 |
#define TESTRES(r,cond) TESTLIT(r,"ERROR",cond)
|
sl@0
|
72 |
|
sl@0
|
73 |
LOCAL_C TChar MountTestFileSystem(TInt aDrive)
|
sl@0
|
74 |
///
|
sl@0
|
75 |
/// Mount a new CTestFileSystem on the drive under test.
|
sl@0
|
76 |
/// @param aDrive Drive number (EDriveC etc.) to be used.
|
sl@0
|
77 |
///
|
sl@0
|
78 |
{
|
sl@0
|
79 |
TInt r;
|
sl@0
|
80 |
// Check attributes
|
sl@0
|
81 |
TBuf<64> b;
|
sl@0
|
82 |
TChar c;
|
sl@0
|
83 |
r=TheFs.DriveToChar(aDrive,c);
|
sl@0
|
84 |
TESTLIT(r, "TheFs.DriveToChar", r==KErrNone);
|
sl@0
|
85 |
|
sl@0
|
86 |
b.Format(_L("Mount test file system on %c:"),(TUint)c);
|
sl@0
|
87 |
test.Next(b);
|
sl@0
|
88 |
|
sl@0
|
89 |
r=TheFs.AddFileSystem(KFsFile);
|
sl@0
|
90 |
TESTLIT(r, "TheFs.AddFileSystem", r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
91 |
|
sl@0
|
92 |
r=TheFs.FileSystemName(gOldFsName,aDrive);
|
sl@0
|
93 |
TESTLIT(r, "TheFs.FileSystemName", r==KErrNone || r==KErrNotFound);
|
sl@0
|
94 |
|
sl@0
|
95 |
TDriveInfo drv;
|
sl@0
|
96 |
r = TheFs.Drive(drv, gRemFsDrv);
|
sl@0
|
97 |
TESTLIT(r, "Drive()", r == KErrNone);
|
sl@0
|
98 |
|
sl@0
|
99 |
gNoMedia = (drv.iType == EMediaUnknown || drv.iType == EMediaNotPresent);
|
sl@0
|
100 |
|
sl@0
|
101 |
if (gOldFsName.Length() > 0)
|
sl@0
|
102 |
{
|
sl@0
|
103 |
r = TheFs.ExtensionName(gPrimaryExtensions[aDrive].iName, aDrive, 0);
|
sl@0
|
104 |
if (r == KErrNone)
|
sl@0
|
105 |
gPrimaryExtensions[aDrive].iExists = ETrue;
|
sl@0
|
106 |
|
sl@0
|
107 |
TTest::Printf(_L("Dismount %C: %S"), (TUint)c, &gOldFsName);
|
sl@0
|
108 |
r=TheFs.DismountFileSystem(gOldFsName,aDrive);
|
sl@0
|
109 |
TESTLIT(r, "DismountFileSystem", r==KErrNone);
|
sl@0
|
110 |
}
|
sl@0
|
111 |
|
sl@0
|
112 |
if (gPrimaryExtensions[aDrive].iExists == EFalse)
|
sl@0
|
113 |
r=TheFs.MountFileSystem(KFsName,aDrive);
|
sl@0
|
114 |
else
|
sl@0
|
115 |
r=TheFs.MountFileSystem(KFsName,gPrimaryExtensions[aDrive].iName,aDrive);
|
sl@0
|
116 |
|
sl@0
|
117 |
TESTLIT(r, "TheFs.MountFileSystem", r==KErrNone);
|
sl@0
|
118 |
|
sl@0
|
119 |
r=TheFs.FileSystemName(gNewFsName,aDrive);
|
sl@0
|
120 |
TESTLIT(r, "TheFs.FileSystemName", r==KErrNone);
|
sl@0
|
121 |
|
sl@0
|
122 |
r = gNewFsName.CompareF(KFsName);
|
sl@0
|
123 |
TESTLIT(r, "gNewFsName.Compare", r==0);
|
sl@0
|
124 |
|
sl@0
|
125 |
return c;
|
sl@0
|
126 |
}
|
sl@0
|
127 |
|
sl@0
|
128 |
LOCAL_C void UnmountFileSystem(TInt aDrive)
|
sl@0
|
129 |
///
|
sl@0
|
130 |
/// Dismount the filesystem and remount the original one.
|
sl@0
|
131 |
/// @param aDrive Drive number (EDriveC etc.) to be unmounted.
|
sl@0
|
132 |
///
|
sl@0
|
133 |
{
|
sl@0
|
134 |
TChar c;
|
sl@0
|
135 |
TInt r=TheFs.DriveToChar(aDrive,c);
|
sl@0
|
136 |
TESTLIT(r, "TheFs.DriveToChar", r==KErrNone);
|
sl@0
|
137 |
|
sl@0
|
138 |
r=TheFs.DismountFileSystem(gNewFsName,aDrive);
|
sl@0
|
139 |
TESTLIT(r, "TheFs.DismountFileSystem", r==KErrNone);
|
sl@0
|
140 |
|
sl@0
|
141 |
if (gNoMedia)
|
sl@0
|
142 |
{
|
sl@0
|
143 |
TTest::Printf(_L("No media on %C: so don't remount it"), (TUint)c);
|
sl@0
|
144 |
}
|
sl@0
|
145 |
else if (gOldFsName.Length() > 0)
|
sl@0
|
146 |
{
|
sl@0
|
147 |
TTest::Printf(_L("Mount %C: %S"), (TUint)c, &gOldFsName);
|
sl@0
|
148 |
if (gPrimaryExtensions[aDrive].iExists == EFalse)
|
sl@0
|
149 |
r=TheFs.MountFileSystem(gOldFsName,aDrive);
|
sl@0
|
150 |
else
|
sl@0
|
151 |
r=TheFs.MountFileSystem(gOldFsName,gPrimaryExtensions[aDrive].iName,aDrive);
|
sl@0
|
152 |
TESTLIT(r, "MountFileSystem", r==KErrNone);
|
sl@0
|
153 |
}
|
sl@0
|
154 |
}
|
sl@0
|
155 |
|
sl@0
|
156 |
LOCAL_C TInt testReadOnly(TAny* /*aData*/)
|
sl@0
|
157 |
///
|
sl@0
|
158 |
/// Task to test read-only operations.
|
sl@0
|
159 |
///
|
sl@0
|
160 |
{
|
sl@0
|
161 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
sl@0
|
162 |
TSoakReadOnly rdonly;
|
sl@0
|
163 |
TInt64 seed = 178543;
|
sl@0
|
164 |
TInt r = KErrNone;
|
sl@0
|
165 |
rdonly.ExcludeDrive(gRemFsDrv);
|
sl@0
|
166 |
while (r == KErrNone)
|
sl@0
|
167 |
{
|
sl@0
|
168 |
r = rdonly.ScanDrives(ETrue, Math::Rand(seed) % 90 + 10);
|
sl@0
|
169 |
TTest::PrintLock();
|
sl@0
|
170 |
TTest::Printf();
|
sl@0
|
171 |
TTest::Printf(_L("Read-only test results:\n"));
|
sl@0
|
172 |
TSoakStats::Print();
|
sl@0
|
173 |
rdonly.iDrives.Print(_L("Drives:"));
|
sl@0
|
174 |
rdonly.iDirs.Print(_L("Dirs:"));
|
sl@0
|
175 |
rdonly.iFiles.Print(_L("Files:"));
|
sl@0
|
176 |
rdonly.iReads.Print(_L("Reads:"));
|
sl@0
|
177 |
TTest::Printf();
|
sl@0
|
178 |
TTest::PrintUnlock();
|
sl@0
|
179 |
gNumRead++;
|
sl@0
|
180 |
}
|
sl@0
|
181 |
delete cleanup;
|
sl@0
|
182 |
TTest::Fail(HERE, r, _L("ScanDrives error"));
|
sl@0
|
183 |
return r;
|
sl@0
|
184 |
}
|
sl@0
|
185 |
|
sl@0
|
186 |
LOCAL_C TInt testFillEmpty(TAny* /*aData*/)
|
sl@0
|
187 |
///
|
sl@0
|
188 |
/// Task to repeatedly fill and clean a drive.
|
sl@0
|
189 |
///
|
sl@0
|
190 |
{
|
sl@0
|
191 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
sl@0
|
192 |
TVolumeInfo info;
|
sl@0
|
193 |
TFullName gFsName;
|
sl@0
|
194 |
TChar drvch = 0;
|
sl@0
|
195 |
TInt drive = 0;
|
sl@0
|
196 |
TInt64 free = 0;
|
sl@0
|
197 |
RFs fs;
|
sl@0
|
198 |
TInt r = fs.Connect();
|
sl@0
|
199 |
if (r != KErrNone)
|
sl@0
|
200 |
TTest::Fail(HERE, r, _L("can't connect to fileserver\n"));
|
sl@0
|
201 |
if (gDrvChFill)
|
sl@0
|
202 |
{
|
sl@0
|
203 |
// User specified the drive, so use that explicitly
|
sl@0
|
204 |
drvch = gDrvChFill;
|
sl@0
|
205 |
}
|
sl@0
|
206 |
else
|
sl@0
|
207 |
{
|
sl@0
|
208 |
// User didn't specify the drive, so scan through them looking for
|
sl@0
|
209 |
// likely candidates. Don't use ROM or RAM drives, or LFFS ones, or
|
sl@0
|
210 |
// our own 'slow' file system. Out of what's left, look for the one
|
sl@0
|
211 |
// with the least (but non-zero) free space.
|
sl@0
|
212 |
for (drive = EDriveA; drive <= EDriveZ; drive++)
|
sl@0
|
213 |
{
|
sl@0
|
214 |
if (drive != gRemFsDrv)
|
sl@0
|
215 |
{
|
sl@0
|
216 |
TDriveInfo d;
|
sl@0
|
217 |
TInt r;
|
sl@0
|
218 |
r = fs.Drive(d, drive);
|
sl@0
|
219 |
if (r == KErrNone && d.iDriveAtt != 0 &&
|
sl@0
|
220 |
!(d.iDriveAtt & KDriveAttRom) &&
|
sl@0
|
221 |
d.iMediaAtt != EMediaRam &&
|
sl@0
|
222 |
!IsFileSystemLFFS(fs, drive))
|
sl@0
|
223 |
{
|
sl@0
|
224 |
r = fs.Volume(info, drive);
|
sl@0
|
225 |
if (r == KErrNone)
|
sl@0
|
226 |
{
|
sl@0
|
227 |
if (free <= 0 || info.iFree < free)
|
sl@0
|
228 |
{
|
sl@0
|
229 |
r = fs.DriveToChar(drive, drvch);
|
sl@0
|
230 |
if (r != KErrNone)
|
sl@0
|
231 |
TTest::Fail(HERE, r, _L("DriveToChar(%d)"), drive);
|
sl@0
|
232 |
free = info.iFree;
|
sl@0
|
233 |
}
|
sl@0
|
234 |
}
|
sl@0
|
235 |
else
|
sl@0
|
236 |
{
|
sl@0
|
237 |
// not interested in drives which produce errors, they
|
sl@0
|
238 |
// probably don't really exist.
|
sl@0
|
239 |
}
|
sl@0
|
240 |
}
|
sl@0
|
241 |
else
|
sl@0
|
242 |
{
|
sl@0
|
243 |
// Drive doesn't exist, is a ROM drive or an LFFS drive, don't
|
sl@0
|
244 |
// use it.
|
sl@0
|
245 |
}
|
sl@0
|
246 |
}
|
sl@0
|
247 |
}
|
sl@0
|
248 |
}
|
sl@0
|
249 |
|
sl@0
|
250 |
// If no drive found, can't do fill test so fail.
|
sl@0
|
251 |
if (drvch == 0)
|
sl@0
|
252 |
{
|
sl@0
|
253 |
TTest::Fail(HERE, _L("No drive found for fill test!"));
|
sl@0
|
254 |
}
|
sl@0
|
255 |
|
sl@0
|
256 |
r = fs.CharToDrive(drvch, drive);
|
sl@0
|
257 |
if (r != KErrNone)
|
sl@0
|
258 |
TTest::Fail(HERE, r, _L("CharToDrive(%C:)\n"), (TUint)drvch);
|
sl@0
|
259 |
r = fs.FileSystemName(gFsName, drive);
|
sl@0
|
260 |
if (r != KErrNone)
|
sl@0
|
261 |
TTest::Fail(HERE, r, _L("FileSystemName(%C:)\n"), (TUint)drvch);
|
sl@0
|
262 |
|
sl@0
|
263 |
r = fs.Volume(info, drive);
|
sl@0
|
264 |
if (r != KErrNone)
|
sl@0
|
265 |
TTest::Fail(HERE, r, _L("Volume(%C:)\n"), (TUint)drvch);
|
sl@0
|
266 |
|
sl@0
|
267 |
fs.Close();
|
sl@0
|
268 |
|
sl@0
|
269 |
TTest::Printf(_L("Using %C: (%S) with %d KB free for fill/clean cycle test\n"),
|
sl@0
|
270 |
(TUint)drvch, &gFsName, I64LOW(info.iFree / 1024));
|
sl@0
|
271 |
|
sl@0
|
272 |
TSoakFill fill;
|
sl@0
|
273 |
r = fill.SetDrive(drvch);
|
sl@0
|
274 |
if (r != KErrNone)
|
sl@0
|
275 |
TTest::Fail(HERE, r, _L("Unable to setup drive %C"), (TUint)drvch);
|
sl@0
|
276 |
|
sl@0
|
277 |
r = fill.CleanDrive();
|
sl@0
|
278 |
if (r != KErrNone && r != KErrNotFound && r != KErrPathNotFound)
|
sl@0
|
279 |
TTest::Fail(HERE, r, _L("Error cleaning drive %C"), (TUint)drvch);
|
sl@0
|
280 |
|
sl@0
|
281 |
// Loop to do the actual test
|
sl@0
|
282 |
while (r == KErrNone)
|
sl@0
|
283 |
{
|
sl@0
|
284 |
r = fill.FillDrive();
|
sl@0
|
285 |
if (r != KErrNone && r != KErrDiskFull)
|
sl@0
|
286 |
TTest::Fail(HERE, r, _L("Error filling drive %C"), (TUint)drvch);
|
sl@0
|
287 |
|
sl@0
|
288 |
TTest::PrintLock();
|
sl@0
|
289 |
TTest::Printf(_L("%C: filled\n"), (TUint)drvch);
|
sl@0
|
290 |
TTest::PrintUnlock();
|
sl@0
|
291 |
|
sl@0
|
292 |
r = fill.CleanDrive();
|
sl@0
|
293 |
if (r == KErrPathNotFound)
|
sl@0
|
294 |
r = KErrNone;
|
sl@0
|
295 |
if (r != KErrNone)
|
sl@0
|
296 |
TTest::Fail(HERE, r, _L("cleaning drive %C"), (TUint)drvch);
|
sl@0
|
297 |
|
sl@0
|
298 |
TTest::PrintLock();
|
sl@0
|
299 |
TTest::Printf(_L("%C: cleaned\n"), (TUint)drvch);
|
sl@0
|
300 |
TTest::PrintUnlock();
|
sl@0
|
301 |
|
sl@0
|
302 |
gNumFill++;
|
sl@0
|
303 |
}
|
sl@0
|
304 |
delete cleanup;
|
sl@0
|
305 |
TTest::Fail(HERE, r, _L("Fill/clean error"));
|
sl@0
|
306 |
return r;
|
sl@0
|
307 |
}
|
sl@0
|
308 |
|
sl@0
|
309 |
LOCAL_C TInt testRemote(TAny* /*aData*/)
|
sl@0
|
310 |
///
|
sl@0
|
311 |
/// Task to exercise the remote (special) filesystem.
|
sl@0
|
312 |
///
|
sl@0
|
313 |
{
|
sl@0
|
314 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
sl@0
|
315 |
TSoakRemote rem(gRemFsChr);
|
sl@0
|
316 |
TInt r = KErrNone;
|
sl@0
|
317 |
for (TBool sync = EFalse; r == KErrNone; sync = !sync)
|
sl@0
|
318 |
{
|
sl@0
|
319 |
for (TInt i = 0; i < 1; i++)
|
sl@0
|
320 |
{
|
sl@0
|
321 |
rem.Remount(sync);
|
sl@0
|
322 |
r = rem.TestSession();
|
sl@0
|
323 |
if (r != KErrNone)
|
sl@0
|
324 |
TTest::Fail(HERE, r, _L("TestSession failed"));
|
sl@0
|
325 |
r = rem.TestSubSession();
|
sl@0
|
326 |
if (r != KErrNone)
|
sl@0
|
327 |
TTest::Fail(HERE, r, _L("TestSubSession failed"));
|
sl@0
|
328 |
r = rem.TestMount();
|
sl@0
|
329 |
if (r != KErrNone)
|
sl@0
|
330 |
TTest::Fail(HERE, r, _L("Mount/dismount failed"));
|
sl@0
|
331 |
User::After(100*1000000);
|
sl@0
|
332 |
gNumRem++;
|
sl@0
|
333 |
}
|
sl@0
|
334 |
}
|
sl@0
|
335 |
delete cleanup;
|
sl@0
|
336 |
TTest::Fail(HERE, r, _L("Test (remote) filesystem error"));
|
sl@0
|
337 |
return r;
|
sl@0
|
338 |
}
|
sl@0
|
339 |
|
sl@0
|
340 |
GLDEF_C void CallTestsL()
|
sl@0
|
341 |
///
|
sl@0
|
342 |
/// Do all tests.
|
sl@0
|
343 |
///
|
sl@0
|
344 |
{
|
sl@0
|
345 |
// first thing, initialise local test class to make sure it gets done.
|
sl@0
|
346 |
TInt r = TTest::Init();
|
sl@0
|
347 |
test(r == KErrNone);
|
sl@0
|
348 |
|
sl@0
|
349 |
const TInt KMaxArgs = 4;
|
sl@0
|
350 |
TPtrC argv[KMaxArgs];
|
sl@0
|
351 |
TInt argc = TTest::ParseCommandArguments(argv, KMaxArgs);
|
sl@0
|
352 |
|
sl@0
|
353 |
gRemFsChr = 'M'; // probably a 'safe' drive
|
sl@0
|
354 |
gDrvChFill = 0;
|
sl@0
|
355 |
|
sl@0
|
356 |
if (argc > 1)
|
sl@0
|
357 |
gRemFsChr = User::UpperCase(argv[1][0]);
|
sl@0
|
358 |
if (argc > 2)
|
sl@0
|
359 |
gDrvChFill = User::UpperCase(argv[2][0]);
|
sl@0
|
360 |
|
sl@0
|
361 |
r = TheFs.CharToDrive(gRemFsChr, gRemFsDrv);
|
sl@0
|
362 |
|
sl@0
|
363 |
if (r != KErrNone || gRemFsDrv == EDriveZ)
|
sl@0
|
364 |
{
|
sl@0
|
365 |
test.Printf(_L("Test cannnot run on drive %C:\n"), (TUint)gRemFsChr);
|
sl@0
|
366 |
return;
|
sl@0
|
367 |
}
|
sl@0
|
368 |
|
sl@0
|
369 |
// If we can do it, check whether the drives are LFFS and are OK
|
sl@0
|
370 |
// !!! Disable platform security tests until we get the new APIs
|
sl@0
|
371 |
/* if (User::Capability() & KCapabilityRoot)
|
sl@0
|
372 |
{
|
sl@0
|
373 |
if (gDrvChFill != 0 && gDrvChFill != gRemFsChr)
|
sl@0
|
374 |
CheckMountLFFS(TheFs, gDrvChFill);
|
sl@0
|
375 |
}
|
sl@0
|
376 |
*/
|
sl@0
|
377 |
MountTestFileSystem(gRemFsDrv);
|
sl@0
|
378 |
|
sl@0
|
379 |
r = TTest::Create(0, testReadOnly, _L("T_ReadOnly"));
|
sl@0
|
380 |
test(r == KErrNone);
|
sl@0
|
381 |
|
sl@0
|
382 |
r = TTest::Create(1, testFillEmpty, _L("T_FillEmpty"));
|
sl@0
|
383 |
test(r == KErrNone);
|
sl@0
|
384 |
|
sl@0
|
385 |
r = TTest::Create(2, testRemote, _L("T_Remote"));
|
sl@0
|
386 |
test(r == KErrNone);
|
sl@0
|
387 |
|
sl@0
|
388 |
TRequestStatus kStat;
|
sl@0
|
389 |
test.Console()->Read(kStat);
|
sl@0
|
390 |
TInt displaycount = 0;
|
sl@0
|
391 |
while ((r = TTest::Run(ETrue, 1*KSecond)) == KErrNone) // run until any thread exits
|
sl@0
|
392 |
{
|
sl@0
|
393 |
if (++displaycount >= 60 || kStat == KErrNone)
|
sl@0
|
394 |
{
|
sl@0
|
395 |
test.Printf(_L("Fill %-6d Rem %-6d Read %d\n"), gNumFill, gNumRem, gNumRead);
|
sl@0
|
396 |
displaycount = 0;
|
sl@0
|
397 |
}
|
sl@0
|
398 |
if (kStat == KErrNone)
|
sl@0
|
399 |
{
|
sl@0
|
400 |
test.Printf(_L("Aborted by user!\n"));
|
sl@0
|
401 |
break;
|
sl@0
|
402 |
}
|
sl@0
|
403 |
}
|
sl@0
|
404 |
test(r == KErrNone);
|
sl@0
|
405 |
|
sl@0
|
406 |
// Kill all outstanding threads.
|
sl@0
|
407 |
TTest::KillAll(KErrAbort);
|
sl@0
|
408 |
|
sl@0
|
409 |
UnmountFileSystem(gRemFsDrv);
|
sl@0
|
410 |
}
|
sl@0
|
411 |
|
sl@0
|
412 |
GLDEF_C TInt E32Main()
|
sl@0
|
413 |
//
|
sl@0
|
414 |
// Main entry point
|
sl@0
|
415 |
//
|
sl@0
|
416 |
{
|
sl@0
|
417 |
for (TInt i = 0; i < KMaxDrives; i++)
|
sl@0
|
418 |
{
|
sl@0
|
419 |
gPrimaryExtensions[i].iExists = EFalse;
|
sl@0
|
420 |
}
|
sl@0
|
421 |
|
sl@0
|
422 |
TInt r;
|
sl@0
|
423 |
CTrapCleanup* cleanup;
|
sl@0
|
424 |
cleanup=CTrapCleanup::New();
|
sl@0
|
425 |
__UHEAP_MARK;
|
sl@0
|
426 |
|
sl@0
|
427 |
test.Title();
|
sl@0
|
428 |
test.Start(_L("Starting tests..."));
|
sl@0
|
429 |
|
sl@0
|
430 |
r=TheFs.Connect();
|
sl@0
|
431 |
test(r==KErrNone);
|
sl@0
|
432 |
|
sl@0
|
433 |
// TheFs.SetAllocFailure(gAllocFailOn);
|
sl@0
|
434 |
TTime timerC;
|
sl@0
|
435 |
timerC.HomeTime();
|
sl@0
|
436 |
|
sl@0
|
437 |
// Do the test
|
sl@0
|
438 |
TRAP(r,CallTestsL());
|
sl@0
|
439 |
|
sl@0
|
440 |
// reset the debug register
|
sl@0
|
441 |
TheFs.SetDebugRegister(0);
|
sl@0
|
442 |
|
sl@0
|
443 |
TTime endTimeC;
|
sl@0
|
444 |
endTimeC.HomeTime();
|
sl@0
|
445 |
TTimeIntervalSeconds timeTakenC;
|
sl@0
|
446 |
r=endTimeC.SecondsFrom(timerC,timeTakenC);
|
sl@0
|
447 |
test(r==KErrNone);
|
sl@0
|
448 |
test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int());
|
sl@0
|
449 |
// TheFs.SetAllocFailure(gAllocFailOff);
|
sl@0
|
450 |
TheFs.Close();
|
sl@0
|
451 |
test.End();
|
sl@0
|
452 |
test.Close();
|
sl@0
|
453 |
__UHEAP_MARKEND;
|
sl@0
|
454 |
delete cleanup;
|
sl@0
|
455 |
return(KErrNone);
|
sl@0
|
456 |
}
|