author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 25 May 2010 14:09:55 +0300 | |
branch | RCL_3 |
changeset 28 | 5b5d147c7838 |
parent 6 | 0173bcd7697c |
child 43 | c1f20ce4abcf |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// Tests for the blockmap API. The blockmap API enumerates the resources |
|
15 |
// used by a file depending upon the type of media on which the file |
|
16 |
// resides. |
|
17 |
// 002 Test Initialise error checking |
|
18 |
// 003 Test processing of user-side block map into extent list |
|
19 |
// 004 Test processing of user-side block map into extent list, block size > read unit size |
|
20 |
// 005 Test Read error checking |
|
21 |
// 006 Test Read |
|
22 |
// Test BlockMap API functionality. |
|
23 |
// |
|
24 |
// |
|
25 |
||
26 |
//! @SYMTestCaseID KBASE-T_BLOCKMAP-0337 |
|
27 |
//! @SYMTestType UT |
|
28 |
//! @SYMPREQ PREQ1110 |
|
29 |
//! @SYMTestCaseDesc Demand Paging Blockmap tests |
|
30 |
//! @SYMTestActions 001 Unit tests the TKernBlockMap class |
|
31 |
//! @SYMTestExpectedResults All tests should pass. |
|
32 |
//! @SYMTestPriority High |
|
33 |
//! @SYMTestStatus Implemented |
|
34 |
||
35 |
||
36 |
#include <e32test.h> |
|
6
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
37 |
#include <e32svr.h> |
0 | 38 |
#include <f32file.h> |
39 |
#include <e32math.h> |
|
40 |
#include <hal.h> |
|
41 |
#include "t_server.h" |
|
42 |
||
43 |
RTest test( _L("T_BLOCKMAP") ); |
|
44 |
||
45 |
const TInt KReadBufferSize = 1024; |
|
46 |
const TInt KMaxFragmentSize = 400; |
|
47 |
const TInt KMaxFileSize = 10000; |
|
48 |
||
49 |
TInt RamFatDrive = -1; |
|
50 |
TInt RemovableFatDrive = -1; |
|
51 |
TInt InternalRemovableFatDrive = -1; |
|
52 |
TInt NandDrive = -1; |
|
53 |
TBool Pageable = EFalse; |
|
54 |
TBool Finished = EFalse; |
|
55 |
||
56 |
enum DriveType |
|
57 |
{ |
|
58 |
EDriveNand, |
|
59 |
EDriveRam, |
|
60 |
EDriveRemovable, |
|
61 |
EDriveInternalRemovable |
|
62 |
}; |
|
63 |
||
64 |
_LIT( KTestFile, "Z:\\TEST\\T_FILE.CPP"); |
|
65 |
_LIT( KTestFileFAT, "Z:\\Multiple\\T_file.cpp"); |
|
66 |
_LIT( KTestFileName, "T_FILE.CPP"); |
|
67 |
_LIT( KFragmentedFileName1, "FRAG1.TXT"); |
|
68 |
_LIT( KFragmentedFileName2, "FRAG2.TXT"); |
|
69 |
_LIT( KDriveBase, " :\\" ); |
|
70 |
||
71 |
LOCAL_C TInt TestBlockMapNandFATUserData(TInt64 aStartPos, TInt64 aEndPos) |
|
72 |
{ |
|
73 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
74 |
test(fMan!=NULL); |
|
75 |
TFileName name(KDriveBase); |
|
76 |
name[0] = TText('A' + NandDrive); |
|
77 |
name.Append( KTestFileName ); |
|
78 |
||
79 |
TInt r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
|
80 |
r = fMan->Delete(name); |
|
81 |
||
82 |
r = fMan->Copy(KTestFile, name); |
|
83 |
test( r == KErrNone ); |
|
84 |
||
85 |
TInt localDriveNum = 0; |
|
86 |
RFile testFile; |
|
87 |
r = testFile.Open( TheFs, name, EFileRead ); |
|
88 |
test( r == KErrNone ); |
|
89 |
||
90 |
RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
|
91 |
SBlockMapInfo info; |
|
92 |
TInt counter = 0; |
|
93 |
TInt startPos = aStartPos; |
|
94 |
TInt bmErr; |
|
95 |
||
96 |
// Store SBlockMapInfo objects in map:RArray until KErrCompletion is returned. |
|
97 |
do |
|
98 |
{ |
|
99 |
bmErr = testFile.BlockMap(info, aStartPos, aEndPos, ETestDebug); |
|
100 |
if (bmErr != 0 && bmErr != KErrCompletion) |
|
101 |
{ |
|
102 |
map.Close(); |
|
103 |
testFile.Close(); |
|
104 |
r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
|
105 |
test( r == KErrNone ); |
|
106 |
r = fMan->Delete(name); |
|
107 |
test( r == KErrNone ); |
|
108 |
delete fMan; |
|
109 |
return bmErr; |
|
110 |
} |
|
111 |
map.Append(info); |
|
112 |
if (counter++ == 0) |
|
113 |
localDriveNum = info.iLocalDriveNumber; |
|
114 |
} while ( bmErr == 0 && bmErr != KErrCompletion ); |
|
115 |
test( bmErr == KErrCompletion ); |
|
116 |
TInt granularity; |
|
117 |
||
118 |
TInt size; |
|
119 |
r = testFile.Size(size); |
|
120 |
test( r == KErrNone ); |
|
121 |
||
122 |
TBuf8<KReadBufferSize> buf1; |
|
123 |
TBuf8<KReadBufferSize> buf2; |
|
124 |
||
125 |
TBool changed; |
|
126 |
TBusLocalDrive localDrive; |
|
127 |
||
128 |
UserSvr::UnlockRamDrive(); |
|
129 |
||
130 |
TBlockMapEntry* myBlockMapEntry; |
|
131 |
TInt myCounter = 0; |
|
132 |
TInt totalSegments = 0; |
|
133 |
TInt remainder = 0; |
|
134 |
TInt miniLength = 0; |
|
135 |
TInt amountRead = 0; |
|
136 |
||
137 |
TInt c; |
|
138 |
for ( c = 0; c < map.Count(); c++ ) |
|
139 |
{ |
|
140 |
myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
|
141 |
granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
|
142 |
totalSegments += granularity; |
|
143 |
} |
|
144 |
||
145 |
const TInt KTotalSegments = totalSegments; |
|
146 |
r = localDrive.Connect( localDriveNum, changed ); |
|
147 |
test( r == KErrNone ); |
|
148 |
||
149 |
// For each SBlockMapInfo object in RArray map |
|
150 |
for ( c = 0; c < map.Count(); c++ ) |
|
151 |
{ |
|
152 |
myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
|
153 |
granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
|
154 |
TInt length; |
|
155 |
if ( aEndPos == -1 ) |
|
156 |
{ |
|
157 |
length = size - startPos; |
|
158 |
aEndPos = size; |
|
159 |
} |
|
160 |
else |
|
161 |
length = aEndPos - startPos; |
|
162 |
||
163 |
for ( TInt c2 = 1; c2 <= granularity; c2++) |
|
164 |
{ |
|
165 |
myCounter = 0; |
|
166 |
if ( c2 == KTotalSegments && aEndPos%map[c].iBlockGranularity != 0 ) |
|
167 |
remainder = map[c].iBlockGranularity - aEndPos%map[c].iBlockGranularity; |
|
168 |
else |
|
169 |
remainder = 0; |
|
170 |
miniLength = map[c].iBlockGranularity*myBlockMapEntry->iNumberOfBlocks - remainder - (c2 == 1?map[c].iBlockStartOffset:0); |
|
171 |
do |
|
172 |
{ |
|
173 |
if ( miniLength >= KReadBufferSize ) |
|
174 |
{ |
|
175 |
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 |
r = buf1.Compare( buf2 ); |
|
178 |
test( r == 0 ); |
|
179 |
buf1.Zero(); |
|
180 |
buf2.Zero(); |
|
181 |
myCounter++; |
|
182 |
miniLength -= KReadBufferSize; |
|
183 |
length -= KReadBufferSize; |
|
184 |
amountRead += KReadBufferSize; |
|
185 |
} |
|
186 |
else |
|
187 |
{ |
|
188 |
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 |
r = buf1.Compare( buf2 ); |
|
191 |
test( r == 0 ); |
|
192 |
amountRead += miniLength; |
|
193 |
length -= miniLength; |
|
194 |
miniLength = 0; |
|
195 |
} |
|
196 |
} while ( miniLength != 0 && length != 0); |
|
197 |
myBlockMapEntry++; |
|
198 |
} |
|
199 |
} |
|
200 |
map.Close(); |
|
201 |
||
202 |
testFile.Close(); |
|
203 |
r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
|
204 |
test( r == KErrNone ); |
|
205 |
r = fMan->Delete(name); |
|
206 |
test( r == KErrNone ); |
|
207 |
delete fMan; |
|
208 |
return bmErr; |
|
209 |
} |
|
210 |
||
211 |
LOCAL_C TInt TestBlockMapNandFAT(TInt64 aStartPos, TInt64 aEndPos) |
|
212 |
// |
|
213 |
// Test BlockMap retrieval on NAND FAT. |
|
214 |
// |
|
215 |
{ |
|
216 |
TInt localDriveNum = 0; |
|
217 |
RFile testFile; |
|
218 |
TInt r = testFile.Open( TheFs, KTestFileFAT, EFileRead ); |
|
219 |
test( r == KErrNone ); |
|
220 |
||
221 |
RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
|
222 |
SBlockMapInfo info; |
|
223 |
TInt counter = 0; |
|
224 |
TInt startPos = aStartPos; |
|
225 |
TInt bmErr; |
|
226 |
||
227 |
// Store SBlockMapInfo objects in map:RArray until KErrCompletion is returned. |
|
228 |
do |
|
229 |
{ |
|
230 |
bmErr = testFile.BlockMap(info, aStartPos, aEndPos, Pageable?EBlockMapUsagePaging:ETestDebug); |
|
231 |
if (bmErr != 0 && bmErr != KErrCompletion) |
|
232 |
{ |
|
233 |
map.Close(); |
|
234 |
testFile.Close(); |
|
235 |
return bmErr; |
|
236 |
} |
|
237 |
map.Append(info); |
|
238 |
if (counter++ == 0) |
|
239 |
localDriveNum = info.iLocalDriveNumber; |
|
240 |
} while ( bmErr == 0 && bmErr != KErrCompletion ); |
|
241 |
test( bmErr == KErrCompletion ); |
|
242 |
TInt granularity; |
|
243 |
||
244 |
TInt size; |
|
245 |
r = testFile.Size(size); |
|
246 |
test( r == KErrNone ); |
|
247 |
||
248 |
TBuf8<KReadBufferSize> buf1; |
|
249 |
TBuf8<KReadBufferSize> buf2; |
|
250 |
||
251 |
TBool changed; |
|
252 |
TBusLocalDrive localDrive; |
|
253 |
||
254 |
TBlockMapEntry* myBlockMapEntry; |
|
255 |
TInt myCounter = 0; |
|
256 |
TInt totalSegments = 0; |
|
257 |
TInt remainder = 0; |
|
258 |
TInt miniLength = 0; |
|
259 |
TInt amountRead = 0; |
|
260 |
||
261 |
TInt c; |
|
262 |
for ( c = 0; c < map.Count(); c++ ) |
|
263 |
{ |
|
264 |
myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
|
265 |
granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
|
266 |
totalSegments += granularity; |
|
267 |
} |
|
268 |
||
269 |
const TInt KTotalSegments = totalSegments; |
|
270 |
r = localDrive.Connect( localDriveNum, changed ); |
|
271 |
test( r == KErrNone ); |
|
272 |
||
273 |
// For each SBlockMapInfo object in RArray map |
|
274 |
for ( c = 0; c < map.Count(); c++ ) |
|
275 |
{ |
|
276 |
myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
|
277 |
granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
|
278 |
||
279 |
TInt length; |
|
280 |
if ( aEndPos == -1 ) |
|
281 |
{ |
|
282 |
length = size - startPos; |
|
283 |
aEndPos = size; |
|
284 |
} |
|
285 |
else |
|
286 |
length = aEndPos - startPos; |
|
287 |
||
288 |
for ( TInt c2 = 1; c2 <= granularity; c2++) |
|
289 |
{ |
|
290 |
myCounter = 0; |
|
291 |
if ( c2 == KTotalSegments && aEndPos%map[c].iBlockGranularity != 0 ) |
|
292 |
remainder = map[c].iBlockGranularity - aEndPos%map[c].iBlockGranularity; |
|
293 |
else |
|
294 |
remainder = 0; |
|
295 |
miniLength = map[c].iBlockGranularity*myBlockMapEntry->iNumberOfBlocks - remainder - (c2 == 1?map[c].iBlockStartOffset:0); |
|
296 |
do |
|
297 |
{ |
|
298 |
if ( miniLength >= KReadBufferSize ) |
|
299 |
{ |
|
300 |
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 |
r = buf1.Compare( buf2 ); |
|
303 |
test( r == 0 ); |
|
304 |
buf1.Zero(); |
|
305 |
buf2.Zero(); |
|
306 |
myCounter++; |
|
307 |
miniLength -= KReadBufferSize; |
|
308 |
length -= KReadBufferSize; |
|
309 |
amountRead += KReadBufferSize; |
|
310 |
} |
|
311 |
else |
|
312 |
{ |
|
313 |
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 |
r = buf1.Compare( buf2 ); |
|
316 |
test( r == 0 ); |
|
317 |
amountRead += miniLength; |
|
318 |
length -= miniLength; |
|
319 |
miniLength = 0; |
|
320 |
} |
|
321 |
} while ( miniLength != 0 && length != 0); |
|
322 |
myBlockMapEntry++; |
|
323 |
} |
|
324 |
} |
|
325 |
map.Close(); |
|
326 |
testFile.Close(); |
|
327 |
return bmErr; |
|
328 |
} |
|
329 |
||
330 |
LOCAL_C TInt TestBlockMapNandROFS(TInt64 aStartPos, TInt64 aEndPos) |
|
331 |
// |
|
332 |
// Test BlockMap retrieval on NAND ROFS. |
|
333 |
// |
|
334 |
{ |
|
335 |
TInt localDriveNum = 0; |
|
336 |
RFile testFile; |
|
337 |
TInt r = testFile.Open( TheFs, KTestFile, EFileRead ); |
|
338 |
test( r == KErrNone ); |
|
339 |
||
340 |
RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
|
341 |
SBlockMapInfo info; |
|
342 |
TInt counter = 0; |
|
343 |
TInt startPos = aStartPos; |
|
344 |
TInt bmErr; |
|
345 |
||
346 |
// Store SBlockMapInfo objects in map:RArray until KErrCompletion is returned. |
|
347 |
do |
|
348 |
{ |
|
349 |
bmErr = testFile.BlockMap(info, aStartPos, aEndPos, Pageable?EBlockMapUsagePaging:ETestDebug); |
|
350 |
if (bmErr != 0 && bmErr != KErrCompletion) |
|
351 |
{ |
|
352 |
map.Close(); |
|
353 |
testFile.Close(); |
|
354 |
return bmErr; |
|
355 |
} |
|
356 |
map.Append(info); |
|
357 |
if (counter++ == 0) |
|
358 |
localDriveNum = info.iLocalDriveNumber; |
|
359 |
} while ( bmErr == 0 && bmErr != KErrCompletion ); |
|
360 |
test( bmErr == KErrCompletion ); |
|
361 |
TInt granularity; |
|
362 |
||
363 |
TInt size; |
|
364 |
r = testFile.Size(size); |
|
365 |
test( r == KErrNone ); |
|
366 |
||
367 |
TBuf8<KReadBufferSize> buf1; |
|
368 |
TBuf8<KReadBufferSize> buf2; |
|
369 |
||
370 |
TBool changed; |
|
371 |
TBusLocalDrive localDrive; |
|
372 |
||
373 |
TBlockMapEntry* myBlockMapEntry; |
|
374 |
TInt myCounter = 0; |
|
375 |
TInt totalSegments = 0; |
|
376 |
TInt miniLength = 0; |
|
377 |
TInt amountRead = 0; |
|
378 |
||
379 |
TInt c; |
|
380 |
for ( c = 0; c < map.Count(); c++ ) |
|
381 |
{ |
|
382 |
myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
|
383 |
granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
|
384 |
totalSegments += granularity; |
|
385 |
} |
|
386 |
r = localDrive.Connect( localDriveNum, changed ); |
|
387 |
test( r == KErrNone ); |
|
388 |
||
389 |
// For each SBlockMapInfo object in RArray map |
|
390 |
for ( c = 0; c < map.Count(); c++ ) |
|
391 |
{ |
|
392 |
myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
|
393 |
granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
|
394 |
||
395 |
TInt length; |
|
396 |
if ( aEndPos == -1 ) |
|
397 |
{ |
|
398 |
length = size - startPos; |
|
399 |
aEndPos = size; |
|
400 |
} |
|
401 |
else |
|
402 |
length = aEndPos - startPos; |
|
403 |
||
404 |
for ( TInt c2 = 1; c2 <= granularity; c2++) |
|
405 |
{ |
|
406 |
myCounter = 0; |
|
407 |
miniLength = length; |
|
408 |
do |
|
409 |
{ |
|
410 |
if ( miniLength >= KReadBufferSize ) |
|
411 |
{ |
|
412 |
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 |
r = buf1.Compare( buf2 ); |
|
415 |
test( r == 0 ); |
|
416 |
buf1.Zero(); |
|
417 |
buf2.Zero(); |
|
418 |
myCounter++; |
|
419 |
miniLength -= KReadBufferSize; |
|
420 |
length -= KReadBufferSize; |
|
421 |
amountRead += KReadBufferSize; |
|
422 |
} |
|
423 |
else |
|
424 |
{ |
|
425 |
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 |
r = buf1.Compare( buf2 ); |
|
428 |
test( r == 0 ); |
|
429 |
amountRead += miniLength; |
|
430 |
length -= miniLength; |
|
431 |
miniLength = 0; |
|
432 |
} |
|
433 |
} while ( miniLength != 0 && length != 0); |
|
434 |
myBlockMapEntry++; |
|
435 |
} |
|
436 |
} |
|
437 |
map.Close(); |
|
438 |
||
439 |
testFile.Close(); |
|
440 |
return bmErr; |
|
441 |
} |
|
442 |
||
443 |
LOCAL_C TInt TestBlockMapRamFAT(TInt64 aStartPos, TInt64 aEndPos) |
|
444 |
// |
|
445 |
// Test BlockMap retrieval on RAM FAT. |
|
446 |
// |
|
447 |
{ |
|
448 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
449 |
test(fMan!=NULL); |
|
450 |
TFileName name(KDriveBase); |
|
451 |
name[0] = TText('A' + RamFatDrive); |
|
452 |
name.Append( KTestFileName ); |
|
453 |
||
454 |
TInt r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
|
455 |
r = fMan->Delete(name); |
|
456 |
||
457 |
r = fMan->Copy(KTestFile, name); |
|
458 |
test( r == KErrNone || r == KErrAlreadyExists); |
|
459 |
||
460 |
TInt localDriveNum = 0; |
|
461 |
RFile testFile; |
|
462 |
r = testFile.Open( TheFs, name, EFileRead ); |
|
463 |
test( r == KErrNone ); |
|
464 |
||
465 |
RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
|
466 |
SBlockMapInfo info; |
|
467 |
TInt counter = 0; |
|
468 |
TInt startPos = aStartPos; |
|
469 |
TInt bmErr; |
|
470 |
||
471 |
// Store SBlockMapInfo objects in map:RArray until KErrCompletion is returned. |
|
472 |
do |
|
473 |
{ |
|
474 |
bmErr = testFile.BlockMap(info, aStartPos, aEndPos, ETestDebug); |
|
475 |
if (bmErr != 0 && bmErr != KErrCompletion) |
|
476 |
{ |
|
477 |
map.Close(); |
|
478 |
testFile.Close(); |
|
479 |
r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
|
480 |
test( r == KErrNone ); |
|
481 |
r = fMan->Delete(name); |
|
482 |
test( r == KErrNone ); |
|
483 |
delete fMan; |
|
484 |
return bmErr; |
|
485 |
} |
|
486 |
map.Append(info); |
|
487 |
if (counter++ == 0) |
|
488 |
localDriveNum = info.iLocalDriveNumber; |
|
489 |
} while ( bmErr == 0 && bmErr != KErrCompletion ); |
|
490 |
test( bmErr == KErrCompletion ); |
|
491 |
TInt granularity; |
|
492 |
||
493 |
TInt size; |
|
494 |
r = testFile.Size(size); |
|
495 |
test( r == KErrNone ); |
|
496 |
||
497 |
TBuf8<KReadBufferSize> buf1; |
|
498 |
TBuf8<KReadBufferSize> buf2; |
|
499 |
||
500 |
TBool changed; |
|
501 |
TBusLocalDrive localDrive; |
|
502 |
||
503 |
UserSvr::UnlockRamDrive(); |
|
504 |
||
505 |
TBlockMapEntry* myBlockMapEntry; |
|
506 |
TInt myCounter = 0; |
|
507 |
TInt totalSegments = 0; |
|
508 |
TInt remainder = 0; |
|
509 |
TInt miniLength = 0; |
|
510 |
TInt amountRead = 0; |
|
511 |
||
512 |
TInt c; |
|
513 |
for ( c = 0; c < map.Count(); c++ ) |
|
514 |
{ |
|
515 |
myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
|
516 |
granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
|
517 |
totalSegments += granularity; |
|
518 |
} |
|
519 |
||
520 |
const TInt KTotalSegments = totalSegments; |
|
521 |
||
522 |
r = localDrive.Connect( localDriveNum, changed ); |
|
523 |
test( r == KErrNone ); |
|
524 |
||
525 |
// For each SBlockMapInfo object in RArray map |
|
526 |
for ( c = 0; c < map.Count(); c++ ) |
|
527 |
{ |
|
528 |
myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
|
529 |
granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
|
530 |
||
531 |
TInt length; |
|
532 |
if ( aEndPos == -1 ) |
|
533 |
{ |
|
534 |
length = size - startPos; |
|
535 |
aEndPos = size; |
|
536 |
} |
|
537 |
else |
|
538 |
length = aEndPos - startPos; |
|
539 |
||
540 |
for ( TInt c2 = 1; c2 <= granularity; c2++) |
|
541 |
{ |
|
542 |
myCounter = 0; |
|
543 |
if ( c2 == KTotalSegments && aEndPos%map[c].iBlockGranularity != 0 ) |
|
544 |
remainder = map[c].iBlockGranularity - aEndPos%map[c].iBlockGranularity; |
|
545 |
else |
|
546 |
remainder = 0; |
|
547 |
miniLength = map[c].iBlockGranularity*myBlockMapEntry->iNumberOfBlocks - remainder - (c2 == 1?map[c].iBlockStartOffset:0); |
|
548 |
do |
|
549 |
{ |
|
550 |
if ( miniLength >= KReadBufferSize ) |
|
551 |
{ |
|
552 |
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 |
r = buf1.Compare( buf2 ); |
|
555 |
test( r == 0 ); |
|
556 |
buf1.Zero(); |
|
557 |
buf2.Zero(); |
|
558 |
myCounter++; |
|
559 |
miniLength -= KReadBufferSize; |
|
560 |
length -= KReadBufferSize; |
|
561 |
amountRead += KReadBufferSize; |
|
562 |
} |
|
563 |
else |
|
564 |
{ |
|
565 |
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 |
r = buf1.Compare( buf2 ); |
|
568 |
test( r == 0 ); |
|
569 |
amountRead += miniLength; |
|
570 |
length -= miniLength; |
|
571 |
miniLength = 0; |
|
572 |
} |
|
573 |
} while ( miniLength != 0 && length != 0); |
|
574 |
myBlockMapEntry++; |
|
575 |
} |
|
576 |
} |
|
577 |
map.Close(); |
|
578 |
||
579 |
testFile.Close(); |
|
580 |
r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
|
581 |
test( r == KErrNone ); |
|
582 |
r = fMan->Delete(name); |
|
583 |
test( r == KErrNone ); |
|
584 |
delete fMan; |
|
585 |
return bmErr; |
|
586 |
} |
|
587 |
||
588 |
LOCAL_C TInt TestBlockMapRamFAT2(TInt64 aStartPos, TInt64 aEndPos) |
|
589 |
// |
|
590 |
// Test BlockMap retrieval on Ram FAT. |
|
591 |
// |
|
592 |
{ |
|
593 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
594 |
test(fMan!=NULL); |
|
595 |
TFileName name(KDriveBase); |
|
596 |
name[0] = TText('A' + RamFatDrive); |
|
597 |
name.Append( KTestFileName ); |
|
598 |
||
599 |
TInt r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
|
600 |
r = fMan->Delete(name); |
|
601 |
||
602 |
r = fMan->Copy(KTestFile, name); |
|
603 |
test( r == KErrNone || r == KErrAlreadyExists); |
|
604 |
||
605 |
RFile testFile; |
|
606 |
r = testFile.Open( TheFs, name, EFileRead ); |
|
607 |
test( r == KErrNone ); |
|
608 |
||
609 |
RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
|
610 |
SBlockMapInfo info; |
|
611 |
||
612 |
TInt bmErr; |
|
613 |
bmErr = testFile.BlockMap(info, aStartPos, aEndPos, EBlockMapUsagePaging); |
|
614 |
||
615 |
map.Close(); |
|
616 |
||
617 |
testFile.Close(); |
|
618 |
r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
|
619 |
test( r == KErrNone ); |
|
620 |
r = fMan->Delete(name); |
|
621 |
test( r == KErrNone ); |
|
622 |
delete fMan; |
|
623 |
return bmErr; |
|
624 |
} |
|
625 |
||
626 |
LOCAL_C TInt TestBlockMapRemovableFAT(TInt64 aStartPos, TInt64 aEndPos) |
|
627 |
// |
|
628 |
// Test BlockMap retrieval on Removable FAT. |
|
629 |
// |
|
630 |
{ |
|
631 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
632 |
test(fMan!=NULL); |
|
633 |
TFileName name(KDriveBase); |
|
634 |
name[0] = TText('A' + RemovableFatDrive); |
|
635 |
name.Append( KTestFileName ); |
|
636 |
||
637 |
TInt r=fMan->Copy(KTestFile, name); |
|
638 |
test( r == KErrNone || r == KErrAlreadyExists); |
|
639 |
||
640 |
RFile testFile; |
|
641 |
r = testFile.Open( TheFs, name, EFileRead ); |
|
642 |
test( r == KErrNone ); |
|
643 |
||
644 |
RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
|
645 |
SBlockMapInfo info; |
|
646 |
TInt bmErr = testFile.BlockMap(info, aStartPos, aEndPos, Pageable?EBlockMapUsagePaging:ETestDebug); |
|
647 |
map.Close(); |
|
648 |
||
649 |
testFile.Close(); |
|
650 |
r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
|
651 |
test( r == KErrNone ); |
|
652 |
r = fMan->Delete(name); |
|
653 |
test( r == KErrNone ); |
|
654 |
delete fMan; |
|
655 |
return bmErr; |
|
656 |
} |
|
657 |
||
658 |
LOCAL_C TInt TestBlockMapInternalRemovableFAT(TInt64 aStartPos, TInt64 aEndPos) |
|
659 |
// |
|
660 |
// Test BlockMap retrieval on internal removable FAT. |
|
661 |
// |
|
662 |
{ |
|
663 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
664 |
test(fMan!=NULL); |
|
665 |
TFileName name(KDriveBase); |
|
666 |
name[0] = TText('A' + RamFatDrive); |
|
667 |
name.Append( KTestFileName ); |
|
668 |
||
669 |
TInt r=fMan->Copy(KTestFile, name); |
|
670 |
test( r == KErrNone || r == KErrAlreadyExists); |
|
671 |
||
672 |
TInt localDriveNum = 0; |
|
673 |
RFile testFile; |
|
674 |
r = testFile.Open( TheFs, name, EFileRead ); |
|
675 |
test( r == KErrNone ); |
|
676 |
||
677 |
RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
|
678 |
SBlockMapInfo info; |
|
679 |
TInt counter = 0; |
|
680 |
TInt startPos = aStartPos; |
|
681 |
TInt bmErr; |
|
682 |
||
683 |
// Store SBlockMapInfo objects in map:RArray until KErrCompletion is returned. |
|
684 |
do |
|
685 |
{ |
|
686 |
bmErr = testFile.BlockMap(info, aStartPos, aEndPos, ETestDebug); |
|
687 |
if (bmErr != 0 && bmErr != KErrCompletion) |
|
688 |
{ |
|
689 |
map.Close(); |
|
690 |
testFile.Close(); |
|
691 |
r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
|
692 |
test( r == KErrNone ); |
|
693 |
r = fMan->Delete(name); |
|
694 |
test( r == KErrNone ); |
|
695 |
delete fMan; |
|
696 |
return bmErr; |
|
697 |
} |
|
698 |
map.Append(info); |
|
699 |
if (counter++ == 0) |
|
700 |
localDriveNum = info.iLocalDriveNumber; |
|
701 |
} while ( bmErr == 0 && bmErr != KErrCompletion ); |
|
702 |
test( bmErr == KErrCompletion ); |
|
703 |
TInt granularity; |
|
704 |
||
705 |
TInt size; |
|
706 |
r = testFile.Size(size); |
|
707 |
test( r == KErrNone ); |
|
708 |
||
709 |
TBuf8<KReadBufferSize> buf1; |
|
710 |
TBuf8<KReadBufferSize> buf2; |
|
711 |
||
712 |
TBool changed; |
|
713 |
TBusLocalDrive localDrive; |
|
714 |
||
715 |
UserSvr::UnlockRamDrive(); |
|
716 |
||
717 |
TBlockMapEntry* myBlockMapEntry; |
|
718 |
TInt myCounter = 0; |
|
719 |
TInt totalSegments = 0; |
|
720 |
TInt remainder = 0; |
|
721 |
TInt miniLength = 0; |
|
722 |
TInt amountRead = 0; |
|
723 |
||
724 |
TInt c; |
|
725 |
for ( c = 0; c < map.Count(); c++ ) |
|
726 |
{ |
|
727 |
myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
|
728 |
granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
|
729 |
totalSegments += granularity; |
|
730 |
} |
|
731 |
||
732 |
const TInt KTotalSegments = totalSegments; |
|
733 |
||
734 |
r = localDrive.Connect( localDriveNum, changed ); |
|
735 |
test( r == KErrNone ); |
|
736 |
||
737 |
// For each SBlockMapInfo object in RArray map |
|
738 |
for ( c = 0; c < map.Count(); c++ ) |
|
739 |
{ |
|
740 |
myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
|
741 |
granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
|
742 |
||
743 |
TInt length; |
|
744 |
if ( aEndPos == -1 ) |
|
745 |
{ |
|
746 |
length = size - startPos; |
|
747 |
aEndPos = size; |
|
748 |
} |
|
749 |
else |
|
750 |
length = aEndPos - startPos; |
|
751 |
||
752 |
for ( TInt c2 = 1; c2 <= granularity; c2++) |
|
753 |
{ |
|
754 |
myCounter = 0; |
|
755 |
if ( c2 == KTotalSegments && aEndPos%map[c].iBlockGranularity != 0 ) |
|
756 |
remainder = map[c].iBlockGranularity - aEndPos%map[c].iBlockGranularity; |
|
757 |
else |
|
758 |
remainder = 0; |
|
759 |
miniLength = map[c].iBlockGranularity*myBlockMapEntry->iNumberOfBlocks - remainder - (c2 == 1?map[c].iBlockStartOffset:0); |
|
760 |
do |
|
761 |
{ |
|
762 |
if ( miniLength >= KReadBufferSize ) |
|
763 |
{ |
|
764 |
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 |
r = buf1.Compare( buf2 ); |
|
767 |
test( r == 0 ); |
|
768 |
buf1.Zero(); |
|
769 |
buf2.Zero(); |
|
770 |
myCounter++; |
|
771 |
miniLength -= KReadBufferSize; |
|
772 |
length -= KReadBufferSize; |
|
773 |
amountRead += KReadBufferSize; |
|
774 |
} |
|
775 |
else |
|
776 |
{ |
|
777 |
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 |
r = buf1.Compare( buf2 ); |
|
780 |
test( r == 0 ); |
|
781 |
amountRead += miniLength; |
|
782 |
length -= miniLength; |
|
783 |
miniLength = 0; |
|
784 |
} |
|
785 |
} while ( miniLength != 0 && length != 0); |
|
786 |
myBlockMapEntry++; |
|
787 |
} |
|
788 |
} |
|
789 |
map.Close(); |
|
790 |
||
791 |
testFile.Close(); |
|
792 |
r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
|
793 |
test( r == KErrNone ); |
|
794 |
r = fMan->Delete(name); |
|
795 |
test( r == KErrNone ); |
|
796 |
delete fMan; |
|
797 |
return bmErr; |
|
798 |
} |
|
799 |
||
800 |
LOCAL_C TInt TestBlockMapFragmented(DriveType aDriveType, TInt64 aStartPos, TInt64 aEndPos) |
|
801 |
{ |
|
802 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
803 |
test(fMan!=NULL); |
|
804 |
TFileName name(KDriveBase); |
|
805 |
if (aDriveType==EDriveRam) |
|
806 |
name[0] = TText('A' + RamFatDrive); |
|
807 |
else if (aDriveType==EDriveRemovable) |
|
808 |
name[0] = TText('A' + RemovableFatDrive); |
|
809 |
else if (aDriveType==EDriveNand) |
|
810 |
name[0] = TText('A' + NandDrive); |
|
811 |
else |
|
812 |
name[0] = TText('A' + InternalRemovableFatDrive); |
|
813 |
name.Append( KFragmentedFileName1 ); |
|
814 |
TInt localDriveNum = 0; |
|
815 |
RFile testFile; |
|
816 |
TInt r = testFile.Open( TheFs, name, EFileRead ); |
|
817 |
test( r == KErrNone ); |
|
818 |
RArray<SBlockMapInfo> map; // From RArray<TBlockMapEntry> map; to RArray<SBlockMapInfo> map; |
|
819 |
SBlockMapInfo info; |
|
820 |
TInt counter = 0; |
|
821 |
TInt startPos = aStartPos; |
|
822 |
TInt bmErr; |
|
823 |
||
824 |
// Store SBlockMapInfo objects in map:RArray until KErrCompletion is returned. |
|
825 |
do |
|
826 |
{ |
|
827 |
bmErr = testFile.BlockMap(info, aStartPos, aEndPos, ETestDebug); |
|
828 |
if (bmErr != 0 && bmErr != KErrCompletion) |
|
829 |
{ |
|
830 |
map.Close(); |
|
831 |
testFile.Close(); |
|
832 |
if ( Finished ) |
|
833 |
{ |
|
834 |
r = fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
|
835 |
test( r == KErrNone ); |
|
836 |
r = fMan->Delete(name); |
|
837 |
test( r == KErrNone ); |
|
838 |
} |
|
839 |
delete fMan; |
|
840 |
return bmErr; |
|
841 |
} |
|
842 |
map.Append(info); |
|
843 |
if (counter++ == 0) |
|
844 |
localDriveNum = info.iLocalDriveNumber; |
|
845 |
} while ( bmErr == 0 && bmErr != KErrCompletion ); |
|
846 |
test( bmErr == KErrCompletion ); |
|
847 |
TInt granularity; |
|
848 |
TInt size; |
|
849 |
r = testFile.Size(size); |
|
850 |
test( r == KErrNone ); |
|
851 |
||
852 |
TBuf8<KReadBufferSize> buf1; |
|
853 |
TBuf8<KReadBufferSize> buf2; |
|
854 |
||
855 |
TBool changed; |
|
856 |
TBusLocalDrive localDrive; |
|
857 |
||
858 |
UserSvr::UnlockRamDrive(); |
|
859 |
||
860 |
TBlockMapEntry* myBlockMapEntry; |
|
861 |
TInt myCounter = 0; |
|
862 |
TInt totalSegments = 0; |
|
863 |
TInt remainder = 0; |
|
864 |
TInt miniLength = 0; |
|
865 |
TInt amountRead = 0; |
|
866 |
||
867 |
TInt c; |
|
868 |
for ( c = 0; c < map.Count(); c++ ) |
|
869 |
{ |
|
870 |
myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
|
871 |
granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
|
872 |
totalSegments += granularity; |
|
873 |
} |
|
874 |
||
875 |
const TInt KTotalSegments = totalSegments; |
|
876 |
r = localDrive.Connect( localDriveNum, changed ); |
|
877 |
test( r == KErrNone ); |
|
878 |
||
879 |
// For each SBlockMapInfo object in RArray map |
|
880 |
for ( c = 0; c < map.Count(); c++ ) |
|
881 |
{ |
|
882 |
myBlockMapEntry = (TBlockMapEntry*) map[c].iMap.Ptr(); |
|
883 |
granularity = map[c].iMap.Size()/sizeof(TBlockMapEntry); |
|
884 |
||
885 |
TInt length; |
|
886 |
if ( aEndPos == -1 ) |
|
887 |
{ |
|
888 |
length = size - startPos; |
|
889 |
aEndPos = size; |
|
890 |
} |
|
891 |
else |
|
892 |
length = aEndPos - startPos; |
|
893 |
||
894 |
for ( TInt c2 = 1; c2 <= granularity; c2++) |
|
895 |
{ |
|
896 |
myCounter = 0; |
|
897 |
if ( c2 == KTotalSegments && aEndPos%map[c].iBlockGranularity != 0 ) |
|
898 |
remainder = map[c].iBlockGranularity - aEndPos%map[c].iBlockGranularity; |
|
899 |
else |
|
900 |
remainder = 0; |
|
901 |
miniLength = map[c].iBlockGranularity*myBlockMapEntry->iNumberOfBlocks - remainder - (c2 == 1?map[c].iBlockStartOffset:0); |
|
902 |
do |
|
903 |
{ |
|
904 |
if ( miniLength >= KReadBufferSize ) |
|
905 |
{ |
|
906 |
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 |
r = buf1.Compare( buf2 ); |
|
909 |
test( r == 0 ); |
|
910 |
buf1.Zero(); |
|
911 |
buf2.Zero(); |
|
912 |
myCounter++; |
|
913 |
miniLength -= KReadBufferSize; |
|
914 |
length -= KReadBufferSize; |
|
915 |
amountRead += KReadBufferSize; |
|
916 |
} |
|
917 |
else |
|
918 |
{ |
|
919 |
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 |
r = buf1.Compare( buf2 ); |
|
922 |
test( r == 0 ); |
|
923 |
amountRead += miniLength; |
|
924 |
length -= miniLength; |
|
925 |
miniLength = 0; |
|
926 |
} |
|
927 |
} while ( miniLength != 0 && length != 0); |
|
928 |
myBlockMapEntry++; |
|
929 |
} |
|
930 |
} |
|
931 |
map.Close(); |
|
932 |
||
933 |
testFile.Close(); |
|
934 |
if ( Finished ) |
|
935 |
{ |
|
936 |
r=fMan->Attribs(name, 0, KEntryAttReadOnly, 0); |
|
937 |
test( r == KErrNone ); |
|
938 |
r = fMan->Delete(name); |
|
939 |
test( r == KErrNone ); |
|
940 |
} |
|
941 |
delete fMan; |
|
942 |
return bmErr; |
|
943 |
} |
|
944 |
||
945 |
LOCAL_C void GenerateFragmentedFiles(DriveType aDriveType) |
|
946 |
{ |
|
947 |
TInt r; |
|
948 |
TFileName name1(KDriveBase); |
|
949 |
if (aDriveType==EDriveRam) |
|
950 |
name1[0] = TText('A' + RamFatDrive); |
|
951 |
else if (aDriveType==EDriveRemovable) |
|
952 |
name1[0] = TText('A' + RemovableFatDrive); |
|
953 |
else if (aDriveType==EDriveNand) |
|
954 |
name1[0] = TText('A' + NandDrive); |
|
955 |
else |
|
956 |
name1[0] = TText('A' + InternalRemovableFatDrive); |
|
957 |
name1.Append( KFragmentedFileName1 ); |
|
958 |
RFile file1; |
|
959 |
r = file1.Create(TheFs, name1, EFileWrite); |
|
960 |
test( r == KErrNone ); |
|
961 |
file1.Close(); |
|
962 |
||
963 |
TFileName name2(KDriveBase); |
|
964 |
if (aDriveType==EDriveRam) |
|
965 |
name2[0] = TText('A' + RamFatDrive); |
|
966 |
else if (aDriveType==EDriveRemovable) |
|
967 |
name2[0] = TText('A' + RemovableFatDrive); |
|
968 |
else if (aDriveType==EDriveNand) |
|
969 |
name2[0] = TText('A' + NandDrive); |
|
970 |
else |
|
971 |
name2[0] = TText('A' + InternalRemovableFatDrive); |
|
972 |
name2.Append( KFragmentedFileName2 ); |
|
973 |
RFile file2; |
|
974 |
r = file2.Create(TheFs, name2, EFileWrite); |
|
975 |
test( r == KErrNone ); |
|
976 |
file2.Close(); |
|
977 |
TInt64 randomSeed; |
|
978 |
TBuf8<KMaxFragmentSize> tempBuf; |
|
979 |
TUint8 *buf; |
|
980 |
TInt fileSize = 0; |
|
981 |
TInt fragmentSize; |
|
982 |
TInt randomLength; |
|
983 |
TInt pos1; |
|
984 |
TInt pos2; |
|
985 |
TInt mycount = 0; |
|
986 |
do |
|
987 |
{ |
|
988 |
fragmentSize = 0; |
|
989 |
pos1 = 0; |
|
990 |
pos2 = 0; |
|
991 |
buf = (TUint8*) tempBuf.Ptr(); |
|
992 |
tempBuf.Zero(); |
|
993 |
randomLength = Math::Random() % KMaxFragmentSize; |
|
994 |
randomSeed = Math::Random(); |
|
995 |
tempBuf.SetLength(randomLength); |
|
996 |
||
997 |
while (randomLength-- && fragmentSize++ < KMaxFragmentSize && fileSize++ < KMaxFileSize) |
|
998 |
{ |
|
999 |
*buf++ = (TUint8)('A' + (Math::Rand(randomSeed) % ('Z' - 'A'))); |
|
1000 |
} |
|
1001 |
r = file1.Open( TheFs, name1, EFileWrite ); |
|
1002 |
test( r == KErrNone ); |
|
1003 |
r = file1.Seek( ESeekEnd, pos1 ); |
|
1004 |
test( r == KErrNone ); |
|
1005 |
r = file1.Write( pos1, tempBuf ); |
|
1006 |
test( r == KErrNone ); |
|
1007 |
r = file1.Flush(); |
|
1008 |
test( r == KErrNone ); |
|
1009 |
file1.Close(); |
|
1010 |
if ( mycount++ < 6 ) |
|
1011 |
{ |
|
1012 |
r = file2.Open( TheFs, name2, EFileWrite ); |
|
1013 |
test( r == KErrNone ); |
|
1014 |
r = file2.Seek( ESeekEnd, pos2 ); |
|
1015 |
test( r == KErrNone ); |
|
1016 |
r = file2.Write( pos2, tempBuf ); |
|
1017 |
test( r == KErrNone ); |
|
1018 |
r = file2.Flush(); |
|
1019 |
test( r == KErrNone ); |
|
1020 |
file2.Close(); |
|
1021 |
} |
|
1022 |
} while ( fileSize < KMaxFileSize ); |
|
1023 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
1024 |
test(fMan!=NULL); |
|
1025 |
r = fMan->Delete(name2); |
|
1026 |
test( r == KErrNone ); |
|
1027 |
delete fMan; |
|
1028 |
} |
|
1029 |
||
1030 |
LOCAL_C void FindDrive(DriveType aDriveType) |
|
1031 |
{ |
|
1032 |
TInt i; |
|
1033 |
TInt c = 0; |
|
1034 |
for( i = EDriveA; i < EDriveZ; i++ ) |
|
1035 |
{ |
|
1036 |
TDriveInfo info; |
|
1037 |
TInt r = TheFs.Drive(info, i); |
|
1038 |
if ( r != KErrNone ) |
|
1039 |
continue; |
|
1040 |
test( r == KErrNone ); |
|
1041 |
if ( aDriveType == EDriveNand ) |
|
1042 |
{ |
|
1043 |
c++ == 0 ? test.Printf( _L("Searching for NAND drive.")) : test.Printf( _L(".")); |
|
1044 |
if ( info.iType == EMediaNANDFlash && ((info.iMediaAtt & KMediaAttWriteProtected) == 0) ) |
|
1045 |
{ |
|
1046 |
if ( info.iDriveAtt & KDriveAttPageable ) |
|
1047 |
Pageable = ETrue; |
|
1048 |
NandDrive = i; |
|
1049 |
test.Printf( _L("Found NAND drive: %d\n"), NandDrive ); |
|
1050 |
break; |
|
1051 |
} |
|
1052 |
} |
|
1053 |
else if ( aDriveType == EDriveRam ) |
|
1054 |
{ |
|
1055 |
c++ == 0 ? test.Printf( _L("Searching for RAM FAT drive.")) : test.Printf( _L(".")); |
|
1056 |
if ( (info.iType == EMediaRam) && ( info.iDriveAtt == (KDriveAttLocal|KDriveAttInternal) ) && ( info.iMediaAtt == (KMediaAttVariableSize|KMediaAttFormattable) ) ) |
|
1057 |
{ |
|
1058 |
if ( info.iDriveAtt & KDriveAttPageable ) |
|
1059 |
Pageable = ETrue; |
|
1060 |
RamFatDrive = i; |
|
1061 |
test.Printf( _L("Found RAM FAT drive: %d\n"), RamFatDrive ); |
|
1062 |
break; |
|
1063 |
} |
|
1064 |
} |
|
1065 |
else if ( aDriveType == EDriveRemovable ) |
|
1066 |
{ |
|
1067 |
c++ == 0 ? test.Printf( _L("Searching for removable FAT drive.")) : test.Printf( _L(".")); |
|
1068 |
if ( info.iType == EMediaHardDisk && ( info.iDriveAtt == (KDriveAttLocal|KDriveAttRemovable) ) ) |
|
1069 |
{ |
|
1070 |
if ( info.iDriveAtt & KDriveAttPageable ) |
|
1071 |
Pageable = ETrue; |
|
1072 |
RemovableFatDrive = i; |
|
1073 |
test.Printf( _L("Found removable FAT drive: %d\n"), RemovableFatDrive ); |
|
1074 |
break; |
|
1075 |
} |
|
1076 |
} |
|
1077 |
else if ( aDriveType == EDriveInternalRemovable ) |
|
1078 |
{ |
|
1079 |
c++ == 0 ? test.Printf( _L("Searching for internal removable FAT drive.")) : test.Printf( _L(".")); |
|
1080 |
if ( info.iType == EMediaHardDisk && ( info.iDriveAtt == (KDriveAttLocal|KDriveAttInternal) ) ) |
|
1081 |
{ |
|
1082 |
if ( info.iDriveAtt & KDriveAttPageable ) |
|
1083 |
Pageable = ETrue; |
|
1084 |
InternalRemovableFatDrive = i; |
|
1085 |
test.Printf( _L("Found internal removable FAT drive: %d\n"), InternalRemovableFatDrive ); |
|
1086 |
break; |
|
1087 |
} |
|
1088 |
} |
|
1089 |
} |
|
1090 |
if ( i == EDriveZ ) |
|
1091 |
{ |
|
1092 |
switch(aDriveType) |
|
1093 |
{ |
|
1094 |
case EDriveNand: |
|
1095 |
test.Printf( _L("NAND drive not found.\n") ); |
|
1096 |
break; |
|
1097 |
case EDriveRam: |
|
1098 |
test.Printf( _L("RAM FAT drive not found.\n") ); |
|
1099 |
break; |
|
1100 |
case EDriveRemovable: |
|
1101 |
test.Printf( _L("Removable FAT drive not found.\n") ); |
|
1102 |
break; |
|
1103 |
case EDriveInternalRemovable: |
|
1104 |
test.Printf( _L("Internal removable FAT drive not found.\n") ); |
|
1105 |
break; |
|
1106 |
default: |
|
1107 |
test.Printf( _L("Drive not found.\n") ); |
|
1108 |
} |
|
1109 |
} |
|
1110 |
} |
|
1111 |
||
1112 |
//************************ |
|
1113 |
// Entry point |
|
1114 |
||
1115 |
GLDEF_C void CallTestsL(void) |
|
1116 |
{ |
|
1117 |
test.Title(); |
|
1118 |
test.Start( _L("BlockMap Test\n") ); |
|
1119 |
||
1120 |
TInt testFileSize = 0; |
|
1121 |
RFile testFile; |
|
1122 |
TInt r = testFile.Open(TheFs, KTestFile, EFileRead); |
|
1123 |
test(r==KErrNone); |
|
1124 |
r = testFile.Size(testFileSize); |
|
1125 |
test(r==KErrNone); |
|
1126 |
test(testFileSize>16384); |
|
1127 |
testFile.Close(); |
|
1128 |
||
1129 |
if ( gDriveToTest == 'C' ) |
|
1130 |
{ |
|
1131 |
TInt value; |
|
1132 |
r = HAL::Get( HAL::EMachineUid, value ); |
|
1133 |
test( r == KErrNone ); |
|
1134 |
if ( value != HAL::EMachineUid_Lubbock ) // Lubbock cannot run FindDrive as it doesn't support the NAND API |
|
1135 |
{ |
|
1136 |
test.Next(_L("Test BlockMap retrieval on NAND FAT.")); |
|
1137 |
FindDrive(EDriveNand); |
|
1138 |
if ( NandDrive > -1 ) // not finding a NAND drive isn't an error as only NAND builds have one |
|
1139 |
{ |
|
1140 |
r = TestBlockMapNandFATUserData(0, -1); |
|
1141 |
test( r == KErrCompletion ); |
|
1142 |
r = TestBlockMapNandFATUserData(1024, 4096); |
|
1143 |
test( r == KErrCompletion ); |
|
1144 |
r = TestBlockMapNandFATUserData(1020, 4100); |
|
1145 |
test( r == KErrCompletion ); |
|
1146 |
r = TestBlockMapNandFATUserData(1024, 4100); |
|
1147 |
test( r == KErrCompletion ); |
|
1148 |
r = TestBlockMapNandFATUserData(1020, 4096); |
|
1149 |
test( r == KErrCompletion ); |
|
1150 |
r = TestBlockMapNandFATUserData(1025, 1200); |
|
1151 |
test( r == KErrCompletion ); |
|
1152 |
r = TestBlockMapNandFATUserData(0, testFileSize+100); |
|
1153 |
test( r == KErrArgument ); |
|
1154 |
r = TestBlockMapNandFATUserData(-5, -1); |
|
1155 |
test( r == KErrArgument ); |
|
1156 |
r = TestBlockMapNandFATUserData(-5, testFileSize+100); |
|
1157 |
test( r == KErrArgument ); |
|
1158 |
r = TestBlockMapNandFATUserData(0, 0); |
|
1159 |
test( r == KErrArgument ); |
|
1160 |
r = TestBlockMapNandFATUserData(testFileSize, -1); |
|
1161 |
test( r == KErrArgument ); |
|
1162 |
r = TestBlockMapNandFATUserData(0, -1); |
|
1163 |
test( r == KErrCompletion ); |
|
1164 |
r = TestBlockMapNandFATUserData(2000, 2001); |
|
1165 |
test( r == KErrCompletion ); |
|
1166 |
r = TestBlockMapNandFATUserData(0, 0); |
|
1167 |
test( r == KErrArgument ); |
|
1168 |
r = TestBlockMapNandFATUserData(2000, 2000); |
|
1169 |
test( r == KErrArgument ); |
|
1170 |
r = TestBlockMapNandFATUserData(2048, 2048); |
|
1171 |
test( r == KErrArgument ); |
|
1172 |
test.Printf(_L("Generating Fragmented File...")); |
|
1173 |
GenerateFragmentedFiles(EDriveNand); |
|
1174 |
test.Printf(_L("Done!\n")); |
|
1175 |
test.Next(_L("Test BlockMap retrieval on NAND FAT (User area) (fragmented).")); |
|
1176 |
r = TestBlockMapFragmented(EDriveNand, 0, -1); |
|
1177 |
test( r == KErrCompletion ); |
|
1178 |
r = TestBlockMapFragmented(EDriveNand, 1024, 4096); |
|
1179 |
test( r == KErrCompletion ); |
|
1180 |
r = TestBlockMapFragmented(EDriveNand, 1020, 4100); |
|
1181 |
test( r == KErrCompletion ); |
|
1182 |
r = TestBlockMapFragmented(EDriveNand, 1024, 4100); |
|
1183 |
test( r == KErrCompletion ); |
|
1184 |
r = TestBlockMapFragmented(EDriveNand, 1020, 4096); |
|
1185 |
test( r == KErrCompletion ); |
|
1186 |
r = TestBlockMapFragmented(EDriveNand, 1025, 1200); |
|
1187 |
test( r == KErrCompletion ); |
|
1188 |
r = TestBlockMapFragmented(EDriveNand, 0, testFileSize+100); |
|
1189 |
test( r == KErrArgument ); |
|
1190 |
r = TestBlockMapFragmented(EDriveNand, -5, -1); |
|
1191 |
test( r == KErrArgument ); |
|
1192 |
r = TestBlockMapFragmented(EDriveNand, -5, testFileSize+100); |
|
1193 |
test( r == KErrArgument ); |
|
1194 |
r = TestBlockMapFragmented(EDriveNand, 0, 0); |
|
1195 |
test( r == KErrArgument ); |
|
1196 |
r = TestBlockMapFragmented(EDriveNand, testFileSize, -1); |
|
1197 |
test( r == KErrArgument ); |
|
1198 |
r = TestBlockMapFragmented(EDriveNand, 0, -1); |
|
1199 |
test( r == KErrCompletion ); |
|
1200 |
r = TestBlockMapFragmented(EDriveNand, 2000, 2001); |
|
1201 |
test( r == KErrCompletion ); |
|
1202 |
r = TestBlockMapFragmented(EDriveNand, 0, 0); |
|
1203 |
test( r == KErrArgument ); |
|
1204 |
r = TestBlockMapFragmented(EDriveNand, 2000, 2000); |
|
1205 |
test( r == KErrArgument ); |
|
1206 |
Finished = ETrue; |
|
1207 |
r = TestBlockMapFragmented(EDriveNand, 2048, 2048); |
|
1208 |
test( r == KErrArgument ); |
|
1209 |
test.Next(_L("Test BlockMap retrieval on NAND FAT.")); |
|
1210 |
r = TestBlockMapNandFAT(0, -1); |
|
1211 |
test( r == KErrCompletion ); |
|
1212 |
r = TestBlockMapNandFAT(1024, 4096); |
|
1213 |
test( r == KErrCompletion ); |
|
1214 |
r = TestBlockMapNandFAT(1020, 4100); |
|
1215 |
test( r == KErrCompletion ); |
|
1216 |
r = TestBlockMapNandFAT(1024, 4100); |
|
1217 |
test( r == KErrCompletion ); |
|
1218 |
r = TestBlockMapNandFAT(1020, 4096); |
|
1219 |
test( r == KErrCompletion ); |
|
1220 |
r = TestBlockMapNandFAT(1025, 1200); |
|
1221 |
test( r == KErrCompletion ); |
|
1222 |
r = TestBlockMapNandFAT(0, testFileSize+100); |
|
1223 |
test( r == KErrArgument ); |
|
1224 |
r = TestBlockMapNandFAT(-5, -1); |
|
1225 |
test( r == KErrArgument ); |
|
1226 |
r = TestBlockMapNandFAT(-5, testFileSize+100); |
|
1227 |
test( r == KErrArgument ); |
|
1228 |
r = TestBlockMapNandFAT(0, 0); |
|
1229 |
test( r == KErrArgument ); |
|
1230 |
r = TestBlockMapNandFAT(testFileSize, -1); |
|
1231 |
test( r == KErrArgument ); |
|
1232 |
r = TestBlockMapNandFAT(0, -1); |
|
1233 |
test( r == KErrCompletion ); |
|
1234 |
r = TestBlockMapNandFAT(2000, 2001); |
|
1235 |
test( r == KErrCompletion ); |
|
1236 |
r = TestBlockMapNandFAT(0, 0); |
|
1237 |
test( r == KErrArgument ); |
|
1238 |
r = TestBlockMapNandFAT(2000, 2000); |
|
1239 |
test( r == KErrArgument ); |
|
1240 |
r = TestBlockMapNandFAT(2048, 2048); |
|
1241 |
test( r == KErrArgument ); |
|
1242 |
test.Next(_L("Test BlockMap retrieval on NAND ROFS.")); |
|
1243 |
r = TestBlockMapNandROFS(0, -1); |
|
1244 |
test( r == KErrCompletion ); |
|
1245 |
r = TestBlockMapNandROFS(1024, 4096); |
|
1246 |
test( r == KErrCompletion ); |
|
1247 |
r = TestBlockMapNandROFS(1020, 4100); |
|
1248 |
test( r == KErrCompletion ); |
|
1249 |
r = TestBlockMapNandROFS(1024, 4100); |
|
1250 |
test( r == KErrCompletion ); |
|
1251 |
r = TestBlockMapNandROFS(1020, 4096); |
|
1252 |
test( r == KErrCompletion ); |
|
1253 |
r = TestBlockMapNandROFS(1025, 1200); |
|
1254 |
test( r == KErrCompletion ); |
|
1255 |
r = TestBlockMapNandROFS(0, testFileSize+100); |
|
1256 |
test( r == KErrArgument ); |
|
1257 |
r = TestBlockMapNandROFS(-5, -1); |
|
1258 |
test( r == KErrArgument ); |
|
1259 |
r = TestBlockMapNandROFS(-5, testFileSize+100); |
|
1260 |
test( r == KErrArgument ); |
|
1261 |
r = TestBlockMapNandROFS(0, 0); |
|
1262 |
test( r == KErrArgument ); |
|
1263 |
r = TestBlockMapNandROFS(testFileSize, -1); |
|
1264 |
test( r == KErrArgument ); |
|
1265 |
r = TestBlockMapNandROFS(0, -1); |
|
1266 |
test( r == KErrCompletion ); |
|
1267 |
r = TestBlockMapNandROFS(2000, 2001); |
|
1268 |
test( r == KErrCompletion ); |
|
1269 |
r = TestBlockMapNandROFS(0, 0); |
|
1270 |
test( r == KErrArgument ); |
|
1271 |
r = TestBlockMapNandROFS(2000, 2000); |
|
1272 |
test( r == KErrArgument ); |
|
1273 |
r = TestBlockMapNandROFS(2048, 2048); |
|
1274 |
test( r == KErrArgument ); |
|
1275 |
test.Next(_L("Test BlockMap retrieval on RAM FAT.")); |
|
1276 |
FindDrive(EDriveRam); |
|
1277 |
test( RamFatDrive > -1 ); |
|
1278 |
r = TestBlockMapRamFAT(0, -1); |
|
1279 |
test( r == KErrCompletion ); |
|
1280 |
r = TestBlockMapRamFAT(1024, 4096); |
|
1281 |
test( r == KErrCompletion ); |
|
1282 |
r = TestBlockMapRamFAT(1020, 4100); |
|
1283 |
test( r == KErrCompletion ); |
|
1284 |
r = TestBlockMapRamFAT(1024, 4100); |
|
1285 |
test( r == KErrCompletion ); |
|
1286 |
r = TestBlockMapRamFAT(1020, 4096); |
|
1287 |
test( r == KErrCompletion ); |
|
1288 |
r = TestBlockMapRamFAT(1025, 1200); |
|
1289 |
test( r == KErrCompletion ); |
|
1290 |
r = TestBlockMapRamFAT(0, testFileSize+100); |
|
1291 |
test( r == KErrArgument ); |
|
1292 |
r = TestBlockMapRamFAT(-5, -1); |
|
1293 |
test( r == KErrArgument ); |
|
1294 |
r = TestBlockMapRamFAT(-5, testFileSize+100); |
|
1295 |
test( r == KErrArgument ); |
|
1296 |
r = TestBlockMapRamFAT(0, 0); |
|
1297 |
test( r == KErrArgument ); |
|
1298 |
r = TestBlockMapRamFAT(testFileSize, -1); |
|
1299 |
test( r == KErrArgument ); |
|
1300 |
r = TestBlockMapRamFAT(0, -1); |
|
1301 |
test( r == KErrCompletion ); |
|
1302 |
r = TestBlockMapRamFAT(2000, 2001); |
|
1303 |
test( r == KErrCompletion ); |
|
1304 |
r = TestBlockMapRamFAT(0, 0); |
|
1305 |
test( r == KErrArgument ); |
|
1306 |
r = TestBlockMapRamFAT(2000, 2000); |
|
1307 |
test( r == KErrArgument ); |
|
1308 |
r = TestBlockMapRamFAT(2048, 2048); |
|
1309 |
test( r == KErrArgument ); |
|
1310 |
test.Next(_L("Test BlockMap retrieval on Ram FAT (2).")); |
|
1311 |
r = TestBlockMapRamFAT2(0, -1); |
|
1312 |
test( r == KErrNotSupported ); |
|
1313 |
FindDrive(EDriveRemovable); |
|
1314 |
if ( RemovableFatDrive > -1) |
|
1315 |
{ |
|
1316 |
test.Next(_L("Test BlockMap retrieval on removable FAT.")); |
|
1317 |
r = TestBlockMapRemovableFAT(0, -1); |
|
1318 |
Pageable?test( r == KErrNotSupported ):test( r == KErrCompletion ); |
|
1319 |
} |
|
1320 |
else |
|
1321 |
{ |
|
1322 |
test.Next(_L("Test BlockMap retrieval on internal removable FAT.")); |
|
1323 |
FindDrive(EDriveInternalRemovable); |
|
1324 |
test( InternalRemovableFatDrive > -1); |
|
1325 |
r = TestBlockMapInternalRemovableFAT(0, -1); |
|
1326 |
test( r == KErrCompletion ); |
|
1327 |
r = TestBlockMapInternalRemovableFAT(1024, 4096); |
|
1328 |
test( r == KErrCompletion ); |
|
1329 |
r = TestBlockMapInternalRemovableFAT(1020, 4100); |
|
1330 |
test( r == KErrCompletion ); |
|
1331 |
r = TestBlockMapInternalRemovableFAT(1024, 4100); |
|
1332 |
test( r == KErrCompletion ); |
|
1333 |
r = TestBlockMapInternalRemovableFAT(1020, 4096); |
|
1334 |
test( r == KErrCompletion ); |
|
1335 |
r = TestBlockMapInternalRemovableFAT(1025, 1200); |
|
1336 |
test( r == KErrCompletion ); |
|
1337 |
r = TestBlockMapInternalRemovableFAT(0, testFileSize+100); |
|
1338 |
test( r == KErrArgument ); |
|
1339 |
r = TestBlockMapInternalRemovableFAT(-5, -1); |
|
1340 |
test( r == KErrArgument ); |
|
1341 |
r = TestBlockMapInternalRemovableFAT(-5, testFileSize+100); |
|
1342 |
test( r == KErrArgument ); |
|
1343 |
r = TestBlockMapInternalRemovableFAT(0, 0); |
|
1344 |
test( r == KErrArgument ); |
|
1345 |
r = TestBlockMapInternalRemovableFAT(testFileSize, -1); |
|
1346 |
test( r == KErrArgument ); |
|
1347 |
r = TestBlockMapInternalRemovableFAT(0, -1); |
|
1348 |
test( r == KErrCompletion ); |
|
1349 |
r = TestBlockMapInternalRemovableFAT(2000, 2001); |
|
1350 |
test( r == KErrCompletion ); |
|
1351 |
r = TestBlockMapInternalRemovableFAT(0, 0); |
|
1352 |
test( r == KErrArgument ); |
|
1353 |
r = TestBlockMapInternalRemovableFAT(2000, 2000); |
|
1354 |
test( r == KErrArgument ); |
|
1355 |
r = TestBlockMapInternalRemovableFAT(2048, 2048); |
|
1356 |
test( r == KErrArgument ); |
|
1357 |
} |
|
1358 |
test.Next(_L("Test BlockMap retrieval on Ram FAT (fragmented).")); |
|
1359 |
test.Printf(_L("Generating Fragmented File...")); |
|
1360 |
GenerateFragmentedFiles(EDriveRam); |
|
1361 |
test.Printf(_L("Done!\n")); |
|
1362 |
Finished = EFalse; |
|
1363 |
r = TestBlockMapFragmented(EDriveRam, 0, -1); |
|
1364 |
test( r == KErrCompletion ); |
|
1365 |
r = TestBlockMapFragmented(EDriveRam, 1020, 4100); |
|
1366 |
test( r == KErrCompletion ); |
|
1367 |
r = TestBlockMapFragmented(EDriveRam, 2049, 4096); |
|
1368 |
test( r == KErrCompletion ); |
|
1369 |
r = TestBlockMapFragmented(EDriveRam, 1024, 4100); |
|
1370 |
test( r == KErrCompletion ); |
|
1371 |
r = TestBlockMapFragmented(EDriveRam, 1020, 4096); |
|
1372 |
test( r == KErrCompletion ); |
|
1373 |
r = TestBlockMapFragmented(EDriveRam, 1025, 1200); |
|
1374 |
test( r == KErrCompletion ); |
|
1375 |
r = TestBlockMapFragmented(EDriveRam, 0, testFileSize+100); |
|
1376 |
test( r == KErrArgument ); |
|
1377 |
r = TestBlockMapFragmented(EDriveRam, -5, -1); |
|
1378 |
test( r == KErrArgument ); |
|
1379 |
r = TestBlockMapFragmented(EDriveRam, -5, testFileSize+100); |
|
1380 |
test( r == KErrArgument ); |
|
1381 |
r = TestBlockMapFragmented(EDriveRam, 0, 0); |
|
1382 |
test( r == KErrArgument ); |
|
1383 |
r = TestBlockMapFragmented(EDriveRam, testFileSize, -1); |
|
1384 |
test( r == KErrArgument ); |
|
1385 |
r = TestBlockMapFragmented(EDriveRam, 0, -1); |
|
1386 |
test( r == KErrCompletion ); |
|
1387 |
r = TestBlockMapFragmented(EDriveRam, 2000, 2001); |
|
1388 |
test( r == KErrCompletion ); |
|
1389 |
r = TestBlockMapFragmented(EDriveRam, 0, 0); |
|
1390 |
test( r == KErrArgument ); |
|
1391 |
r = TestBlockMapFragmented(EDriveRam, 2000, 2000); |
|
1392 |
test( r == KErrArgument ); |
|
1393 |
Finished = ETrue; |
|
1394 |
r = TestBlockMapFragmented(EDriveRam, 2048, 2048); |
|
1395 |
test( r == KErrArgument ); |
|
1396 |
} |
|
1397 |
else |
|
1398 |
{ |
|
1399 |
test.Printf( _L("NAND drive not found, skipping test.\n") ); |
|
1400 |
} |
|
1401 |
} |
|
1402 |
} |
|
1403 |
test.End(); |
|
1404 |
test.Close(); |
|
1405 |
} |