author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:34:26 +0300 | |
branch | RCL_3 |
changeset 43 | c1f20ce4abcf |
parent 0 | a41df078684a |
child 44 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1997-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 the License "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 |
// f32test\server\t_alert.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
18 |
#define __E32TEST_EXTENSION__ |
0 | 19 |
#include <f32file.h> |
20 |
#include <e32test.h> |
|
21 |
#include <e32math.h> |
|
22 |
#include <e32svr.h> |
|
23 |
#include "t_server.h" |
|
24 |
||
25 |
GLDEF_D RTest test(_L("T_ALERT")); |
|
26 |
||
27 |
LOCAL_D TInt gFileWrites; |
|
28 |
LOCAL_D TInt gFileReads; |
|
29 |
LOCAL_D TInt gFileCreates; |
|
30 |
LOCAL_D TInt gFileDeletes; |
|
31 |
LOCAL_D TInt gNotifies; |
|
32 |
LOCAL_D TInt gNotifyCancels; |
|
33 |
LOCAL_D TInt gMediaChanges; |
|
34 |
||
35 |
LOCAL_D const TInt gMaxIteration=100; |
|
36 |
LOCAL_D const TInt KHeapSize=0x4000; |
|
37 |
LOCAL_D const TInt gMaxDelay=100; |
|
38 |
LOCAL_D const TInt gMaxMediaChangeInterval=1000; |
|
39 |
LOCAL_D const TInt gUpdateInterval=10000; |
|
40 |
LOCAL_D const TInt gMaxFiles=4; |
|
41 |
LOCAL_D const TInt gMaxTempSize=1024; |
|
42 |
LOCAL_D const TFileName gPathThread1=_L("C:\\F32-TST\\TALERT\\"); |
|
43 |
||
44 |
// Test2 |
|
45 |
LOCAL_D const TInt gHeartBeatInterval=10000000; |
|
46 |
LOCAL_D TInt gThreadTick; |
|
47 |
LOCAL_D TInt gFileCreateFail; |
|
48 |
||
49 |
#if defined(__WINS__) |
|
50 |
LOCAL_D const TFileName gPathThread0=_L("X:\\F32-TST\\TALERT\\"); |
|
51 |
LOCAL_D const TFileName gPathThread2=_L("X:\\F32-TST\\TALERT\\"); |
|
52 |
#else |
|
53 |
LOCAL_D TFileName gPathThread0=_L("?:\\F32-TST\\TALERT\\"); |
|
54 |
LOCAL_D TFileName gPathThread2=_L("?:\\F32-TST\\TALERT\\"); |
|
55 |
#endif |
|
56 |
||
57 |
LOCAL_C void WaitForMedia() |
|
58 |
// |
|
59 |
// Wait until the media change is serviced |
|
60 |
// |
|
61 |
{ |
|
62 |
FOREVER |
|
63 |
{ |
|
64 |
TInt r=TheFs.MkDir(gPathThread0); |
|
65 |
if (r==KErrNone || r==KErrAlreadyExists) |
|
66 |
break; |
|
67 |
} |
|
68 |
} |
|
69 |
||
70 |
LOCAL_C TInt FileAccess(TAny* aPathPtr) |
|
71 |
// |
|
72 |
// Do lots of file access - ignore all errors |
|
73 |
// |
|
74 |
{ |
|
75 |
||
76 |
TFileName file[gMaxFiles]; |
|
77 |
TFileName sessionPath=*(TDesC*)aPathPtr; |
|
78 |
HBufC8* tempPtr=HBufC8::New(gMaxTempSize); |
|
79 |
HBufC* tempPtrx=HBufC::New(gMaxTempSize); |
|
80 |
TPtr8 temp(tempPtr->Des()); |
|
81 |
TPtr tempx(tempPtrx->Des()); |
|
82 |
||
83 |
RFs fs; |
|
84 |
fs.Connect(); |
|
85 |
fs.SetSessionPath(sessionPath); |
|
86 |
||
87 |
FOREVER |
|
88 |
{ |
|
89 |
switch(Math::Rand(gSeed)%4) |
|
90 |
{ |
|
91 |
case 0: |
|
92 |
{ |
|
93 |
TInt fileNum=Math::Rand(gSeed)%gMaxFiles; |
|
94 |
if (file[fileNum].Length()==0) |
|
95 |
break; |
|
96 |
RFile f; |
|
97 |
TInt r=f.Open(fs,file[fileNum],EFileRead|EFileWrite); |
|
98 |
if (r!=KErrNone) |
|
99 |
break; |
|
100 |
CreateLongName(tempx,gSeed,Math::Rand(gSeed)%gMaxTempSize); |
|
101 |
temp.Copy(tempx); |
|
102 |
r=f.Write(temp); |
|
103 |
if (r==KErrNone) |
|
104 |
gFileWrites++; |
|
105 |
f.Close(); |
|
106 |
break; |
|
107 |
} |
|
108 |
case 1: |
|
109 |
{ |
|
110 |
TInt fileNum=Math::Rand(gSeed)%gMaxFiles; |
|
111 |
if (file[fileNum].Length()==0) |
|
112 |
break; |
|
113 |
RFile f; |
|
114 |
TInt r=f.Open(fs,file[fileNum],EFileRead|EFileWrite); |
|
115 |
if (r!=KErrNone) |
|
116 |
break; |
|
117 |
r=f.Read(temp); |
|
118 |
if (r==KErrNone) |
|
119 |
gFileReads++; |
|
120 |
f.Close(); |
|
121 |
break; |
|
122 |
} |
|
123 |
case 2: |
|
124 |
{ |
|
125 |
TInt fileNum=Math::Rand(gSeed)%gMaxFiles; |
|
126 |
if (file[fileNum].Length()!=0) |
|
127 |
break; |
|
128 |
RFile f; |
|
129 |
TInt r=f.Temp(fs,sessionPath,file[fileNum],EFileRead|EFileWrite); |
|
130 |
if (r==KErrNone) |
|
131 |
gFileCreates++; |
|
132 |
f.Close(); |
|
133 |
break; |
|
134 |
} |
|
135 |
case 3: |
|
136 |
{ |
|
137 |
TInt fileNum=Math::Rand(gSeed)%gMaxFiles; |
|
138 |
if (file[fileNum].Length()==0) |
|
139 |
break; |
|
140 |
TInt r=fs.Delete(file[fileNum]); |
|
141 |
if (r==KErrNone) |
|
142 |
{ |
|
143 |
file[fileNum].SetLength(0); |
|
144 |
gFileDeletes++; |
|
145 |
} |
|
146 |
break; |
|
147 |
} |
|
148 |
default: |
|
149 |
break; |
|
150 |
} |
|
151 |
} |
|
152 |
||
153 |
//delete tempPtr; |
|
154 |
//delete tempPtrx; |
|
155 |
//return(KErrNone); |
|
156 |
} |
|
157 |
||
158 |
||
159 |
LOCAL_C void StartThread0() |
|
160 |
// |
|
161 |
// Start a thread that reads and writes to D: |
|
162 |
// |
|
163 |
{ |
|
164 |
||
165 |
RThread clientThread; |
|
166 |
TInt r=clientThread.Create(_L("TALERT_Thread0"),FileAccess,0x4000,KHeapSize,KHeapSize,(TAny*)&gPathThread0,EOwnerThread); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
167 |
test_KErrNone(r); |
0 | 168 |
clientThread.Resume(); |
169 |
clientThread.Close(); |
|
170 |
} |
|
171 |
||
172 |
LOCAL_C void StartThread1() |
|
173 |
// |
|
174 |
// Start a thread that reads and writes to C: |
|
175 |
// |
|
176 |
{ |
|
177 |
||
178 |
RThread clientThread; |
|
179 |
TInt r=clientThread.Create(_L("TALERT_Thread1"),FileAccess,0x4000,KHeapSize,KHeapSize,(TAny*)&gPathThread1,EOwnerThread); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
180 |
test_KErrNone(r); |
0 | 181 |
clientThread.Resume(); |
182 |
clientThread.Close(); |
|
183 |
} |
|
184 |
||
185 |
LOCAL_C void StartThread2() |
|
186 |
// |
|
187 |
// Start a thread that reads and writes to D: |
|
188 |
// |
|
189 |
{ |
|
190 |
||
191 |
RThread clientThread; |
|
192 |
TInt r=clientThread.Create(_L("TALERT_Thread2"),FileAccess,0x4000,KHeapSize,KHeapSize,(TAny*)&gPathThread2,EOwnerThread); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
193 |
test_KErrNone(r); |
0 | 194 |
clientThread.Resume(); |
195 |
clientThread.Close(); |
|
196 |
} |
|
197 |
||
198 |
||
199 |
LOCAL_C TInt NotifyAccess(TAny*) |
|
200 |
// |
|
201 |
// Create, wait for and cancel notifiers. |
|
202 |
// |
|
203 |
{ |
|
204 |
||
205 |
RFs fs; |
|
206 |
fs.Connect(); |
|
207 |
TRequestStatus status; |
|
208 |
||
209 |
FOREVER |
|
210 |
{ |
|
211 |
switch(Math::Rand(gSeed)%4) |
|
212 |
{ |
|
213 |
case 0: |
|
214 |
gNotifies++; |
|
215 |
fs.NotifyChange(ENotifyAll,status); |
|
216 |
User::WaitForRequest(status); |
|
217 |
break; |
|
218 |
case 1: |
|
219 |
gNotifies++; |
|
220 |
fs.NotifyChange(ENotifyEntry,status); |
|
221 |
User::WaitForRequest(status); |
|
222 |
break; |
|
223 |
case 2: |
|
224 |
gNotifyCancels++; |
|
225 |
fs.NotifyChange(ENotifyAll,status); |
|
226 |
User::After(Math::Rand(gSeed)%gMaxDelay); |
|
227 |
fs.NotifyChangeCancel(); |
|
228 |
User::WaitForRequest(status); |
|
229 |
break; |
|
230 |
case 3: |
|
231 |
gNotifyCancels++; |
|
232 |
fs.NotifyChange(ENotifyEntry,status); |
|
233 |
User::After(Math::Rand(gSeed)%gMaxDelay); |
|
234 |
fs.NotifyChangeCancel(); |
|
235 |
User::WaitForRequest(status); |
|
236 |
break; |
|
237 |
} |
|
238 |
} |
|
239 |
||
240 |
//return(KErrNone); |
|
241 |
} |
|
242 |
||
243 |
LOCAL_C void StartThread3() |
|
244 |
// |
|
245 |
// Start a thread that creates and waits/cancel RFs::Notifiers |
|
246 |
// |
|
247 |
{ |
|
248 |
||
249 |
RThread clientThread; |
|
250 |
TInt r=clientThread.Create(_L("TALERT_Thread3"),NotifyAccess,0x4000,KHeapSize,KHeapSize,NULL,EOwnerThread); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
251 |
test_KErrNone(r); |
0 | 252 |
clientThread.Resume(); |
253 |
clientThread.Close(); |
|
254 |
} |
|
255 |
||
256 |
LOCAL_C TInt MediaChange(TAny*) |
|
257 |
// |
|
258 |
// Cause media changes a random intervals |
|
259 |
// |
|
260 |
{ |
|
261 |
gMediaChanges=0; |
|
262 |
FOREVER |
|
263 |
{ |
|
264 |
TInt interval=Math::Rand(gSeed)%gMaxMediaChangeInterval; |
|
265 |
User::After(interval); |
|
266 |
// UserSvr::ForceRemountMedia(ERemovableMedia0); // Generate media change |
|
267 |
++gMediaChanges; |
|
268 |
} |
|
269 |
||
270 |
//return(KErrNone); |
|
271 |
} |
|
272 |
||
273 |
LOCAL_C void StartThread4() |
|
274 |
// |
|
275 |
// Start a thread that creates media changes |
|
276 |
// |
|
277 |
{ |
|
278 |
||
279 |
RThread clientThread; |
|
280 |
TInt r=clientThread.Create(_L("TALERT_Thread4"),MediaChange,0x4000,KHeapSize,KHeapSize,NULL,EOwnerThread); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
281 |
test_KErrNone(r); |
0 | 282 |
clientThread.SetPriority(EPriorityMore); |
283 |
clientThread.Resume(); |
|
284 |
clientThread.Close(); |
|
285 |
} |
|
286 |
||
287 |
LOCAL_C void StartClock() |
|
288 |
// |
|
289 |
// Display ongoing reads/writes. Getch to exit |
|
290 |
// |
|
291 |
{ |
|
292 |
||
293 |
test.Console()->ClearScreen(); |
|
294 |
FOREVER |
|
295 |
{ |
|
296 |
User::After(gUpdateInterval); |
|
297 |
test.Console()->SetPos(0,5); |
|
298 |
test.Printf(_L("File writes = %d \n"),gFileWrites); |
|
299 |
test.Printf(_L("File reads = %d \n"),gFileReads); |
|
300 |
test.Printf(_L("File creates = %d \n"),gFileCreates); |
|
301 |
test.Printf(_L("File deletes = %d \n"),gFileDeletes); |
|
302 |
test.Printf(_L("File notifies = %d \n"),gNotifies); |
|
303 |
test.Printf(_L("File notifies cancelled = %d \n"),gNotifyCancels); |
|
304 |
// test.Printf(_L("Press any key to exit\n")); |
|
305 |
// TKeyCode keycode=test.Console()->KeyCode(); |
|
306 |
// if (keycode!=EKeyNull) |
|
307 |
// break; |
|
308 |
if (gFileWrites>gMaxIteration) |
|
309 |
break; |
|
310 |
} |
|
311 |
} |
|
312 |
||
313 |
LOCAL_C void KillThreads() |
|
314 |
// |
|
315 |
// Kill all threads |
|
316 |
// |
|
317 |
{ |
|
318 |
test.Printf(_L("+Kill threads")); |
|
319 |
RThread t; |
|
320 |
||
321 |
TInt r=t.Open(_L("TALERT_Thread0"),EOwnerThread); |
|
322 |
if(r==KErrNone) |
|
323 |
{ |
|
324 |
t.Kill(KErrCancel); |
|
325 |
t.Close(); |
|
326 |
} |
|
327 |
else |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
328 |
test_Value(r, r == KErrNotFound); |
0 | 329 |
|
330 |
r=t.Open(_L("TALERT_Thread1"),EOwnerThread); |
|
331 |
if(r==KErrNone) |
|
332 |
{ |
|
333 |
t.Kill(KErrCancel); |
|
334 |
t.Close(); |
|
335 |
} |
|
336 |
else |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
337 |
test_Value(r, r == KErrNotFound); |
0 | 338 |
|
339 |
r=t.Open(_L("TALERT_Thread2"),EOwnerThread); |
|
340 |
if(r==KErrNone) |
|
341 |
{ |
|
342 |
t.Kill(KErrCancel); |
|
343 |
t.Close(); |
|
344 |
} |
|
345 |
else |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
346 |
test_Value(r, r == KErrNotFound); |
0 | 347 |
|
348 |
r=t.Open(_L("TALERT_Thread3"),EOwnerThread); |
|
349 |
if(r==KErrNone) |
|
350 |
{ |
|
351 |
t.Kill(KErrCancel); |
|
352 |
t.Close(); |
|
353 |
} |
|
354 |
else |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
355 |
test_Value(r, r == KErrNotFound); |
0 | 356 |
|
357 |
r=t.Open(_L("TALERT_Thread4"),EOwnerThread); |
|
358 |
if(r==KErrNone) |
|
359 |
{ |
|
360 |
t.Kill(KErrCancel); |
|
361 |
t.Close(); |
|
362 |
} |
|
363 |
else |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
364 |
test_Value(r, r == KErrNotFound); |
0 | 365 |
|
366 |
/* TFindThread threadFinder(_L("TALERT_*")); |
|
367 |
FOREVER |
|
368 |
{ |
|
369 |
TFullName threadName; |
|
370 |
TInt r=threadFinder.Next(threadName); |
|
371 |
test.Printf(_L("r=%d"),r); |
|
372 |
if (r==KErrNotFound) |
|
373 |
break; |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
374 |
test_KErrNone(r); |
0 | 375 |
test.Printf(_L("Killing Thread %S\n"),&threadName); |
376 |
RThread t; |
|
377 |
r=t.Open(threadName,EOwnerThread); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
378 |
test_KErrNone(r); |
0 | 379 |
t.Kill(KErrCancel); |
380 |
t.Close(); |
|
381 |
} */ |
|
382 |
test.Printf(_L("-Kill threads")); |
|
383 |
} |
|
384 |
||
385 |
LOCAL_C void Test1() |
|
386 |
// |
|
387 |
// Create lots of threads and change notifiers |
|
388 |
// |
|
389 |
{ |
|
390 |
test.Next(_L("Create lots of threads and change notifiers")); |
|
391 |
TInt r=TheFs.MkDirAll(gPathThread1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
392 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 393 |
r=TheFs.MkDir(gPathThread2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
394 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 395 |
|
396 |
StartThread0(); // Read and write to D: |
|
397 |
StartThread1(); // Read and write to C: |
|
398 |
StartThread2(); // Read and write to D: (again) |
|
399 |
StartThread3(); // Set RFs::Notifiers |
|
400 |
StartThread4(); // Generate media changes |
|
401 |
StartClock(); // Time how long test has run |
|
402 |
KillThreads(); |
|
403 |
} |
|
404 |
||
405 |
LOCAL_C TInt ThreadHangTest(TAny*) |
|
406 |
// |
|
407 |
// Keep writing to the fileserver and setting gThreadTick |
|
408 |
// |
|
409 |
{ |
|
410 |
||
411 |
RFs fs; |
|
412 |
fs.Connect(); |
|
413 |
fs.SetSessionPath(gPathThread0); |
|
414 |
||
415 |
FOREVER |
|
416 |
{ |
|
417 |
gFileCreateFail++; |
|
418 |
gThreadTick=ETrue; |
|
419 |
RFile f; |
|
420 |
TInt r=f.Replace(fs,_L("TwiddleThumbs"),EFileRead|EFileWrite); |
|
421 |
if (r!=KErrNone) |
|
422 |
continue; |
|
423 |
gFileCreateFail=0; |
|
424 |
f.Close(); |
|
425 |
gThreadTick=ETrue; |
|
426 |
fs.Delete(_L("TwiddleThumbs")); |
|
427 |
gThreadTick=ETrue; |
|
428 |
} |
|
429 |
||
430 |
//return(KErrNone); |
|
431 |
} |
|
432 |
||
433 |
LOCAL_C void Test2() |
|
434 |
// |
|
435 |
// Create a hung server then kill the thread it wants to write to. |
|
436 |
// |
|
437 |
{ |
|
438 |
||
439 |
test.Next(_L("Create a hung server and kill the thread it is writing to")); |
|
440 |
TInt r=TheFs.MkDir(gPathThread0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
441 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 442 |
StartThread4(); // Generate media changes |
443 |
||
444 |
RThread clientThread; |
|
445 |
r=clientThread.Create(_L("TALERT_ThreadHangTest"),ThreadHangTest,0x4000,KHeapSize,KHeapSize,NULL,EOwnerThread); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
446 |
test_KErrNone(r); |
0 | 447 |
TRequestStatus status; |
448 |
clientThread.Logon(status); |
|
449 |
clientThread.Resume(); |
|
450 |
gThreadTick=ETrue; |
|
451 |
test.Next(_L("ThreadHangTest is running")); |
|
452 |
||
453 |
TInt count=0; |
|
454 |
FOREVER |
|
455 |
{ |
|
456 |
test.Printf(_L("Thread tick = %d File create failures = %d \n"),count,gFileCreateFail); |
|
457 |
test.Printf(_L("Media changes = %d\n"),gMediaChanges); |
|
458 |
User::After(gHeartBeatInterval); |
|
459 |
if (gThreadTick==0) |
|
460 |
break; |
|
461 |
gThreadTick=0; |
|
462 |
count++; |
|
463 |
} |
|
464 |
||
465 |
test.Next(_L("Thread is hung")); |
|
466 |
clientThread.Kill(KErrCancel); |
|
467 |
clientThread.Close(); |
|
468 |
User::WaitForRequest(status); |
|
469 |
KillThreads(); |
|
470 |
User::After(1000000); |
|
471 |
||
472 |
test.Printf(_L("Press return to the clear notifier, then any key to continue test")); |
|
473 |
test.Getch(); |
|
474 |
||
475 |
test.Next(_L("Test fileserver is still alive after thread is killed")); |
|
476 |
WaitForMedia(); |
|
477 |
r=TheFs.MkDir(gPathThread0); // Check fileserver ok |
|
478 |
if(r!=KErrNone && r!=KErrAlreadyExists) |
|
479 |
test.Printf(_L("r=%d"),r); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
480 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 481 |
|
482 |
} |
|
483 |
||
484 |
GLDEF_C void CallTestsL() |
|
485 |
// |
|
486 |
// Do tests relative to the session path |
|
487 |
// |
|
488 |
{ |
|
489 |
||
490 |
RThread().SetPriority(EPriorityLess); |
|
491 |
#if defined(__WINS__) |
|
492 |
if (gSessionPath[0]!='X') |
|
493 |
return; |
|
494 |
#else |
|
495 |
// Test on two drives where possible. This should be C: together with |
|
496 |
// the drive referenced by the default path. Where the default path is |
|
497 |
// C:, then only C: is used. The standard way to run the test is to |
|
498 |
// set the default path to D: |
|
499 |
||
500 |
gPathThread0[0]=gSessionPath[0]; |
|
501 |
gPathThread2[0]=gSessionPath[0]; |
|
502 |
#endif |
|
503 |
||
504 |
Test2(); |
|
505 |
Test1(); |
|
506 |
//This test can leave the drive corrupt so a format is required |
|
507 |
#if defined(__WINS__) |
|
508 |
Format(EDriveX); |
|
509 |
#else |
|
510 |
Format(EDriveD); |
|
511 |
#endif |
|
512 |
//clean up the talert directory after the test completes |
|
513 |
/* CFileMan* FileMan=NULL; |
|
514 |
FileMan=CFileMan::NewL(TheFs); |
|
515 |
TInt r=FileMan->RmDir(_L("\\F32-TST\\TALERT\\")); |
|
516 |
test.Printf(_L("r=%d"),r); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
517 |
test_Value(r, r == KErrNone || r==KErrPathNotFound); |
0 | 518 |
delete FileMan; |
519 |
*/ |
|
520 |
} |