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