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) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// f32test\server\t_fsrv.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
#define __E32TEST_EXTENSION__ |
|
18 |
#include <f32file.h> |
|
19 |
#include <e32test.h> |
|
20 |
#include "t_server.h" |
|
21 |
#include "t_chlffs.h" |
|
22 |
||
23 |
#include "f32_test_utils.h" |
|
24 |
||
25 |
using namespace F32_Test_Utils; |
|
26 |
||
27 |
||
28 |
RTest test(_L("T_FSRV")); |
|
29 |
||
30 |
||
31 |
||
32 |
const TInt KMaxParses=7; |
|
33 |
const TInt KHeapSize=0x2000; |
|
34 |
TFileName tPath; |
|
35 |
TBool gFirstTime=ETrue; |
|
36 |
const TInt KMaxVolumeName=11; |
|
37 |
||
38 |
TInt substDrive=0; |
|
39 |
||
40 |
TFileName gTestSessionPath; |
|
41 |
||
42 |
TInt LargeFileSize; |
|
43 |
TInt gDrive=-1; |
|
44 |
||
45 |
struct SParse |
|
46 |
{ |
|
47 |
const TText* src; |
|
48 |
const TText* rel; |
|
49 |
const TText* def; |
|
50 |
const TText* fullName; |
|
51 |
const TText* drive; |
|
52 |
const TText* path; |
|
53 |
const TText* name; |
|
54 |
const TText* ext; |
|
55 |
}; |
|
56 |
||
57 |
struct SParseServer |
|
58 |
{ |
|
59 |
const TText* src; |
|
60 |
const TText* rel; |
|
61 |
const TText* fullName; |
|
62 |
const TText* drive; |
|
63 |
const TText* path; |
|
64 |
const TText* name; |
|
65 |
const TText* ext; |
|
66 |
}; |
|
67 |
||
68 |
LOCAL_D SParse parse[KMaxParses] = |
|
69 |
{ |
|
70 |
{_S("A:\\PATH\\NAME.EXT"),NULL,NULL,_S("A:\\PATH\\NAME.EXT"),_S("A:"),_S("\\PATH\\"),_S("NAME"),_S(".EXT")}, |
|
71 |
{_S("A:\\PATH\\NAME"),NULL,NULL,_S("A:\\PATH\\NAME"),_S("A:"),_S("\\PATH\\"),_S("NAME"),_S("")}, |
|
72 |
{_S("A:\\PATH\\"),NULL,NULL,_S("A:\\PATH\\"),_S("A:"),_S("\\PATH\\"),_S(""),_S("")}, |
|
73 |
{_S("A:"),NULL,NULL,_S("A:"),_S("A:"),_S(""),_S(""),_S("")}, |
|
74 |
{_S(""),NULL,NULL,_S(""),_S(""),_S(""),_S(""),_S("")}, |
|
75 |
{_S("A:\\PATH\\NAME"),_S("A:\\ZZZZ\\YYYY.XXX"),NULL,_S("A:\\PATH\\NAME.XXX"),_S("A:"),_S("\\PATH\\"),_S("NAME"),_S(".XXX")}, |
|
76 |
{_S("NAME"),_S(".YYY"),_S("A:\\PATH\\"),_S("A:\\PATH\\NAME.YYY"),_S("A:"),_S("\\PATH\\"),_S("NAME"),_S(".YYY")} |
|
77 |
}; |
|
78 |
||
79 |
LOCAL_D SParseServer parseServer[KMaxParses] = |
|
80 |
{ |
|
81 |
{_S("A:\\PATH\\NAME.EXT"),NULL,_S("A:\\PATH\\NAME.EXT"),_S("A:"),_S("\\PATH\\"),_S("NAME"),_S(".EXT")}, |
|
82 |
{_S("A:\\PATH\\NAME"),NULL,_S("A:\\PATH\\NAME"),_S("A:"),_S("\\PATH\\"),_S("NAME"),_S("")}, |
|
83 |
{_S("A:\\PATH\\"),NULL,_S("A:\\PATH\\"),_S("A:"),_S("\\PATH\\"),_S(""),_S("")}, |
|
84 |
{_S("A:"),NULL,_S("A:\\ABCDEF\\"),_S("A:"),_S("\\ABCDEF\\"),_S(""),_S("")}, |
|
85 |
{_S(""),NULL,_S("C:\\ABCDEF\\"),_S("C:"),_S("\\ABCDEF\\"),_S(""),_S("")}, |
|
86 |
{_S("A:\\PATH\\NAME"),_S("A:\\ZZZZ\\YYYY.XXX"),_S("A:\\PATH\\NAME.XXX"),_S("A:"),_S("\\PATH\\"),_S("NAME"),_S(".XXX")}, |
|
87 |
{_S("NAME"),_S(".YYY"),_S("C:\\ABCDEF\\NAME.YYY"),_S("C:"),_S("\\ABCDEF\\"),_S("NAME"),_S(".YYY")} |
|
88 |
}; |
|
89 |
||
90 |
LOCAL_C TInt pathTestThread(TAny*) |
|
91 |
// |
|
92 |
// The entry point for the producer thread. |
|
93 |
// |
|
94 |
{ |
|
95 |
||
96 |
RTest test(_L("Second thread path handling")); |
|
97 |
test.Title(); |
|
98 |
||
99 |
test.Start(_L("Path test thread")); |
|
100 |
RFs f; |
|
101 |
TInt r=f.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
102 |
test_KErrNone(r); |
0 | 103 |
r=f.SessionPath(tPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
104 |
test_KErrNone(r); |
0 | 105 |
f.Close(); |
106 |
||
107 |
return(KErrNone); |
|
108 |
} |
|
109 |
||
110 |
LOCAL_C void printDriveAtt(TInt aDrive,TUint anAtt) |
|
111 |
// |
|
112 |
// Print a drive attribute. |
|
113 |
// |
|
114 |
{ |
|
115 |
||
116 |
test.Printf(_L("%c: "),aDrive+'A'); |
|
117 |
if (anAtt&KDriveAttLocal) |
|
118 |
test.Printf(_L("LOCAL ")); |
|
119 |
if (anAtt&KDriveAttRom) |
|
120 |
test.Printf(_L("ROM ")); |
|
121 |
if (anAtt&KDriveAttRedirected) |
|
122 |
test.Printf(_L("REDIR ")); |
|
123 |
if (anAtt&KDriveAttSubsted) |
|
124 |
test.Printf(_L("SUBST ")); |
|
125 |
if (anAtt&KDriveAttInternal) |
|
126 |
test.Printf(_L("INTERNAL ")); |
|
127 |
if (anAtt&KDriveAttHidden) |
|
128 |
test.Printf(_L("HIDDEN ")); |
|
129 |
if ((anAtt&KDriveAttRemovable) && !(anAtt&KDriveAttLogicallyRemovable)) |
|
130 |
test.Printf(_L("PHYSICALLYREMOVABLE ")); |
|
131 |
if ((anAtt&KDriveAttRemovable) && (anAtt&KDriveAttLogicallyRemovable)) |
|
132 |
test.Printf(_L("LOGICALLYREMOVABLE ")); |
|
133 |
||
134 |
test.Printf(_L("\n")); |
|
135 |
} |
|
136 |
||
137 |
LOCAL_C void printDriveInfo(TInt aDrive,TDriveInfo& anInfo) |
|
138 |
// |
|
139 |
// Print a drive info. |
|
140 |
// |
|
141 |
{ |
|
142 |
||
143 |
printDriveAtt(aDrive,anInfo.iDriveAtt); |
|
144 |
test.Printf(_L(" MEDIA-ATT=")); |
|
145 |
if (anInfo.iMediaAtt==0) |
|
146 |
test.Printf(_L("<none>")); |
|
147 |
if (anInfo.iMediaAtt&KMediaAttVariableSize) |
|
148 |
test.Printf(_L("VariableSize ")); |
|
149 |
if (anInfo.iMediaAtt&KMediaAttDualDensity) |
|
150 |
test.Printf(_L("DualDensity ")); |
|
151 |
if (anInfo.iMediaAtt&KMediaAttFormattable) |
|
152 |
test.Printf(_L("Formattable ")); |
|
153 |
if (anInfo.iMediaAtt&KMediaAttWriteProtected) |
|
154 |
test.Printf(_L("WProtected ")); |
|
6
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
155 |
test.Printf(_L("\n CONNECTION BUS=")); |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
156 |
switch(anInfo.iConnectionBusType) |
0 | 157 |
{ |
6
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
158 |
case EConnectionBusInternal: test.Printf(_L("Internal\n")); break; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
159 |
case EConnectionBusUsb: test.Printf(_L("USB\n")); break; |
0 | 160 |
default: |
161 |
test.Printf(_L("Unknown value\n")); |
|
162 |
} |
|
163 |
test.Printf(_L(" MEDIA=")); |
|
164 |
switch(anInfo.iType) |
|
165 |
{ |
|
166 |
case EMediaNotPresent: test.Printf(_L("Not present\n")); break; |
|
167 |
case EMediaUnknown: test.Printf(_L("Unknown\n")); break; |
|
168 |
case EMediaFloppy: test.Printf(_L("Floppy\n")); break; |
|
169 |
case EMediaHardDisk: test.Printf(_L("Hard disk\n")); break; |
|
170 |
case EMediaCdRom: test.Printf(_L("CD Rom\n")); break; |
|
171 |
case EMediaRam: test.Printf(_L("Ram\n")); break; |
|
172 |
case EMediaFlash: test.Printf(_L("Flash\n")); break; |
|
173 |
case EMediaRom: test.Printf(_L("Rom\n")); break; |
|
174 |
case EMediaRemote: test.Printf(_L("Remote\n")); break; |
|
175 |
case EMediaNANDFlash: test.Printf(_L("NANDFlash\n")); break; |
|
176 |
default: |
|
177 |
test.Printf(_L("Unknown value\n")); |
|
178 |
} |
|
179 |
} |
|
180 |
||
181 |
||
182 |
||
183 |
||
184 |
LOCAL_C void MountRemoteFilesystem() |
|
185 |
{ |
|
186 |
test.Next(_L("Mount Remote Drive simulator on Q:")); |
|
187 |
||
188 |
TInt r=TheFs.AddFileSystem(_L("CFAFSDLY")); |
|
189 |
test.Printf(_L("Add remote file system")); |
|
190 |
test.Printf(_L("AddFileSystem returned %d\n"),r); |
|
191 |
test_Value(r, r==KErrNone || r==KErrAlreadyExists); |
|
192 |
||
193 |
r=TheFs.MountFileSystem(_L("DELAYFS"),EDriveQ); |
|
194 |
||
195 |
||
196 |
test.Printf(_L("Mount remote file system")); |
|
197 |
test.Printf(_L("MountFileSystem returned %d\n"),r); |
|
198 |
test_Value(r, r==KErrNone || r==KErrCorrupt || r==KErrNotReady || r==KErrAlreadyExists); |
|
199 |
||
200 |
} |
|
201 |
||
202 |
||
203 |
LOCAL_C void DisMountRemoteFilesystem() |
|
204 |
{ |
|
205 |
||
206 |
test.Printf(_L("Dismounting the remote Drives \n")); |
|
207 |
||
208 |
TInt r=TheFs.DismountFileSystem(_L("DELAYFS"),EDriveQ); |
|
209 |
||
210 |
test.Printf(_L("Dismounting the Remote Drive returned %d\n"),r); |
|
211 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
212 |
test_Value(r, r == KErrNone ); |
0 | 213 |
} |
214 |
||
215 |
||
216 |
LOCAL_C void CreateSubstDrive() |
|
217 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
218 |
test.Printf(_L("Create Substitute Drive \n")); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
219 |
|
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
220 |
TDriveList driveList; |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
221 |
|
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
222 |
TInt r=TheFs.SessionPath(gTestSessionPath); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
223 |
test_KErrNone(r); |
0 | 224 |
|
225 |
r=TheFs.DriveList(driveList, KDriveAttExclude|KDriveAttLocal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
226 |
test_KErrNone(r); |
0 | 227 |
|
228 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
229 |
for (TInt i = EDriveO; i < KMaxDrives; i++) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
230 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
231 |
if (driveList[i] == 0) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
232 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
233 |
if (i == EDriveQ) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
234 |
continue; // Q reserved to mount a virtual Remote Drive, as part of the test. |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
235 |
substDrive = i; |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
236 |
break; |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
237 |
} |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
238 |
} |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
239 |
|
0 | 240 |
if (substDrive) |
241 |
{ |
|
242 |
TDriveInfo driveInfo; |
|
243 |
r=TheFs.Drive(driveInfo,substDrive); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
244 |
test_KErrNone(r); |
0 | 245 |
|
246 |
if (driveInfo.iDriveAtt==KDriveAttLocal) |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
247 |
{ |
0 | 248 |
return; // Subst local drives fails |
249 |
} |
|
250 |
||
251 |
TFileName n; |
|
252 |
r=TheFs.Subst(n,substDrive); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
253 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
254 |
test_Value(n.Length(), n.Length() == 0); |
0 | 255 |
r=TheFs.SetSubst(gTestSessionPath,substDrive); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
256 |
test_KErrNone(r); |
0 | 257 |
r=TheFs.Subst(n,substDrive); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
258 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
259 |
test(n==gTestSessionPath); |
0 | 260 |
} |
261 |
} |
|
262 |
||
263 |
||
264 |
LOCAL_C void RemoveSubstDrive() |
|
265 |
{ |
|
266 |
if( substDrive) |
|
267 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
268 |
test.Printf(_L("Removing Substitute Drive \n")); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
269 |
TInt r =TheFs.SetSubst(_L(""),substDrive); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
270 |
test_KErrNone(r); |
0 | 271 |
} |
272 |
||
273 |
} |
|
274 |
||
275 |
||
276 |
||
277 |
LOCAL_C void testDriveInfo(TInt aDrive,TDriveInfo& anInfo) |
|
278 |
// |
|
279 |
// Test the drive info is reasonable |
|
280 |
// |
|
281 |
{ |
|
282 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
283 |
test_Value(anInfo.iConnectionBusType, anInfo.iConnectionBusType==EConnectionBusInternal || anInfo.iConnectionBusType==EConnectionBusUsb); |
0 | 284 |
|
285 |
if (aDrive==EDriveZ) |
|
286 |
{ |
|
287 |
if (anInfo.iType==EMediaNotPresent) |
|
288 |
return; |
|
289 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
290 |
test_Value(anInfo.iMediaAtt, anInfo.iMediaAtt==KMediaAttWriteProtected); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
291 |
test_Value(anInfo.iDriveAtt, anInfo.iDriveAtt==(KDriveAttRom|KDriveAttInternal)); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
292 |
test_Value(anInfo.iType, anInfo.iType==EMediaRom); |
0 | 293 |
} |
294 |
||
295 |
else if (GetDriveLFFS()==aDrive) |
|
296 |
{ |
|
297 |
if (anInfo.iType==EMediaNotPresent) |
|
298 |
return; |
|
299 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
300 |
test_Value(anInfo.iDriveAtt, anInfo.iDriveAtt&(KDriveAttLocal|KDriveAttInternal)==KDriveAttLocal|KDriveAttInternal); // LFFS sets KDriveAttTransaction as well |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
301 |
test_Value(anInfo.iType, anInfo.iType==EMediaFlash); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
302 |
test_Value(anInfo.iMediaAtt, anInfo.iMediaAtt==KMediaAttFormattable); |
0 | 303 |
} |
304 |
/* |
|
305 |
Why assume certain drive letters can only refer to certain drive types? |
|
306 |
else if (aDrive==EDriveC || aDrive==EDriveY) |
|
307 |
{ |
|
308 |
if (anInfo.iType==EMediaNotPresent) |
|
309 |
return; |
|
310 |
||
311 |
// test(anInfo.iDriveAtt==(KDriveAttLocal|KDriveAttInternal)); |
|
312 |
||
313 |
test(anInfo.iDriveAtt&(KDriveAttLocal|KDriveAttInternal)==KDriveAttLocal|KDriveAttInternal); // LFFS sets KDriveAttTransaction as well |
|
314 |
test(anInfo.iType==EMediaRam || anInfo.iType==EMediaFlash); |
|
315 |
if(anInfo.iType==EMediaRam) test(anInfo.iMediaAtt==(KMediaAttVariableSize|KMediaAttFormattable)); |
|
316 |
else if(anInfo.iType==EMediaFlash) test(anInfo.iMediaAtt==KMediaAttFormattable); |
|
317 |
} |
|
318 |
||
319 |
else if (aDrive==EDriveD || aDrive==EDriveX) |
|
320 |
{ |
|
321 |
if (anInfo.iType==EMediaNotPresent) |
|
322 |
return; |
|
323 |
||
324 |
test(anInfo.iDriveAtt==(KDriveAttLocal|KDriveAttRemovable)); |
|
325 |
test(anInfo.iType==EMediaHardDisk); |
|
326 |
test(anInfo.iMediaAtt & KMediaAttFormattable); |
|
327 |
} |
|
328 |
*/ |
|
329 |
} |
|
330 |
||
331 |
||
332 |
/* |
|
333 |
* The following test has the requirement that the only remote drive is the one we mount |
|
334 |
* during the test and which doesn't have any other attributes set. If this is not the |
|
335 |
* case then the test conditions must be changed, in order for the test to stop failing. |
|
336 |
*/ |
|
337 |
||
338 |
||
339 |
LOCAL_C void testDriveList() |
|
340 |
// |
|
341 |
// Test the drive list. |
|
342 |
// |
|
343 |
{ |
|
344 |
||
345 |
test.Start(_L("The drive list\n")); |
|
346 |
||
347 |
||
348 |
TInt err; |
|
349 |
TInt drivecount = 0; |
|
350 |
TDriveList driveList; |
|
351 |
TDriveInfo info; |
|
352 |
TUint flags; |
|
353 |
TInt removableDriveCount =0; |
|
354 |
TInt nonHiddenRemovableDriveCount =0; |
|
355 |
TInt logicallyRemovableDriveCount =0; |
|
356 |
TInt substDriveCount =0; |
|
357 |
TInt exclusiveSubstDriveCount =0; |
|
358 |
TInt hiddenDriveCount = 0; |
|
359 |
TInt hiddenOrRemoteDriveCount = 0; |
|
360 |
||
361 |
TInt i ; |
|
362 |
||
363 |
||
364 |
//--------------------------------------------- |
|
365 |
//! @SYMTestCaseID PBASE-T_FSRV-0544 |
|
366 |
//! @SYMTestType UT |
|
367 |
//! @SYMREQ CR909, CR1086 |
|
368 |
//! @SYMTestCaseDesc Test that RFs::DriveList(TDriveList& aList) does not return remote or hidden drives. |
|
369 |
//! @SYMTestActions Call DriveList to get the drive list. |
|
370 |
//! @SYMTestExpectedResults Check that no remote or hidden drive was returned. Count the number of drives we got |
|
371 |
//! and seperately the number of none hidden removable ones. |
|
372 |
//! @SYMTestPriority High |
|
373 |
//! @SYMTestStatus Implemented |
|
374 |
//--------------------------------------------- |
|
375 |
||
376 |
||
377 |
test.Printf(_L("Test existing DriveList \n")); |
|
378 |
||
379 |
err = TheFs.DriveList(driveList); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
380 |
test_KErrNone(err); |
0 | 381 |
|
382 |
for ( i = 0; i < KMaxDrives; i++) |
|
383 |
{ |
|
384 |
if (driveList[i]) |
|
385 |
{ |
|
386 |
err = TheFs.Drive(info, i); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
387 |
test_KErrNone(err); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
388 |
test_Value(info.iType, info.iType != EMediaRemote); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
389 |
test_Value(info.iDriveAtt, !(info.iDriveAtt & KDriveAttRemote)); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
390 |
test_Value(info.iDriveAtt, !(info.iDriveAtt & KDriveAttHidden)); |
0 | 391 |
drivecount++; |
392 |
||
393 |
if( info.iDriveAtt & KDriveAttRemovable) |
|
394 |
nonHiddenRemovableDriveCount++; |
|
395 |
||
396 |
printDriveAtt(i,info.iDriveAtt); |
|
397 |
||
398 |
} |
|
399 |
||
400 |
} |
|
401 |
||
402 |
||
403 |
TInt nonHiddenNonRemovables = drivecount - nonHiddenRemovableDriveCount; |
|
404 |
test.Printf(_L("Found %d non hidden non removable drives\n"), nonHiddenNonRemovables); |
|
405 |
test.Printf(_L("Found %d non hidden removable drives \n"),nonHiddenRemovableDriveCount); |
|
406 |
||
407 |
||
408 |
||
409 |
//--------------------------------------------- |
|
410 |
//! @SYMTestCaseID PBASE-T_FSRV-0545 |
|
411 |
//! @SYMTestType UT |
|
412 |
//! @SYMREQ CR909, CR1086 |
|
413 |
//! @SYMTestCaseDesc Test that RFs::DriveList(TDriveList& aList, TUint aFlags) can be used to return all |
|
414 |
//! available drives, including the remote and the hidden ones. |
|
415 |
//! @SYMTestActions Call DriveList by passing to aFlags a value of KDriveAttAll. |
|
416 |
//! @SYMTestExpectedResults Check that the number of drives is increased by the number of hidden and remote drives and also that the number of remote drives is one (one remote drive we mounted). |
|
417 |
//! Also count the number of substitute, exclusively substitute, removable, physically removable and logically removable drives. |
|
418 |
//! @SYMTestPriority High |
|
419 |
//! @SYMTestStatus Implemented |
|
420 |
//--------------------------------------------- |
|
421 |
||
422 |
||
423 |
test.Printf(_L("Return all available drives\n")); |
|
424 |
||
425 |
TInt allDrivecount = 0; |
|
426 |
flags = KDriveAttAll; |
|
427 |
err = TheFs.DriveList(driveList, flags); |
|
428 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
429 |
test_KErrNone(err); |
0 | 430 |
for ( i = 0; i < KMaxDrives; i++) |
431 |
{ |
|
432 |
if (driveList[i]) |
|
433 |
{ |
|
434 |
err = TheFs.Drive(info,i); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
435 |
test_KErrNone(err); |
0 | 436 |
allDrivecount++; |
437 |
||
438 |
if( info.iDriveAtt & KDriveAttSubsted ) |
|
439 |
substDriveCount++; |
|
440 |
||
441 |
if( info.iDriveAtt == KDriveAttSubsted) |
|
442 |
exclusiveSubstDriveCount++; |
|
443 |
||
444 |
if( info.iDriveAtt & KDriveAttHidden) |
|
445 |
hiddenDriveCount++; |
|
446 |
||
447 |
if( info.iDriveAtt & (KDriveAttHidden|KDriveAttRemote)) |
|
448 |
hiddenOrRemoteDriveCount++; |
|
449 |
||
450 |
if( info.iDriveAtt & KDriveAttRemovable) |
|
451 |
removableDriveCount++; |
|
452 |
||
453 |
if( info.iDriveAtt & KDriveAttLogicallyRemovable) |
|
454 |
logicallyRemovableDriveCount++; |
|
455 |
||
456 |
||
457 |
printDriveAtt(i,info.iDriveAtt); |
|
458 |
} |
|
459 |
} |
|
460 |
||
461 |
test.Printf(_L("Found %d substitute drives\n"), substDriveCount); |
|
462 |
test.Printf(_L("Found %d exclusively substitute drives \n"),exclusiveSubstDriveCount); |
|
463 |
test.Printf(_L("Found %d hidden drives\n"), hiddenDriveCount); |
|
464 |
||
465 |
TInt nonRemovables = drivecount - removableDriveCount; |
|
466 |
TInt physicallyRemovable = removableDriveCount - logicallyRemovableDriveCount; |
|
467 |
test.Printf(_L("Found %d non removables drives\n"), nonRemovables); |
|
468 |
test.Printf(_L("Found %d physically removable drives \n"),physicallyRemovable); |
|
469 |
test.Printf(_L("Found %d logically removable drives \n"),logicallyRemovableDriveCount); |
|
470 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
471 |
test(allDrivecount == drivecount + hiddenOrRemoteDriveCount); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
472 |
test(hiddenOrRemoteDriveCount - hiddenDriveCount == 1); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
473 |
|
0 | 474 |
|
475 |
//--------------------------------------------- |
|
476 |
//! @SYMTestCaseID PBASE-T_FSRV-0546 |
|
477 |
//! @SYMTestType UT |
|
478 |
//! @SYMREQ CR909 |
|
479 |
//! @SYMTestCaseDesc Test that RFs::DriveList(TDriveList& aList, TUint aFlags) can be used to specify |
|
480 |
//! certain attributes that drives to be returned should have. |
|
481 |
//! @SYMTestActions Call DriveList by passing to aFlags a value of KDriveAttRemovable. |
|
482 |
//! @SYMTestExpectedResults Check that the number of drives returned is the same, since no removable drive was added. |
|
483 |
//! @SYMTestPriority High |
|
484 |
//! @SYMTestStatus Implemented |
|
485 |
//--------------------------------------------- |
|
486 |
||
487 |
||
488 |
test.Printf(_L("Return only Removable \n")); |
|
489 |
||
490 |
drivecount = 0; |
|
491 |
||
492 |
flags = KDriveAttRemovable; |
|
493 |
err = TheFs.DriveList(driveList, flags); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
494 |
test_KErrNone(err); |
0 | 495 |
for ( i = 0; i < KMaxDrives; i++) |
496 |
{ |
|
497 |
if (driveList[i]) |
|
498 |
{ |
|
499 |
err = TheFs.Drive(info, i); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
500 |
test_KErrNone(err); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
501 |
test_Value(info.iDriveAtt, info.iDriveAtt & KDriveAttRemovable); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
502 |
drivecount++; |
0 | 503 |
|
504 |
printDriveAtt(i,info.iDriveAtt); |
|
505 |
} |
|
506 |
||
507 |
} |
|
508 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
509 |
test_Value(drivecount, drivecount == removableDriveCount); // no removable drive was added |
0 | 510 |
|
511 |
||
512 |
//--------------------------------------------- |
|
513 |
//! @SYMTestCaseID PBASE-T_FSRV-0547 |
|
514 |
//! @SYMTestType UT |
|
515 |
//! @SYMREQ CR909 |
|
516 |
//! @SYMTestCaseDesc Test that RFs::DriveList(TDriveList& aList, TUint aFlags) can be used to specify |
|
517 |
//! certain attributes(as a combination)that drives to be returned should have. |
|
518 |
//! @SYMTestActions Call DriveList by passing to aFlags a value of KDriveAttRemovable | KDriveAttRemote |
|
519 |
//! @SYMTestExpectedResults Check that the number of drives is increased by one, since we also allow remote drives. |
|
520 |
//! @SYMTestPriority High |
|
521 |
//! @SYMTestStatus Implemented |
|
522 |
//--------------------------------------------- |
|
523 |
||
524 |
||
525 |
test.Printf(_L("Return only Removable and Remote \n")); |
|
526 |
||
527 |
drivecount = 0; |
|
528 |
flags = KDriveAttRemovable | KDriveAttRemote; |
|
529 |
err = TheFs.DriveList(driveList, flags); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
530 |
test_KErrNone(err); |
0 | 531 |
for ( i = 0; i < KMaxDrives; i++) |
532 |
{ |
|
533 |
if (driveList[i]) |
|
534 |
{ |
|
535 |
err = TheFs.Drive(info, i); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
536 |
test_KErrNone(err); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
537 |
test_Value(info.iDriveAtt, (info.iDriveAtt & KDriveAttRemovable ) || (info.iDriveAtt & KDriveAttRemote)); |
0 | 538 |
drivecount++; |
539 |
||
540 |
printDriveAtt(i,info.iDriveAtt); |
|
541 |
||
542 |
} |
|
543 |
||
544 |
} |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
545 |
test_Value(drivecount, drivecount == removableDriveCount + 1 ); //contains the remote drive we mounted |
0 | 546 |
|
547 |
||
548 |
//--------------------------------------------- |
|
549 |
//! @SYMTestCaseID PBASE-T_FSRV-0548 |
|
550 |
//! @SYMTestType UT |
|
551 |
//! @SYMREQ CR909 |
|
552 |
//! @SYMTestCaseDesc Test that RFs::DriveList(TDriveList& aList, TUint aFlags) can be used to exclusively |
|
553 |
//! return drives with certain attributes. |
|
554 |
//! @SYMTestActions Call DriveList by passing to aFlags a value of KDriveAttExclusive | KDriveAttRemote. |
|
555 |
//! @SYMTestExpectedResults Check that only the remote drive that was mounted is returned. |
|
556 |
//! @SYMTestPriority High |
|
557 |
//! @SYMTestStatus Implemented |
|
558 |
//--------------------------------------------- |
|
559 |
||
560 |
||
561 |
test.Printf(_L("Return Exclusively Remote drives \n")); |
|
562 |
||
563 |
drivecount = 0; |
|
564 |
flags = KDriveAttExclusive | KDriveAttRemote; |
|
565 |
TUint match = KDriveAttRemote; |
|
566 |
err = TheFs.DriveList(driveList, flags); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
567 |
test_KErrNone(err); |
0 | 568 |
for ( i = 0; i < KMaxDrives; i++) |
569 |
{ |
|
570 |
if (driveList[i]) |
|
571 |
{ |
|
572 |
err = TheFs.Drive(info, i); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
573 |
test_KErrNone(err); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
574 |
test_Value(info.iDriveAtt, (info.iDriveAtt == match)); |
0 | 575 |
drivecount++; |
576 |
||
577 |
printDriveAtt(i,info.iDriveAtt); |
|
578 |
} |
|
579 |
||
580 |
} |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
581 |
test_Value(drivecount, drivecount == 1); //The remote drive we mounted. |
0 | 582 |
|
583 |
||
584 |
//--------------------------------------------- |
|
585 |
//! @SYMTestCaseID PBASE-T_FSRV-0549 |
|
586 |
//! @SYMTestType UT |
|
587 |
//! @SYMREQ CR909 |
|
588 |
//! @SYMTestCaseDesc Test that RFs::DriveList(TDriveList& aList, TUint aFlags) can be used to exclude drives |
|
589 |
//! to be returned with certain attributes. |
|
590 |
//! @SYMTestActions Call DriveList by passing to aFlags a value of KDriveAttExclude | KDriveAttRemovable. |
|
591 |
//! @SYMTestExpectedResults Check that the remote drive we mounted is included as a non removable one. |
|
592 |
//! @SYMTestPriority High |
|
593 |
//! @SYMTestStatus Implemented |
|
594 |
//--------------------------------------------- |
|
595 |
||
596 |
||
597 |
test.Printf(_L("Exclude Removable\n")); |
|
598 |
||
599 |
drivecount = 0; |
|
600 |
flags = KDriveAttExclude | KDriveAttRemovable; |
|
601 |
err = TheFs.DriveList(driveList, flags); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
602 |
test_KErrNone(err); |
0 | 603 |
for (i = 0; i < KMaxDrives; i++) |
604 |
{ |
|
605 |
if (driveList[i]) |
|
606 |
{ |
|
607 |
err = TheFs.Drive(info, i); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
608 |
test_KErrNone(err); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
609 |
test_Value(info.iDriveAtt, (!(info.iDriveAtt & KDriveAttRemovable ) )); |
0 | 610 |
drivecount++; |
611 |
||
612 |
printDriveAtt(i,info.iDriveAtt); |
|
613 |
} |
|
614 |
||
615 |
} |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
616 |
test_Value(drivecount, drivecount == allDrivecount - removableDriveCount); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
617 |
test_Value (drivecount, drivecount == nonRemovables + hiddenDriveCount + 1) ; //The remote drive we added is non removable |
0 | 618 |
|
619 |
||
620 |
||
621 |
//--------------------------------------------- |
|
622 |
//! @SYMTestCaseID PBASE-T_FSRV-0550 |
|
623 |
//! @SYMTestType UT |
|
624 |
//! @SYMREQ CR909 |
|
625 |
//! @SYMTestCaseDesc Test that RFs::DriveList(TDriveList& aList, TUint aFlags) can be used to exclude |
|
626 |
//! drives to be returned with certain attributes(as a combination). |
|
627 |
//! @SYMTestActions Call DriveList by passing to aFlags a value of |
|
628 |
//! KDriveAttExclude | KDriveAttRemovable | KDriveAttRemote. |
|
629 |
//! @SYMTestExpectedResults Test that only the remote drive that was mounted is returned. |
|
630 |
//! @SYMTestPriority High |
|
631 |
//! @SYMTestStatus Implemented |
|
632 |
//--------------------------------------------- |
|
633 |
||
634 |
||
635 |
||
636 |
test.Printf(_L("Exclude Removable and Remote\n")); |
|
637 |
||
638 |
drivecount = 0; |
|
639 |
flags = KDriveAttExclude | KDriveAttRemovable | KDriveAttRemote; |
|
640 |
err = TheFs.DriveList(driveList, flags); |
|
641 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
642 |
test_KErrNone(err); |
0 | 643 |
|
644 |
for ( i = 0; i < KMaxDrives; i++) |
|
645 |
{ |
|
646 |
if (driveList[i]) |
|
647 |
{ |
|
648 |
err = TheFs.Drive(info,i); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
649 |
test_KErrNone(err); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
650 |
test_Value(info.iDriveAtt, (!(info.iDriveAtt & KDriveAttRemovable ) && (!(info.iDriveAtt & KDriveAttRemote )))); |
0 | 651 |
drivecount++; |
652 |
||
653 |
printDriveAtt(i,info.iDriveAtt); |
|
654 |
} |
|
655 |
} |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
656 |
test_Value(drivecount, drivecount == (allDrivecount - removableDriveCount - 1) ); // also excluding the removables and the remote drive |
0 | 657 |
|
658 |
||
659 |
||
660 |
||
661 |
||
662 |
//--------------------------------------------- |
|
663 |
//! @SYMTestCaseID PBASE-T_FSRV-0551 |
|
664 |
//! @SYMTestType UT |
|
665 |
//! @SYMREQ CR909 |
|
666 |
//! @SYMTestCaseDesc Test RFs::DriveList(TDriveList& aList, TUint aFlags) with substitute drives. |
|
667 |
//! @SYMTestActions Call DriveList by passing to aFlags combinations of attributes that exclude, exclusive or |
|
668 |
//! not substitute drives. |
|
669 |
//! @SYMTestExpectedResults Test that only the appropriate drives are returned. |
|
670 |
//! @SYMTestPriority High |
|
671 |
//! @SYMTestStatus Implemented |
|
672 |
//--------------------------------------------- |
|
673 |
||
674 |
||
675 |
||
676 |
if (substDrive) |
|
677 |
{ |
|
678 |
||
679 |
||
680 |
test.Printf(_L("Exclude Remote and Substed\n")); |
|
681 |
||
682 |
drivecount = 0; |
|
683 |
flags = KDriveAttExclude | KDriveAttRemote | KDriveAttSubsted; |
|
684 |
err = TheFs.DriveList(driveList, flags); |
|
685 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
686 |
test_KErrNone(err); |
0 | 687 |
|
688 |
for ( i = 0; i < KMaxDrives; i++) |
|
689 |
{ |
|
690 |
if (driveList[i]) |
|
691 |
{ |
|
692 |
err = TheFs.Drive(info,i); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
693 |
test_KErrNone(err); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
694 |
test_Value(info.iDriveAtt, (!(info.iDriveAtt & KDriveAttRemote ) && (!(info.iDriveAtt & KDriveAttSubsted )))); |
0 | 695 |
drivecount++; |
696 |
||
697 |
printDriveAtt(i,info.iDriveAtt); |
|
698 |
} |
|
699 |
} |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
700 |
test_Value(drivecount, drivecount == (allDrivecount - substDriveCount- 1) ); |
0 | 701 |
|
702 |
||
703 |
||
704 |
test.Printf(_L("Exclusively Exclude Substed drives\n")); |
|
705 |
||
706 |
drivecount = 0; |
|
707 |
flags = KDriveAttExclusive | KDriveAttExclude | KDriveAttSubsted; |
|
708 |
err = TheFs.DriveList(driveList, flags); |
|
709 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
710 |
test_KErrNone(err); |
0 | 711 |
|
712 |
for ( i = 0; i < KMaxDrives; i++) |
|
713 |
{ |
|
714 |
if (driveList[i]) |
|
715 |
{ |
|
716 |
err = TheFs.Drive(info,i); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
717 |
test_KErrNone(err); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
718 |
test_Value(info.iDriveAtt, info.iDriveAtt != KDriveAttSubsted); |
0 | 719 |
drivecount++; |
720 |
||
721 |
printDriveAtt(i,info.iDriveAtt); |
|
722 |
} |
|
723 |
||
724 |
} |
|
725 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
726 |
test_Value(drivecount, drivecount == (allDrivecount - exclusiveSubstDriveCount) ); |
0 | 727 |
|
728 |
} |
|
729 |
||
730 |
||
731 |
//--------------------------------------------- |
|
732 |
//! @SYMTestCaseID PBASE-T_FSRV-0552 |
|
733 |
//! @SYMTestType UT |
|
734 |
//! @SYMREQ CR909 |
|
735 |
//! @SYMTestCaseDesc Test that RFs::DriveList(TDriveList& aList, TUint aFlags) returns the correct value for every |
|
736 |
//! combination of matching mask. |
|
737 |
//! @SYMTestActions Call DriveList for every combination of mask and check that the correct value is returned. |
|
738 |
//! A structure is used to store the expected value for each combination. |
|
739 |
//! @SYMTestExpectedResults Test for every combination that only drives with the correct attributes are retruned. |
|
740 |
//! @SYMTestPriority High |
|
741 |
//! @SYMTestStatus Implemented |
|
742 |
//--------------------------------------------- |
|
743 |
||
744 |
||
745 |
test.Printf(_L("Test All Combinations \n")); |
|
746 |
||
747 |
struct TCombinations |
|
748 |
{ |
|
749 |
TUint iMatchMask; // The Match Mask to be combined with drive attributes |
|
750 |
TInt iExpectedResultNoAtts; // Expected result when flag used on it's own |
|
751 |
TInt iExpectedResultWithAtts; // Expected result when flag used in combination with drive flags |
|
752 |
}; |
|
753 |
||
754 |
TCombinations testCombinations[] = { |
|
755 |
{ 0, KErrNone, KErrNone}, |
|
756 |
{ KDriveAttAll, KErrNone, KErrArgument }, |
|
757 |
{ KDriveAttExclude, KErrArgument, KErrNone }, |
|
758 |
{ KDriveAttExclusive, KErrArgument, KErrNone }, |
|
759 |
{ KDriveAttExclude | KDriveAttExclusive, KErrArgument, KErrNone }, |
|
760 |
{ KDriveAttAll | KDriveAttExclude, KErrArgument, KErrArgument }, |
|
761 |
{ KDriveAttAll | KDriveAttExclusive, KErrArgument, KErrArgument}, |
|
762 |
{ KDriveAttAll | KDriveAttExclude | KDriveAttExclusive, KErrArgument, KErrArgument}}; |
|
763 |
||
764 |
TDriveList fullDriveList; |
|
765 |
err = TheFs.DriveList(fullDriveList, KDriveAttAll); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
766 |
test_KErrNone(err); |
0 | 767 |
|
768 |
for ( i = 0; i < KMaxDrives; i++) |
|
769 |
{ |
|
770 |
if (driveList[i]) |
|
771 |
{ |
|
772 |
err = TheFs.Drive(info,i); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
773 |
test_KErrNone(err); |
0 | 774 |
printDriveAtt(i,info.iDriveAtt); |
775 |
} |
|
776 |
} |
|
777 |
||
778 |
for(TUint matchIdx = 0; matchIdx < sizeof(testCombinations) / sizeof(TCombinations); matchIdx++) |
|
779 |
{ |
|
780 |
test.Printf(_L("\nMatch Flags: KDriveAttAll[%c] KDriveAttExclude[%c] KDriveAttExclusive[%c]\n"), testCombinations[matchIdx].iMatchMask & KDriveAttAll ? 'X' : ' ', |
|
781 |
testCombinations[matchIdx].iMatchMask & KDriveAttExclude ? 'X' : ' ', |
|
782 |
testCombinations[matchIdx].iMatchMask & KDriveAttExclusive ? 'X' : ' '); |
|
783 |
||
784 |
for(TUint testAtt = 0; testAtt <= KMaxTUint8; testAtt++) |
|
785 |
{ |
|
786 |
TDriveList newDriveList; |
|
787 |
err = TheFs.DriveList(newDriveList, testCombinations[matchIdx].iMatchMask | testAtt); |
|
788 |
||
789 |
//test.Printf(_L(" ATT : 0x%08x \n"), testAtt); |
|
790 |
//test.Printf(_L("Expected Result : %d \n"), testAtt == 0 ? testCombinations[matchIdx].iExpectedResultNoAtts : testCombinations[matchIdx].iExpectedResultWithAtts); |
|
791 |
//test.Printf(_L(" Actual Result : 0x%08x \n"), err); |
|
792 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
793 |
test_Value(err, err == (testAtt == 0 ? testCombinations[matchIdx].iExpectedResultNoAtts : testCombinations[matchIdx].iExpectedResultWithAtts)); |
0 | 794 |
|
795 |
if(err == KErrNone) |
|
796 |
{ |
|
797 |
//printDriveAtt(0, testAtt); //Prints attributes |
|
798 |
for ( i = 0; i < KMaxDrives; i++) |
|
799 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
800 |
TBool expectMatch = EFalse; |
0 | 801 |
|
802 |
switch(testCombinations[matchIdx].iMatchMask) |
|
803 |
{ |
|
804 |
case 0: |
|
805 |
expectMatch = (fullDriveList[i] & testAtt) != 0; |
|
806 |
break; |
|
807 |
||
808 |
case KDriveAttAll: |
|
809 |
expectMatch = ETrue; |
|
810 |
break; |
|
811 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
812 |
case KDriveAttExclude: |
0 | 813 |
expectMatch = (fullDriveList[i] & testAtt) == 0; |
814 |
break; |
|
815 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
816 |
case KDriveAttExclusive: |
0 | 817 |
expectMatch = (fullDriveList[i] == testAtt); |
818 |
break; |
|
819 |
||
820 |
case KDriveAttExclude | KDriveAttExclusive: |
|
821 |
expectMatch = (fullDriveList[i] != testAtt); |
|
822 |
break; |
|
823 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
824 |
case KDriveAttAll | KDriveAttExclude: |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
825 |
// Invalid - should never get here as this returns KErrArgument for all cases |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
826 |
case KDriveAttAll | KDriveAttExclusive: |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
827 |
// Invalid - should never get here as this returns KErrArgument for all cases |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
828 |
case KDriveAttAll | KDriveAttExclude | KDriveAttExclusive: |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
829 |
// Invalid - should never get here as this returns KErrArgument for all cases |
0 | 830 |
default: |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
831 |
test.Printf(_L("Unexpected or invalid Match Mask %08x"), testCombinations[matchIdx].iMatchMask); |
0 | 832 |
test(0); |
833 |
break; |
|
834 |
} |
|
835 |
||
836 |
if(expectMatch) |
|
837 |
{ |
|
838 |
//test.Printf(_L(" %c MATCHED OK "), 'A' + i); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
839 |
test_Value(newDriveList[i], newDriveList[i] == fullDriveList[i]); |
0 | 840 |
} |
841 |
else |
|
842 |
{ |
|
843 |
/*if(fullDriveList[i] == 0) |
|
844 |
{ |
|
845 |
test.Printf(_L(" %c NOT PRESENT "), 'A' + i); |
|
846 |
} |
|
847 |
else |
|
848 |
{ |
|
849 |
test.Printf(_L(" %c NOT MATCHED "), 'A' + i); |
|
850 |
} |
|
851 |
*/ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
852 |
test_Value(newDriveList[i], newDriveList[i] == 0); |
0 | 853 |
} |
854 |
} |
|
855 |
} |
|
856 |
} |
|
857 |
} |
|
858 |
||
859 |
||
860 |
||
861 |
//--------------------------------------------- |
|
862 |
//! @SYMTestCaseID PBASE-T_FSRV-0605 |
|
863 |
//! @SYMTestType UT |
|
864 |
//! @SYMREQ CR1086 |
|
865 |
//! @SYMTestCaseDesc Test that RFs::DriveList(TDriveList& aList, TUint aFlags) can identify the |
|
866 |
//! logically removable drives. |
|
867 |
//! @SYMTestActions Call DriveList by passing to aFlags a value of KDriveAttLogicallyRemovable. |
|
868 |
//! @SYMTestExpectedResults Check that only the logically removable drives specified in estart.txt are returned. |
|
869 |
//! @SYMTestPriority High |
|
870 |
//! @SYMTestStatus Implemented |
|
871 |
//--------------------------------------------- |
|
872 |
||
873 |
test.Printf(_L("Return only Logically Removable drives \n")); |
|
874 |
||
875 |
drivecount = 0; |
|
876 |
flags = KDriveAttLogicallyRemovable; |
|
877 |
err = TheFs.DriveList(driveList, flags); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
878 |
test_KErrNone(err); |
0 | 879 |
for ( i = 0; i < KMaxDrives; i++) |
880 |
{ |
|
881 |
if (driveList[i]) |
|
882 |
{ |
|
883 |
err = TheFs.Drive(info, i); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
884 |
test_KErrNone(err); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
885 |
test_Value(info.iDriveAtt, info.iDriveAtt & KDriveAttLogicallyRemovable); |
0 | 886 |
drivecount++; |
887 |
||
888 |
printDriveAtt(i,info.iDriveAtt); |
|
889 |
} |
|
890 |
||
891 |
} |
|
892 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
893 |
test_Value(drivecount, drivecount == logicallyRemovableDriveCount); // no logically removable drive was added |
0 | 894 |
|
895 |
test.End(); |
|
896 |
} |
|
897 |
||
898 |
||
899 |
||
900 |
||
901 |
||
902 |
||
903 |
||
904 |
LOCAL_C void testDriveInfo() |
|
905 |
// |
|
906 |
// Test the drive info. |
|
907 |
// |
|
908 |
{ |
|
909 |
||
910 |
test.Start(_L("The drive info")); |
|
911 |
TDriveList list; |
|
912 |
TInt r=TheFs.DriveList(list); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
913 |
test_KErrNone(r); |
0 | 914 |
for (TInt i=0;i<KMaxDrives;i++) |
915 |
{ |
|
916 |
TInt att=list[i]; |
|
917 |
if (att) |
|
918 |
{ |
|
919 |
TDriveInfo d; |
|
920 |
r=TheFs.Drive(d,i); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
921 |
test_KErrNone(r); |
0 | 922 |
printDriveInfo(i,d); |
923 |
test.Printf(_L("\n")); |
|
924 |
testDriveInfo(i,d); |
|
925 |
} |
|
926 |
} |
|
927 |
||
928 |
test.End(); |
|
929 |
} |
|
930 |
||
931 |
LOCAL_C void testVolumeInfo() |
|
932 |
// |
|
933 |
// Test volume info. |
|
934 |
// |
|
935 |
{ |
|
936 |
||
937 |
test.Start(_L("The volume info")); |
|
938 |
TDriveList list; |
|
939 |
TInt r=TheFs.DriveList(list); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
940 |
test_KErrNone(r); |
0 | 941 |
for (TInt i=0;i<KMaxDrives;i++) |
942 |
{ |
|
943 |
TVolumeInfo v; |
|
944 |
TDriveInfo d; |
|
945 |
switch (r=TheFs.Volume(v,i)) |
|
946 |
{ |
|
947 |
case KErrNone: |
|
948 |
printDriveInfo(i,v.iDrive); |
|
949 |
test.Printf(_L(" VOL=\"%S\" ID=%08x\n"),&v.iName,v.iUniqueID); |
|
950 |
test.Printf(_L(" SIZE=%ldK FREE=%ldK\n"),v.iSize/1024,v.iFree/1024); |
|
951 |
break; |
|
952 |
case KErrNotReady: |
|
953 |
r=TheFs.Drive(d, i); |
|
954 |
test_KErrNone(r); |
|
955 |
if (d.iType == EMediaNotPresent) |
|
956 |
test.Printf(_L("%c: Medium not present - cannot perform test.\n"), i + 'A'); |
|
957 |
else |
|
958 |
test.Printf(_L("medium found (type %d) but drive %c: not ready\nPrevious test may have hung; else, check hardware.\n"), (TInt)d.iType, i + 'A'); |
|
959 |
break; |
|
960 |
case KErrPathNotFound: |
|
961 |
test.Printf(_L("%c: Not Found\n"), i + 'A'); |
|
962 |
break; |
|
963 |
case KErrCorrupt: |
|
964 |
test.Printf(_L("%c: Media corruption; previous test may have aborted; else, check hardware\n"), i + 'A'); |
|
965 |
default: |
|
966 |
test_KErrNone(r); |
|
967 |
} |
|
968 |
test.Printf(_L("\n")); |
|
969 |
} |
|
970 |
||
971 |
test.End(); |
|
972 |
} |
|
973 |
||
974 |
LOCAL_C void testClientParse() |
|
975 |
// |
|
976 |
// Test the client side parse. |
|
977 |
// |
|
978 |
{ |
|
979 |
||
980 |
test.Start(_L("Test client side parsing")); |
|
981 |
||
982 |
for (TInt i=0;i<KMaxParses;i++) |
|
983 |
{ |
|
984 |
TInt r; |
|
985 |
TParse f; |
|
986 |
SParse& p=parse[i]; |
|
987 |
TPtrC name(p.src); |
|
988 |
if (p.rel) |
|
989 |
{ |
|
990 |
if (p.def) |
|
991 |
{ |
|
992 |
TPtrC rel(p.rel); |
|
993 |
TPtrC def(p.def); |
|
994 |
r=f.Set(name,&rel,&def); |
|
995 |
} |
|
996 |
else |
|
997 |
{ |
|
998 |
TPtrC rel(p.rel); |
|
999 |
r=f.Set(name,&rel,NULL); |
|
1000 |
} |
|
1001 |
} |
|
1002 |
else |
|
1003 |
r=f.Set(name,NULL,NULL); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1004 |
test_KErrNone(r); |
0 | 1005 |
test(TPtrC(p.fullName)==f.FullName()); |
1006 |
test(TPtrC(p.drive)==f.Drive()); |
|
1007 |
test(TPtrC(p.path)==f.Path()); |
|
1008 |
test(TPtrC(p.name)==f.Name()); |
|
1009 |
test(TPtrC(p.ext)==f.Ext()); |
|
1010 |
} |
|
1011 |
||
1012 |
test.End(); |
|
1013 |
} |
|
1014 |
||
1015 |
LOCAL_C void testPath() |
|
1016 |
// |
|
1017 |
// Test the path handling. |
|
1018 |
// |
|
1019 |
{ |
|
1020 |
||
1021 |
test.Start(_L("Test path handling")); |
|
1022 |
TFileName p; |
|
1023 |
TInt r=TheFs.SessionPath(p); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1024 |
test_KErrNone(r); |
0 | 1025 |
test.Printf(_L("SESSION=\"%S\"\n"),&p); |
1026 |
r=TheFs.SetSessionPath(_L("A:\\TEST\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1027 |
test_KErrNone(r); |
0 | 1028 |
r=TheFs.SessionPath(p); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1029 |
test_KErrNone(r); |
0 | 1030 |
test(p==_L("A:\\TEST\\")); |
1031 |
r=TheFs.SetSessionPath(gSessionPath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1032 |
test_KErrNone(r); |
0 | 1033 |
|
1034 |
||
1035 |
TheFs.SetAllocFailure(gAllocFailOff); |
|
1036 |
||
1037 |
RThread t; |
|
1038 |
r=t.Create(_L("PathTest"),pathTestThread,KDefaultStackSize,KHeapSize,KHeapSize,NULL); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1039 |
test_KErrNone(r); |
0 | 1040 |
TRequestStatus tStat; |
1041 |
t.Logon(tStat); |
|
1042 |
t.Resume(); |
|
1043 |
User::WaitForRequest(tStat); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1044 |
r = tStat.Int(); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1045 |
test_KErrNone(r); |
0 | 1046 |
t.Close(); |
1047 |
||
1048 |
TheFs.SetAllocFailure(gAllocFailOn); |
|
1049 |
||
1050 |
test.End(); |
|
1051 |
} |
|
1052 |
||
1053 |
LOCAL_C void testServerParse() |
|
1054 |
// |
|
1055 |
// Test the client side parse. |
|
1056 |
// |
|
1057 |
{ |
|
1058 |
||
1059 |
test.Start(_L("Test server side parsing")); |
|
1060 |
||
1061 |
TFileName old; |
|
1062 |
TInt r=TheFs.SessionPath(old); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1063 |
test_KErrNone(r); |
0 | 1064 |
r=TheFs.SetSessionPath(_L("C:\\ABCDEF\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1065 |
test_KErrNone(r); |
0 | 1066 |
for (TInt i=0;i<KMaxParses;i++) |
1067 |
{ |
|
1068 |
TInt r; |
|
1069 |
TParse f; |
|
1070 |
SParseServer& p=parseServer[i]; |
|
1071 |
TPtrC name(p.src); |
|
1072 |
if (p.rel) |
|
1073 |
r=TheFs.Parse(name,TPtrC(p.rel),f); |
|
1074 |
else |
|
1075 |
r=TheFs.Parse(name,f); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1076 |
test_KErrNone(r); |
0 | 1077 |
test(TPtrC(p.fullName)==f.FullName()); |
1078 |
test(TPtrC(p.drive)==f.Drive()); |
|
1079 |
test(TPtrC(p.path)==f.Path()); |
|
1080 |
test(TPtrC(p.name)==f.Name()); |
|
1081 |
test(TPtrC(p.ext)==f.Ext()); |
|
1082 |
} |
|
1083 |
r=TheFs.SetSessionPath(old); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1084 |
test_KErrNone(r); |
0 | 1085 |
|
1086 |
test.End(); |
|
1087 |
} |
|
1088 |
||
1089 |
LOCAL_C void testSubst() |
|
1090 |
// |
|
1091 |
// Test the substitute functions. |
|
1092 |
// |
|
1093 |
{ |
|
1094 |
||
1095 |
test.Printf(_L("Test subst")); |
|
1096 |
TVolumeInfo v; |
|
1097 |
TInt r=TheFs.Volume(v); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1098 |
test_KErrNone(r); |
0 | 1099 |
TDriveInfo origDI; |
1100 |
r=TheFs.Drive(origDI); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1101 |
test_KErrNone(r); |
0 | 1102 |
|
1103 |
TDriveInfo driveInfo; |
|
1104 |
r=TheFs.Drive(driveInfo,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1105 |
test_KErrNone(r); |
0 | 1106 |
|
1107 |
if (driveInfo.iDriveAtt==KDriveAttLocal) |
|
1108 |
{ |
|
1109 |
return; // Subst local drives fails |
|
1110 |
} |
|
1111 |
||
1112 |
TFileName n; |
|
1113 |
r=TheFs.Subst(n,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1114 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1115 |
test_Value(n.Length(), n.Length()==0); |
0 | 1116 |
r=TheFs.SetSubst(gSessionPath,EDriveO); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1117 |
test_KErrNone(r); |
0 | 1118 |
r=TheFs.Subst(n,EDriveO); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1119 |
test_KErrNone(r); |
0 | 1120 |
test(n==gSessionPath); |
1121 |
TVolumeInfo w; |
|
1122 |
r=TheFs.Volume(w,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1123 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1124 |
test_Value(w.iDrive.iType, w.iDrive.iType==v.iDrive.iType); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1125 |
test_Value(w.iDrive.iConnectionBusType, w.iDrive.iConnectionBusType==v.iDrive.iConnectionBusType); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1126 |
test_Value(w.iDrive.iDriveAtt, w.iDrive.iDriveAtt==KDriveAttSubsted); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1127 |
test_Value(w.iDrive.iMediaAtt, w.iDrive.iMediaAtt==v.iDrive.iMediaAtt); |
0 | 1128 |
test(w.iUniqueID==v.iUniqueID); |
1129 |
test(w.iSize==v.iSize); |
|
1130 |
test(w.iFree==v.iFree); |
|
1131 |
test(w.iName==v.iName); |
|
1132 |
TDriveList driveList; |
|
1133 |
r=TheFs.DriveList(driveList); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1134 |
test_KErrNone(r); |
0 | 1135 |
test(driveList[EDriveO]==KDriveAttSubsted); |
1136 |
TDriveInfo d; |
|
1137 |
r=TheFs.Drive(d,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1138 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1139 |
test_Value(d.iDriveAtt, d.iDriveAtt==KDriveAttSubsted); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1140 |
test_Value(d.iMediaAtt, d.iMediaAtt==origDI.iMediaAtt); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1141 |
test_Value(d.iType, d.iType==origDI.iType); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1142 |
test_Value(d.iConnectionBusType, d.iConnectionBusType==origDI.iConnectionBusType); |
0 | 1143 |
|
1144 |
||
1145 |
test.Next(_L("Test real name")); |
|
1146 |
r=TheFs.RealName(_L("O:\\FILE.XXX"),n); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1147 |
test_KErrNone(r); |
0 | 1148 |
TFileName substedPath=gSessionPath; |
1149 |
substedPath.Append(_L("FILE.XXX")); |
|
1150 |
test(n.CompareF(substedPath)==KErrNone); |
|
1151 |
// |
|
1152 |
test.Next(_L("Test MkDir, Rename and RmDir on Substed drive")); |
|
1153 |
_LIT(KTurgid,"turgid\\"); |
|
1154 |
TFileName dir=gSessionPath; |
|
1155 |
dir+=KTurgid; |
|
1156 |
r=TheFs.MkDirAll(dir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1157 |
test_KErrNone(r); |
0 | 1158 |
dir+=_L("subdir\\"); |
1159 |
r=TheFs.MkDir(dir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1160 |
test_KErrNone(r); |
0 | 1161 |
r=TheFs.RmDir(_L("O:\\turgid\\subdir\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1162 |
test_KErrNone(r); |
0 | 1163 |
r=TheFs.Rename(_L("O:\\turgid"), _L("O:\\facile")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1164 |
test_KErrNone(r); |
0 | 1165 |
r=TheFs.MkDir(_L("O:\\insipid\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1166 |
test_KErrNone(r); |
0 | 1167 |
r=TheFs.Rename(_L("O:\\insipid"), _L("O:\\glib")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1168 |
test_KErrNone(r); |
0 | 1169 |
r=TheFs.RmDir(_L("O:\\facile\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1170 |
test_KErrNone(r); |
0 | 1171 |
_LIT(KGlib,"glib\\"); |
1172 |
dir=gSessionPath; |
|
1173 |
dir+=KGlib; |
|
1174 |
r=TheFs.RmDir(dir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1175 |
test_KErrNone(r); |
0 | 1176 |
// |
1177 |
test.Next(_L("Test file operations on Substed drive")); |
|
1178 |
_LIT(File1,"File1.txt"); |
|
1179 |
_LIT(File2,"File2.txt"); |
|
1180 |
_LIT(SubstRoot,"O:\\"); |
|
1181 |
_LIT(Subdir,"subdir\\"); |
|
1182 |
TFileName name1,name2; |
|
1183 |
name1=gSessionPath; |
|
1184 |
name1+=File1; |
|
1185 |
RFile f1; |
|
1186 |
r=f1.Replace(TheFs,name1,EFileShareExclusive|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1187 |
test_KErrNone(r); |
0 | 1188 |
name2=SubstRoot; |
1189 |
name2+=File2; |
|
1190 |
TBool isValid=TheFs.IsValidName(name2); |
|
1191 |
test(isValid); |
|
1192 |
r=f1.Rename(name2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1193 |
test_KErrNone(r); |
0 | 1194 |
f1.Close(); |
1195 |
r=f1.Create(TheFs,name1,EFileShareExclusive|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1196 |
test_KErrNone(r); |
0 | 1197 |
f1.Close(); |
1198 |
r=TheFs.Replace(name2,name1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1199 |
test_KErrNone(r); |
0 | 1200 |
r=TheFs.Delete(name1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1201 |
test_KErrNone(r); |
0 | 1202 |
test.Next(_L("Test notifications on Substed drive")); |
1203 |
name1=gSessionPath; |
|
1204 |
name1+=Subdir; |
|
1205 |
name2=SubstRoot; |
|
1206 |
name2+=Subdir; |
|
1207 |
// set up some extended notifications |
|
1208 |
TRequestStatus status1; |
|
1209 |
TRequestStatus status2; |
|
1210 |
TRequestStatus status3; |
|
1211 |
TheFs.NotifyChange(ENotifyDir,status1,name1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1212 |
test_Value(status1.Int(), status1==KRequestPending); |
0 | 1213 |
TheFs.NotifyChange(ENotifyDir,status2,name2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1214 |
test_Value(status2.Int(), status2==KRequestPending); |
0 | 1215 |
r=TheFs.MkDirAll(name1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1216 |
test_KErrNone(r); |
0 | 1217 |
User::WaitForRequest(status1); |
1218 |
User::WaitForRequest(status2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1219 |
test_KErrNone(status1.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1220 |
test_KErrNone(status2.Int()); |
0 | 1221 |
TheFs.NotifyChange(ENotifyDir,status1,name1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1222 |
test_Value(status1.Int(), status1==KRequestPending); |
0 | 1223 |
TheFs.NotifyChange(ENotifyDir,status2,name2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1224 |
test_Value(status2.Int(), status2==KRequestPending); |
0 | 1225 |
TheFs.NotifyChange(ENotifyAll,status3,name2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1226 |
test_Value(status3.Int(), status3==KRequestPending); |
0 | 1227 |
r=f1.Temp(TheFs,name2,n,EFileShareAny|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1228 |
test_KErrNone(r); |
0 | 1229 |
User::WaitForRequest(status3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1230 |
test_KErrNone(status3.Int()); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1231 |
test_Value(status1.Int(), status1==KRequestPending); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1232 |
test_Value(status2.Int(), status2==KRequestPending); |
0 | 1233 |
f1.Close(); |
1234 |
TheFs.NotifyChangeCancel(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1235 |
test_Value(status1.Int(), status1==KErrCancel); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1236 |
test_Value(status2.Int(), status2==KErrCancel); |
0 | 1237 |
r=TheFs.Delete(n); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1238 |
test_KErrNone(r); |
0 | 1239 |
r=TheFs.RmDir(name1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1240 |
test_KErrNone(r); |
0 | 1241 |
// |
1242 |
test.Next(_L("Test file systems on Substed drive")); |
|
1243 |
// test cannot mount file system on substituted drive |
|
1244 |
TInt sessionDrv; |
|
1245 |
r=TheFs.CharToDrive(gSessionPath[0],sessionDrv); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1246 |
test_KErrNone(r); |
0 | 1247 |
r=TheFs.FileSystemName(n,sessionDrv); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1248 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 1249 |
r=TheFs.MountFileSystem(n,EDriveO); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1250 |
test_Value(r, r == KErrAccessDenied); |
0 | 1251 |
// test file system name on substitued drive is null |
1252 |
r=TheFs.FileSystemName(n,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1253 |
test_Value(r, r == KErrNotFound && n==KNullDesC); |
0 | 1254 |
// test cannot format a substitued drive |
1255 |
RFormat format; |
|
1256 |
TInt count; |
|
1257 |
r=format.Open(TheFs,SubstRoot,EHighDensity,count); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1258 |
test_Value(r, r == KErrAccessDenied); |
0 | 1259 |
|
1260 |
r=TheFs.SetSubst(_L(""),EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1261 |
test_KErrNone(r); |
0 | 1262 |
r=TheFs.Subst(n,EDriveO); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1263 |
test_KErrNone(r); |
0 | 1264 |
test(n==_L("")); |
1265 |
r=TheFs.Drive(d,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1266 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1267 |
test_Value(d.iDriveAtt, d.iDriveAtt==0); |
0 | 1268 |
} |
1269 |
||
1270 |
LOCAL_C void testSetVolume() |
|
1271 |
// |
|
1272 |
// Test setting the volume info. |
|
1273 |
// |
|
1274 |
{ |
|
1275 |
||
1276 |
test.Start(_L("Test setting the volume label")); |
|
1277 |
||
1278 |
const TInt driveNum=CurrentDrive(); |
|
1279 |
||
1280 |
TVolumeInfo v; |
|
1281 |
TInt r=TheFs.Volume(v,driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1282 |
test_KErrNone(r); |
0 | 1283 |
TFileName n=v.iName; |
1284 |
test.Printf(_L("VOL=\"%S\"\n"),&n); |
|
1285 |
||
1286 |
test.Next(_L("Set volume label to nothing")); |
|
1287 |
r=TheFs.SetVolumeLabel(_L(""),driveNum); |
|
1288 |
||
1289 |
if(Is_Win32(TheFs, gDrive) && (r==KErrGeneral || r==KErrAccessDenied || r==KErrNotSupported)) |
|
1290 |
{ |
|
1291 |
test.Printf(_L("Error %d: Set volume label not testing on WINS\n"),r); |
|
1292 |
test.End(); |
|
1293 |
return; |
|
1294 |
} |
|
1295 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1296 |
test_KErrNone(r); |
0 | 1297 |
r=TheFs.Volume(v,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1298 |
test_Value(r, r == KErrNone ); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1299 |
test.Printf(_L("VOL=\"%S\"\n"),&v.iName); |
0 | 1300 |
test(v.iName==_L("")); |
1301 |
||
1302 |
test.Next(_L("Set volume label to ABCDEFGHIJK")); |
|
1303 |
r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1304 |
test_KErrNone(r); |
0 | 1305 |
r=TheFs.Volume(v,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1306 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1307 |
test.Printf(_L("VOL=\"%S\"\n"),&v.iName); |
0 | 1308 |
test(v.iName==_L("ABCDEFGHIJK")); |
1309 |
||
1310 |
test.Next(_L("Set volume label to ABCDE")); |
|
1311 |
r=TheFs.SetVolumeLabel(_L("ABCDE"),driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1312 |
test_KErrNone(r); |
0 | 1313 |
r=TheFs.Volume(v,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1314 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1315 |
test.Printf(_L("VOL=\"%S\"\n"),&v.iName); |
0 | 1316 |
test(v.iName==_L("ABCDE")); |
1317 |
||
1318 |
||
1319 |
test.Next(_L("Test replacement of non-ascii chars")); |
|
1320 |
TBuf<KMaxVolumeName> uBuf(KMaxVolumeName); |
|
1321 |
uBuf.FillZ(); |
|
1322 |
uBuf[0]='a'; |
|
1323 |
uBuf[1]=0x100; |
|
1324 |
uBuf[2]='b'; |
|
1325 |
uBuf[3]=0x101; |
|
1326 |
uBuf[4]='c'; |
|
1327 |
uBuf[5]=0x102; |
|
1328 |
uBuf[6]='d'; |
|
1329 |
uBuf[7]=0x103; |
|
1330 |
uBuf[8]='e'; |
|
1331 |
uBuf[9]=0x104; |
|
1332 |
uBuf[10]='f'; |
|
1333 |
r=TheFs.SetVolumeLabel(uBuf,driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1334 |
test_KErrNone(r); |
0 | 1335 |
TFileName drive=_L("?:"); |
1336 |
drive[0]=gSessionPath[0]; |
|
1337 |
||
1338 |
// ??? this needs to be replaced |
|
1339 |
// UserSvr::ForceRemountMedia(ERemovableMedia0); |
|
1340 |
User::After(1000000); |
|
1341 |
||
1342 |
TFileName sess; |
|
1343 |
r=TheFs.SessionPath(sess); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1344 |
test_KErrNone(r); |
0 | 1345 |
r=TheFs.Volume(v,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1346 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1347 |
test.Printf(_L("VOL=\"%S\"\n"),&v.iName); |
0 | 1348 |
if(Is_Fat(TheFs, gDrive)) //-- FAT doesn't support normal UNICODE in volume labels |
1349 |
test(v.iName==_L("a_b_c_d_e_f")); |
|
1350 |
else |
|
1351 |
test(v.iName == uBuf); |
|
1352 |
||
1353 |
test.Next(_L("Set volume label back to nothing")); |
|
1354 |
r=TheFs.SetVolumeLabel(_L(""),driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1355 |
test_KErrNone(r); |
0 | 1356 |
r=TheFs.Volume(v,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1357 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1358 |
test.Printf(_L("VOL=\"%S\"\n"),&v.iName); |
0 | 1359 |
test(v.iName==_L("")); |
1360 |
||
1361 |
test.Next(_L("Attempt to set volume label containing illegal characters")); |
|
1362 |
r=TheFs.SetVolumeLabel(_L("abc>def"),driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1363 |
test_Value(r, r == KErrBadName); |
0 | 1364 |
r=TheFs.SetVolumeLabel(_L("ghi*jkl"),driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1365 |
test_Value(r, r == KErrBadName); |
0 | 1366 |
r=TheFs.SetVolumeLabel(_L("mno?pqr"),driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1367 |
test_Value(r, r == KErrBadName); |
0 | 1368 |
r=TheFs.SetVolumeLabel(_L("stu|vwx"),driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1369 |
test_Value(r, r == KErrBadName); |
0 | 1370 |
r=TheFs.SetVolumeLabel(_L("yz<abc"),driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1371 |
test_Value(r, r == KErrBadName); |
0 | 1372 |
r=TheFs.SetVolumeLabel(_L("def//ghi"),driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1373 |
test_Value(r, r == KErrBadName); |
0 | 1374 |
|
1375 |
r=TheFs.Volume(v,driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1376 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1377 |
test.Printf(_L("VOL=\"%S\"\n"),&v.iName); |
0 | 1378 |
test(v.iName==_L("")); |
1379 |
||
1380 |
// test volume label after remount (for removable media only) |
|
1381 |
test.Next(_L("Test volume label after remount")); |
|
1382 |
||
1383 |
TDriveInfo info; |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1384 |
r = TheFs.Drive(info, driveNum); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1385 |
test_KErrNone(r); |
0 | 1386 |
|
1387 |
if((info.iDriveAtt & KDriveAttRemovable) != 0) |
|
1388 |
{ |
|
1389 |
// 1. set volume label |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1390 |
r = TheFs.SetVolumeLabel(_L("XXX"), driveNum); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1391 |
test_KErrNone(r); |
0 | 1392 |
|
1393 |
// 2. change bootsector volume label |
|
1394 |
const TInt offset = IsFileSystemFAT32(TheFs, driveNum)? |
|
1395 |
71 /*KFat32VolumeLabelPos*/ |
|
1396 |
: |
|
1397 |
43 /*KFat16VolumeLabelPos*/; // both from sfat32\inc\sl_bpb.h |
|
1398 |
||
1399 |
RRawDisk rdisk; |
|
1400 |
TPtrC8 label(_S8("Z"), 1); |
|
1401 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1402 |
r = rdisk.Open(TheFs, driveNum); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1403 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1404 |
r = rdisk.Write(offset, label); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1405 |
test_KErrNone(r); |
0 | 1406 |
rdisk.Close(); |
1407 |
||
1408 |
// 3. remount the drive |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1409 |
r = TheFs.RemountDrive(driveNum); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1410 |
test_KErrNone(r); |
0 | 1411 |
|
1412 |
// 4. check volume label |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1413 |
r = TheFs.Volume(v, driveNum); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1414 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1415 |
test.Printf(_L("VOL=\"%S\"\n"),&v.iName); |
0 | 1416 |
test(v.iName == _L("XXX")); |
1417 |
test.Printf(_L("- Passed.\n")); |
|
1418 |
} |
|
1419 |
else |
|
1420 |
test.Printf(_L("- Skipped (drive is not removable).\n")); |
|
1421 |
||
1422 |
// clean up |
|
1423 |
test.Next(_L("Set volume label to original")); |
|
1424 |
r=TheFs.SetVolumeLabel(n,driveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1425 |
test_KErrNone(r); |
0 | 1426 |
r=TheFs.Volume(v,driveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1427 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1428 |
test.Printf(_L("VOL=\"%S\"\n"),&v.iName); |
0 | 1429 |
test(v.iName==n); |
1430 |
||
1431 |
test.End(); |
|
1432 |
} |
|
1433 |
||
1434 |
LOCAL_C void testModified() |
|
1435 |
// |
|
1436 |
// Test the Modified/SetModified functions. |
|
1437 |
// |
|
1438 |
{ |
|
1439 |
||
1440 |
test.Start(_L("Test modified/SetModified functions")); |
|
1441 |
TTime savedTime; |
|
1442 |
TInt r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),savedTime); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1443 |
test_KErrNone(r); |
0 | 1444 |
TDateTime dateTime=savedTime.DateTime(); |
1445 |
test.Printf(_L("T_FSRV.CPP last modified %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond()); |
|
1446 |
test.Next(_L("Set modified")); |
|
1447 |
dateTime.Set(1993,EAugust,23,1,13,54,123456); |
|
1448 |
TTime newTime(dateTime); |
|
1449 |
r=TheFs.SetModified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),newTime); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1450 |
test_KErrNone(r); |
0 | 1451 |
TTime checkTime; |
1452 |
r=TheFs.Modified(_L("\\XXXX\\YYYY\\ZZZZ.CPP"),checkTime); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1453 |
test_Value(r, r == KErrPathNotFound); |
0 | 1454 |
r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1455 |
test_KErrNone(r); |
0 | 1456 |
dateTime=checkTime.DateTime(); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1457 |
test.Printf(_L("T_FSRV.CPP last modified %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond()); |
0 | 1458 |
test(dateTime.Year()==1993); |
1459 |
test(dateTime.Month()==EAugust); |
|
1460 |
test(dateTime.Day()==23); |
|
1461 |
test(dateTime.Hour()==1); |
|
1462 |
test(dateTime.Minute()==13); |
|
1463 |
test(dateTime.Second()==54); |
|
1464 |
// test(dateTime.MicroSecond()==123456); // dos is not accurate enough |
|
1465 |
r=TheFs.SetModified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),savedTime); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1466 |
test_KErrNone(r); |
0 | 1467 |
r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1468 |
test_KErrNone(r); |
0 | 1469 |
test(checkTime==savedTime); |
1470 |
||
1471 |
RFile f; |
|
1472 |
r=f.Open(TheFs,_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1473 |
test_KErrNone(r); |
0 | 1474 |
dateTime.Set(1997,EJanuary,1,2,55,51,999999); |
1475 |
newTime=dateTime; |
|
1476 |
r=f.SetModified(newTime); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1477 |
test_KErrNone(r); |
0 | 1478 |
r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1479 |
test_KErrNone(r); |
0 | 1480 |
|
1481 |
dateTime=checkTime.DateTime(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1482 |
test.Printf(_L("T_FSRV.CPP last modified via RFs::Modified() %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond()); |
0 | 1483 |
test(dateTime.Year()==1997); |
1484 |
test(dateTime.Month()==EJanuary); |
|
1485 |
test(dateTime.Day()==1); |
|
1486 |
test(dateTime.Hour()==2); |
|
1487 |
test(dateTime.Minute()==55); |
|
1488 |
test(dateTime.Second()>=50 && dateTime.Second()<=51); // Dos stores seconds %2 |
|
1489 |
||
1490 |
r=f.Modified(checkTime); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1491 |
test_KErrNone(r); |
0 | 1492 |
|
1493 |
dateTime=checkTime.DateTime(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1494 |
test.Printf(_L("T_FSRV.CPP last modified via RFile::Modified() %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond()); |
0 | 1495 |
test(dateTime.Year()==1997); |
1496 |
test(dateTime.Month()==EJanuary); |
|
1497 |
test(dateTime.Day()==1); |
|
1498 |
test(dateTime.Hour()==2); |
|
1499 |
test(dateTime.Minute()==55); |
|
1500 |
test(dateTime.Second()>=50 && dateTime.Second()<=51); // Dos stores seconds %2 |
|
1501 |
f.Close(); |
|
1502 |
||
1503 |
r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1504 |
test_KErrNone(r); |
0 | 1505 |
|
1506 |
dateTime=checkTime.DateTime(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1507 |
test.Printf(_L("T_FSRV.CPP last modified via RFs::Modified() %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond()); |
0 | 1508 |
test(dateTime.Year()==1997); |
1509 |
test(dateTime.Month()==EJanuary); |
|
1510 |
test(dateTime.Day()==1); |
|
1511 |
test(dateTime.Hour()==2); |
|
1512 |
test(dateTime.Minute()==55); |
|
1513 |
test(dateTime.Second()>=50 && dateTime.Second()<=51); // Dos stores seconds %2 |
|
1514 |
test.End(); |
|
1515 |
} |
|
1516 |
||
1517 |
LOCAL_C void testName() |
|
1518 |
// |
|
1519 |
// Test the Modified/SetModified functions. |
|
1520 |
// |
|
1521 |
{ |
|
1522 |
test.Start(_L("Test file name functions")); |
|
1523 |
||
1524 |
||
1525 |
_LIT(KFileNameAndPath, "\\F32-TST\\TFSRV\\T_FSRV.CPP"); |
|
1526 |
_LIT(KFileName, "T_FSRV.CPP"); |
|
1527 |
||
1528 |
RFile file; |
|
1529 |
||
1530 |
TInt r=file.Open(TheFs, KFileName, 0 ); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1531 |
test_KErrNone(r); |
0 | 1532 |
|
1533 |
TFileName fileName; |
|
1534 |
||
1535 |
// Check RFile::Name just retuns the file name, without path and drive |
|
1536 |
r=file.Name(fileName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1537 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1538 |
if (fileName != KFileName) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1539 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1540 |
test.Printf(_L("%S\n"), &fileName); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1541 |
test(0); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1542 |
} |
0 | 1543 |
|
1544 |
// Check RFile::FullName returns the complete file name and path |
|
1545 |
r=file.FullName(fileName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1546 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1547 |
if (fileName.Mid(2)!=KFileNameAndPath) // chop off drive letter + ':' |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1548 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1549 |
test.Printf(_L("%S\n"), &fileName); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1550 |
test(0); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1551 |
} |
0 | 1552 |
|
1553 |
file.Close(); |
|
1554 |
||
1555 |
test.End(); |
|
1556 |
} |
|
1557 |
||
1558 |
LOCAL_C TInt CreateFileX(const TDesC& aBaseName,TInt aX) |
|
1559 |
// |
|
1560 |
// Create a large file. Return KErrEof or KErrNone |
|
1561 |
// |
|
1562 |
{ |
|
1563 |
||
1564 |
TBuf<128> fileName=aBaseName; |
|
1565 |
fileName.AppendNum(aX); |
|
1566 |
RFile file; |
|
1567 |
||
1568 |
TInt r=file.Replace(TheFs,fileName,EFileWrite); |
|
1569 |
if (r==KErrDiskFull) |
|
1570 |
return(r); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1571 |
test_KErrNone(r); |
0 | 1572 |
|
1573 |
if (!IsTestingLFFS()) |
|
1574 |
r=file.SetSize(LargeFileSize); |
|
1575 |
else |
|
1576 |
{ // ??? Whats wrong with setsize |
|
1577 |
TBuf8<1024> testdata(1024); |
|
1578 |
TInt count=(LargeFileSize/testdata.Length()); |
|
1579 |
r=KErrNone; |
|
1580 |
while (count-- && r==KErrNone) |
|
1581 |
r=file.Write(testdata); |
|
1582 |
} |
|
1583 |
if (r==KErrDiskFull) |
|
1584 |
{ |
|
1585 |
file.Close(); |
|
1586 |
return(r); |
|
1587 |
} |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1588 |
test_KErrNone(r); |
0 | 1589 |
|
1590 |
file.Close(); |
|
1591 |
// r=TheFs.CheckDisk(fileName); |
|
1592 |
// if (r!=KErrNone && r!=KErrNotSupported) |
|
1593 |
// { |
|
1594 |
// test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r); |
|
1595 |
// test.Getch(); |
|
1596 |
// return(KErrDiskFull); |
|
1597 |
// } |
|
1598 |
test.Printf(_L("Created file %d size %d\n"),aX,LargeFileSize); |
|
1599 |
return(KErrNone); |
|
1600 |
} |
|
1601 |
||
1602 |
LOCAL_C TInt DeleteFileX(TBuf<128>& aBaseName,TInt aX) |
|
1603 |
// |
|
1604 |
// Delete a file. |
|
1605 |
// |
|
1606 |
{ |
|
1607 |
||
1608 |
TBuf<128> fileName=aBaseName; |
|
1609 |
fileName.AppendNum(aX); |
|
1610 |
TInt r=TheFs.Delete(fileName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1611 |
test_KErrNone(r); |
0 | 1612 |
// r=TheFs.CheckDisk(fileName); |
1613 |
// if (r!=KErrNone && r!=KErrNotSupported) |
|
1614 |
// { |
|
1615 |
// test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1616 |
// test_KErrNone(r); |
0 | 1617 |
// } |
1618 |
test.Printf(_L("Deleted File %d\n"),aX); |
|
1619 |
return(KErrNone); |
|
1620 |
} |
|
1621 |
||
1622 |
LOCAL_C void MakeAndDeleteFiles() |
|
1623 |
// |
|
1624 |
// Create and delete large files in a randomish order |
|
1625 |
// |
|
1626 |
{ |
|
1627 |
||
1628 |
test.Start(_L("Create and delete large files")); |
|
1629 |
TInt r=TheFs.MkDirAll(_L("\\F32-TST\\SMALLDIRECTORY\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1630 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 1631 |
TBuf<128> fileName=_L("\\F32-TST\\SMALLDIRECTORY\\FILE"); |
1632 |
r=CreateFileX(fileName,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1633 |
test_KErrNone(r); |
0 | 1634 |
r=CreateFileX(fileName,1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1635 |
test_KErrNone(r); |
0 | 1636 |
r=DeleteFileX(fileName,0); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1637 |
test_KErrNone(r); |
0 | 1638 |
r=CreateFileX(fileName,2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1639 |
test_KErrNone(r); |
0 | 1640 |
r=CreateFileX(fileName,1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1641 |
test_KErrNone(r); |
0 | 1642 |
r=CreateFileX(fileName,3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1643 |
test_KErrNone(r); |
0 | 1644 |
r=DeleteFileX(fileName,1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1645 |
test_KErrNone(r); |
0 | 1646 |
r=CreateFileX(fileName,4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1647 |
test_KErrNone(r); |
0 | 1648 |
r=DeleteFileX(fileName,2); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1649 |
test_KErrNone(r); |
0 | 1650 |
r=DeleteFileX(fileName,3); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1651 |
test_KErrNone(r); |
0 | 1652 |
r=DeleteFileX(fileName,4); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1653 |
test_KErrNone(r); |
0 | 1654 |
r=CreateFileX(fileName,1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1655 |
test_KErrNone(r); |
0 | 1656 |
r=DeleteFileX(fileName,1); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1657 |
test_KErrNone(r); |
0 | 1658 |
|
1659 |
r=TheFs.CheckDisk(fileName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1660 |
test_Value(r, r == KErrNone || r == KErrNotSupported); |
0 | 1661 |
test.End(); |
1662 |
} |
|
1663 |
||
1664 |
LOCAL_C void FillUpDisk() |
|
1665 |
// |
|
1666 |
// Test that a full disk is ok |
|
1667 |
// |
|
1668 |
{ |
|
1669 |
||
1670 |
test.Start(_L("Fill disk to capacity")); |
|
1671 |
TInt r=TheFs.MkDirAll(_L("\\F32-TST\\BIGDIRECTORY\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1672 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 1673 |
TInt count=0; |
1674 |
TFileName sessionPath; |
|
1675 |
r=TheFs.SessionPath(sessionPath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1676 |
test_KErrNone(r); |
0 | 1677 |
TBuf<128> fileName=_L("\\F32-TST\\BIGDIRECTORY\\FILE"); |
1678 |
FOREVER |
|
1679 |
{ |
|
1680 |
TInt r=CreateFileX(fileName,count); |
|
1681 |
if (r==KErrDiskFull) |
|
1682 |
break; |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1683 |
test_KErrNone(r); |
0 | 1684 |
count++; |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1685 |
if (Is_SimulatedSystemDrive(TheFs,gDrive) && count==32) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1686 |
break; // Limit on disk size for emulator/PlatSim |
0 | 1687 |
} |
1688 |
||
1689 |
r=TheFs.CheckDisk(fileName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1690 |
test_Value(r, r == KErrNone || r == KErrNotSupported); |
0 | 1691 |
|
1692 |
while(count--) |
|
1693 |
DeleteFileX(fileName,count); |
|
1694 |
||
1695 |
r=TheFs.CheckDisk(fileName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1696 |
test_Value(r, r == KErrNone || r == KErrNotSupported); |
0 | 1697 |
|
1698 |
test.End(); |
|
1699 |
} |
|
1700 |
||
1701 |
LOCAL_C void CopyFileToTestDirectory() |
|
1702 |
// |
|
1703 |
// Make a copy of the file in ram |
|
1704 |
// |
|
1705 |
{ |
|
1706 |
||
1707 |
TFileName fn = _L("Z:\\TEST\\T_FSRV.CPP"); |
|
1708 |
fn[0] = gExeFileName[0]; |
|
1709 |
TParse f; |
|
1710 |
TInt r=TheFs.Parse(fn,f); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1711 |
test_KErrNone(r); |
0 | 1712 |
test.Next(_L("Copying file to test directory")); |
1713 |
TParse fCopy; |
|
1714 |
r=TheFs.Parse(f.NameAndExt(),fCopy); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1715 |
test_KErrNone(r); |
0 | 1716 |
|
1717 |
RFile f1; |
|
1718 |
r=f1.Open(TheFs,f.FullName(),EFileStreamText|EFileShareReadersOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1719 |
test_KErrNone(r); |
0 | 1720 |
RFile f2; |
1721 |
r=f2.Replace(TheFs,fCopy.FullName(),EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1722 |
test_KErrNone(r); |
0 | 1723 |
TBuf8<512> copyBuf; |
1724 |
TInt rem; |
|
1725 |
r=f1.Size(rem); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1726 |
test_KErrNone(r); |
0 | 1727 |
TInt pos=0; |
1728 |
while (rem) |
|
1729 |
{ |
|
1730 |
TInt s=Min(rem,copyBuf.MaxSize()); |
|
1731 |
r=f1.Read(pos,copyBuf,s); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1732 |
test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1733 |
test_Value(copyBuf.Length(), copyBuf.Length() == s); |
0 | 1734 |
r=f2.Write(pos,copyBuf,s); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1735 |
test_KErrNone(r); |
0 | 1736 |
pos+=s; |
1737 |
rem-=s; |
|
1738 |
} |
|
1739 |
f1.Close(); |
|
1740 |
f2.Close(); |
|
1741 |
} |
|
1742 |
||
1743 |
||
1744 |
//--------------------------------------------------------------------------- |
|
1745 |
||
1746 |
/** |
|
1747 |
test RFs::SetErrorCondition() aspects |
|
1748 |
*/ |
|
1749 |
void TestSetErrorCondition() |
|
1750 |
{ |
|
1751 |
#ifdef _DEBUG |
|
1752 |
||
1753 |
test.Next(_L("TestSetErrorCondition\n")); |
|
1754 |
||
1755 |
_LIT(KFileName, "\\A.swf"); |
|
1756 |
||
1757 |
TInt nRes; |
|
1758 |
RFile file; |
|
1759 |
RFile file1; |
|
1760 |
||
1761 |
const TInt KMyError = -756; //-- specific error code we will simulate |
|
1762 |
||
1763 |
//========== just create a file |
|
1764 |
nRes = TheFs.SetErrorCondition(KMyError,0); //-- set up FS error simulation |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1765 |
test_KErrNone(nRes); |
0 | 1766 |
|
1767 |
//-- this shall fail immediately |
|
1768 |
nRes = file.Replace(TheFs, KFileName, EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1769 |
test_Value(nRes, nRes == KMyError); |
0 | 1770 |
|
1771 |
nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation |
|
1772 |
file.Close(); |
|
1773 |
||
1774 |
//========== create file & duplicate a handle #1 |
|
1775 |
nRes = TheFs.SetErrorCondition(KMyError,1); //-- set up FS error simulation |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1776 |
test_KErrNone(nRes); |
0 | 1777 |
|
1778 |
//-- this shall succeed |
|
1779 |
nRes = file.Replace(TheFs, KFileName, EFileWrite); //-- err cnt -> 0 |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1780 |
test_KErrNone(nRes); |
0 | 1781 |
|
1782 |
//-- this shall fail inside RFile::Duplicate() half way through in the RFile::DuplicateHandle() |
|
1783 |
nRes = file1.Duplicate(file); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1784 |
test_Value(nRes, nRes == KMyError); |
0 | 1785 |
file1.Close(); |
1786 |
||
1787 |
nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation |
|
1788 |
file.Close(); |
|
1789 |
||
1790 |
//-- check that the file isn't locked |
|
1791 |
nRes = TheFs.Delete(KFileName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1792 |
test_KErrNone(nRes); |
0 | 1793 |
|
1794 |
//========== create file & duplicate a handle #2 |
|
1795 |
nRes = TheFs.SetErrorCondition(KMyError,2); //-- set up FS error simulation |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1796 |
test_KErrNone(nRes); |
0 | 1797 |
|
1798 |
//-- this shall succeed |
|
1799 |
nRes = file.Replace(TheFs, KFileName, EFileWrite); //-- err cnt -> 1 |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1800 |
test_KErrNone(nRes); |
0 | 1801 |
|
1802 |
//-- this must not fail, because EFsFileAdopt is excluded from the erros simulation |
|
1803 |
nRes = file1.Duplicate(file); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1804 |
test_KErrNone(nRes); |
0 | 1805 |
file1.Close(); |
1806 |
||
1807 |
nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation |
|
1808 |
file.Close(); |
|
1809 |
||
1810 |
//-- check that the file isn't locked |
|
1811 |
nRes = TheFs.Delete(KFileName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1812 |
test_KErrNone(nRes); |
0 | 1813 |
|
1814 |
//========== crazy loop, for DEF103757 |
|
1815 |
||
1816 |
for(TInt i=0; i<6; ++i) |
|
1817 |
{ |
|
1818 |
nRes = TheFs.SetErrorCondition(KMyError,i); //-- set up FS error simulation |
|
1819 |
||
1820 |
nRes = file.Replace(TheFs, KFileName, EFileWrite); //-- err cnt -> 1 |
|
1821 |
if(nRes != KErrNone) |
|
1822 |
continue; |
|
1823 |
||
1824 |
nRes = file1.Duplicate(file); |
|
1825 |
||
1826 |
file1.Close(); |
|
1827 |
file.Close(); |
|
1828 |
||
1829 |
nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation |
|
1830 |
} |
|
1831 |
||
1832 |
//-- check that the file isn't locked |
|
1833 |
nRes = TheFs.Delete(KFileName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1834 |
test_KErrNone(nRes); |
0 | 1835 |
|
1836 |
||
1837 |
#endif |
|
1838 |
} |
|
1839 |
||
1840 |
//--------------------------------------------------------------------------- |
|
1841 |
||
1842 |
GLDEF_C void CallTestsL() |
|
1843 |
// |
|
1844 |
// Test the file server. |
|
1845 |
// |
|
1846 |
{ |
|
1847 |
||
1848 |
//-- set up console output |
|
1849 |
F32_Test_Utils::SetConsole(test.Console()); |
|
1850 |
||
1851 |
TInt nRes=TheFs.CharToDrive(gDriveToTest, gDrive); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1852 |
test_KErrNone(nRes); |
0 | 1853 |
|
1854 |
PrintDrvInfo(TheFs, gDrive); |
|
1855 |
||
1856 |
||
1857 |
TVolumeInfo v; |
|
1858 |
TInt r=TheFs.Volume(v, CurrentDrive()); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1859 |
test_KErrNone(r); |
0 | 1860 |
LargeFileSize=Max((TUint32)I64LOW(v.iFree >> 7), (TUint32)65536u); |
1861 |
||
1862 |
if (gFirstTime) |
|
1863 |
{ |
|
1864 |
MountRemoteFilesystem(); |
|
1865 |
CreateSubstDrive(); |
|
1866 |
||
1867 |
testDriveList(); |
|
1868 |
||
1869 |
DisMountRemoteFilesystem(); |
|
1870 |
RemoveSubstDrive(); |
|
1871 |
||
1872 |
testDriveInfo(); |
|
1873 |
testVolumeInfo(); |
|
1874 |
testClientParse(); |
|
1875 |
testPath(); |
|
1876 |
testServerParse(); |
|
1877 |
gFirstTime=EFalse; |
|
1878 |
} |
|
1879 |
||
1880 |
CreateTestDirectory(_L("\\F32-TST\\TFSRV\\")); |
|
1881 |
testSubst(); |
|
1882 |
testSetVolume(); |
|
1883 |
CopyFileToTestDirectory(); |
|
1884 |
testModified(); |
|
1885 |
testName(); |
|
1886 |
MakeAndDeleteFiles(); |
|
1887 |
FillUpDisk(); |
|
1888 |
DeleteTestDirectory(); |
|
1889 |
||
1890 |
TestSetErrorCondition(); |
|
1891 |
||
1892 |
} |
|
1893 |