branch | RCL_3 |
changeset 43 | c1f20ce4abcf |
parent 6 | 0173bcd7697c |
child 44 | 3e88ff8f41d5 |
42:a179b74831c9 | 43:c1f20ce4abcf |
---|---|
31 //! @SYMTestExpectedResults All tests should pass. |
31 //! @SYMTestExpectedResults All tests should pass. |
32 //! @SYMTestPriority High |
32 //! @SYMTestPriority High |
33 //! @SYMTestStatus Implemented |
33 //! @SYMTestStatus Implemented |
34 |
34 |
35 |
35 |
36 #define __E32TEST_EXTENSION__ |
|
36 #include <e32test.h> |
37 #include <e32test.h> |
37 #include <e32svr.h> |
38 #include <e32svr.h> |
38 #include <f32file.h> |
39 #include <f32file.h> |
39 #include <e32math.h> |
40 #include <e32math.h> |
40 #include <hal.h> |
41 #include <hal.h> |
78 |
79 |
79 TInt r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
80 TInt r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
80 r = fMan->Delete(name); |
81 r = fMan->Delete(name); |
81 |
82 |
82 r = fMan->Copy(KTestFile, name); |
83 r = fMan->Copy(KTestFile, name); |
83 test( r == KErrNone ); |
84 test_KErrNone(r); |
84 |
85 |
85 TInt localDriveNum = 0; |
86 TInt localDriveNum = 0; |
86 RFile testFile; |
87 RFile testFile; |
87 r = testFile.Open( TheFs, name, EFileRead ); |
88 r = testFile.Open( TheFs, name, EFileRead ); |
88 test( r == KErrNone ); |
89 test_KErrNone(r); |
89 |
90 |
90 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
91 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
91 SBlockMapInfo info; |
92 SBlockMapInfo info; |
92 TInt counter = 0; |
93 TInt counter = 0; |
93 TInt startPos = aStartPos; |
94 TInt startPos = aStartPos; |
100 if (bmErr != 0 && bmErr != KErrCompletion) |
101 if (bmErr != 0 && bmErr != KErrCompletion) |
101 { |
102 { |
102 map.Close(); |
103 map.Close(); |
103 testFile.Close(); |
104 testFile.Close(); |
104 r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
105 r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
105 test( r == KErrNone ); |
106 test_KErrNone(r); |
106 r = fMan->Delete(name); |
107 r = fMan->Delete(name); |
107 test( r == KErrNone ); |
108 test_KErrNone(r); |
108 delete fMan; |
109 delete fMan; |
109 return bmErr; |
110 return bmErr; |
110 } |
111 } |
111 map.Append(info); |
112 map.Append(info); |
112 if (counter++ == 0) |
113 if (counter++ == 0) |
115 test( bmErr == KErrCompletion ); |
116 test( bmErr == KErrCompletion ); |
116 TInt granularity; |
117 TInt granularity; |
117 |
118 |
118 TInt size; |
119 TInt size; |
119 r = testFile.Size(size); |
120 r = testFile.Size(size); |
120 test( r == KErrNone ); |
121 test_KErrNone(r); |
121 |
122 |
122 TBuf8<KReadBufferSize> buf1; |
123 TBuf8<KReadBufferSize> buf1; |
123 TBuf8<KReadBufferSize> buf2; |
124 TBuf8<KReadBufferSize> buf2; |
124 |
125 |
125 TBool changed; |
126 TBool changed; |
142 totalSegments += granularity; |
143 totalSegments += granularity; |
143 } |
144 } |
144 |
145 |
145 const TInt KTotalSegments = totalSegments; |
146 const TInt KTotalSegments = totalSegments; |
146 r = localDrive.Connect( localDriveNum, changed ); |
147 r = localDrive.Connect( localDriveNum, changed ); |
147 test( r == KErrNone ); |
148 test_KErrNone(r); |
148 |
149 |
149 // For each SBlockMapInfo object in RArray map |
150 // For each SBlockMapInfo object in RArray map |
150 for ( c = 0; c < map.Count(); c++ ) |
151 for ( c = 0; c < map.Count(); c++ ) |
151 { |
152 { |
152 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
153 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
173 if ( miniLength >= KReadBufferSize ) |
174 if ( miniLength >= KReadBufferSize ) |
174 { |
175 { |
175 testFile.Read( startPos + amountRead, buf1, KReadBufferSize ); |
176 testFile.Read( startPos + amountRead, buf1, KReadBufferSize ); |
176 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, KReadBufferSize, buf2); |
177 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, KReadBufferSize, buf2); |
177 r = buf1.Compare( buf2 ); |
178 r = buf1.Compare( buf2 ); |
178 test( r == 0 ); |
179 test_Value(r, r == 0 ); |
179 buf1.Zero(); |
180 buf1.Zero(); |
180 buf2.Zero(); |
181 buf2.Zero(); |
181 myCounter++; |
182 myCounter++; |
182 miniLength -= KReadBufferSize; |
183 miniLength -= KReadBufferSize; |
183 length -= KReadBufferSize; |
184 length -= KReadBufferSize; |
186 else |
187 else |
187 { |
188 { |
188 testFile.Read(startPos + amountRead, buf1, miniLength); |
189 testFile.Read(startPos + amountRead, buf1, miniLength); |
189 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, miniLength, buf2); |
190 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, miniLength, buf2); |
190 r = buf1.Compare( buf2 ); |
191 r = buf1.Compare( buf2 ); |
191 test( r == 0 ); |
192 test_Value(r, r == 0 ); |
192 amountRead += miniLength; |
193 amountRead += miniLength; |
193 length -= miniLength; |
194 length -= miniLength; |
194 miniLength = 0; |
195 miniLength = 0; |
195 } |
196 } |
196 } while ( miniLength != 0 && length != 0); |
197 } while ( miniLength != 0 && length != 0); |
199 } |
200 } |
200 map.Close(); |
201 map.Close(); |
201 |
202 |
202 testFile.Close(); |
203 testFile.Close(); |
203 r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
204 r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
204 test( r == KErrNone ); |
205 test_KErrNone(r); |
205 r = fMan->Delete(name); |
206 r = fMan->Delete(name); |
206 test( r == KErrNone ); |
207 test_KErrNone(r); |
207 delete fMan; |
208 delete fMan; |
208 return bmErr; |
209 return bmErr; |
209 } |
210 } |
210 |
211 |
211 LOCAL_C TInt TestBlockMapNandFAT(TInt64 aStartPos, TInt64 aEndPos) |
212 LOCAL_C TInt TestBlockMapNandFAT(TInt64 aStartPos, TInt64 aEndPos) |
214 // |
215 // |
215 { |
216 { |
216 TInt localDriveNum = 0; |
217 TInt localDriveNum = 0; |
217 RFile testFile; |
218 RFile testFile; |
218 TInt r = testFile.Open( TheFs, KTestFileFAT, EFileRead ); |
219 TInt r = testFile.Open( TheFs, KTestFileFAT, EFileRead ); |
219 test( r == KErrNone ); |
220 test_KErrNone(r); |
220 |
221 |
221 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
222 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
222 SBlockMapInfo info; |
223 SBlockMapInfo info; |
223 TInt counter = 0; |
224 TInt counter = 0; |
224 TInt startPos = aStartPos; |
225 TInt startPos = aStartPos; |
241 test( bmErr == KErrCompletion ); |
242 test( bmErr == KErrCompletion ); |
242 TInt granularity; |
243 TInt granularity; |
243 |
244 |
244 TInt size; |
245 TInt size; |
245 r = testFile.Size(size); |
246 r = testFile.Size(size); |
246 test( r == KErrNone ); |
247 test_KErrNone(r); |
247 |
248 |
248 TBuf8<KReadBufferSize> buf1; |
249 TBuf8<KReadBufferSize> buf1; |
249 TBuf8<KReadBufferSize> buf2; |
250 TBuf8<KReadBufferSize> buf2; |
250 |
251 |
251 TBool changed; |
252 TBool changed; |
266 totalSegments += granularity; |
267 totalSegments += granularity; |
267 } |
268 } |
268 |
269 |
269 const TInt KTotalSegments = totalSegments; |
270 const TInt KTotalSegments = totalSegments; |
270 r = localDrive.Connect( localDriveNum, changed ); |
271 r = localDrive.Connect( localDriveNum, changed ); |
271 test( r == KErrNone ); |
272 test_KErrNone(r); |
272 |
273 |
273 // For each SBlockMapInfo object in RArray map |
274 // For each SBlockMapInfo object in RArray map |
274 for ( c = 0; c < map.Count(); c++ ) |
275 for ( c = 0; c < map.Count(); c++ ) |
275 { |
276 { |
276 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
277 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
298 if ( miniLength >= KReadBufferSize ) |
299 if ( miniLength >= KReadBufferSize ) |
299 { |
300 { |
300 testFile.Read( startPos + amountRead, buf1, KReadBufferSize ); |
301 testFile.Read( startPos + amountRead, buf1, KReadBufferSize ); |
301 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, KReadBufferSize, buf2); |
302 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, KReadBufferSize, buf2); |
302 r = buf1.Compare( buf2 ); |
303 r = buf1.Compare( buf2 ); |
303 test( r == 0 ); |
304 test_Value(r, r == 0 ); |
304 buf1.Zero(); |
305 buf1.Zero(); |
305 buf2.Zero(); |
306 buf2.Zero(); |
306 myCounter++; |
307 myCounter++; |
307 miniLength -= KReadBufferSize; |
308 miniLength -= KReadBufferSize; |
308 length -= KReadBufferSize; |
309 length -= KReadBufferSize; |
311 else |
312 else |
312 { |
313 { |
313 testFile.Read(startPos + amountRead, buf1, miniLength); |
314 testFile.Read(startPos + amountRead, buf1, miniLength); |
314 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, miniLength, buf2); |
315 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, miniLength, buf2); |
315 r = buf1.Compare( buf2 ); |
316 r = buf1.Compare( buf2 ); |
316 test( r == 0 ); |
317 test_Value(r, r == 0 ); |
317 amountRead += miniLength; |
318 amountRead += miniLength; |
318 length -= miniLength; |
319 length -= miniLength; |
319 miniLength = 0; |
320 miniLength = 0; |
320 } |
321 } |
321 } while ( miniLength != 0 && length != 0); |
322 } while ( miniLength != 0 && length != 0); |
333 // |
334 // |
334 { |
335 { |
335 TInt localDriveNum = 0; |
336 TInt localDriveNum = 0; |
336 RFile testFile; |
337 RFile testFile; |
337 TInt r = testFile.Open( TheFs, KTestFile, EFileRead ); |
338 TInt r = testFile.Open( TheFs, KTestFile, EFileRead ); |
338 test( r == KErrNone ); |
339 test_KErrNone(r); |
339 |
340 |
340 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
341 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
341 SBlockMapInfo info; |
342 SBlockMapInfo info; |
342 TInt counter = 0; |
343 TInt counter = 0; |
343 TInt startPos = aStartPos; |
344 TInt startPos = aStartPos; |
360 test( bmErr == KErrCompletion ); |
361 test( bmErr == KErrCompletion ); |
361 TInt granularity; |
362 TInt granularity; |
362 |
363 |
363 TInt size; |
364 TInt size; |
364 r = testFile.Size(size); |
365 r = testFile.Size(size); |
365 test( r == KErrNone ); |
366 test_KErrNone(r); |
366 |
367 |
367 TBuf8<KReadBufferSize> buf1; |
368 TBuf8<KReadBufferSize> buf1; |
368 TBuf8<KReadBufferSize> buf2; |
369 TBuf8<KReadBufferSize> buf2; |
369 |
370 |
370 TBool changed; |
371 TBool changed; |
382 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
383 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
383 granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
384 granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
384 totalSegments += granularity; |
385 totalSegments += granularity; |
385 } |
386 } |
386 r = localDrive.Connect( localDriveNum, changed ); |
387 r = localDrive.Connect( localDriveNum, changed ); |
387 test( r == KErrNone ); |
388 test_KErrNone(r); |
388 |
389 |
389 // For each SBlockMapInfo object in RArray map |
390 // For each SBlockMapInfo object in RArray map |
390 for ( c = 0; c < map.Count(); c++ ) |
391 for ( c = 0; c < map.Count(); c++ ) |
391 { |
392 { |
392 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
393 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
410 if ( miniLength >= KReadBufferSize ) |
411 if ( miniLength >= KReadBufferSize ) |
411 { |
412 { |
412 testFile.Read( startPos + amountRead, buf1, KReadBufferSize ); |
413 testFile.Read( startPos + amountRead, buf1, KReadBufferSize ); |
413 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, KReadBufferSize, buf2); |
414 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, KReadBufferSize, buf2); |
414 r = buf1.Compare( buf2 ); |
415 r = buf1.Compare( buf2 ); |
415 test( r == 0 ); |
416 test_Value(r, r == 0 ); |
416 buf1.Zero(); |
417 buf1.Zero(); |
417 buf2.Zero(); |
418 buf2.Zero(); |
418 myCounter++; |
419 myCounter++; |
419 miniLength -= KReadBufferSize; |
420 miniLength -= KReadBufferSize; |
420 length -= KReadBufferSize; |
421 length -= KReadBufferSize; |
423 else |
424 else |
424 { |
425 { |
425 testFile.Read(startPos + amountRead, buf1, miniLength); |
426 testFile.Read(startPos + amountRead, buf1, miniLength); |
426 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, miniLength, buf2); |
427 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, miniLength, buf2); |
427 r = buf1.Compare( buf2 ); |
428 r = buf1.Compare( buf2 ); |
428 test( r == 0 ); |
429 test_Value(r, r == 0 ); |
429 amountRead += miniLength; |
430 amountRead += miniLength; |
430 length -= miniLength; |
431 length -= miniLength; |
431 miniLength = 0; |
432 miniLength = 0; |
432 } |
433 } |
433 } while ( miniLength != 0 && length != 0); |
434 } while ( miniLength != 0 && length != 0); |
453 |
454 |
454 TInt r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
455 TInt r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
455 r = fMan->Delete(name); |
456 r = fMan->Delete(name); |
456 |
457 |
457 r = fMan->Copy(KTestFile, name); |
458 r = fMan->Copy(KTestFile, name); |
458 test( r == KErrNone || r == KErrAlreadyExists); |
459 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
459 |
460 |
460 TInt localDriveNum = 0; |
461 TInt localDriveNum = 0; |
461 RFile testFile; |
462 RFile testFile; |
462 r = testFile.Open( TheFs, name, EFileRead ); |
463 r = testFile.Open( TheFs, name, EFileRead ); |
463 test( r == KErrNone ); |
464 test_KErrNone(r); |
464 |
465 |
465 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
466 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
466 SBlockMapInfo info; |
467 SBlockMapInfo info; |
467 TInt counter = 0; |
468 TInt counter = 0; |
468 TInt startPos = aStartPos; |
469 TInt startPos = aStartPos; |
475 if (bmErr != 0 && bmErr != KErrCompletion) |
476 if (bmErr != 0 && bmErr != KErrCompletion) |
476 { |
477 { |
477 map.Close(); |
478 map.Close(); |
478 testFile.Close(); |
479 testFile.Close(); |
479 r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
480 r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
480 test( r == KErrNone ); |
481 test_KErrNone(r); |
481 r = fMan->Delete(name); |
482 r = fMan->Delete(name); |
482 test( r == KErrNone ); |
483 test_KErrNone(r); |
483 delete fMan; |
484 delete fMan; |
484 return bmErr; |
485 return bmErr; |
485 } |
486 } |
486 map.Append(info); |
487 map.Append(info); |
487 if (counter++ == 0) |
488 if (counter++ == 0) |
490 test( bmErr == KErrCompletion ); |
491 test( bmErr == KErrCompletion ); |
491 TInt granularity; |
492 TInt granularity; |
492 |
493 |
493 TInt size; |
494 TInt size; |
494 r = testFile.Size(size); |
495 r = testFile.Size(size); |
495 test( r == KErrNone ); |
496 test_KErrNone(r); |
496 |
497 |
497 TBuf8<KReadBufferSize> buf1; |
498 TBuf8<KReadBufferSize> buf1; |
498 TBuf8<KReadBufferSize> buf2; |
499 TBuf8<KReadBufferSize> buf2; |
499 |
500 |
500 TBool changed; |
501 TBool changed; |
518 } |
519 } |
519 |
520 |
520 const TInt KTotalSegments = totalSegments; |
521 const TInt KTotalSegments = totalSegments; |
521 |
522 |
522 r = localDrive.Connect( localDriveNum, changed ); |
523 r = localDrive.Connect( localDriveNum, changed ); |
523 test( r == KErrNone ); |
524 test_KErrNone(r); |
524 |
525 |
525 // For each SBlockMapInfo object in RArray map |
526 // For each SBlockMapInfo object in RArray map |
526 for ( c = 0; c < map.Count(); c++ ) |
527 for ( c = 0; c < map.Count(); c++ ) |
527 { |
528 { |
528 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
529 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
550 if ( miniLength >= KReadBufferSize ) |
551 if ( miniLength >= KReadBufferSize ) |
551 { |
552 { |
552 testFile.Read( startPos + amountRead, buf1, KReadBufferSize ); |
553 testFile.Read( startPos + amountRead, buf1, KReadBufferSize ); |
553 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, KReadBufferSize, buf2); |
554 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, KReadBufferSize, buf2); |
554 r = buf1.Compare( buf2 ); |
555 r = buf1.Compare( buf2 ); |
555 test( r == 0 ); |
556 test_Value(r, r == 0 ); |
556 buf1.Zero(); |
557 buf1.Zero(); |
557 buf2.Zero(); |
558 buf2.Zero(); |
558 myCounter++; |
559 myCounter++; |
559 miniLength -= KReadBufferSize; |
560 miniLength -= KReadBufferSize; |
560 length -= KReadBufferSize; |
561 length -= KReadBufferSize; |
563 else |
564 else |
564 { |
565 { |
565 testFile.Read(startPos + amountRead, buf1, miniLength); |
566 testFile.Read(startPos + amountRead, buf1, miniLength); |
566 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, miniLength, buf2); |
567 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, miniLength, buf2); |
567 r = buf1.Compare( buf2 ); |
568 r = buf1.Compare( buf2 ); |
568 test( r == 0 ); |
569 test_Value(r, r == 0 ); |
569 amountRead += miniLength; |
570 amountRead += miniLength; |
570 length -= miniLength; |
571 length -= miniLength; |
571 miniLength = 0; |
572 miniLength = 0; |
572 } |
573 } |
573 } while ( miniLength != 0 && length != 0); |
574 } while ( miniLength != 0 && length != 0); |
576 } |
577 } |
577 map.Close(); |
578 map.Close(); |
578 |
579 |
579 testFile.Close(); |
580 testFile.Close(); |
580 r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
581 r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
581 test( r == KErrNone ); |
582 test_KErrNone(r); |
582 r = fMan->Delete(name); |
583 r = fMan->Delete(name); |
583 test( r == KErrNone ); |
584 test_KErrNone(r); |
584 delete fMan; |
585 delete fMan; |
585 return bmErr; |
586 return bmErr; |
586 } |
587 } |
587 |
588 |
588 LOCAL_C TInt TestBlockMapRamFAT2(TInt64 aStartPos, TInt64 aEndPos) |
589 LOCAL_C TInt TestBlockMapRamFAT2(TInt64 aStartPos, TInt64 aEndPos) |
598 |
599 |
599 TInt r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
600 TInt r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
600 r = fMan->Delete(name); |
601 r = fMan->Delete(name); |
601 |
602 |
602 r = fMan->Copy(KTestFile, name); |
603 r = fMan->Copy(KTestFile, name); |
603 test( r == KErrNone || r == KErrAlreadyExists); |
604 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
604 |
605 |
605 RFile testFile; |
606 RFile testFile; |
606 r = testFile.Open( TheFs, name, EFileRead ); |
607 r = testFile.Open( TheFs, name, EFileRead ); |
607 test( r == KErrNone ); |
608 test_KErrNone(r); |
608 |
609 |
609 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
610 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
610 SBlockMapInfo info; |
611 SBlockMapInfo info; |
611 |
612 |
612 TInt bmErr; |
613 TInt bmErr; |
614 |
615 |
615 map.Close(); |
616 map.Close(); |
616 |
617 |
617 testFile.Close(); |
618 testFile.Close(); |
618 r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
619 r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
619 test( r == KErrNone ); |
620 test_KErrNone(r); |
620 r = fMan->Delete(name); |
621 r = fMan->Delete(name); |
621 test( r == KErrNone ); |
622 test_KErrNone(r); |
622 delete fMan; |
623 delete fMan; |
623 return bmErr; |
624 return bmErr; |
624 } |
625 } |
625 |
626 |
626 LOCAL_C TInt TestBlockMapRemovableFAT(TInt64 aStartPos, TInt64 aEndPos) |
627 LOCAL_C TInt TestBlockMapRemovableFAT(TInt64 aStartPos, TInt64 aEndPos) |
633 TFileName name(KDriveBase); |
634 TFileName name(KDriveBase); |
634 name[0] = TText('A' + RemovableFatDrive); |
635 name[0] = TText('A' + RemovableFatDrive); |
635 name.Append( KTestFileName ); |
636 name.Append( KTestFileName ); |
636 |
637 |
637 TInt r=fMan->Copy(KTestFile, name); |
638 TInt r=fMan->Copy(KTestFile, name); |
638 test( r == KErrNone || r == KErrAlreadyExists); |
639 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
639 |
640 |
640 RFile testFile; |
641 RFile testFile; |
641 r = testFile.Open( TheFs, name, EFileRead ); |
642 r = testFile.Open( TheFs, name, EFileRead ); |
642 test( r == KErrNone ); |
643 test_KErrNone(r); |
643 |
644 |
644 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
645 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
645 SBlockMapInfo info; |
646 SBlockMapInfo info; |
646 TInt bmErr = testFile.BlockMap(info, aStartPos, aEndPos, Pageable?EBlockMapUsagePaging:ETestDebug); |
647 TInt bmErr = testFile.BlockMap(info, aStartPos, aEndPos, Pageable?EBlockMapUsagePaging:ETestDebug); |
647 map.Close(); |
648 map.Close(); |
648 |
649 |
649 testFile.Close(); |
650 testFile.Close(); |
650 r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
651 r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
651 test( r == KErrNone ); |
652 test_KErrNone(r); |
652 r = fMan->Delete(name); |
653 r = fMan->Delete(name); |
653 test( r == KErrNone ); |
654 test_KErrNone(r); |
654 delete fMan; |
655 delete fMan; |
655 return bmErr; |
656 return bmErr; |
656 } |
657 } |
657 |
658 |
658 LOCAL_C TInt TestBlockMapInternalRemovableFAT(TInt64 aStartPos, TInt64 aEndPos) |
659 LOCAL_C TInt TestBlockMapInternalRemovableFAT(TInt64 aStartPos, TInt64 aEndPos) |
665 TFileName name(KDriveBase); |
666 TFileName name(KDriveBase); |
666 name[0] = TText('A' + RamFatDrive); |
667 name[0] = TText('A' + RamFatDrive); |
667 name.Append( KTestFileName ); |
668 name.Append( KTestFileName ); |
668 |
669 |
669 TInt r=fMan->Copy(KTestFile, name); |
670 TInt r=fMan->Copy(KTestFile, name); |
670 test( r == KErrNone || r == KErrAlreadyExists); |
671 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
671 |
672 |
672 TInt localDriveNum = 0; |
673 TInt localDriveNum = 0; |
673 RFile testFile; |
674 RFile testFile; |
674 r = testFile.Open( TheFs, name, EFileRead ); |
675 r = testFile.Open( TheFs, name, EFileRead ); |
675 test( r == KErrNone ); |
676 test_KErrNone(r); |
676 |
677 |
677 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
678 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
678 SBlockMapInfo info; |
679 SBlockMapInfo info; |
679 TInt counter = 0; |
680 TInt counter = 0; |
680 TInt startPos = aStartPos; |
681 TInt startPos = aStartPos; |
687 if (bmErr != 0 && bmErr != KErrCompletion) |
688 if (bmErr != 0 && bmErr != KErrCompletion) |
688 { |
689 { |
689 map.Close(); |
690 map.Close(); |
690 testFile.Close(); |
691 testFile.Close(); |
691 r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
692 r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
692 test( r == KErrNone ); |
693 test_KErrNone(r); |
693 r = fMan->Delete(name); |
694 r = fMan->Delete(name); |
694 test( r == KErrNone ); |
695 test_KErrNone(r); |
695 delete fMan; |
696 delete fMan; |
696 return bmErr; |
697 return bmErr; |
697 } |
698 } |
698 map.Append(info); |
699 map.Append(info); |
699 if (counter++ == 0) |
700 if (counter++ == 0) |
702 test( bmErr == KErrCompletion ); |
703 test( bmErr == KErrCompletion ); |
703 TInt granularity; |
704 TInt granularity; |
704 |
705 |
705 TInt size; |
706 TInt size; |
706 r = testFile.Size(size); |
707 r = testFile.Size(size); |
707 test( r == KErrNone ); |
708 test_KErrNone(r); |
708 |
709 |
709 TBuf8<KReadBufferSize> buf1; |
710 TBuf8<KReadBufferSize> buf1; |
710 TBuf8<KReadBufferSize> buf2; |
711 TBuf8<KReadBufferSize> buf2; |
711 |
712 |
712 TBool changed; |
713 TBool changed; |
730 } |
731 } |
731 |
732 |
732 const TInt KTotalSegments = totalSegments; |
733 const TInt KTotalSegments = totalSegments; |
733 |
734 |
734 r = localDrive.Connect( localDriveNum, changed ); |
735 r = localDrive.Connect( localDriveNum, changed ); |
735 test( r == KErrNone ); |
736 test_KErrNone(r); |
736 |
737 |
737 // For each SBlockMapInfo object in RArray map |
738 // For each SBlockMapInfo object in RArray map |
738 for ( c = 0; c < map.Count(); c++ ) |
739 for ( c = 0; c < map.Count(); c++ ) |
739 { |
740 { |
740 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
741 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
762 if ( miniLength >= KReadBufferSize ) |
763 if ( miniLength >= KReadBufferSize ) |
763 { |
764 { |
764 testFile.Read( startPos + amountRead, buf1, KReadBufferSize ); |
765 testFile.Read( startPos + amountRead, buf1, KReadBufferSize ); |
765 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, KReadBufferSize, buf2); |
766 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, KReadBufferSize, buf2); |
766 r = buf1.Compare( buf2 ); |
767 r = buf1.Compare( buf2 ); |
767 test( r == 0 ); |
768 test_Value(r, r == 0 ); |
768 buf1.Zero(); |
769 buf1.Zero(); |
769 buf2.Zero(); |
770 buf2.Zero(); |
770 myCounter++; |
771 myCounter++; |
771 miniLength -= KReadBufferSize; |
772 miniLength -= KReadBufferSize; |
772 length -= KReadBufferSize; |
773 length -= KReadBufferSize; |
775 else |
776 else |
776 { |
777 { |
777 testFile.Read(startPos + amountRead, buf1, miniLength); |
778 testFile.Read(startPos + amountRead, buf1, miniLength); |
778 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, miniLength, buf2); |
779 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, miniLength, buf2); |
779 r = buf1.Compare( buf2 ); |
780 r = buf1.Compare( buf2 ); |
780 test( r == 0 ); |
781 test_Value(r, r == 0 ); |
781 amountRead += miniLength; |
782 amountRead += miniLength; |
782 length -= miniLength; |
783 length -= miniLength; |
783 miniLength = 0; |
784 miniLength = 0; |
784 } |
785 } |
785 } while ( miniLength != 0 && length != 0); |
786 } while ( miniLength != 0 && length != 0); |
788 } |
789 } |
789 map.Close(); |
790 map.Close(); |
790 |
791 |
791 testFile.Close(); |
792 testFile.Close(); |
792 r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
793 r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
793 test( r == KErrNone ); |
794 test_KErrNone(r); |
794 r = fMan->Delete(name); |
795 r = fMan->Delete(name); |
795 test( r == KErrNone ); |
796 test_KErrNone(r); |
796 delete fMan; |
797 delete fMan; |
797 return bmErr; |
798 return bmErr; |
798 } |
799 } |
799 |
800 |
800 LOCAL_C TInt TestBlockMapFragmented(DriveType aDriveType, TInt64 aStartPos, TInt64 aEndPos) |
801 LOCAL_C TInt TestBlockMapFragmented(DriveType aDriveType, TInt64 aStartPos, TInt64 aEndPos) |
812 name[0] = TText('A' + InternalRemovableFatDrive); |
813 name[0] = TText('A' + InternalRemovableFatDrive); |
813 name.Append( KFragmentedFileName1 ); |
814 name.Append( KFragmentedFileName1 ); |
814 TInt localDriveNum = 0; |
815 TInt localDriveNum = 0; |
815 RFile testFile; |
816 RFile testFile; |
816 TInt r = testFile.Open( TheFs, name, EFileRead ); |
817 TInt r = testFile.Open( TheFs, name, EFileRead ); |
817 test( r == KErrNone ); |
818 test_KErrNone(r); |
818 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
819 RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
819 SBlockMapInfo info; |
820 SBlockMapInfo info; |
820 TInt counter = 0; |
821 TInt counter = 0; |
821 TInt startPos = aStartPos; |
822 TInt startPos = aStartPos; |
822 TInt bmErr; |
823 TInt bmErr; |
830 map.Close(); |
831 map.Close(); |
831 testFile.Close(); |
832 testFile.Close(); |
832 if ( Finished ) |
833 if ( Finished ) |
833 { |
834 { |
834 r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
835 r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
835 test( r == KErrNone ); |
836 test_KErrNone(r); |
836 r = fMan->Delete(name); |
837 r = fMan->Delete(name); |
837 test( r == KErrNone ); |
838 test_KErrNone(r); |
838 } |
839 } |
839 delete fMan; |
840 delete fMan; |
840 return bmErr; |
841 return bmErr; |
841 } |
842 } |
842 map.Append(info); |
843 map.Append(info); |
845 } while ( bmErr == 0 && bmErr != KErrCompletion ); |
846 } while ( bmErr == 0 && bmErr != KErrCompletion ); |
846 test( bmErr == KErrCompletion ); |
847 test( bmErr == KErrCompletion ); |
847 TInt granularity; |
848 TInt granularity; |
848 TInt size; |
849 TInt size; |
849 r = testFile.Size(size); |
850 r = testFile.Size(size); |
850 test( r == KErrNone ); |
851 test_KErrNone(r); |
851 |
852 |
852 TBuf8<KReadBufferSize> buf1; |
853 TBuf8<KReadBufferSize> buf1; |
853 TBuf8<KReadBufferSize> buf2; |
854 TBuf8<KReadBufferSize> buf2; |
854 |
855 |
855 TBool changed; |
856 TBool changed; |
872 totalSegments += granularity; |
873 totalSegments += granularity; |
873 } |
874 } |
874 |
875 |
875 const TInt KTotalSegments = totalSegments; |
876 const TInt KTotalSegments = totalSegments; |
876 r = localDrive.Connect( localDriveNum, changed ); |
877 r = localDrive.Connect( localDriveNum, changed ); |
877 test( r == KErrNone ); |
878 test_KErrNone(r); |
878 |
879 |
879 // For each SBlockMapInfo object in RArray map |
880 // For each SBlockMapInfo object in RArray map |
880 for ( c = 0; c < map.Count(); c++ ) |
881 for ( c = 0; c < map.Count(); c++ ) |
881 { |
882 { |
882 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
883 myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
904 if ( miniLength >= KReadBufferSize ) |
905 if ( miniLength >= KReadBufferSize ) |
905 { |
906 { |
906 testFile.Read( startPos + amountRead, buf1, KReadBufferSize ); |
907 testFile.Read( startPos + amountRead, buf1, KReadBufferSize ); |
907 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, KReadBufferSize, buf2); |
908 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, KReadBufferSize, buf2); |
908 r = buf1.Compare( buf2 ); |
909 r = buf1.Compare( buf2 ); |
909 test( r == 0 ); |
910 test_Value(r, r == 0 ); |
910 buf1.Zero(); |
911 buf1.Zero(); |
911 buf2.Zero(); |
912 buf2.Zero(); |
912 myCounter++; |
913 myCounter++; |
913 miniLength -= KReadBufferSize; |
914 miniLength -= KReadBufferSize; |
914 length -= KReadBufferSize; |
915 length -= KReadBufferSize; |
917 else |
918 else |
918 { |
919 { |
919 testFile.Read(startPos + amountRead, buf1, miniLength ); |
920 testFile.Read(startPos + amountRead, buf1, miniLength ); |
920 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, miniLength, buf2); |
921 localDrive.Read( map[c].iStartBlockAddress + myBlockMapEntry->iStartBlock * map[c].iBlockGranularity + (c2 == 1?map[c].iBlockStartOffset:0) + myCounter*KReadBufferSize, miniLength, buf2); |
921 r = buf1.Compare( buf2 ); |
922 r = buf1.Compare( buf2 ); |
922 test( r == 0 ); |
923 test_Value(r, r == 0 ); |
923 amountRead += miniLength; |
924 amountRead += miniLength; |
924 length -= miniLength; |
925 length -= miniLength; |
925 miniLength = 0; |
926 miniLength = 0; |
926 } |
927 } |
927 } while ( miniLength != 0 && length != 0); |
928 } while ( miniLength != 0 && length != 0); |
932 |
933 |
933 testFile.Close(); |
934 testFile.Close(); |
934 if ( Finished ) |
935 if ( Finished ) |
935 { |
936 { |
936 r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
937 r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
937 test( r == KErrNone ); |
938 test_KErrNone(r); |
938 r = fMan->Delete(name); |
939 r = fMan->Delete(name); |
939 test( r == KErrNone ); |
940 test_KErrNone(r); |
940 } |
941 } |
941 delete fMan; |
942 delete fMan; |
942 return bmErr; |
943 return bmErr; |
943 } |
944 } |
944 |
945 |
955 else |
956 else |
956 name1[0] = TText('A' + InternalRemovableFatDrive); |
957 name1[0] = TText('A' + InternalRemovableFatDrive); |
957 name1.Append( KFragmentedFileName1 ); |
958 name1.Append( KFragmentedFileName1 ); |
958 RFile file1; |
959 RFile file1; |
959 r = file1.Create(TheFs, name1, EFileWrite); |
960 r = file1.Create(TheFs, name1, EFileWrite); |
960 test( r == KErrNone ); |
961 test_KErrNone(r); |
961 file1.Close(); |
962 file1.Close(); |
962 |
963 |
963 TFileName name2(KDriveBase); |
964 TFileName name2(KDriveBase); |
964 if (aDriveType==EDriveRam) |
965 if (aDriveType==EDriveRam) |
965 name2[0] = TText('A' + RamFatDrive); |
966 name2[0] = TText('A' + RamFatDrive); |
970 else |
971 else |
971 name2[0] = TText('A' + InternalRemovableFatDrive); |
972 name2[0] = TText('A' + InternalRemovableFatDrive); |
972 name2.Append( KFragmentedFileName2 ); |
973 name2.Append( KFragmentedFileName2 ); |
973 RFile file2; |
974 RFile file2; |
974 r = file2.Create(TheFs, name2, EFileWrite); |
975 r = file2.Create(TheFs, name2, EFileWrite); |
975 test( r == KErrNone ); |
976 test_KErrNone(r); |
976 file2.Close(); |
977 file2.Close(); |
977 TInt64 randomSeed; |
978 TInt64 randomSeed; |
978 TBuf8<KMaxFragmentSize> tempBuf; |
979 TBuf8<KMaxFragmentSize> tempBuf; |
979 TUint8 *buf; |
980 TUint8 *buf; |
980 TInt fileSize = 0; |
981 TInt fileSize = 0; |
997 while (randomLength-- && fragmentSize++ < KMaxFragmentSize && fileSize++ < KMaxFileSize) |
998 while (randomLength-- && fragmentSize++ < KMaxFragmentSize && fileSize++ < KMaxFileSize) |
998 { |
999 { |
999 *buf++ = (TUint8)('A' + (Math::Rand(randomSeed) % ('Z' - 'A'))); |
1000 *buf++ = (TUint8)('A' + (Math::Rand(randomSeed) % ('Z' - 'A'))); |
1000 } |
1001 } |
1001 r = file1.Open( TheFs, name1, EFileWrite ); |
1002 r = file1.Open( TheFs, name1, EFileWrite ); |
1002 test( r == KErrNone ); |
1003 test_KErrNone(r); |
1003 r = file1.Seek( ESeekEnd, pos1 ); |
1004 r = file1.Seek( ESeekEnd, pos1 ); |
1004 test( r == KErrNone ); |
1005 test_KErrNone(r); |
1005 r = file1.Write( pos1, tempBuf ); |
1006 r = file1.Write( pos1, tempBuf ); |
1006 test( r == KErrNone ); |
1007 test_KErrNone(r); |
1007 r = file1.Flush(); |
1008 r = file1.Flush(); |
1008 test( r == KErrNone ); |
1009 test_KErrNone(r); |
1009 file1.Close(); |
1010 file1.Close(); |
1010 if ( mycount++ < 6 ) |
1011 if ( mycount++ < 6 ) |
1011 { |
1012 { |
1012 r = file2.Open( TheFs, name2, EFileWrite ); |
1013 r = file2.Open( TheFs, name2, EFileWrite ); |
1013 test( r == KErrNone ); |
1014 test_KErrNone(r); |
1014 r = file2.Seek( ESeekEnd, pos2 ); |
1015 r = file2.Seek( ESeekEnd, pos2 ); |
1015 test( r == KErrNone ); |
1016 test_KErrNone(r); |
1016 r = file2.Write( pos2, tempBuf ); |
1017 r = file2.Write( pos2, tempBuf ); |
1017 test( r == KErrNone ); |
1018 test_KErrNone(r); |
1018 r = file2.Flush(); |
1019 r = file2.Flush(); |
1019 test( r == KErrNone ); |
1020 test_KErrNone(r); |
1020 file2.Close(); |
1021 file2.Close(); |
1021 } |
1022 } |
1022 } while ( fileSize < KMaxFileSize ); |
1023 } while ( fileSize < KMaxFileSize ); |
1023 CFileMan* fMan=CFileMan::NewL(TheFs); |
1024 CFileMan* fMan=CFileMan::NewL(TheFs); |
1024 test(fMan!=NULL); |
1025 test(fMan!=NULL); |
1025 r = fMan->Delete(name2); |
1026 r = fMan->Delete(name2); |
1026 test( r == KErrNone ); |
1027 test_KErrNone(r); |
1027 delete fMan; |
1028 delete fMan; |
1028 } |
1029 } |
1029 |
1030 |
1030 LOCAL_C void FindDrive(DriveType aDriveType) |
1031 LOCAL_C void FindDrive(DriveType aDriveType) |
1031 { |
1032 { |
1035 { |
1036 { |
1036 TDriveInfo info; |
1037 TDriveInfo info; |
1037 TInt r = TheFs.Drive(info, i); |
1038 TInt r = TheFs.Drive(info, i); |
1038 if ( r != KErrNone ) |
1039 if ( r != KErrNone ) |
1039 continue; |
1040 continue; |
1040 test( r == KErrNone ); |
1041 test_KErrNone(r); |
1041 if ( aDriveType == EDriveNand ) |
1042 if ( aDriveType == EDriveNand ) |
1042 { |
1043 { |
1043 c++ == 0 ? test.Printf( _L("Searching for NAND drive.")) : test.Printf( _L(".")); |
1044 c++ == 0 ? test.Printf( _L("Searching for NAND drive.")) : test.Printf( _L(".")); |
1044 if ( info.iType == EMediaNANDFlash && ((info.iMediaAtt & KMediaAttWriteProtected) == 0) ) |
1045 if ( info.iType == EMediaNANDFlash && ((info.iMediaAtt & KMediaAttWriteProtected) == 0) ) |
1045 { |
1046 { |
1118 test.Start( _L("BlockMap Test\n") ); |
1119 test.Start( _L("BlockMap Test\n") ); |
1119 |
1120 |
1120 TInt testFileSize = 0; |
1121 TInt testFileSize = 0; |
1121 RFile testFile; |
1122 RFile testFile; |
1122 TInt r = testFile.Open(TheFs, KTestFile, EFileRead); |
1123 TInt r = testFile.Open(TheFs, KTestFile, EFileRead); |
1123 test(r==KErrNone); |
1124 test_KErrNone(r); |
1124 r = testFile.Size(testFileSize); |
1125 r = testFile.Size(testFileSize); |
1125 test(r==KErrNone); |
1126 test_KErrNone(r); |
1126 test(testFileSize>16384); |
1127 test(testFileSize>16384); |
1127 testFile.Close(); |
1128 testFile.Close(); |
1128 |
1129 |
1129 if ( gDriveToTest == 'C' ) |
1130 if ( gDriveToTest == 'C' ) |
1130 { |
1131 { |
1131 TInt value; |
1132 TInt value; |
1132 r = HAL::Get( HAL::EMachineUid, value ); |
1133 r = HAL::Get( HAL::EMachineUid, value ); |
1133 test( r == KErrNone ); |
1134 test_KErrNone(r); |
1134 if ( value != HAL::EMachineUid_Lubbock ) // Lubbock cannot run FindDrive as it doesn't support the NAND API |
1135 if ( value != HAL::EMachineUid_Lubbock ) // Lubbock cannot run FindDrive as it doesn't support the NAND API |
1135 { |
1136 { |
1136 test.Next(_L("Test BlockMap retrieval on NAND FAT.")); |
1137 test.Next(_L("Test BlockMap retrieval on NAND FAT.")); |
1137 FindDrive(EDriveNand); |
1138 FindDrive(EDriveNand); |
1138 if ( NandDrive > -1 ) // not finding a NAND drive isn't an error as only NAND builds have one |
1139 if ( NandDrive > -1 ) // not finding a NAND drive isn't an error as only NAND builds have one |
1139 { |
1140 { |
1140 r = TestBlockMapNandFATUserData(0, -1); |
1141 r = TestBlockMapNandFATUserData(0, -1); |
1141 test( r == KErrCompletion ); |
1142 test_Value(r, r == KErrCompletion ); |
1142 r = TestBlockMapNandFATUserData(1024, 4096); |
1143 r = TestBlockMapNandFATUserData(1024, 4096); |
1143 test( r == KErrCompletion ); |
1144 test_Value(r, r == KErrCompletion ); |
1144 r = TestBlockMapNandFATUserData(1020, 4100); |
1145 r = TestBlockMapNandFATUserData(1020, 4100); |
1145 test( r == KErrCompletion ); |
1146 test_Value(r, r == KErrCompletion ); |
1146 r = TestBlockMapNandFATUserData(1024, 4100); |
1147 r = TestBlockMapNandFATUserData(1024, 4100); |
1147 test( r == KErrCompletion ); |
1148 test_Value(r, r == KErrCompletion ); |
1148 r = TestBlockMapNandFATUserData(1020, 4096); |
1149 r = TestBlockMapNandFATUserData(1020, 4096); |
1149 test( r == KErrCompletion ); |
1150 test_Value(r, r == KErrCompletion ); |
1150 r = TestBlockMapNandFATUserData(1025, 1200); |
1151 r = TestBlockMapNandFATUserData(1025, 1200); |
1151 test( r == KErrCompletion ); |
1152 test_Value(r, r == KErrCompletion ); |
1152 r = TestBlockMapNandFATUserData(0, testFileSize+100); |
1153 r = TestBlockMapNandFATUserData(0, testFileSize+100); |
1153 test( r == KErrArgument ); |
1154 test_Value(r, r == KErrArgument ); |
1154 r = TestBlockMapNandFATUserData(-5, -1); |
1155 r = TestBlockMapNandFATUserData(-5, -1); |
1155 test( r == KErrArgument ); |
1156 test_Value(r, r == KErrArgument ); |
1156 r = TestBlockMapNandFATUserData(-5, testFileSize+100); |
1157 r = TestBlockMapNandFATUserData(-5, testFileSize+100); |
1157 test( r == KErrArgument ); |
1158 test_Value(r, r == KErrArgument ); |
1158 r = TestBlockMapNandFATUserData(0, 0); |
1159 r = TestBlockMapNandFATUserData(0, 0); |
1159 test( r == KErrArgument ); |
1160 test_Value(r, r == KErrArgument ); |
1160 r = TestBlockMapNandFATUserData(testFileSize, -1); |
1161 r = TestBlockMapNandFATUserData(testFileSize, -1); |
1161 test( r == KErrArgument ); |
1162 test_Value(r, r == KErrArgument ); |
1162 r = TestBlockMapNandFATUserData(0, -1); |
1163 r = TestBlockMapNandFATUserData(0, -1); |
1163 test( r == KErrCompletion ); |
1164 test_Value(r, r == KErrCompletion ); |
1164 r = TestBlockMapNandFATUserData(2000, 2001); |
1165 r = TestBlockMapNandFATUserData(2000, 2001); |
1165 test( r == KErrCompletion ); |
1166 test_Value(r, r == KErrCompletion ); |
1166 r = TestBlockMapNandFATUserData(0, 0); |
1167 r = TestBlockMapNandFATUserData(0, 0); |
1167 test( r == KErrArgument ); |
1168 test_Value(r, r == KErrArgument ); |
1168 r = TestBlockMapNandFATUserData(2000, 2000); |
1169 r = TestBlockMapNandFATUserData(2000, 2000); |
1169 test( r == KErrArgument ); |
1170 test_Value(r, r == KErrArgument ); |
1170 r = TestBlockMapNandFATUserData(2048, 2048); |
1171 r = TestBlockMapNandFATUserData(2048, 2048); |
1171 test( r == KErrArgument ); |
1172 test_Value(r, r == KErrArgument ); |
1172 test.Printf(_L("Generating Fragmented File...")); |
1173 test.Printf(_L("Generating Fragmented File...")); |
1173 GenerateFragmentedFiles(EDriveNand); |
1174 GenerateFragmentedFiles(EDriveNand); |
1174 test.Printf(_L("Done!\n")); |
1175 test.Printf(_L("Done!\n")); |
1175 test.Next(_L("Test BlockMap retrieval on NAND FAT (User area) (fragmented).")); |
1176 test.Next(_L("Test BlockMap retrieval on NAND FAT (User area) (fragmented).")); |
1176 r = TestBlockMapFragmented(EDriveNand, 0, -1); |
1177 r = TestBlockMapFragmented(EDriveNand, 0, -1); |
1177 test( r == KErrCompletion ); |
1178 test_Value(r, r == KErrCompletion ); |
1178 r = TestBlockMapFragmented(EDriveNand, 1024, 4096); |
1179 r = TestBlockMapFragmented(EDriveNand, 1024, 4096); |
1179 test( r == KErrCompletion ); |
1180 test_Value(r, r == KErrCompletion ); |
1180 r = TestBlockMapFragmented(EDriveNand, 1020, 4100); |
1181 r = TestBlockMapFragmented(EDriveNand, 1020, 4100); |
1181 test( r == KErrCompletion ); |
1182 test_Value(r, r == KErrCompletion ); |
1182 r = TestBlockMapFragmented(EDriveNand, 1024, 4100); |
1183 r = TestBlockMapFragmented(EDriveNand, 1024, 4100); |
1183 test( r == KErrCompletion ); |
1184 test_Value(r, r == KErrCompletion ); |
1184 r = TestBlockMapFragmented(EDriveNand, 1020, 4096); |
1185 r = TestBlockMapFragmented(EDriveNand, 1020, 4096); |
1185 test( r == KErrCompletion ); |
1186 test_Value(r, r == KErrCompletion ); |
1186 r = TestBlockMapFragmented(EDriveNand, 1025, 1200); |
1187 r = TestBlockMapFragmented(EDriveNand, 1025, 1200); |
1187 test( r == KErrCompletion ); |
1188 test_Value(r, r == KErrCompletion ); |
1188 r = TestBlockMapFragmented(EDriveNand, 0, testFileSize+100); |
1189 r = TestBlockMapFragmented(EDriveNand, 0, testFileSize+100); |
1189 test( r == KErrArgument ); |
1190 test_Value(r, r == KErrArgument ); |
1190 r = TestBlockMapFragmented(EDriveNand, -5, -1); |
1191 r = TestBlockMapFragmented(EDriveNand, -5, -1); |
1191 test( r == KErrArgument ); |
1192 test_Value(r, r == KErrArgument ); |
1192 r = TestBlockMapFragmented(EDriveNand, -5, testFileSize+100); |
1193 r = TestBlockMapFragmented(EDriveNand, -5, testFileSize+100); |
1193 test( r == KErrArgument ); |
1194 test_Value(r, r == KErrArgument ); |
1194 r = TestBlockMapFragmented(EDriveNand, 0, 0); |
1195 r = TestBlockMapFragmented(EDriveNand, 0, 0); |
1195 test( r == KErrArgument ); |
1196 test_Value(r, r == KErrArgument ); |
1196 r = TestBlockMapFragmented(EDriveNand, testFileSize, -1); |
1197 r = TestBlockMapFragmented(EDriveNand, testFileSize, -1); |
1197 test( r == KErrArgument ); |
1198 test_Value(r, r == KErrArgument ); |
1198 r = TestBlockMapFragmented(EDriveNand, 0, -1); |
1199 r = TestBlockMapFragmented(EDriveNand, 0, -1); |
1199 test( r == KErrCompletion ); |
1200 test_Value(r, r == KErrCompletion ); |
1200 r = TestBlockMapFragmented(EDriveNand, 2000, 2001); |
1201 r = TestBlockMapFragmented(EDriveNand, 2000, 2001); |
1201 test( r == KErrCompletion ); |
1202 test_Value(r, r == KErrCompletion ); |
1202 r = TestBlockMapFragmented(EDriveNand, 0, 0); |
1203 r = TestBlockMapFragmented(EDriveNand, 0, 0); |
1203 test( r == KErrArgument ); |
1204 test_Value(r, r == KErrArgument ); |
1204 r = TestBlockMapFragmented(EDriveNand, 2000, 2000); |
1205 r = TestBlockMapFragmented(EDriveNand, 2000, 2000); |
1205 test( r == KErrArgument ); |
1206 test_Value(r, r == KErrArgument ); |
1206 Finished = ETrue; |
1207 Finished = ETrue; |
1207 r = TestBlockMapFragmented(EDriveNand, 2048, 2048); |
1208 r = TestBlockMapFragmented(EDriveNand, 2048, 2048); |
1208 test( r == KErrArgument ); |
1209 test_Value(r, r == KErrArgument ); |
1209 test.Next(_L("Test BlockMap retrieval on NAND FAT.")); |
1210 test.Next(_L("Test BlockMap retrieval on NAND FAT.")); |
1210 r = TestBlockMapNandFAT(0, -1); |
1211 r = TestBlockMapNandFAT(0, -1); |
1211 test( r == KErrCompletion ); |
1212 test_Value(r, r == KErrCompletion ); |
1212 r = TestBlockMapNandFAT(1024, 4096); |
1213 r = TestBlockMapNandFAT(1024, 4096); |
1213 test( r == KErrCompletion ); |
1214 test_Value(r, r == KErrCompletion ); |
1214 r = TestBlockMapNandFAT(1020, 4100); |
1215 r = TestBlockMapNandFAT(1020, 4100); |
1215 test( r == KErrCompletion ); |
1216 test_Value(r, r == KErrCompletion ); |
1216 r = TestBlockMapNandFAT(1024, 4100); |
1217 r = TestBlockMapNandFAT(1024, 4100); |
1217 test( r == KErrCompletion ); |
1218 test_Value(r, r == KErrCompletion ); |
1218 r = TestBlockMapNandFAT(1020, 4096); |
1219 r = TestBlockMapNandFAT(1020, 4096); |
1219 test( r == KErrCompletion ); |
1220 test_Value(r, r == KErrCompletion ); |
1220 r = TestBlockMapNandFAT(1025, 1200); |
1221 r = TestBlockMapNandFAT(1025, 1200); |
1221 test( r == KErrCompletion ); |
1222 test_Value(r, r == KErrCompletion ); |
1222 r = TestBlockMapNandFAT(0, testFileSize+100); |
1223 r = TestBlockMapNandFAT(0, testFileSize+100); |
1223 test( r == KErrArgument ); |
1224 test_Value(r, r == KErrArgument ); |
1224 r = TestBlockMapNandFAT(-5, -1); |
1225 r = TestBlockMapNandFAT(-5, -1); |
1225 test( r == KErrArgument ); |
1226 test_Value(r, r == KErrArgument ); |
1226 r = TestBlockMapNandFAT(-5, testFileSize+100); |
1227 r = TestBlockMapNandFAT(-5, testFileSize+100); |
1227 test( r == KErrArgument ); |
1228 test_Value(r, r == KErrArgument ); |
1228 r = TestBlockMapNandFAT(0, 0); |
1229 r = TestBlockMapNandFAT(0, 0); |
1229 test( r == KErrArgument ); |
1230 test_Value(r, r == KErrArgument ); |
1230 r = TestBlockMapNandFAT(testFileSize, -1); |
1231 r = TestBlockMapNandFAT(testFileSize, -1); |
1231 test( r == KErrArgument ); |
1232 test_Value(r, r == KErrArgument ); |
1232 r = TestBlockMapNandFAT(0, -1); |
1233 r = TestBlockMapNandFAT(0, -1); |
1233 test( r == KErrCompletion ); |
1234 test_Value(r, r == KErrCompletion ); |
1234 r = TestBlockMapNandFAT(2000, 2001); |
1235 r = TestBlockMapNandFAT(2000, 2001); |
1235 test( r == KErrCompletion ); |
1236 test_Value(r, r == KErrCompletion ); |
1236 r = TestBlockMapNandFAT(0, 0); |
1237 r = TestBlockMapNandFAT(0, 0); |
1237 test( r == KErrArgument ); |
1238 test_Value(r, r == KErrArgument ); |
1238 r = TestBlockMapNandFAT(2000, 2000); |
1239 r = TestBlockMapNandFAT(2000, 2000); |
1239 test( r == KErrArgument ); |
1240 test_Value(r, r == KErrArgument ); |
1240 r = TestBlockMapNandFAT(2048, 2048); |
1241 r = TestBlockMapNandFAT(2048, 2048); |
1241 test( r == KErrArgument ); |
1242 test_Value(r, r == KErrArgument ); |
1242 test.Next(_L("Test BlockMap retrieval on NAND ROFS.")); |
1243 test.Next(_L("Test BlockMap retrieval on NAND ROFS.")); |
1243 r = TestBlockMapNandROFS(0, -1); |
1244 r = TestBlockMapNandROFS(0, -1); |
1244 test( r == KErrCompletion ); |
1245 test_Value(r, r == KErrCompletion ); |
1245 r = TestBlockMapNandROFS(1024, 4096); |
1246 r = TestBlockMapNandROFS(1024, 4096); |
1246 test( r == KErrCompletion ); |
1247 test_Value(r, r == KErrCompletion ); |
1247 r = TestBlockMapNandROFS(1020, 4100); |
1248 r = TestBlockMapNandROFS(1020, 4100); |
1248 test( r == KErrCompletion ); |
1249 test_Value(r, r == KErrCompletion ); |
1249 r = TestBlockMapNandROFS(1024, 4100); |
1250 r = TestBlockMapNandROFS(1024, 4100); |
1250 test( r == KErrCompletion ); |
1251 test_Value(r, r == KErrCompletion ); |
1251 r = TestBlockMapNandROFS(1020, 4096); |
1252 r = TestBlockMapNandROFS(1020, 4096); |
1252 test( r == KErrCompletion ); |
1253 test_Value(r, r == KErrCompletion ); |
1253 r = TestBlockMapNandROFS(1025, 1200); |
1254 r = TestBlockMapNandROFS(1025, 1200); |
1254 test( r == KErrCompletion ); |
1255 test_Value(r, r == KErrCompletion ); |
1255 r = TestBlockMapNandROFS(0, testFileSize+100); |
1256 r = TestBlockMapNandROFS(0, testFileSize+100); |
1256 test( r == KErrArgument ); |
1257 test_Value(r, r == KErrArgument ); |
1257 r = TestBlockMapNandROFS(-5, -1); |
1258 r = TestBlockMapNandROFS(-5, -1); |
1258 test( r == KErrArgument ); |
1259 test_Value(r, r == KErrArgument ); |
1259 r = TestBlockMapNandROFS(-5, testFileSize+100); |
1260 r = TestBlockMapNandROFS(-5, testFileSize+100); |
1260 test( r == KErrArgument ); |
1261 test_Value(r, r == KErrArgument ); |
1261 r = TestBlockMapNandROFS(0, 0); |
1262 r = TestBlockMapNandROFS(0, 0); |
1262 test( r == KErrArgument ); |
1263 test_Value(r, r == KErrArgument ); |
1263 r = TestBlockMapNandROFS(testFileSize, -1); |
1264 r = TestBlockMapNandROFS(testFileSize, -1); |
1264 test( r == KErrArgument ); |
1265 test_Value(r, r == KErrArgument ); |
1265 r = TestBlockMapNandROFS(0, -1); |
1266 r = TestBlockMapNandROFS(0, -1); |
1266 test( r == KErrCompletion ); |
1267 test_Value(r, r == KErrCompletion ); |
1267 r = TestBlockMapNandROFS(2000, 2001); |
1268 r = TestBlockMapNandROFS(2000, 2001); |
1268 test( r == KErrCompletion ); |
1269 test_Value(r, r == KErrCompletion ); |
1269 r = TestBlockMapNandROFS(0, 0); |
1270 r = TestBlockMapNandROFS(0, 0); |
1270 test( r == KErrArgument ); |
1271 test_Value(r, r == KErrArgument ); |
1271 r = TestBlockMapNandROFS(2000, 2000); |
1272 r = TestBlockMapNandROFS(2000, 2000); |
1272 test( r == KErrArgument ); |
1273 test_Value(r, r == KErrArgument ); |
1273 r = TestBlockMapNandROFS(2048, 2048); |
1274 r = TestBlockMapNandROFS(2048, 2048); |
1274 test( r == KErrArgument ); |
1275 test_Value(r, r == KErrArgument ); |
1275 test.Next(_L("Test BlockMap retrieval on RAM FAT.")); |
1276 test.Next(_L("Test BlockMap retrieval on RAM FAT.")); |
1276 FindDrive(EDriveRam); |
1277 FindDrive(EDriveRam); |
1277 test( RamFatDrive > -1 ); |
1278 test( RamFatDrive > -1 ); |
1278 r = TestBlockMapRamFAT(0, -1); |
1279 r = TestBlockMapRamFAT(0, -1); |
1279 test( r == KErrCompletion ); |
1280 test_Value(r, r == KErrCompletion ); |
1280 r = TestBlockMapRamFAT(1024, 4096); |
1281 r = TestBlockMapRamFAT(1024, 4096); |
1281 test( r == KErrCompletion ); |
1282 test_Value(r, r == KErrCompletion ); |
1282 r = TestBlockMapRamFAT(1020, 4100); |
1283 r = TestBlockMapRamFAT(1020, 4100); |
1283 test( r == KErrCompletion ); |
1284 test_Value(r, r == KErrCompletion ); |
1284 r = TestBlockMapRamFAT(1024, 4100); |
1285 r = TestBlockMapRamFAT(1024, 4100); |
1285 test( r == KErrCompletion ); |
1286 test_Value(r, r == KErrCompletion ); |
1286 r = TestBlockMapRamFAT(1020, 4096); |
1287 r = TestBlockMapRamFAT(1020, 4096); |
1287 test( r == KErrCompletion ); |
1288 test_Value(r, r == KErrCompletion ); |
1288 r = TestBlockMapRamFAT(1025, 1200); |
1289 r = TestBlockMapRamFAT(1025, 1200); |
1289 test( r == KErrCompletion ); |
1290 test_Value(r, r == KErrCompletion ); |
1290 r = TestBlockMapRamFAT(0, testFileSize+100); |
1291 r = TestBlockMapRamFAT(0, testFileSize+100); |
1291 test( r == KErrArgument ); |
1292 test_Value(r, r == KErrArgument ); |
1292 r = TestBlockMapRamFAT(-5, -1); |
1293 r = TestBlockMapRamFAT(-5, -1); |
1293 test( r == KErrArgument ); |
1294 test_Value(r, r == KErrArgument ); |
1294 r = TestBlockMapRamFAT(-5, testFileSize+100); |
1295 r = TestBlockMapRamFAT(-5, testFileSize+100); |
1295 test( r == KErrArgument ); |
1296 test_Value(r, r == KErrArgument ); |
1296 r = TestBlockMapRamFAT(0, 0); |
1297 r = TestBlockMapRamFAT(0, 0); |
1297 test( r == KErrArgument ); |
1298 test_Value(r, r == KErrArgument ); |
1298 r = TestBlockMapRamFAT(testFileSize, -1); |
1299 r = TestBlockMapRamFAT(testFileSize, -1); |
1299 test( r == KErrArgument ); |
1300 test_Value(r, r == KErrArgument ); |
1300 r = TestBlockMapRamFAT(0, -1); |
1301 r = TestBlockMapRamFAT(0, -1); |
1301 test( r == KErrCompletion ); |
1302 test_Value(r, r == KErrCompletion ); |
1302 r = TestBlockMapRamFAT(2000, 2001); |
1303 r = TestBlockMapRamFAT(2000, 2001); |
1303 test( r == KErrCompletion ); |
1304 test_Value(r, r == KErrCompletion ); |
1304 r = TestBlockMapRamFAT(0, 0); |
1305 r = TestBlockMapRamFAT(0, 0); |
1305 test( r == KErrArgument ); |
1306 test_Value(r, r == KErrArgument ); |
1306 r = TestBlockMapRamFAT(2000, 2000); |
1307 r = TestBlockMapRamFAT(2000, 2000); |
1307 test( r == KErrArgument ); |
1308 test_Value(r, r == KErrArgument ); |
1308 r = TestBlockMapRamFAT(2048, 2048); |
1309 r = TestBlockMapRamFAT(2048, 2048); |
1309 test( r == KErrArgument ); |
1310 test_Value(r, r == KErrArgument ); |
1310 test.Next(_L("Test BlockMap retrieval on Ram FAT (2).")); |
1311 test.Next(_L("Test BlockMap retrieval on Ram FAT (2).")); |
1311 r = TestBlockMapRamFAT2(0, -1); |
1312 r = TestBlockMapRamFAT2(0, -1); |
1312 test( r == KErrNotSupported ); |
1313 test_Value(r, r == KErrNotSupported ); |
1313 FindDrive(EDriveRemovable); |
1314 FindDrive(EDriveRemovable); |
1314 if ( RemovableFatDrive > -1) |
1315 if ( RemovableFatDrive > -1) |
1315 { |
1316 { |
1316 test.Next(_L("Test BlockMap retrieval on removable FAT.")); |
1317 test.Next(_L("Test BlockMap retrieval on removable FAT.")); |
1317 r = TestBlockMapRemovableFAT(0, -1); |
1318 r = TestBlockMapRemovableFAT(0, -1); |
1318 Pageable?test( r == KErrNotSupported ):test( r == KErrCompletion ); |
1319 test_Value(r, r == Pageable ? KErrNotSupported : KErrCompletion); |
1319 } |
1320 } |
1320 else |
1321 else |
1321 { |
1322 { |
1322 test.Next(_L("Test BlockMap retrieval on internal removable FAT.")); |
1323 test.Next(_L("Test BlockMap retrieval on internal removable FAT.")); |
1323 FindDrive(EDriveInternalRemovable); |
1324 FindDrive(EDriveInternalRemovable); |
1324 test( InternalRemovableFatDrive > -1); |
1325 test( InternalRemovableFatDrive > -1); |
1325 r = TestBlockMapInternalRemovableFAT(0, -1); |
1326 r = TestBlockMapInternalRemovableFAT(0, -1); |
1326 test( r == KErrCompletion ); |
1327 test_Value(r, r == KErrCompletion ); |
1327 r = TestBlockMapInternalRemovableFAT(1024, 4096); |
1328 r = TestBlockMapInternalRemovableFAT(1024, 4096); |
1328 test( r == KErrCompletion ); |
1329 test_Value(r, r == KErrCompletion ); |
1329 r = TestBlockMapInternalRemovableFAT(1020, 4100); |
1330 r = TestBlockMapInternalRemovableFAT(1020, 4100); |
1330 test( r == KErrCompletion ); |
1331 test_Value(r, r == KErrCompletion ); |
1331 r = TestBlockMapInternalRemovableFAT(1024, 4100); |
1332 r = TestBlockMapInternalRemovableFAT(1024, 4100); |
1332 test( r == KErrCompletion ); |
1333 test_Value(r, r == KErrCompletion ); |
1333 r = TestBlockMapInternalRemovableFAT(1020, 4096); |
1334 r = TestBlockMapInternalRemovableFAT(1020, 4096); |
1334 test( r == KErrCompletion ); |
1335 test_Value(r, r == KErrCompletion ); |
1335 r = TestBlockMapInternalRemovableFAT(1025, 1200); |
1336 r = TestBlockMapInternalRemovableFAT(1025, 1200); |
1336 test( r == KErrCompletion ); |
1337 test_Value(r, r == KErrCompletion ); |
1337 r = TestBlockMapInternalRemovableFAT(0, testFileSize+100); |
1338 r = TestBlockMapInternalRemovableFAT(0, testFileSize+100); |
1338 test( r == KErrArgument ); |
1339 test_Value(r, r == KErrArgument ); |
1339 r = TestBlockMapInternalRemovableFAT(-5, -1); |
1340 r = TestBlockMapInternalRemovableFAT(-5, -1); |
1340 test( r == KErrArgument ); |
1341 test_Value(r, r == KErrArgument ); |
1341 r = TestBlockMapInternalRemovableFAT(-5, testFileSize+100); |
1342 r = TestBlockMapInternalRemovableFAT(-5, testFileSize+100); |
1342 test( r == KErrArgument ); |
1343 test_Value(r, r == KErrArgument ); |
1343 r = TestBlockMapInternalRemovableFAT(0, 0); |
1344 r = TestBlockMapInternalRemovableFAT(0, 0); |
1344 test( r == KErrArgument ); |
1345 test_Value(r, r == KErrArgument ); |
1345 r = TestBlockMapInternalRemovableFAT(testFileSize, -1); |
1346 r = TestBlockMapInternalRemovableFAT(testFileSize, -1); |
1346 test( r == KErrArgument ); |
1347 test_Value(r, r == KErrArgument ); |
1347 r = TestBlockMapInternalRemovableFAT(0, -1); |
1348 r = TestBlockMapInternalRemovableFAT(0, -1); |
1348 test( r == KErrCompletion ); |
1349 test_Value(r, r == KErrCompletion ); |
1349 r = TestBlockMapInternalRemovableFAT(2000, 2001); |
1350 r = TestBlockMapInternalRemovableFAT(2000, 2001); |
1350 test( r == KErrCompletion ); |
1351 test_Value(r, r == KErrCompletion ); |
1351 r = TestBlockMapInternalRemovableFAT(0, 0); |
1352 r = TestBlockMapInternalRemovableFAT(0, 0); |
1352 test( r == KErrArgument ); |
1353 test_Value(r, r == KErrArgument ); |
1353 r = TestBlockMapInternalRemovableFAT(2000, 2000); |
1354 r = TestBlockMapInternalRemovableFAT(2000, 2000); |
1354 test( r == KErrArgument ); |
1355 test_Value(r, r == KErrArgument ); |
1355 r = TestBlockMapInternalRemovableFAT(2048, 2048); |
1356 r = TestBlockMapInternalRemovableFAT(2048, 2048); |
1356 test( r == KErrArgument ); |
1357 test_Value(r, r == KErrArgument ); |
1357 } |
1358 } |
1358 test.Next(_L("Test BlockMap retrieval on Ram FAT (fragmented).")); |
1359 test.Next(_L("Test BlockMap retrieval on Ram FAT (fragmented).")); |
1359 test.Printf(_L("Generating Fragmented File...")); |
1360 test.Printf(_L("Generating Fragmented File...")); |
1360 GenerateFragmentedFiles(EDriveRam); |
1361 GenerateFragmentedFiles(EDriveRam); |
1361 test.Printf(_L("Done!\n")); |
1362 test.Printf(_L("Done!\n")); |
1362 Finished = EFalse; |
1363 Finished = EFalse; |
1363 r = TestBlockMapFragmented(EDriveRam, 0, -1); |
1364 r = TestBlockMapFragmented(EDriveRam, 0, -1); |
1364 test( r == KErrCompletion ); |
1365 test_Value(r, r == KErrCompletion ); |
1365 r = TestBlockMapFragmented(EDriveRam, 1020, 4100); |
1366 r = TestBlockMapFragmented(EDriveRam, 1020, 4100); |
1366 test( r == KErrCompletion ); |
1367 test_Value(r, r == KErrCompletion ); |
1367 r = TestBlockMapFragmented(EDriveRam, 2049, 4096); |
1368 r = TestBlockMapFragmented(EDriveRam, 2049, 4096); |
1368 test( r == KErrCompletion ); |
1369 test_Value(r, r == KErrCompletion ); |
1369 r = TestBlockMapFragmented(EDriveRam, 1024, 4100); |
1370 r = TestBlockMapFragmented(EDriveRam, 1024, 4100); |
1370 test( r == KErrCompletion ); |
1371 test_Value(r, r == KErrCompletion ); |
1371 r = TestBlockMapFragmented(EDriveRam, 1020, 4096); |
1372 r = TestBlockMapFragmented(EDriveRam, 1020, 4096); |
1372 test( r == KErrCompletion ); |
1373 test_Value(r, r == KErrCompletion ); |
1373 r = TestBlockMapFragmented(EDriveRam, 1025, 1200); |
1374 r = TestBlockMapFragmented(EDriveRam, 1025, 1200); |
1374 test( r == KErrCompletion ); |
1375 test_Value(r, r == KErrCompletion ); |
1375 r = TestBlockMapFragmented(EDriveRam, 0, testFileSize+100); |
1376 r = TestBlockMapFragmented(EDriveRam, 0, testFileSize+100); |
1376 test( r == KErrArgument ); |
1377 test_Value(r, r == KErrArgument ); |
1377 r = TestBlockMapFragmented(EDriveRam, -5, -1); |
1378 r = TestBlockMapFragmented(EDriveRam, -5, -1); |
1378 test( r == KErrArgument ); |
1379 test_Value(r, r == KErrArgument ); |
1379 r = TestBlockMapFragmented(EDriveRam, -5, testFileSize+100); |
1380 r = TestBlockMapFragmented(EDriveRam, -5, testFileSize+100); |
1380 test( r == KErrArgument ); |
1381 test_Value(r, r == KErrArgument ); |
1381 r = TestBlockMapFragmented(EDriveRam, 0, 0); |
1382 r = TestBlockMapFragmented(EDriveRam, 0, 0); |
1382 test( r == KErrArgument ); |
1383 test_Value(r, r == KErrArgument ); |
1383 r = TestBlockMapFragmented(EDriveRam, testFileSize, -1); |
1384 r = TestBlockMapFragmented(EDriveRam, testFileSize, -1); |
1384 test( r == KErrArgument ); |
1385 test_Value(r, r == KErrArgument ); |
1385 r = TestBlockMapFragmented(EDriveRam, 0, -1); |
1386 r = TestBlockMapFragmented(EDriveRam, 0, -1); |
1386 test( r == KErrCompletion ); |
1387 test_Value(r, r == KErrCompletion ); |
1387 r = TestBlockMapFragmented(EDriveRam, 2000, 2001); |
1388 r = TestBlockMapFragmented(EDriveRam, 2000, 2001); |
1388 test( r == KErrCompletion ); |
1389 test_Value(r, r == KErrCompletion ); |
1389 r = TestBlockMapFragmented(EDriveRam, 0, 0); |
1390 r = TestBlockMapFragmented(EDriveRam, 0, 0); |
1390 test( r == KErrArgument ); |
1391 test_Value(r, r == KErrArgument ); |
1391 r = TestBlockMapFragmented(EDriveRam, 2000, 2000); |
1392 r = TestBlockMapFragmented(EDriveRam, 2000, 2000); |
1392 test( r == KErrArgument ); |
1393 test_Value(r, r == KErrArgument ); |
1393 Finished = ETrue; |
1394 Finished = ETrue; |
1394 r = TestBlockMapFragmented(EDriveRam, 2048, 2048); |
1395 r = TestBlockMapFragmented(EDriveRam, 2048, 2048); |
1395 test( r == KErrArgument ); |
1396 test_Value(r, r == KErrArgument ); |
1396 } |
1397 } |
1397 else |
1398 else |
1398 { |
1399 { |
1399 test.Printf( _L("NAND drive not found, skipping test.\n") ); |
1400 test.Printf( _L("NAND drive not found, skipping test.\n") ); |
1400 } |
1401 } |