changeset 189 | a5496987b1da |
parent 0 | a41df078684a |
child 245 | 647ab20fee2e |
177:a232af6b0b1f | 189:a5496987b1da |
---|---|
13 // Description: |
13 // Description: |
14 // f32test\server\t_dcdiskadminallfiles.cpp |
14 // f32test\server\t_dcdiskadminallfiles.cpp |
15 // |
15 // |
16 // |
16 // |
17 |
17 |
18 #define __E32TEST_EXTENSION__ |
|
18 #include <f32file.h> |
19 #include <f32file.h> |
19 #include <e32test.h> |
20 #include <e32test.h> |
20 #include <e32std.h> |
21 #include <e32std.h> |
21 #include <e32std_private.h> |
22 #include <e32std_private.h> |
22 #include <e32def.h> |
23 #include <e32def.h> |
111 |
112 |
112 mkdirname.Zero(); |
113 mkdirname.Zero(); |
113 mkdirname.Append(systestname); |
114 mkdirname.Append(systestname); |
114 mkdirname.Append(KMkDirSub); |
115 mkdirname.Append(KMkDirSub); |
115 r=TheFs.MkDirAll(mkdirname); |
116 r=TheFs.MkDirAll(mkdirname); |
116 test(r==KErrPermissionDenied); |
117 test_Value(r, r == KErrPermissionDenied); |
117 |
118 |
118 TheFs.RmDir(mkdirname); |
119 TheFs.RmDir(mkdirname); |
119 test(r==KErrPermissionDenied); |
120 test_Value(r, r == KErrPermissionDenied); |
120 |
121 |
121 r=TheFs.SetSubst(systestname,EDriveO); |
122 r=TheFs.SetSubst(systestname,EDriveO); |
122 test(r==KErrPermissionDenied); |
123 test_Value(r, r == KErrPermissionDenied); |
123 |
124 |
124 r=TheFs.SetSessionPath(systestname); |
125 r=TheFs.SetSessionPath(systestname); |
125 test(r==KErrNone); |
126 test_KErrNone(r); |
126 |
127 |
127 TheFs.NotifyChange(ENotifyAll,aStat1,systestname); |
128 TheFs.NotifyChange(ENotifyAll,aStat1,systestname); |
128 test(aStat1==KRequestPending); |
129 test(aStat1==KRequestPending); |
129 |
130 |
130 systestfile=KSystemPath; |
131 systestfile=KSystemPath; |
135 |
136 |
136 oldName=KOldFile; |
137 oldName=KOldFile; |
137 oldName[0]=(TText)gDriveToTest; |
138 oldName[0]=(TText)gDriveToTest; |
138 |
139 |
139 r=TheFs.GetShortName(systestfile, shortfilename); |
140 r=TheFs.GetShortName(systestfile, shortfilename); |
140 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
141 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
141 |
142 |
142 r=TheFs.GetLongName(systestfile1, longfilename); |
143 r=TheFs.GetLongName(systestfile1, longfilename); |
143 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
144 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
144 |
145 |
145 r=file1.Create(TheFs,oldName,EFileWrite); |
146 r=file1.Create(TheFs,oldName,EFileWrite); |
146 test(r==KErrNone || r==KErrAlreadyExists); |
147 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
147 file1.Close(); |
148 file1.Close(); |
148 |
149 |
149 r=TheFs.Replace(oldName,systestfile); |
150 r=TheFs.Replace(oldName,systestfile); |
150 test(r==KErrPermissionDenied); |
151 test_Value(r, r == KErrPermissionDenied); |
151 |
152 |
152 r=TheFs.Rename(systestfile,systestfile1); |
153 r=TheFs.Rename(systestfile,systestfile1); |
153 test(r==KErrPermissionDenied); |
154 test_Value(r, r == KErrPermissionDenied); |
154 |
155 |
155 r=TheFs.Entry(systestfile1,entry); |
156 r=TheFs.Entry(systestfile1,entry); |
156 test(r==KErrNone || KErrNotFound); |
157 test_Value(r, r == KErrNone || r == KErrNotFound); |
157 |
158 |
158 r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
159 r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
159 test(r==KErrPermissionDenied); |
160 test_Value(r, r == KErrPermissionDenied); |
160 |
161 |
161 r=TheFs.Delete(systestfile1); |
162 r=TheFs.Delete(systestfile1); |
162 test(r==KErrPermissionDenied); |
163 test_Value(r, r == KErrPermissionDenied); |
163 } |
164 } |
164 |
165 |
165 LOCAL_C void ResourceRFsTest() |
166 LOCAL_C void ResourceRFsTest() |
166 // |
167 // |
167 // |
168 // |
172 |
173 |
173 mkdirname.Zero(); |
174 mkdirname.Zero(); |
174 mkdirname.Append(restestname); |
175 mkdirname.Append(restestname); |
175 mkdirname.Append(KMkDirSub); |
176 mkdirname.Append(KMkDirSub); |
176 r=TheFs.MkDirAll(mkdirname); |
177 r=TheFs.MkDirAll(mkdirname); |
177 test(r==KErrPermissionDenied); |
178 test_Value(r, r == KErrPermissionDenied); |
178 |
179 |
179 TheFs.RmDir(mkdirname); |
180 TheFs.RmDir(mkdirname); |
180 test(r==KErrPermissionDenied); |
181 test_Value(r, r == KErrPermissionDenied); |
181 |
182 |
182 // Change due to defect DEF099546 fix |
183 // Change due to defect DEF099546 fix |
183 // TCB capability is required for following operation. |
184 // TCB capability is required for following operation. |
184 r=TheFs.SetSubst(restestname,EDriveO); |
185 r=TheFs.SetSubst(restestname,EDriveO); |
185 //test(r==KErrNone); |
186 //test_KErrNone(r); |
186 test(r==KErrPermissionDenied); |
187 test_Value(r, r == KErrPermissionDenied); |
187 |
188 |
188 // SetSubst will fail. |
189 // SetSubst will fail. |
189 //r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
190 //r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
190 //test(r==KErrNone); |
191 //test_KErrNone(r); |
191 |
192 |
192 //r=TheFs.SetSubst(_L(""),EDriveO); |
193 //r=TheFs.SetSubst(_L(""),EDriveO); |
193 //test(r==KErrNone); |
194 //test_KErrNone(r); |
194 |
195 |
195 r=TheFs.SetSessionPath(restestname); |
196 r=TheFs.SetSessionPath(restestname); |
196 test(r==KErrNone); |
197 test_KErrNone(r); |
197 |
198 |
198 TheFs.NotifyChange(ENotifyAll,aStat4,restestname); |
199 TheFs.NotifyChange(ENotifyAll,aStat4,restestname); |
199 test(aStat4==KRequestPending); |
200 test(aStat4==KRequestPending); |
200 |
201 |
201 restestfile=KResourcePath; |
202 restestfile=KResourcePath; |
206 |
207 |
207 oldName=KOldFile; |
208 oldName=KOldFile; |
208 oldName[0]=(TText)gDriveToTest; |
209 oldName[0]=(TText)gDriveToTest; |
209 |
210 |
210 r=TheFs.GetShortName(restestfile, shortfilename); |
211 r=TheFs.GetShortName(restestfile, shortfilename); |
211 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
212 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
212 |
213 |
213 r=TheFs.GetLongName(restestfile1, longfilename); |
214 r=TheFs.GetLongName(restestfile1, longfilename); |
214 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
215 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
215 |
216 |
216 r=file1.Create(TheFs,oldName,EFileWrite); |
217 r=file1.Create(TheFs,oldName,EFileWrite); |
217 test(r==KErrNone || r==KErrAlreadyExists); |
218 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
218 file1.Close(); |
219 file1.Close(); |
219 |
220 |
220 r=TheFs.Replace(oldName,restestfile); |
221 r=TheFs.Replace(oldName,restestfile); |
221 test(r==KErrPermissionDenied); |
222 test_Value(r, r == KErrPermissionDenied); |
222 |
223 |
223 r=TheFs.Rename(restestfile,restestfile1); |
224 r=TheFs.Rename(restestfile,restestfile1); |
224 test(r==KErrPermissionDenied); |
225 test_Value(r, r == KErrPermissionDenied); |
225 |
226 |
226 r=TheFs.Entry(restestfile1,entry); |
227 r=TheFs.Entry(restestfile1,entry); |
227 test(r==KErrNone || r==KErrPathNotFound || r==KErrNotFound); |
228 test_Value(r, r == KErrNone || r==KErrPathNotFound || r==KErrNotFound); |
228 |
229 |
229 r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
230 r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
230 test(r==KErrPermissionDenied); |
231 test_Value(r, r == KErrPermissionDenied); |
231 |
232 |
232 r=TheFs.Delete(restestfile1); |
233 r=TheFs.Delete(restestfile1); |
233 test(r==KErrPermissionDenied); |
234 test_Value(r, r == KErrPermissionDenied); |
234 |
235 |
235 } |
236 } |
236 |
237 |
237 |
238 |
238 LOCAL_C void privatefalseIDRFsTest() |
239 LOCAL_C void privatefalseIDRFsTest() |
246 mkdirname.Zero(); |
247 mkdirname.Zero(); |
247 mkdirname.Append(pritestfalseidname); |
248 mkdirname.Append(pritestfalseidname); |
248 mkdirname.Append(KMkDirSub); |
249 mkdirname.Append(KMkDirSub); |
249 |
250 |
250 r=TheFs.MkDirAll(mkdirname); |
251 r=TheFs.MkDirAll(mkdirname); |
251 test(r==KErrNone); |
252 test_KErrNone(r); |
252 |
253 |
253 r=TheFs.RmDir(mkdirname); |
254 r=TheFs.RmDir(mkdirname); |
254 test(r==KErrNone); |
255 test_KErrNone(r); |
255 |
256 |
256 r=TheFs.SetSubst(pritestfalseidname,EDriveO); |
257 r=TheFs.SetSubst(pritestfalseidname,EDriveO); |
257 test(r==KErrNone); |
258 test_KErrNone(r); |
258 |
259 |
259 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
260 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
260 test(r==KErrNone); |
261 test_KErrNone(r); |
261 |
262 |
262 r=TheFs.SetSubst(_L(""),EDriveO); |
263 r=TheFs.SetSubst(_L(""),EDriveO); |
263 test(r==KErrNone); |
264 test_KErrNone(r); |
264 |
265 |
265 r=TheFs.SetSessionPath(pritestfalseidname); |
266 r=TheFs.SetSessionPath(pritestfalseidname); |
266 test(r==KErrNone); |
267 test_KErrNone(r); |
267 |
268 |
268 TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname); |
269 TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname); |
269 test(aStat2==KRequestPending); |
270 test(aStat2==KRequestPending); |
270 |
271 |
271 |
272 |
277 |
278 |
278 oldName=KOldFile; |
279 oldName=KOldFile; |
279 oldName[0]=(TText)gDriveToTest; |
280 oldName[0]=(TText)gDriveToTest; |
280 |
281 |
281 r=TheFs.GetShortName(pritestfile, shortfilename); |
282 r=TheFs.GetShortName(pritestfile, shortfilename); |
282 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
283 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
283 |
284 |
284 r=TheFs.GetLongName(pritestfile1, longfilename); |
285 r=TheFs.GetLongName(pritestfile1, longfilename); |
285 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
286 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
286 |
287 |
287 r=file1.Create(TheFs,oldName,EFileWrite); |
288 r=file1.Create(TheFs,oldName,EFileWrite); |
288 test(r==KErrNone || r==KErrAlreadyExists); |
289 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
289 file1.Close(); |
290 file1.Close(); |
290 |
291 |
291 r=TheFs.Replace(oldName,pritestfile); |
292 r=TheFs.Replace(oldName,pritestfile); |
292 test(r==KErrNone); |
293 test_KErrNone(r); |
293 |
294 |
294 r=TheFs.Rename(pritestfile,pritestfile1); |
295 r=TheFs.Rename(pritestfile,pritestfile1); |
295 test(r==KErrNone); |
296 test_KErrNone(r); |
296 |
297 |
297 r=TheFs.Entry(pritestfile1,entry); |
298 r=TheFs.Entry(pritestfile1,entry); |
298 test(r==KErrNone); |
299 test_KErrNone(r); |
299 |
300 |
300 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
301 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
301 test(r==KErrNone); |
302 test_KErrNone(r); |
302 |
303 |
303 r=TheFs.Delete(pritestfile1); |
304 r=TheFs.Delete(pritestfile1); |
304 test(r==KErrNone); |
305 test_KErrNone(r); |
305 |
306 |
306 } |
307 } |
307 |
308 |
308 |
309 |
309 LOCAL_C void privateRFsTest() |
310 LOCAL_C void privateRFsTest() |
318 mkdirname.Zero(); |
319 mkdirname.Zero(); |
319 mkdirname.Append(pritestname); |
320 mkdirname.Append(pritestname); |
320 mkdirname.Append(KMkDirSub); |
321 mkdirname.Append(KMkDirSub); |
321 |
322 |
322 r=TheFs.MkDirAll(mkdirname); |
323 r=TheFs.MkDirAll(mkdirname); |
323 test(r==KErrNone); |
324 test_KErrNone(r); |
324 |
325 |
325 r=TheFs.RmDir(mkdirname); |
326 r=TheFs.RmDir(mkdirname); |
326 test(r==KErrNone); |
327 test_KErrNone(r); |
327 |
328 |
328 r=TheFs.SetSubst(pritestname,EDriveO); |
329 r=TheFs.SetSubst(pritestname,EDriveO); |
329 test(r==KErrNone); |
330 test_KErrNone(r); |
330 |
331 |
331 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
332 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
332 test(r==KErrNone); |
333 test_KErrNone(r); |
333 |
334 |
334 r=TheFs.SetSubst(_L(""),EDriveO); |
335 r=TheFs.SetSubst(_L(""),EDriveO); |
335 test(r==KErrNone); |
336 test_KErrNone(r); |
336 |
337 |
337 r=TheFs.SetSessionPath(pritestname); |
338 r=TheFs.SetSessionPath(pritestname); |
338 test(r==KErrNone); |
339 test_KErrNone(r); |
339 |
340 |
340 TheFs.NotifyChange(ENotifyAll,aStat2,pritestname); |
341 TheFs.NotifyChange(ENotifyAll,aStat2,pritestname); |
341 test(aStat2==KRequestPending); |
342 test(aStat2==KRequestPending); |
342 |
343 |
343 |
344 |
349 |
350 |
350 oldName=KOldFile; |
351 oldName=KOldFile; |
351 oldName[0]=(TText)gDriveToTest; |
352 oldName[0]=(TText)gDriveToTest; |
352 |
353 |
353 r=TheFs.GetShortName(pritestfile, shortfilename); |
354 r=TheFs.GetShortName(pritestfile, shortfilename); |
354 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
355 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
355 |
356 |
356 r=TheFs.GetLongName(pritestfile1, longfilename); |
357 r=TheFs.GetLongName(pritestfile1, longfilename); |
357 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
358 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
358 |
359 |
359 r=file1.Create(TheFs,oldName,EFileWrite); |
360 r=file1.Create(TheFs,oldName,EFileWrite); |
360 test(r==KErrNone || r==KErrAlreadyExists); |
361 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
361 file1.Close(); |
362 file1.Close(); |
362 |
363 |
363 r=TheFs.Replace(oldName,pritestfile); |
364 r=TheFs.Replace(oldName,pritestfile); |
364 test(r==KErrNone || r==KErrNotFound); |
365 test_Value(r, r == KErrNone || r==KErrNotFound); |
365 |
366 |
366 r=TheFs.Rename(pritestfile,pritestfile1); |
367 r=TheFs.Rename(pritestfile,pritestfile1); |
367 test(r==KErrNone); |
368 test_KErrNone(r); |
368 |
369 |
369 r=TheFs.Entry(pritestfile1,entry); |
370 r=TheFs.Entry(pritestfile1,entry); |
370 test(r==KErrNone); |
371 test_KErrNone(r); |
371 |
372 |
372 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
373 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
373 test(r==KErrNone); |
374 test_KErrNone(r); |
374 |
375 |
375 r=TheFs.Delete(pritestfile1); |
376 r=TheFs.Delete(pritestfile1); |
376 test(r==KErrNone); |
377 test_KErrNone(r); |
377 |
378 |
378 } |
379 } |
379 |
380 |
380 |
381 |
381 LOCAL_C void privateSIDRFstest() |
382 LOCAL_C void privateSIDRFstest() |
385 |
386 |
386 mkdirname.Zero(); |
387 mkdirname.Zero(); |
387 mkdirname.Append(theprivatepath); |
388 mkdirname.Append(theprivatepath); |
388 mkdirname.Append(KMkDirSub); |
389 mkdirname.Append(KMkDirSub); |
389 r=TheFs.MkDirAll(mkdirname); |
390 r=TheFs.MkDirAll(mkdirname); |
390 test(r==KErrNone); |
391 test_KErrNone(r); |
391 |
392 |
392 r=TheFs.RmDir(mkdirname); |
393 r=TheFs.RmDir(mkdirname); |
393 test(r==KErrNone); |
394 test_KErrNone(r); |
394 |
395 |
395 r=TheFs.SetSubst(theprivatepath,EDriveO); |
396 r=TheFs.SetSubst(theprivatepath,EDriveO); |
396 test(r==KErrNone); |
397 test_KErrNone(r); |
397 |
398 |
398 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
399 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
399 test(r==KErrNone); |
400 test_KErrNone(r); |
400 |
401 |
401 r=TheFs.SetSubst(_L(""),EDriveO); |
402 r=TheFs.SetSubst(_L(""),EDriveO); |
402 test(r==KErrNone); |
403 test_KErrNone(r); |
403 |
404 |
404 r=TheFs.SetSessionPath(theprivatepath); |
405 r=TheFs.SetSessionPath(theprivatepath); |
405 test(r==KErrNone); |
406 test_KErrNone(r); |
406 |
407 |
407 TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath); |
408 TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath); |
408 test(aStat3==KRequestPending); |
409 test(aStat3==KRequestPending); |
409 |
410 |
410 pritestfile=theprivatepath; |
411 pritestfile=theprivatepath; |
415 |
416 |
416 oldName=KOldFile; |
417 oldName=KOldFile; |
417 oldName[0]=(TText)gDriveToTest; |
418 oldName[0]=(TText)gDriveToTest; |
418 |
419 |
419 r=TheFs.GetShortName(pritestfile, shortfilename); |
420 r=TheFs.GetShortName(pritestfile, shortfilename); |
420 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
421 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
421 |
422 |
422 r=TheFs.GetLongName(pritestfile1, longfilename); |
423 r=TheFs.GetLongName(pritestfile1, longfilename); |
423 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
424 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
424 |
425 |
425 r=file1.Create(TheFs,oldName,EFileWrite); |
426 r=file1.Create(TheFs,oldName,EFileWrite); |
426 test(r==KErrNone || r==KErrAlreadyExists); |
427 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
427 file1.Close(); |
428 file1.Close(); |
428 |
429 |
429 r=TheFs.Replace(oldName,pritestfile); |
430 r=TheFs.Replace(oldName,pritestfile); |
430 test(r==KErrNone); |
431 test_KErrNone(r); |
431 |
432 |
432 r=TheFs.Rename(pritestfile,pritestfile1); |
433 r=TheFs.Rename(pritestfile,pritestfile1); |
433 test(r==KErrNone || r==KErrAlreadyExists); |
434 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
434 |
435 |
435 r=TheFs.Entry(pritestfile1,entry); |
436 r=TheFs.Entry(pritestfile1,entry); |
436 test(r==KErrNone); |
437 test_KErrNone(r); |
437 |
438 |
438 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
439 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
439 test(r==KErrNone); |
440 test_KErrNone(r); |
440 |
441 |
441 r=TheFs.Delete(pritestfile1); |
442 r=TheFs.Delete(pritestfile1); |
442 test(r==KErrNone); |
443 test_KErrNone(r); |
443 } |
444 } |
444 |
445 |
445 |
446 |
446 LOCAL_C void systemRFiletest() |
447 LOCAL_C void systemRFiletest() |
447 // |
448 // |
448 //RFile testing with session path set to //system// |
449 //RFile testing with session path set to //system// |
449 // |
450 // |
450 { |
451 { |
451 |
452 |
452 r=TheFs.SetSessionPath(systestname); |
453 r=TheFs.SetSessionPath(systestname); |
453 test(r==KErrNone); |
454 test_KErrNone(r); |
454 |
455 |
455 r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite); |
456 r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite); |
456 test(r==KErrPermissionDenied); |
457 test_Value(r, r == KErrPermissionDenied); |
457 file1.Close(); |
458 file1.Close(); |
458 |
459 |
459 systestfile=systestname; |
460 systestfile=systestname; |
460 systestfile.Append(KFileSys); |
461 systestfile.Append(KFileSys); |
461 r=file1.Create(TheFs,systestfile,EFileWrite); |
462 r=file1.Create(TheFs,systestfile,EFileWrite); |
462 test(r==KErrPermissionDenied); |
463 test_Value(r, r == KErrPermissionDenied); |
463 file1.Close(); |
464 file1.Close(); |
464 |
465 |
465 r=file1.Open(TheFs,systestfile,EFileWrite); |
466 r=file1.Open(TheFs,systestfile,EFileWrite); |
466 test(r==KErrPermissionDenied); |
467 test_Value(r, r == KErrPermissionDenied); |
467 |
468 |
468 r=file1.Open(TheFs,systestfile,EFileRead); |
469 r=file1.Open(TheFs,systestfile,EFileRead); |
469 test(r==KErrNone|| r==KErrNotFound); |
470 test_Value(r, r == KErrNone|| r==KErrNotFound); |
470 |
471 |
471 r=file1.Replace(TheFs,systestfile,EFileWrite); |
472 r=file1.Replace(TheFs,systestfile,EFileWrite); |
472 test(r==KErrPermissionDenied); |
473 test_Value(r, r == KErrPermissionDenied); |
473 |
474 |
474 TFindFile finder(TheFs); |
475 TFindFile finder(TheFs); |
475 CDir* dir = NULL; |
476 CDir* dir = NULL; |
476 r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
477 r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
477 if (!(r==KErrNone)) |
478 if (!(r==KErrNone)) |
478 test.Printf(_L("T_DCDISKADMINALLFILES: test find wildcards r = %d (expected KErrNone)\n"), r); |
479 test.Printf(_L("T_DCDISKADMINALLFILES: test find wildcards r = %d (expected KErrNone)\n"), r); |
479 test(r==KErrNone); |
480 test_KErrNone(r); |
480 delete dir; |
481 delete dir; |
481 } |
482 } |
482 |
483 |
483 LOCAL_C void resourceRFiletest() |
484 LOCAL_C void resourceRFiletest() |
484 // |
485 // |
485 //RFile testing with session path set to //resource// |
486 //RFile testing with session path set to //resource// |
486 // |
487 // |
487 { |
488 { |
488 r=TheFs.SetSessionPath(restestname); |
489 r=TheFs.SetSessionPath(restestname); |
489 test(r==KErrNone); |
490 test_KErrNone(r); |
490 |
491 |
491 r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite); |
492 r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite); |
492 test(r==KErrPermissionDenied); |
493 test_Value(r, r == KErrPermissionDenied); |
493 file1.Close(); |
494 file1.Close(); |
494 |
495 |
495 r=file1.Create(TheFs,KFileRes,EFileWrite); |
496 r=file1.Create(TheFs,KFileRes,EFileWrite); |
496 test(r==KErrPermissionDenied); |
497 test_Value(r, r == KErrPermissionDenied); |
497 file1.Close(); |
498 file1.Close(); |
498 |
499 |
499 r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive ); |
500 r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive ); |
500 test(r==KErrPermissionDenied); |
501 test_Value(r, r == KErrPermissionDenied); |
501 |
502 |
502 r=file1.Open(TheFs,KFileRes,EFileShareReadersOnly); |
503 r=file1.Open(TheFs,KFileRes,EFileShareReadersOnly); |
503 test(r==KErrNone || KErrPathNotFound || KErrNotFound); |
504 test_Value(r, r == KErrNone || r == KErrPathNotFound || r == KErrNotFound); |
504 file1.Close(); |
505 file1.Close(); |
505 |
506 |
506 r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileRead); |
507 r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileRead); |
507 test(r==KErrNone || KErrPathNotFound || KErrNotFound); |
508 test_Value(r, r == KErrNone || r == KErrPathNotFound || r == KErrNotFound); |
508 file1.Close(); |
509 file1.Close(); |
509 |
510 |
510 r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileWrite); |
511 r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileWrite); |
511 test(r==KErrPermissionDenied); |
512 test_Value(r, r == KErrPermissionDenied); |
512 file1.Close(); |
513 file1.Close(); |
513 |
514 |
514 r=file1.Replace(TheFs,KFileRes3,EFileWrite); |
515 r=file1.Replace(TheFs,KFileRes3,EFileWrite); |
515 test(r==KErrPermissionDenied); |
516 test_Value(r, r == KErrPermissionDenied); |
516 file1.Close(); |
517 file1.Close(); |
517 } |
518 } |
518 |
519 |
519 |
520 |
520 LOCAL_C void privatefalseIDRFiletest() |
521 LOCAL_C void privatefalseIDRFiletest() |
521 // |
522 // |
522 //RFile testing with session path set to //Private//false ID |
523 //RFile testing with session path set to //Private//false ID |
523 // |
524 // |
524 { |
525 { |
525 r=TheFs.SetSessionPath(pritestfalseidname); |
526 r=TheFs.SetSessionPath(pritestfalseidname); |
526 test(r==KErrNone); |
527 test_KErrNone(r); |
527 |
528 |
528 r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite); |
529 r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite); |
529 test(r==KErrNone); |
530 test_KErrNone(r); |
530 file1.Close(); |
531 file1.Close(); |
531 |
532 |
532 r=file1.Create(TheFs,KFilePri,EFileWrite); |
533 r=file1.Create(TheFs,KFilePri,EFileWrite); |
533 test(r==KErrNone); |
534 test_KErrNone(r); |
534 file1.Close(); |
535 file1.Close(); |
535 |
536 |
536 r=file1.Open(TheFs,KFilePri,EFileWrite); |
537 r=file1.Open(TheFs,KFilePri,EFileWrite); |
537 test(r==KErrNone); |
538 test_KErrNone(r); |
538 file1.Close(); |
539 file1.Close(); |
539 |
540 |
540 r=file1.Open(TheFs,KFilePri,EFileRead); |
541 r=file1.Open(TheFs,KFilePri,EFileRead); |
541 test(r==KErrNone); |
542 test_KErrNone(r); |
542 file1.Close(); |
543 file1.Close(); |
543 |
544 |
544 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
545 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
545 test(r==KErrNone); |
546 test_KErrNone(r); |
546 |
547 |
547 r=file1.Rename(KFilePri3); |
548 r=file1.Rename(KFilePri3); |
548 test(r==KErrNone); |
549 test_KErrNone(r); |
549 file1.Close(); |
550 file1.Close(); |
550 } |
551 } |
551 |
552 |
552 |
553 |
553 LOCAL_C void privateRFiletest() |
554 LOCAL_C void privateRFiletest() |
554 // |
555 // |
555 //RFile testing with session path set to //Private// |
556 //RFile testing with session path set to //Private// |
556 // |
557 // |
557 { |
558 { |
558 r=TheFs.SetSessionPath(pritestname); |
559 r=TheFs.SetSessionPath(pritestname); |
559 test(r==KErrNone); |
560 test_KErrNone(r); |
560 |
561 |
561 r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); |
562 r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); |
562 test(r==KErrNone); |
563 test_KErrNone(r); |
563 file1.Close(); |
564 file1.Close(); |
564 |
565 |
565 r=file1.Create(TheFs,KFilePri,EFileWrite); |
566 r=file1.Create(TheFs,KFilePri,EFileWrite); |
566 test(r==KErrNone); |
567 test_KErrNone(r); |
567 file1.Close(); |
568 file1.Close(); |
568 |
569 |
569 r=file1.Open(TheFs,KFilePri,EFileWrite); |
570 r=file1.Open(TheFs,KFilePri,EFileWrite); |
570 test(r==KErrNone); |
571 test_KErrNone(r); |
571 file1.Close(); |
572 file1.Close(); |
572 |
573 |
573 r=file1.Open(TheFs,KFilePri,EFileRead); |
574 r=file1.Open(TheFs,KFilePri,EFileRead); |
574 test(r==KErrNone); |
575 test_KErrNone(r); |
575 file1.Close(); |
576 file1.Close(); |
576 |
577 |
577 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
578 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
578 test(r==KErrNone); |
579 test_KErrNone(r); |
579 |
580 |
580 r=file1.Rename(KFilePri3); |
581 r=file1.Rename(KFilePri3); |
581 test(r==KErrNone); |
582 test_KErrNone(r); |
582 file1.Close(); |
583 file1.Close(); |
583 } |
584 } |
584 |
585 |
585 |
586 |
586 LOCAL_C void privateSIDRFiletest() |
587 LOCAL_C void privateSIDRFiletest() |
587 // |
588 // |
588 //Rfile Testing with session path set to //Private//UID// |
589 //Rfile Testing with session path set to //Private//UID// |
589 // |
590 // |
590 { |
591 { |
591 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
592 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
592 test(r==KErrNone); |
593 test_KErrNone(r); |
593 |
594 |
594 r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
595 r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
595 test(r==KErrNone); |
596 test_KErrNone(r); |
596 file1.Close(); |
597 file1.Close(); |
597 |
598 |
598 r=file1.Create(TheFs,KFilePri,EFileWrite); |
599 r=file1.Create(TheFs,KFilePri,EFileWrite); |
599 test(r==KErrNone); |
600 test_KErrNone(r); |
600 file1.Close(); |
601 file1.Close(); |
601 |
602 |
602 r=file1.Open(TheFs,KFilePri,EFileWrite); |
603 r=file1.Open(TheFs,KFilePri,EFileWrite); |
603 test(r==KErrNone); |
604 test_KErrNone(r); |
604 file1.Close(); |
605 file1.Close(); |
605 |
606 |
606 r=file1.Open(TheFs,KFilePri,EFileRead); |
607 r=file1.Open(TheFs,KFilePri,EFileRead); |
607 test(r==KErrNone); |
608 test_KErrNone(r); |
608 file1.Close(); |
609 file1.Close(); |
609 |
610 |
610 |
611 |
611 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
612 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
612 test(r==KErrNone); |
613 test_KErrNone(r); |
613 |
614 |
614 r=file1.Rename(KFilePri3); |
615 r=file1.Rename(KFilePri3); |
615 test(r==KErrNone); |
616 test_KErrNone(r); |
616 file1.Close(); |
617 file1.Close(); |
617 } |
618 } |
618 |
619 |
619 LOCAL_C void RDirtest() |
620 LOCAL_C void RDirtest() |
620 // |
621 // |
625 //system |
626 //system |
626 CDir* dirEntries; |
627 CDir* dirEntries; |
627 TBuf<30> dirNameBuf(KSystemPath); |
628 TBuf<30> dirNameBuf(KSystemPath); |
628 dirNameBuf[0]=(TText)gDriveToTest; |
629 dirNameBuf[0]=(TText)gDriveToTest; |
629 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
630 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
630 test(r==KErrNone || r==KErrPathNotFound || r==KErrNotFound); |
631 test_Value(r, r == KErrNone || r==KErrPathNotFound || r==KErrNotFound); |
631 dir.Close(); |
632 dir.Close(); |
632 if(r==KErrNone) |
633 if(r==KErrNone) |
633 { |
634 { |
634 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
635 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
635 test(r==KErrNone); |
636 test_KErrNone(r); |
636 delete dirEntries; |
637 delete dirEntries; |
637 } |
638 } |
638 dirNameBuf.Zero(); |
639 dirNameBuf.Zero(); |
639 //Private//falseID |
640 //Private//falseID |
640 dirNameBuf=KPrivateFalseID; |
641 dirNameBuf=KPrivateFalseID; |
641 dirNameBuf[0]=(TText)gDriveToTest; |
642 dirNameBuf[0]=(TText)gDriveToTest; |
642 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
643 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
643 test(r==KErrNone); |
644 test_KErrNone(r); |
644 dir.Close(); |
645 dir.Close(); |
645 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
646 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
646 test(r==KErrNone); |
647 test_KErrNone(r); |
647 dirNameBuf.Zero(); |
648 dirNameBuf.Zero(); |
648 delete dirEntries; |
649 delete dirEntries; |
649 //Private |
650 //Private |
650 dirNameBuf=KPrivatePath; |
651 dirNameBuf=KPrivatePath; |
651 dirNameBuf[0]=(TText)gDriveToTest; |
652 dirNameBuf[0]=(TText)gDriveToTest; |
652 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
653 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
653 test(r==KErrNone); |
654 test_KErrNone(r); |
654 dir.Close(); |
655 dir.Close(); |
655 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
656 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
656 test(r==KErrNone); |
657 test_KErrNone(r); |
657 dirNameBuf.Zero(); |
658 dirNameBuf.Zero(); |
658 delete dirEntries; |
659 delete dirEntries; |
659 //Private/uid |
660 //Private/uid |
660 TheFs.PrivatePath(dirNameBuf); |
661 TheFs.PrivatePath(dirNameBuf); |
661 dirNameBuf.Insert(0,_L("?:")); |
662 dirNameBuf.Insert(0,_L("?:")); |
662 dirNameBuf[0]=(TText)gDriveToTest; |
663 dirNameBuf[0]=(TText)gDriveToTest; |
663 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
664 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
664 test(r==KErrNone); |
665 test_KErrNone(r); |
665 dir.Close(); |
666 dir.Close(); |
666 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
667 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
667 test(r==KErrNone); |
668 test_KErrNone(r); |
668 dirNameBuf.Zero(); |
669 dirNameBuf.Zero(); |
669 delete dirEntries; |
670 delete dirEntries; |
670 //Resource |
671 //Resource |
671 dirNameBuf=KResourcePath; |
672 dirNameBuf=KResourcePath; |
672 dirNameBuf[0]=(TText)gDriveToTest; |
673 dirNameBuf[0]=(TText)gDriveToTest; |
673 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
674 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
674 test(r==KErrNone || r==KErrPathNotFound); |
675 test_Value(r, r == KErrNone || r==KErrPathNotFound); |
675 if(r==KErrNone) |
676 if(r==KErrNone) |
676 { |
677 { |
677 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
678 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
678 test(r==KErrNone); |
679 test_KErrNone(r); |
679 dir.Close(); |
680 dir.Close(); |
680 delete dirEntries; |
681 delete dirEntries; |
681 } |
682 } |
682 } |
683 } |
683 |
684 |
686 // |
687 // |
687 // Test with root capabilities |
688 // Test with root capabilities |
688 // |
689 // |
689 { |
690 { |
690 r=TheFs.FileSystemName(fsname,gTheDriveNum); |
691 r=TheFs.FileSystemName(fsname,gTheDriveNum); |
691 test(r==KErrNone); |
692 test_KErrNone(r); |
692 r = DismountFileSystem(TheFs, fsname, gTheDriveNum); |
693 r = DismountFileSystem(TheFs, fsname, gTheDriveNum); |
693 test(r==KErrNone); |
694 test_KErrNone(r); |
694 // r=TheFs.RemoveFileSystem(fsname); //can not test due to bug else where fix exists |
695 // r=TheFs.RemoveFileSystem(fsname); //can not test due to bug else where fix exists |
695 // test(r==KErrNone); |
696 // test_KErrNone(r); |
696 // r=TheFs.AddFileSystem(fsname); |
697 // r=TheFs.AddFileSystem(fsname); |
697 // test(r==KErrNone); |
698 // test_KErrNone(r); |
698 r = MountFileSystem(TheFs, fsname, gTheDriveNum); |
699 r = MountFileSystem(TheFs, fsname, gTheDriveNum); |
699 test(r==KErrNone); |
700 test_KErrNone(r); |
700 r=TheFs.SetDriveName(gTheDriveNum,KDriveName); |
701 r=TheFs.SetDriveName(gTheDriveNum,KDriveName); |
701 test(r==KErrNone); |
702 test_KErrNone(r); |
702 #ifndef __WINS__ |
703 #ifndef __WINS__ |
703 r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum); |
704 r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum); |
704 test(r==KErrNone); |
705 test_KErrNone(r); |
705 #endif |
706 #endif |
706 |
707 |
707 systemRFsTest(); |
708 systemRFsTest(); |
708 ResourceRFsTest(); |
709 ResourceRFsTest(); |
709 privateRFsTest(); |
710 privateRFsTest(); |
731 test(aStat4 == KRequestPending); |
732 test(aStat4 == KRequestPending); |
732 TheFs.NotifyChangeCancel(aStat4); |
733 TheFs.NotifyChangeCancel(aStat4); |
733 test(aStat4==KErrCancel); |
734 test(aStat4==KErrCancel); |
734 |
735 |
735 r=TheFs.SetSessionPath(systestname); |
736 r=TheFs.SetSessionPath(systestname); |
736 test(r==KErrNone); |
737 test_KErrNone(r); |
737 |
738 |
738 //Test RRawDisk class |
739 //Test RRawDisk class |
739 r=rawdisk.Open(TheFs,gTheDriveNum); |
740 r=rawdisk.Open(TheFs,gTheDriveNum); |
740 test(r==KErrPermissionDenied); |
741 test_Value(r, r == KErrPermissionDenied); |
741 rawdisk.Close(); |
742 rawdisk.Close(); |
742 |
743 |
743 RDirtest(); |
744 RDirtest(); |
744 |
745 |
745 #ifdef __WINS__ |
746 #ifdef __WINS__ |
746 if (User::UpperCase(driveBuf[0]) != 'C') |
747 if (User::UpperCase(driveBuf[0]) != 'C') |
747 #endif |
748 #endif |
748 { |
749 { |
749 //Test RFormat class |
750 //Test RFormat class |
750 r=format.Open(TheFs,driveBuf,EHighDensity,count); |
751 r=format.Open(TheFs,driveBuf,EHighDensity,count); |
751 test(r==KErrNone); |
752 test_KErrNone(r); |
752 while(count) |
753 while(count) |
753 { |
754 { |
754 TInt r=format.Next(count); |
755 TInt r=format.Next(count); |
755 test(r==KErrNone); |
756 test_KErrNone(r); |
756 } |
757 } |
757 format.Close(); |
758 format.Close(); |
758 } |
759 } |
759 |
760 |
760 driveBuf[0]=(TText)gDriveToTest; |
761 driveBuf[0]=(TText)gDriveToTest; |
761 r=TheFs.ScanDrive(driveBuf); |
762 r=TheFs.ScanDrive(driveBuf); |
762 test(r==KErrNone || r==KErrNotSupported || KErrInUse); |
763 test_Value(r, r == KErrNone || r==KErrNotSupported || r == KErrInUse); |
763 r=TheFs.CheckDisk(driveBuf); |
764 r=TheFs.CheckDisk(driveBuf); |
764 test(r==KErrNone || r==KErrNotSupported || KErrInUse); |
765 test_Value(r, r == KErrNone || r==KErrNotSupported || r == KErrInUse); |
765 } |
766 } |
766 |
767 |
767 LOCAL_C void TestCaps() |
768 LOCAL_C void TestCaps() |
768 // |
769 // |
769 // test format etc that require certain capabilities |
770 // test format etc that require certain capabilities |
777 r=RProcess().HasCapability(ECapabilityDiskAdmin, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
778 r=RProcess().HasCapability(ECapabilityDiskAdmin, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
778 test(r); |
779 test(r); |
779 |
780 |
780 driveBuf[0]=(TText)gDriveToTest; |
781 driveBuf[0]=(TText)gDriveToTest; |
781 r=TheFs.SessionPath(temp); |
782 r=TheFs.SessionPath(temp); |
782 test(r==KErrNone); |
783 test_KErrNone(r); |
783 |
784 |
784 test.Printf(_L("Session path: %S"),&temp); |
785 test.Printf(_L("Session path: %S"),&temp); |
785 |
786 |
786 r=TheFs.CreatePrivatePath(gTheDriveNum); |
787 r=TheFs.CreatePrivatePath(gTheDriveNum); |
787 test(r==KErrNone || r== KErrAlreadyExists); |
788 test_Value(r, r == KErrNone || r== KErrAlreadyExists); |
788 |
789 |
789 TBuf<18> tempPri; |
790 TBuf<18> tempPri; |
790 r=TheFs.PrivatePath(tempPri); |
791 r=TheFs.PrivatePath(tempPri); |
791 test(r==KErrNone); |
792 test_KErrNone(r); |
792 theprivatepath = _L("?:"); |
793 theprivatepath = _L("?:"); |
793 theprivatepath.Append(tempPri); |
794 theprivatepath.Append(tempPri); |
794 |
795 |
795 TestDiskAdminAllfiles(); |
796 TestDiskAdminAllfiles(); |
796 |
797 |
797 TFileName thesessionpath; |
798 TFileName thesessionpath; |
798 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
799 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
799 test(r==KErrNone); |
800 test_KErrNone(r); |
800 r=TheFs.SessionPath(thesessionpath); |
801 r=TheFs.SessionPath(thesessionpath); |
801 test(r==KErrNone); |
802 test_KErrNone(r); |
802 test(thesessionpath == theprivatepath); |
803 test(thesessionpath == theprivatepath); |
803 } |
804 } |
804 |
805 |
805 |
806 |
806 LOCAL_C void CleanupL() |
807 LOCAL_C void CleanupL() |
809 // |
810 // |
810 { |
811 { |
811 test.Next(_L("Delete test directory")); |
812 test.Next(_L("Delete test directory")); |
812 CFileMan* fMan=CFileMan::NewL(TheFs); |
813 CFileMan* fMan=CFileMan::NewL(TheFs); |
813 TInt r=fMan->RmDir(gSessionPath); |
814 TInt r=fMan->RmDir(gSessionPath); |
814 test(r==KErrNone || KErrPathNotFound); |
815 test_Value(r, r == KErrNone || r == KErrPathNotFound); |
815 delete fMan; |
816 delete fMan; |
816 } |
817 } |
817 |
818 |
818 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/) |
819 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/) |
819 // |
820 // |
833 TBuf<30> sesspath; |
834 TBuf<30> sesspath; |
834 sesspath=_L("?:\\"); |
835 sesspath=_L("?:\\"); |
835 sesspath[0] = (TText)gDriveToTest; |
836 sesspath[0] = (TText)gDriveToTest; |
836 |
837 |
837 TInt r= TheFs.SetSessionPath(sesspath); |
838 TInt r= TheFs.SetSessionPath(sesspath); |
838 test(r==KErrNone); |
839 test_KErrNone(r); |
839 |
840 |
840 TBuf<2> cmd; |
841 TBuf<2> cmd; |
841 cmd.SetLength(1); |
842 cmd.SetLength(1); |
842 cmd[0] = (TText)gDriveToTest; |
843 cmd[0] = (TText)gDriveToTest; |
843 RProcess tp; |
844 RProcess tp; |
844 r=tp.Create(_L("clean_prepdc.exe"),sesspath); |
845 r=tp.Create(_L("clean_prepdc.exe"),sesspath); |
845 test(r==KErrNone); |
846 test_KErrNone(r); |
846 { |
847 { |
847 TRequestStatus ps; |
848 TRequestStatus ps; |
848 tp.Logon(ps); |
849 tp.Logon(ps); |
849 tp.Resume(); |
850 tp.Resume(); |
850 tp.Close(); |
851 tp.Close(); |
854 //check double mode ie that Defpath still works |
855 //check double mode ie that Defpath still works |
855 RFs fs1; |
856 RFs fs1; |
856 RFs fs2; |
857 RFs fs2; |
857 |
858 |
858 r=fs1.Connect(); |
859 r=fs1.Connect(); |
859 test(r==KErrNone); |
860 test_KErrNone(r); |
860 r=fs1.SessionPath(sesspath); |
861 r=fs1.SessionPath(sesspath); |
861 test(r==KErrNone); |
862 test_KErrNone(r); |
862 test.Printf(_L("session1 Path=%S"),&sesspath); |
863 test.Printf(_L("session1 Path=%S"),&sesspath); |
863 |
864 |
864 TBuf<30> privatepath; |
865 TBuf<30> privatepath; |
865 r=fs1.SetSessionToPrivate(gTheDriveNum); |
866 r=fs1.SetSessionToPrivate(gTheDriveNum); |
866 test(r==KErrNone); |
867 test_KErrNone(r); |
867 r=fs1.PrivatePath(privatepath); |
868 r=fs1.PrivatePath(privatepath); |
868 test(r==KErrNone); |
869 test_KErrNone(r); |
869 r=privatepath.Compare(KExpectedPrivatePath()); |
870 r=privatepath.Compare(KExpectedPrivatePath()); |
870 test(r==0); |
871 test_Value(r, r == 0); |
871 r=fs1.SessionPath(sesspath); |
872 r=fs1.SessionPath(sesspath); |
872 test(r==KErrNone); |
873 test_KErrNone(r); |
873 r=privatepath.Compare(sesspath.Mid(KPathPosition)); |
874 r=privatepath.Compare(sesspath.Mid(KPathPosition)); |
874 test(r==0); |
875 test_Value(r, r == 0); |
875 r=fs1.CreatePrivatePath(gTheDriveNum); |
876 r=fs1.CreatePrivatePath(gTheDriveNum); |
876 test(r==KErrNone); |
877 test_KErrNone(r); |
877 fs1.Close(); |
878 fs1.Close(); |
878 |
879 |
879 r=fs2.Connect(); |
880 r=fs2.Connect(); |
880 test(r==KErrNone); |
881 test_KErrNone(r); |
881 r=fs2.SessionPath(sesspath); |
882 r=fs2.SessionPath(sesspath); |
882 test(r==KErrNone); |
883 test_KErrNone(r); |
883 test.Printf(_L("session2 Path=%S"),&sesspath); |
884 test.Printf(_L("session2 Path=%S"),&sesspath); |
884 fs2.Close(); |
885 fs2.Close(); |
885 |
886 |
886 TestCaps(); |
887 TestCaps(); |
887 |
888 |