sl@0
|
1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// f32test\server\t_chkuid.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <f32file.h>
|
sl@0
|
19 |
#include <e32test.h>
|
sl@0
|
20 |
#include "t_server.h"
|
sl@0
|
21 |
#include "t_chlffs.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
#if defined(__WINS__)
|
sl@0
|
24 |
#define WIN32_LEAN_AND_MEAN
|
sl@0
|
25 |
#pragma warning (disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
|
sl@0
|
26 |
#pragma warning (default:4201) // warning C4201: nonstandard extension used : nameless struct/union
|
sl@0
|
27 |
#endif
|
sl@0
|
28 |
|
sl@0
|
29 |
GLDEF_D RTest test(_L("T_CHKUID"));
|
sl@0
|
30 |
|
sl@0
|
31 |
|
sl@0
|
32 |
LOCAL_C void CreateUidTestFiles()
|
sl@0
|
33 |
//
|
sl@0
|
34 |
// Create files with uids for testing
|
sl@0
|
35 |
//
|
sl@0
|
36 |
{
|
sl@0
|
37 |
// Create \\gSessionPath\\UIDCHKNO.SHT - no uid, zero length
|
sl@0
|
38 |
RFile file;
|
sl@0
|
39 |
TInt r=file.Replace(TheFs,_L("UIDCHKNO.SHT"),EFileRead|EFileWrite);
|
sl@0
|
40 |
test(r==KErrNone);
|
sl@0
|
41 |
file.Close();
|
sl@0
|
42 |
|
sl@0
|
43 |
// Create \\gSessionPath\\UIDCHKNO.LNG - no uid, long length
|
sl@0
|
44 |
r=file.Replace(TheFs,_L("UIDCHKNO.LNG"),EFileRead|EFileWrite);
|
sl@0
|
45 |
test(r==KErrNone);
|
sl@0
|
46 |
r=file.Write(_L8("Hello World needs to be over 16 bytes"));
|
sl@0
|
47 |
file.Close();
|
sl@0
|
48 |
|
sl@0
|
49 |
// Create \\gSessionPath\\UIDCHK.BLG - with uid no data
|
sl@0
|
50 |
r=file.Replace(TheFs,_L("UIDCHK.BLG"),EFileRead|EFileWrite);
|
sl@0
|
51 |
test(r==KErrNone);
|
sl@0
|
52 |
TUidType uidType(TUid::Uid('U'),TUid::Uid('I'),TUid::Uid('D'));
|
sl@0
|
53 |
TCheckedUid checkedUid(uidType);
|
sl@0
|
54 |
TPtrC8 buf((TUint8*)&checkedUid,sizeof(TCheckedUid));
|
sl@0
|
55 |
r=file.Write(buf);
|
sl@0
|
56 |
test(r==KErrNone);
|
sl@0
|
57 |
file.Close();
|
sl@0
|
58 |
|
sl@0
|
59 |
// Create \\gSessionPath\\UIDCHK.MSG - with uid and data
|
sl@0
|
60 |
r=file.Replace(TheFs,_L("UIDCHK.MSG"),EFileRead|EFileWrite);
|
sl@0
|
61 |
test(r==KErrNone);
|
sl@0
|
62 |
TUidType uidType2(TUid::Uid('X'),TUid::Uid('Y'),TUid::Uid('Z'));
|
sl@0
|
63 |
checkedUid.Set(uidType2);
|
sl@0
|
64 |
buf.Set((TUint8*)&checkedUid,sizeof(TCheckedUid));
|
sl@0
|
65 |
r=file.Write(buf);
|
sl@0
|
66 |
test(r==KErrNone);
|
sl@0
|
67 |
r=file.Write(_L8("More file data"));
|
sl@0
|
68 |
test(r==KErrNone);
|
sl@0
|
69 |
file.Close();
|
sl@0
|
70 |
|
sl@0
|
71 |
// Create \\gSessionPath\\UIDCHK.DAT - uid stored only in the file
|
sl@0
|
72 |
r=file.Replace(TheFs,_L("UIDCHK.DAT"),EFileRead|EFileWrite);
|
sl@0
|
73 |
test(r==KErrNone);
|
sl@0
|
74 |
TUidType uidType3(TUid::Uid('D'),TUid::Uid('A'),TUid::Uid('T'));
|
sl@0
|
75 |
checkedUid.Set(uidType3);
|
sl@0
|
76 |
buf.Set((TUint8*)&checkedUid,sizeof(TCheckedUid));
|
sl@0
|
77 |
r=file.Write(buf);
|
sl@0
|
78 |
test(r==KErrNone);
|
sl@0
|
79 |
r=file.Write(_L8("More file data"));
|
sl@0
|
80 |
test(r==KErrNone);
|
sl@0
|
81 |
file.Close();
|
sl@0
|
82 |
|
sl@0
|
83 |
// Create \\gSessionPath\\UIDCHK.PE - uid stored in WINS PE file header
|
sl@0
|
84 |
r=file.Replace(TheFs,_L("UIDWINS.PE"),EFileRead|EFileWrite);
|
sl@0
|
85 |
test(r==KErrNone);
|
sl@0
|
86 |
|
sl@0
|
87 |
#if defined(__WINS__)
|
sl@0
|
88 |
if (!IsTestingLFFS())
|
sl@0
|
89 |
{
|
sl@0
|
90 |
RFile fileSource;
|
sl@0
|
91 |
r=fileSource.Open(TheFs,_L("Z:\\TEST\\T_CHKUID.EXE"),EFileShareReadersOnly|EFileRead);
|
sl@0
|
92 |
test(r==KErrNone);
|
sl@0
|
93 |
|
sl@0
|
94 |
TBuf8<0x100> buffer;
|
sl@0
|
95 |
do
|
sl@0
|
96 |
{
|
sl@0
|
97 |
r=fileSource.Read(buffer);
|
sl@0
|
98 |
test(r==KErrNone);
|
sl@0
|
99 |
r=file.Write(buffer);
|
sl@0
|
100 |
test(r==KErrNone);
|
sl@0
|
101 |
}
|
sl@0
|
102 |
while (buffer.Length()==buffer.MaxLength());
|
sl@0
|
103 |
|
sl@0
|
104 |
fileSource.Close();
|
sl@0
|
105 |
}
|
sl@0
|
106 |
else
|
sl@0
|
107 |
{
|
sl@0
|
108 |
r=file.Write(_L8("Some zany stuff here!"));
|
sl@0
|
109 |
test(r==KErrNone);
|
sl@0
|
110 |
}
|
sl@0
|
111 |
#else
|
sl@0
|
112 |
r=file.Write(_L8("Some zany stuff here!"));
|
sl@0
|
113 |
test(r==KErrNone);
|
sl@0
|
114 |
#endif
|
sl@0
|
115 |
file.Close();
|
sl@0
|
116 |
}
|
sl@0
|
117 |
|
sl@0
|
118 |
LOCAL_C void Test1()
|
sl@0
|
119 |
//
|
sl@0
|
120 |
// Test GetDir
|
sl@0
|
121 |
//
|
sl@0
|
122 |
{
|
sl@0
|
123 |
|
sl@0
|
124 |
test.Next(_L("Use GetDir to check files"));
|
sl@0
|
125 |
CDir* dum=NULL;
|
sl@0
|
126 |
TInt r=TheFs.GetDir(_L("UID*"),KEntryAttAllowUid,ESortByName,dum);
|
sl@0
|
127 |
CDir& dir=*dum;
|
sl@0
|
128 |
test(r==KErrNone);
|
sl@0
|
129 |
TInt count=dir.Count();
|
sl@0
|
130 |
test(count==6);
|
sl@0
|
131 |
|
sl@0
|
132 |
TEntry entry=dir[0];
|
sl@0
|
133 |
test(entry.iName==_L("UIDCHK.BLG"));
|
sl@0
|
134 |
test(entry.IsTypeValid());
|
sl@0
|
135 |
test(entry.iType[0]==TUid::Uid('U') && entry.iType[1]==TUid::Uid('I') && entry.iType[2]==TUid::Uid('D'));
|
sl@0
|
136 |
|
sl@0
|
137 |
entry=dir[1];
|
sl@0
|
138 |
test(entry.iName==_L("UIDCHK.DAT"));
|
sl@0
|
139 |
test(entry.IsTypeValid());
|
sl@0
|
140 |
test(entry.iType[0]==TUid::Uid('D') && entry.iType[1]==TUid::Uid('A') && entry.iType[2]==TUid::Uid('T'));
|
sl@0
|
141 |
|
sl@0
|
142 |
entry=dir[2];
|
sl@0
|
143 |
test(entry.iName==_L("UIDCHK.MSG"));
|
sl@0
|
144 |
test(entry.IsTypeValid());
|
sl@0
|
145 |
test(entry.iType[0]==TUid::Uid('X') && entry.iType[1]==TUid::Uid('Y') && entry.iType[2]==TUid::Uid('Z'));
|
sl@0
|
146 |
|
sl@0
|
147 |
entry=dir[3];
|
sl@0
|
148 |
test(entry.iName==_L("UIDCHKNO.LNG"));
|
sl@0
|
149 |
test(entry.IsTypeValid()==EFalse);
|
sl@0
|
150 |
|
sl@0
|
151 |
entry=dir[4];
|
sl@0
|
152 |
test(entry.iName==_L("UIDCHKNO.SHT"));
|
sl@0
|
153 |
test(entry.IsTypeValid()==EFalse);
|
sl@0
|
154 |
|
sl@0
|
155 |
entry=dir[5];
|
sl@0
|
156 |
test(entry.iName==_L("UIDWINS.PE"));
|
sl@0
|
157 |
#if defined(__WINS__)
|
sl@0
|
158 |
TFileName sessionPath;
|
sl@0
|
159 |
TheFs.SessionPath(sessionPath);
|
sl@0
|
160 |
if (sessionPath[0]!='C')
|
sl@0
|
161 |
test(entry.IsTypeValid()==EFalse);
|
sl@0
|
162 |
else
|
sl@0
|
163 |
{
|
sl@0
|
164 |
test(entry.IsTypeValid());
|
sl@0
|
165 |
test(entry.iType[0]==TUid::Uid(0x1000007a) && entry.iType[1]==TUid::Uid(2) && entry.iType[2]==TUid::Uid(3));
|
sl@0
|
166 |
}
|
sl@0
|
167 |
#else
|
sl@0
|
168 |
test(entry.IsTypeValid()==EFalse);
|
sl@0
|
169 |
#endif
|
sl@0
|
170 |
delete dum;
|
sl@0
|
171 |
}
|
sl@0
|
172 |
|
sl@0
|
173 |
LOCAL_C void Test2()
|
sl@0
|
174 |
//
|
sl@0
|
175 |
// Test GetDir
|
sl@0
|
176 |
//
|
sl@0
|
177 |
{
|
sl@0
|
178 |
|
sl@0
|
179 |
test.Next(_L("Test KEntryAttAllowUid allows uids"));
|
sl@0
|
180 |
CDir* dum=NULL;
|
sl@0
|
181 |
TInt r=TheFs.GetDir(_L("UID*"),0,ESortByName,dum);
|
sl@0
|
182 |
CDir& dir=*dum;
|
sl@0
|
183 |
test(r==KErrNone);
|
sl@0
|
184 |
TInt count=dir.Count();
|
sl@0
|
185 |
test(count==6);
|
sl@0
|
186 |
|
sl@0
|
187 |
TEntry entry=dir[0];
|
sl@0
|
188 |
test(entry.iName==_L("UIDCHK.BLG"));
|
sl@0
|
189 |
test(!entry.IsTypeValid());
|
sl@0
|
190 |
|
sl@0
|
191 |
entry=dir[1];
|
sl@0
|
192 |
test(entry.iName==_L("UIDCHK.DAT"));
|
sl@0
|
193 |
test(!entry.IsTypeValid());
|
sl@0
|
194 |
|
sl@0
|
195 |
entry=dir[2];
|
sl@0
|
196 |
test(entry.iName==_L("UIDCHK.MSG"));
|
sl@0
|
197 |
test(!entry.IsTypeValid());
|
sl@0
|
198 |
|
sl@0
|
199 |
entry=dir[3];
|
sl@0
|
200 |
test(entry.iName==_L("UIDCHKNO.LNG"));
|
sl@0
|
201 |
test(entry.IsTypeValid()==EFalse);
|
sl@0
|
202 |
|
sl@0
|
203 |
entry=dir[4];
|
sl@0
|
204 |
test(entry.iName==_L("UIDCHKNO.SHT"));
|
sl@0
|
205 |
test(entry.IsTypeValid()==EFalse);
|
sl@0
|
206 |
|
sl@0
|
207 |
entry=dir[5];
|
sl@0
|
208 |
test(entry.iName==_L("UIDWINS.PE"));
|
sl@0
|
209 |
test(entry.IsTypeValid()==EFalse);
|
sl@0
|
210 |
delete dum;
|
sl@0
|
211 |
}
|
sl@0
|
212 |
|
sl@0
|
213 |
LOCAL_C void Test3()
|
sl@0
|
214 |
//
|
sl@0
|
215 |
// Test RFs::Entry()
|
sl@0
|
216 |
//
|
sl@0
|
217 |
{
|
sl@0
|
218 |
|
sl@0
|
219 |
test.Next(_L("Use RFs::EntryL() to check files"));
|
sl@0
|
220 |
TEntry entry;
|
sl@0
|
221 |
TInt r=TheFs.Entry(_L("UIDCHKNO.SHT"),entry);
|
sl@0
|
222 |
test(r==KErrNone);
|
sl@0
|
223 |
test(entry.iName==_L("UIDCHKNO.SHT"));
|
sl@0
|
224 |
test(entry.IsTypeValid()==EFalse);
|
sl@0
|
225 |
|
sl@0
|
226 |
r=TheFs.Entry(_L("UIDCHKNO.LNG"),entry);
|
sl@0
|
227 |
test(r==KErrNone);
|
sl@0
|
228 |
test(entry.iName==_L("UIDCHKNO.LNG"));
|
sl@0
|
229 |
test(entry.IsTypeValid()==EFalse);
|
sl@0
|
230 |
|
sl@0
|
231 |
r=TheFs.Entry(_L("UIDCHK.MSG"),entry);
|
sl@0
|
232 |
test(r==KErrNone);
|
sl@0
|
233 |
test(entry.iName==_L("UIDCHK.MSG"));
|
sl@0
|
234 |
test(entry.IsTypeValid());
|
sl@0
|
235 |
test(entry.iType[0]==TUid::Uid('X') && entry.iType[1]==TUid::Uid('Y') && entry.iType[2]==TUid::Uid('Z'));
|
sl@0
|
236 |
|
sl@0
|
237 |
r=TheFs.Entry(_L("UIDCHK.BLG"),entry);
|
sl@0
|
238 |
test(r==KErrNone);
|
sl@0
|
239 |
test(entry.iName==_L("UIDCHK.BLG"));
|
sl@0
|
240 |
test(entry.IsTypeValid());
|
sl@0
|
241 |
test(entry.iType[0]==TUid::Uid('U') && entry.iType[1]==TUid::Uid('I') && entry.iType[2]==TUid::Uid('D'));
|
sl@0
|
242 |
|
sl@0
|
243 |
r=TheFs.Entry(_L("UIDCHK.DAT"),entry);
|
sl@0
|
244 |
test(r==KErrNone);
|
sl@0
|
245 |
test(entry.iName==_L("UIDCHK.DAT"));
|
sl@0
|
246 |
test(entry.IsTypeValid());
|
sl@0
|
247 |
test(entry.iType[0]==TUid::Uid('D') && entry.iType[1]==TUid::Uid('A') && entry.iType[2]==TUid::Uid('T'));
|
sl@0
|
248 |
|
sl@0
|
249 |
r=TheFs.Entry(_L("UIDWINS.PE"),entry);
|
sl@0
|
250 |
test(r==KErrNone);
|
sl@0
|
251 |
test(entry.iName==_L("UIDWINS.PE"));
|
sl@0
|
252 |
#if defined(__WINS__)
|
sl@0
|
253 |
TFileName sessionPath;
|
sl@0
|
254 |
TheFs.SessionPath(sessionPath);
|
sl@0
|
255 |
if (sessionPath[0]!='C')
|
sl@0
|
256 |
test(entry.IsTypeValid()==EFalse);
|
sl@0
|
257 |
else
|
sl@0
|
258 |
{
|
sl@0
|
259 |
test(entry.IsTypeValid());
|
sl@0
|
260 |
test(entry.iType[0]==TUid::Uid(0x1000007a) && entry.iType[1]==TUid::Uid(2) && entry.iType[2]==TUid::Uid(3));
|
sl@0
|
261 |
}
|
sl@0
|
262 |
#else
|
sl@0
|
263 |
test(entry.IsTypeValid()==EFalse);
|
sl@0
|
264 |
#endif
|
sl@0
|
265 |
}
|
sl@0
|
266 |
|
sl@0
|
267 |
LOCAL_C void Test4()
|
sl@0
|
268 |
//
|
sl@0
|
269 |
// Test uid's can be read when the file is open
|
sl@0
|
270 |
//
|
sl@0
|
271 |
// EFileShareExclusive,EFileShareReadersOnly,EFileShareAny,
|
sl@0
|
272 |
// EFileStream=0,EFileStreamText=0x100,
|
sl@0
|
273 |
// EFileRead=0,EFileWrite=0x200
|
sl@0
|
274 |
//
|
sl@0
|
275 |
{
|
sl@0
|
276 |
|
sl@0
|
277 |
test.Next(_L("Uids can be read if the file is open"));
|
sl@0
|
278 |
RFile f;
|
sl@0
|
279 |
TEntry entry;
|
sl@0
|
280 |
TInt r=f.Open(TheFs,_L("UIDCHK.DAT"),EFileShareExclusive|EFileRead);
|
sl@0
|
281 |
test(r==KErrNone);
|
sl@0
|
282 |
r=TheFs.Entry(_L("UIDCHK.DAT"),entry);
|
sl@0
|
283 |
test(r==KErrNone);
|
sl@0
|
284 |
test(entry.iName==_L("UIDCHK.DAT"));
|
sl@0
|
285 |
test(entry.IsTypeValid());
|
sl@0
|
286 |
test(entry.iType[0]==TUid::Uid('D') && entry.iType[1]==TUid::Uid('A') && entry.iType[2]==TUid::Uid('T'));
|
sl@0
|
287 |
f.Close();
|
sl@0
|
288 |
|
sl@0
|
289 |
r=f.Open(TheFs,_L("UIDCHK.DAT"),EFileShareExclusive|EFileWrite);
|
sl@0
|
290 |
test(r==KErrNone);
|
sl@0
|
291 |
r=TheFs.Entry(_L("UIDCHK.DAT"),entry);
|
sl@0
|
292 |
test(r==KErrNone);
|
sl@0
|
293 |
test(entry.iName==_L("UIDCHK.DAT"));
|
sl@0
|
294 |
test(entry.IsTypeValid());
|
sl@0
|
295 |
test(entry.iType[0]==TUid::Uid('D') && entry.iType[1]==TUid::Uid('A') && entry.iType[2]==TUid::Uid('T'));
|
sl@0
|
296 |
|
sl@0
|
297 |
r=f.SetSize(256);
|
sl@0
|
298 |
test(r==KErrNone);
|
sl@0
|
299 |
TBuf8<16> des;
|
sl@0
|
300 |
r=TheFs.ReadFileSection(_L("UIDCHK.DAT"),0,des,16);
|
sl@0
|
301 |
test(r==KErrNone);
|
sl@0
|
302 |
|
sl@0
|
303 |
f.Close();
|
sl@0
|
304 |
|
sl@0
|
305 |
r=f.Open(TheFs,_L("UIDCHK.DAT"),EFileShareReadersOnly|EFileRead);
|
sl@0
|
306 |
test(r==KErrNone);
|
sl@0
|
307 |
r=TheFs.Entry(_L("UIDCHK.DAT"),entry);
|
sl@0
|
308 |
test(r==KErrNone);
|
sl@0
|
309 |
test(entry.iName==_L("UIDCHK.DAT"));
|
sl@0
|
310 |
test(entry.IsTypeValid());
|
sl@0
|
311 |
test(entry.iType[0]==TUid::Uid('D') && entry.iType[1]==TUid::Uid('A') && entry.iType[2]==TUid::Uid('T'));
|
sl@0
|
312 |
f.Close();
|
sl@0
|
313 |
|
sl@0
|
314 |
// EFileShareReadersOnly|EFileWrite is illegal
|
sl@0
|
315 |
|
sl@0
|
316 |
r=f.Open(TheFs,_L("UIDCHK.DAT"),EFileShareAny|EFileRead);
|
sl@0
|
317 |
test(r==KErrNone);
|
sl@0
|
318 |
r=TheFs.Entry(_L("UIDCHK.DAT"),entry);
|
sl@0
|
319 |
test(r==KErrNone);
|
sl@0
|
320 |
test(entry.iName==_L("UIDCHK.DAT"));
|
sl@0
|
321 |
test(entry.IsTypeValid());
|
sl@0
|
322 |
test(entry.iType[0]==TUid::Uid('D') && entry.iType[1]==TUid::Uid('A') && entry.iType[2]==TUid::Uid('T'));
|
sl@0
|
323 |
f.Close();
|
sl@0
|
324 |
|
sl@0
|
325 |
r=f.Open(TheFs,_L("UIDCHK.DAT"),EFileShareAny|EFileWrite);
|
sl@0
|
326 |
test(r==KErrNone);
|
sl@0
|
327 |
|
sl@0
|
328 |
RFile secondFile;
|
sl@0
|
329 |
r=secondFile.Open(TheFs,_L("UIDCHK.DAT"),EFileShareAny|EFileWrite);
|
sl@0
|
330 |
test(r==KErrNone);
|
sl@0
|
331 |
|
sl@0
|
332 |
RFile thirdFile;
|
sl@0
|
333 |
r=thirdFile.Open(TheFs,_L("UIDCHK.DAT"),EFileShareAny|EFileRead);
|
sl@0
|
334 |
test(r==KErrNone);
|
sl@0
|
335 |
|
sl@0
|
336 |
r=TheFs.Entry(_L("UIDCHK.DAT"),entry);
|
sl@0
|
337 |
test(r==KErrNone);
|
sl@0
|
338 |
test(entry.iName==_L("UIDCHK.DAT"));
|
sl@0
|
339 |
test(entry.IsTypeValid());
|
sl@0
|
340 |
test(entry.iType[0]==TUid::Uid('D') && entry.iType[1]==TUid::Uid('A') && entry.iType[2]==TUid::Uid('T'));
|
sl@0
|
341 |
f.Close();
|
sl@0
|
342 |
secondFile.Close();
|
sl@0
|
343 |
thirdFile.Close();
|
sl@0
|
344 |
|
sl@0
|
345 |
r=f.Open(TheFs,_L("UIDWINS.PE"),EFileShareAny|EFileWrite);
|
sl@0
|
346 |
test(r==KErrNone);
|
sl@0
|
347 |
|
sl@0
|
348 |
r=TheFs.Entry(_L("UIDWINS.PE"),entry);
|
sl@0
|
349 |
test(r==KErrNone);
|
sl@0
|
350 |
test(entry.iName==_L("UIDWINS.PE"));
|
sl@0
|
351 |
#if defined(__WINS__)
|
sl@0
|
352 |
TFileName sessionPath;
|
sl@0
|
353 |
TheFs.SessionPath(sessionPath);
|
sl@0
|
354 |
if (sessionPath[0]!='C')
|
sl@0
|
355 |
test(entry.IsTypeValid()==EFalse);
|
sl@0
|
356 |
else
|
sl@0
|
357 |
{
|
sl@0
|
358 |
test(entry.IsTypeValid());
|
sl@0
|
359 |
test(entry.iType[0]==TUid::Uid(0x1000007a) && entry.iType[1]==TUid::Uid(2) && entry.iType[2]==TUid::Uid(3));
|
sl@0
|
360 |
}
|
sl@0
|
361 |
#else
|
sl@0
|
362 |
test(entry.IsTypeValid()==EFalse);
|
sl@0
|
363 |
#endif
|
sl@0
|
364 |
f.Close();
|
sl@0
|
365 |
}
|
sl@0
|
366 |
|
sl@0
|
367 |
LOCAL_C void TestZ()
|
sl@0
|
368 |
//
|
sl@0
|
369 |
// Test Rom filesystem
|
sl@0
|
370 |
//
|
sl@0
|
371 |
{
|
sl@0
|
372 |
|
sl@0
|
373 |
CDir* dum=NULL;
|
sl@0
|
374 |
|
sl@0
|
375 |
TInt r=TheFs.GetDir(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)?_L("Z:\\Sys\\Bin\\*"):_L("Z:\\System\\Bin\\*"),KEntryAttAllowUid,0,dum);
|
sl@0
|
376 |
|
sl@0
|
377 |
if (r==KErrNotReady)
|
sl@0
|
378 |
{
|
sl@0
|
379 |
test.Printf(_L("Error: Unable to open Z:\n"));
|
sl@0
|
380 |
return;
|
sl@0
|
381 |
}
|
sl@0
|
382 |
test(r==KErrNone);
|
sl@0
|
383 |
CDir& dir=*dum;
|
sl@0
|
384 |
TInt count=dir.Count();
|
sl@0
|
385 |
if (count==0)
|
sl@0
|
386 |
test.Printf(_L("No files present on Z:\\*\n"));
|
sl@0
|
387 |
while (count--)
|
sl@0
|
388 |
{
|
sl@0
|
389 |
TBuf<32> UID;
|
sl@0
|
390 |
if (dir[count].IsTypeValid()==EFalse)
|
sl@0
|
391 |
UID=_L("INVALID");
|
sl@0
|
392 |
else
|
sl@0
|
393 |
{
|
sl@0
|
394 |
UID=dir[count].iType[0].Name();
|
sl@0
|
395 |
UID.Append(dir[count].iType[1].Name());
|
sl@0
|
396 |
UID.Append(dir[count].iType[2].Name());
|
sl@0
|
397 |
}
|
sl@0
|
398 |
test.Printf(_L("FILE: %S UID %S\n"),&dir[count].iName,&UID);
|
sl@0
|
399 |
}
|
sl@0
|
400 |
delete &dir;
|
sl@0
|
401 |
TEntry entry;
|
sl@0
|
402 |
r=TheFs.Entry(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)?_L("Z:\\Sys\\Bin\\ELOCAL.FSY"):_L("Z:\\System\\Bin\\ELOCAL.FSY"),entry);
|
sl@0
|
403 |
}
|
sl@0
|
404 |
|
sl@0
|
405 |
GLDEF_C void CallTestsL(void)
|
sl@0
|
406 |
//
|
sl@0
|
407 |
// Do all tests
|
sl@0
|
408 |
//
|
sl@0
|
409 |
{
|
sl@0
|
410 |
|
sl@0
|
411 |
TBuf<64> b;
|
sl@0
|
412 |
|
sl@0
|
413 |
TFileName sessionPath;
|
sl@0
|
414 |
|
sl@0
|
415 |
TInt r=TheFs.SessionPath(sessionPath);
|
sl@0
|
416 |
test(r==KErrNone);
|
sl@0
|
417 |
TChar driveLetter=sessionPath[0];
|
sl@0
|
418 |
b.Format(_L("Testing filesystem on %c:"),(TText)driveLetter);
|
sl@0
|
419 |
test.Next(b);
|
sl@0
|
420 |
|
sl@0
|
421 |
CreateUidTestFiles();
|
sl@0
|
422 |
Test1();
|
sl@0
|
423 |
Test2();
|
sl@0
|
424 |
Test3();
|
sl@0
|
425 |
Test4();
|
sl@0
|
426 |
|
sl@0
|
427 |
test.Next(_L("Testing filesystem on Z:"));
|
sl@0
|
428 |
TRAP(r,TestZ());
|
sl@0
|
429 |
if (r!=KErrNone)
|
sl@0
|
430 |
test.Printf(_L("Error: %d\n"),r);
|
sl@0
|
431 |
}
|