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