107 mkdirname.Zero(); |
105 mkdirname.Zero(); |
108 mkdirname.Append(pritestfalseidname); |
106 mkdirname.Append(pritestfalseidname); |
109 mkdirname.Append(KMkDirSub); |
107 mkdirname.Append(KMkDirSub); |
110 |
108 |
111 r=TheFs.MkDirAll(mkdirname); |
109 r=TheFs.MkDirAll(mkdirname); |
112 test(r==KErrPermissionDenied); |
110 test_Value(r, r == KErrPermissionDenied); |
113 |
111 |
114 r=TheFs.RmDir(mkdirname); |
112 r=TheFs.RmDir(mkdirname); |
115 test(r==KErrPermissionDenied); |
113 test_Value(r, r == KErrPermissionDenied); |
116 |
114 |
117 r=TheFs.SetSubst(pritestfalseidname,EDriveO); |
115 r=TheFs.SetSubst(pritestfalseidname,EDriveO); |
118 test(r==KErrPermissionDenied); |
116 test_Value(r, r == KErrPermissionDenied); |
119 |
117 |
120 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
118 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
121 test(r==KErrNone); |
119 test_KErrNone(r); |
122 |
120 |
123 r=TheFs.SetSessionPath(pritestfalseidname); |
121 r=TheFs.SetSessionPath(pritestfalseidname); |
124 test(r==KErrPermissionDenied); |
122 test_Value(r, r == KErrPermissionDenied); |
125 |
123 |
126 TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname); |
124 TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname); |
127 test(aStat2==KErrPermissionDenied); |
125 test(aStat2==KErrPermissionDenied); |
128 |
126 |
129 |
127 |
135 |
133 |
136 oldName=KOldFile; |
134 oldName=KOldFile; |
137 oldName[0]=(TText)gDriveToTest; |
135 oldName[0]=(TText)gDriveToTest; |
138 |
136 |
139 r=TheFs.GetShortName(pritestfile, shortfilename); |
137 r=TheFs.GetShortName(pritestfile, shortfilename); |
140 test(r==KErrPermissionDenied || r==KErrNotSupported); |
138 test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported); |
141 |
139 |
142 r=TheFs.GetLongName(pritestfile1, longfilename); |
140 r=TheFs.GetLongName(pritestfile1, longfilename); |
143 test(r==KErrPermissionDenied || r==KErrNotSupported); |
141 test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported); |
144 |
142 |
145 r=file1.Create(TheFs,oldName,EFileWrite); |
143 r=file1.Create(TheFs,oldName,EFileWrite); |
146 test(r==KErrNone || r==KErrAlreadyExists); |
144 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
147 file1.Close(); |
145 file1.Close(); |
148 |
146 |
149 r=TheFs.Replace(oldName,pritestfile); |
147 r=TheFs.Replace(oldName,pritestfile); |
150 test(r==KErrPermissionDenied); |
148 test_Value(r, r == KErrPermissionDenied); |
151 |
149 |
152 r=TheFs.Rename(pritestfile,pritestfile1); |
150 r=TheFs.Rename(pritestfile,pritestfile1); |
153 test(r==KErrPermissionDenied); |
151 test_Value(r, r == KErrPermissionDenied); |
154 |
152 |
155 r=TheFs.Entry(pritestfile1,entry); |
153 r=TheFs.Entry(pritestfile1,entry); |
156 test(r==KErrPermissionDenied); |
154 test_Value(r, r == KErrPermissionDenied); |
157 |
155 |
158 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
156 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
159 test(r==KErrPermissionDenied); |
157 test_Value(r, r == KErrPermissionDenied); |
160 |
158 |
161 r=TheFs.Delete(pritestfile1); |
159 r=TheFs.Delete(pritestfile1); |
162 test(r==KErrPermissionDenied); |
160 test_Value(r, r == KErrPermissionDenied); |
163 |
161 |
164 r=TheFs.Delete(oldName); |
162 r=TheFs.Delete(oldName); |
165 test(r==KErrNone); |
163 test_KErrNone(r); |
166 |
164 |
167 __UHEAP_MARKEND; |
165 __UHEAP_MARKEND; |
168 } |
166 } |
169 LOCAL_C void systemRFsTest() |
167 LOCAL_C void systemRFsTest() |
170 // |
168 // |
178 |
176 |
179 mkdirname.Zero(); |
177 mkdirname.Zero(); |
180 mkdirname.Append(systestname); |
178 mkdirname.Append(systestname); |
181 mkdirname.Append(KMkDirSub); |
179 mkdirname.Append(KMkDirSub); |
182 r=TheFs.MkDirAll(mkdirname); |
180 r=TheFs.MkDirAll(mkdirname); |
183 test(r==KErrNone); |
181 test_KErrNone(r); |
184 |
182 |
185 TheFs.RmDir(mkdirname); |
183 TheFs.RmDir(mkdirname); |
186 test(r==KErrNone); |
184 test_KErrNone(r); |
187 |
185 |
188 r=TheFs.SetSubst(systestname,EDriveO); |
186 r=TheFs.SetSubst(systestname,EDriveO); |
189 test(r==KErrNone); |
187 test_KErrNone(r); |
190 |
188 |
191 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
189 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
192 test(r==KErrPermissionDenied); |
190 test_Value(r, r == KErrPermissionDenied); |
193 |
191 |
194 r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst |
192 r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst |
195 test(r==KErrNone); |
193 test_KErrNone(r); |
196 |
194 |
197 r=TheFs.SetSessionPath(systestname); |
195 r=TheFs.SetSessionPath(systestname); |
198 test(r==KErrPermissionDenied); |
196 test_Value(r, r == KErrPermissionDenied); |
199 |
197 |
200 TheFs.NotifyChange(ENotifyAll,aStat1,systestname); |
198 TheFs.NotifyChange(ENotifyAll,aStat1,systestname); |
201 test(aStat1==KErrPermissionDenied); |
199 test(aStat1==KErrPermissionDenied); |
202 |
200 |
203 systestfile=KSystemPath; |
201 systestfile=KSystemPath; |
208 |
206 |
209 oldName=KOldFile; |
207 oldName=KOldFile; |
210 oldName[0]=(TText)gDriveToTest; |
208 oldName[0]=(TText)gDriveToTest; |
211 |
209 |
212 r=TheFs.GetShortName(systestfile, shortfilename); |
210 r=TheFs.GetShortName(systestfile, shortfilename); |
213 test(r==KErrPermissionDenied || r==KErrNotSupported); |
211 test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported); |
214 |
212 |
215 r=TheFs.GetLongName(systestfile1, longfilename); |
213 r=TheFs.GetLongName(systestfile1, longfilename); |
216 test(r==KErrPermissionDenied || r==KErrNotSupported); |
214 test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported); |
217 |
215 |
218 r=file1.Create(TheFs,oldName,EFileWrite); |
216 r=file1.Create(TheFs,oldName,EFileWrite); |
219 test(r==KErrNone || r==KErrAlreadyExists); |
217 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
220 file1.Close(); |
218 file1.Close(); |
221 |
219 |
222 r=TheFs.Replace(oldName,systestfile); |
220 r=TheFs.Replace(oldName,systestfile); |
223 test(r==KErrNone); |
221 test_KErrNone(r); |
224 |
222 |
225 r=TheFs.Delete(systestfile1); |
223 r=TheFs.Delete(systestfile1); |
226 test(r==KErrNone || r==KErrNotFound); |
224 test_Value(r, r == KErrNone || r==KErrNotFound); |
227 |
225 |
228 r=TheFs.Rename(systestfile,systestfile1); |
226 r=TheFs.Rename(systestfile,systestfile1); |
229 test(r==KErrNone); |
227 test_KErrNone(r); |
230 |
228 |
231 r=TheFs.Entry(systestfile1,entry); |
229 r=TheFs.Entry(systestfile1,entry); |
232 test(r==KErrPermissionDenied); |
230 test_Value(r, r == KErrPermissionDenied); |
233 |
231 |
234 r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
232 r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
235 test(r==KErrNone); |
233 test_KErrNone(r); |
236 |
234 |
237 r=TheFs.Delete(systestfile1); |
235 r=TheFs.Delete(systestfile1); |
238 test(r==KErrNone); |
236 test_KErrNone(r); |
239 |
237 |
240 __UHEAP_MARKEND; |
238 __UHEAP_MARKEND; |
241 } |
239 } |
242 |
240 |
243 LOCAL_C void ResourceRFsTest() |
241 LOCAL_C void ResourceRFsTest() |
252 |
250 |
253 mkdirname.Zero(); |
251 mkdirname.Zero(); |
254 mkdirname.Append(restestname); |
252 mkdirname.Append(restestname); |
255 mkdirname.Append(KMkDirSub); |
253 mkdirname.Append(KMkDirSub); |
256 r=TheFs.MkDirAll(mkdirname); |
254 r=TheFs.MkDirAll(mkdirname); |
257 test(r==KErrNone); |
255 test_KErrNone(r); |
258 |
256 |
259 TheFs.RmDir(mkdirname); |
257 TheFs.RmDir(mkdirname); |
260 test(r==KErrNone); |
258 test_KErrNone(r); |
261 |
259 |
262 r=TheFs.SetSubst(restestname,EDriveO); |
260 r=TheFs.SetSubst(restestname,EDriveO); |
263 test(r==KErrNone); |
261 test_KErrNone(r); |
264 |
262 |
265 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
263 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
266 test(r==KErrNone); |
264 test_KErrNone(r); |
267 |
265 |
268 r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst |
266 r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst |
269 test(r==KErrNone); |
267 test_KErrNone(r); |
270 |
268 |
271 r=TheFs.SetSessionPath(restestname); |
269 r=TheFs.SetSessionPath(restestname); |
272 test(r==KErrNone); |
270 test_KErrNone(r); |
273 |
271 |
274 TheFs.NotifyChange(ENotifyAll,aStat4,restestname); |
272 TheFs.NotifyChange(ENotifyAll,aStat4,restestname); |
275 test(aStat4==KRequestPending); |
273 test(aStat4==KRequestPending); |
276 |
274 |
277 restestfile=KResourcePath; |
275 restestfile=KResourcePath; |
282 |
280 |
283 oldName=KOldFile; |
281 oldName=KOldFile; |
284 oldName[0]=(TText)gDriveToTest; |
282 oldName[0]=(TText)gDriveToTest; |
285 |
283 |
286 r=TheFs.GetShortName(restestfile, shortfilename); |
284 r=TheFs.GetShortName(restestfile, shortfilename); |
287 test(r==KErrNone || KErrNotFound || r==KErrNotSupported); |
285 test_Value(r, r == KErrNone || r == KErrNotFound || r==KErrNotSupported); |
288 |
286 |
289 r=TheFs.GetLongName(restestfile1, longfilename); |
287 r=TheFs.GetLongName(restestfile1, longfilename); |
290 test(r==KErrNone || KErrNotFound || r==KErrNotSupported); |
288 test_Value(r, r == KErrNone || r == KErrNotFound || r==KErrNotSupported); |
291 |
289 |
292 r=file1.Create(TheFs,oldName,EFileWrite); |
290 r=file1.Create(TheFs,oldName,EFileWrite); |
293 test(r==KErrNone || r==KErrAlreadyExists); |
291 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
294 file1.Close(); |
292 file1.Close(); |
295 |
293 |
296 r=TheFs.Replace(oldName,restestfile); |
294 r=TheFs.Replace(oldName,restestfile); |
297 test(r==KErrNone); |
295 test_KErrNone(r); |
298 |
296 |
299 r=TheFs.Delete(restestfile1); |
297 r=TheFs.Delete(restestfile1); |
300 test(r==KErrNone || r==KErrNotFound); |
298 test_Value(r, r == KErrNone || r==KErrNotFound); |
301 |
299 |
302 r=TheFs.Rename(restestfile,restestfile1); |
300 r=TheFs.Rename(restestfile,restestfile1); |
303 test(r==KErrNone); |
301 test_KErrNone(r); |
304 |
302 |
305 r=TheFs.Entry(restestfile1,entry); |
303 r=TheFs.Entry(restestfile1,entry); |
306 test(r==KErrNone); |
304 test_KErrNone(r); |
307 |
305 |
308 r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
306 r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
309 test(r==KErrNone); |
307 test_KErrNone(r); |
310 |
308 |
311 r=TheFs.Delete(restestfile1); |
309 r=TheFs.Delete(restestfile1); |
312 test(r==KErrNone); |
310 test_KErrNone(r); |
313 |
311 |
314 |
312 |
315 __UHEAP_MARKEND; |
313 __UHEAP_MARKEND; |
316 } |
314 } |
317 |
315 |
329 mkdirname.Zero(); |
327 mkdirname.Zero(); |
330 mkdirname.Append(pritestname); |
328 mkdirname.Append(pritestname); |
331 mkdirname.Append(KMkDirSub); |
329 mkdirname.Append(KMkDirSub); |
332 |
330 |
333 r=TheFs.MkDirAll(mkdirname); |
331 r=TheFs.MkDirAll(mkdirname); |
334 test(r==KErrPermissionDenied); |
332 test_Value(r, r == KErrPermissionDenied); |
335 |
333 |
336 r=TheFs.RmDir(mkdirname); |
334 r=TheFs.RmDir(mkdirname); |
337 test(r==KErrPermissionDenied); |
335 test_Value(r, r == KErrPermissionDenied); |
338 |
336 |
339 r=TheFs.SetSubst(pritestname,EDriveO); |
337 r=TheFs.SetSubst(pritestname,EDriveO); |
340 test(r==KErrPermissionDenied); |
338 test_Value(r, r == KErrPermissionDenied); |
341 |
339 |
342 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
340 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
343 test(r==KErrNone); |
341 test_KErrNone(r); |
344 |
342 |
345 r=TheFs.SetSessionPath(pritestname); |
343 r=TheFs.SetSessionPath(pritestname); |
346 test(r==KErrPermissionDenied); |
344 test_Value(r, r == KErrPermissionDenied); |
347 |
345 |
348 TheFs.NotifyChange(ENotifyAll,aStat2,pritestname); |
346 TheFs.NotifyChange(ENotifyAll,aStat2,pritestname); |
349 test(aStat2==KErrPermissionDenied); |
347 test(aStat2==KErrPermissionDenied); |
350 |
348 |
351 |
349 |
357 |
355 |
358 oldName=KOldFile; |
356 oldName=KOldFile; |
359 oldName[0]=(TText)gDriveToTest; |
357 oldName[0]=(TText)gDriveToTest; |
360 |
358 |
361 r=TheFs.GetShortName(pritestfile, shortfilename); |
359 r=TheFs.GetShortName(pritestfile, shortfilename); |
362 test(r==KErrPermissionDenied || r==KErrNotSupported); |
360 test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported); |
363 |
361 |
364 r=TheFs.GetLongName(pritestfile1, longfilename); |
362 r=TheFs.GetLongName(pritestfile1, longfilename); |
365 test(r==KErrPermissionDenied || r==KErrNotSupported); |
363 test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported); |
366 |
364 |
367 r=file1.Create(TheFs,oldName,EFileWrite); |
365 r=file1.Create(TheFs,oldName,EFileWrite); |
368 test(r==KErrNone || r==KErrAlreadyExists); |
366 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
369 file1.Close(); |
367 file1.Close(); |
370 |
368 |
371 r=TheFs.Replace(oldName,pritestfile); |
369 r=TheFs.Replace(oldName,pritestfile); |
372 test(r==KErrPermissionDenied); |
370 test_Value(r, r == KErrPermissionDenied); |
373 |
371 |
374 r=TheFs.Rename(pritestfile,pritestfile1); |
372 r=TheFs.Rename(pritestfile,pritestfile1); |
375 test(r==KErrPermissionDenied); |
373 test_Value(r, r == KErrPermissionDenied); |
376 |
374 |
377 r=TheFs.Entry(pritestfile1,entry); |
375 r=TheFs.Entry(pritestfile1,entry); |
378 test(r==KErrPermissionDenied); |
376 test_Value(r, r == KErrPermissionDenied); |
379 |
377 |
380 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
378 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
381 test(r==KErrPermissionDenied); |
379 test_Value(r, r == KErrPermissionDenied); |
382 |
380 |
383 r=TheFs.Delete(pritestfile1); |
381 r=TheFs.Delete(pritestfile1); |
384 test(r==KErrPermissionDenied); |
382 test_Value(r, r == KErrPermissionDenied); |
385 |
383 |
386 |
384 |
387 __UHEAP_MARKEND; |
385 __UHEAP_MARKEND; |
388 } |
386 } |
389 |
387 |
397 |
395 |
398 mkdirname.Zero(); |
396 mkdirname.Zero(); |
399 mkdirname.Append(theprivatepath); |
397 mkdirname.Append(theprivatepath); |
400 mkdirname.Append(KMkDirSub); |
398 mkdirname.Append(KMkDirSub); |
401 r=TheFs.MkDirAll(mkdirname); |
399 r=TheFs.MkDirAll(mkdirname); |
402 test(r==KErrNone); |
400 test_KErrNone(r); |
403 |
401 |
404 r=TheFs.RmDir(mkdirname); |
402 r=TheFs.RmDir(mkdirname); |
405 test(r==KErrNone); |
403 test_KErrNone(r); |
406 |
404 |
407 r=TheFs.SetSubst(theprivatepath,EDriveO); |
405 r=TheFs.SetSubst(theprivatepath,EDriveO); |
408 test(r==KErrNone); |
406 test_KErrNone(r); |
409 |
407 |
410 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
408 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
411 test(r==KErrNone); |
409 test_KErrNone(r); |
412 |
410 |
413 r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst |
411 r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst |
414 test(r==KErrNone); |
412 test_KErrNone(r); |
415 |
413 |
416 r=TheFs.SetSessionPath(theprivatepath); |
414 r=TheFs.SetSessionPath(theprivatepath); |
417 test(r==KErrNone); |
415 test_KErrNone(r); |
418 |
416 |
419 TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath); |
417 TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath); |
420 test(aStat3==KRequestPending); |
418 test(aStat3==KRequestPending); |
421 |
419 |
422 pritestfile=theprivatepath; |
420 pritestfile=theprivatepath; |
427 |
425 |
428 oldName=KOldFile; |
426 oldName=KOldFile; |
429 oldName[0]=(TText)gDriveToTest; |
427 oldName[0]=(TText)gDriveToTest; |
430 |
428 |
431 r=TheFs.GetShortName(pritestfile, shortfilename); |
429 r=TheFs.GetShortName(pritestfile, shortfilename); |
432 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
430 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
433 |
431 |
434 r=TheFs.GetLongName(pritestfile1, longfilename); |
432 r=TheFs.GetLongName(pritestfile1, longfilename); |
435 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
433 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
436 |
434 |
437 r=file1.Create(TheFs,oldName,EFileWrite); |
435 r=file1.Create(TheFs,oldName,EFileWrite); |
438 test(r==KErrNone || r==KErrAlreadyExists); |
436 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
439 file1.Close(); |
437 file1.Close(); |
440 |
438 |
441 r=TheFs.Replace(oldName,pritestfile); |
439 r=TheFs.Replace(oldName,pritestfile); |
442 test(r==KErrNone); |
440 test_KErrNone(r); |
443 |
441 |
444 r=TheFs.Rename(pritestfile,pritestfile1); |
442 r=TheFs.Rename(pritestfile,pritestfile1); |
445 test(r==KErrNone || r==KErrAlreadyExists); |
443 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
446 |
444 |
447 r=TheFs.Entry(pritestfile1,entry); |
445 r=TheFs.Entry(pritestfile1,entry); |
448 test(r==KErrNone); |
446 test_KErrNone(r); |
449 |
447 |
450 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
448 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
451 test(r==KErrNone); |
449 test_KErrNone(r); |
452 |
450 |
453 r=TheFs.Delete(pritestfile1); |
451 r=TheFs.Delete(pritestfile1); |
454 test(r==KErrNone); |
452 test_KErrNone(r); |
455 |
453 |
456 __UHEAP_MARKEND; |
454 __UHEAP_MARKEND; |
457 } |
455 } |
458 |
456 |
459 |
457 |
463 // |
461 // |
464 { |
462 { |
465 __UHEAP_MARK; |
463 __UHEAP_MARK; |
466 |
464 |
467 r=TheFs.SetSessionPath(systestname); |
465 r=TheFs.SetSessionPath(systestname); |
468 test(r==KErrPermissionDenied); |
466 test_Value(r, r == KErrPermissionDenied); |
469 |
467 |
470 r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite); |
468 r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite); |
471 test(r==KErrNone); |
469 test_KErrNone(r); |
472 file1.Close(); |
470 file1.Close(); |
473 |
471 |
474 systestfile=KSystemPath; |
472 systestfile=KSystemPath; |
475 systestfile[0]=(TText)('A' + gTheDriveNum); |
473 systestfile[0]=(TText)('A' + gTheDriveNum); |
476 systestfile1=systestfile; |
474 systestfile1=systestfile; |
477 systestfile.Append(KFileSys); |
475 systestfile.Append(KFileSys); |
478 systestfile1.Append(KFileSys3); |
476 systestfile1.Append(KFileSys3); |
479 |
477 |
480 r=file1.Create(TheFs,systestfile,EFileWrite); |
478 r=file1.Create(TheFs,systestfile,EFileWrite); |
481 test(r==KErrNone); |
479 test_KErrNone(r); |
482 file1.Close(); |
480 file1.Close(); |
483 |
481 |
484 r=file1.Open(TheFs,systestfile,EFileWrite); |
482 r=file1.Open(TheFs,systestfile,EFileWrite); |
485 test(r==KErrNone); |
483 test_KErrNone(r); |
486 file1.Close(); |
484 file1.Close(); |
487 |
485 |
488 r=file1.Open(TheFs,systestfile,EFileRead); |
486 r=file1.Open(TheFs,systestfile,EFileRead); |
489 test(r==KErrPermissionDenied); |
487 test_Value(r, r == KErrPermissionDenied); |
490 file1.Close(); |
488 file1.Close(); |
491 |
489 |
492 r=file1.Replace(TheFs,systestfile,EFileWrite); |
490 r=file1.Replace(TheFs,systestfile,EFileWrite); |
493 test(r==KErrNone); |
491 test_KErrNone(r); |
494 |
492 |
495 r=file1.Rename(systestfile1); |
493 r=file1.Rename(systestfile1); |
496 test(r==KErrNone); |
494 test_KErrNone(r); |
497 file1.Close(); |
495 file1.Close(); |
498 |
496 |
499 TFindFile finder(TheFs); |
497 TFindFile finder(TheFs); |
500 CDir* dir = NULL; |
498 CDir* dir = NULL; |
501 r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
499 r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
502 if (!(r==KErrPermissionDenied)) |
500 if (!(r==KErrPermissionDenied)) |
503 test.Printf(_L("T_DCTCBDISKADMIN: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r); |
501 test.Printf(_L("T_DCTCBDISKADMIN: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r); |
504 test(r==KErrPermissionDenied); |
502 test_Value(r, r == KErrPermissionDenied); |
505 // delete dir; |
503 // delete dir; |
506 |
504 |
507 r=TheFs.Delete(fromTemp); |
505 r=TheFs.Delete(fromTemp); |
508 test(r==KErrNone); |
506 test_KErrNone(r); |
509 |
507 |
510 r=TheFs.Delete(systestfile1); |
508 r=TheFs.Delete(systestfile1); |
511 test(r==KErrNone); |
509 test_KErrNone(r); |
512 |
510 |
513 |
511 |
514 __UHEAP_MARKEND; |
512 __UHEAP_MARKEND; |
515 } |
513 } |
516 |
514 |
520 // |
518 // |
521 { |
519 { |
522 __UHEAP_MARK; |
520 __UHEAP_MARK; |
523 |
521 |
524 r=TheFs.SetSessionPath(restestname); |
522 r=TheFs.SetSessionPath(restestname); |
525 test(r==KErrNone); |
523 test_KErrNone(r); |
526 |
524 |
527 r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite); |
525 r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite); |
528 test(r==KErrNone); |
526 test_KErrNone(r); |
529 file1.Close(); |
527 file1.Close(); |
530 |
528 |
531 r=file1.Create(TheFs,KFileRes,EFileWrite); |
529 r=file1.Create(TheFs,KFileRes,EFileWrite); |
532 test(r==KErrNone); |
530 test_KErrNone(r); |
533 file1.Close(); |
531 file1.Close(); |
534 |
532 |
535 r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive ); |
533 r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive ); |
536 test(r==KErrNone); |
534 test_KErrNone(r); |
537 |
535 |
538 r=file1.Rename(KFileRes3); |
536 r=file1.Rename(KFileRes3); |
539 test(r==KErrNone); |
537 test_KErrNone(r); |
540 file1.Close(); |
538 file1.Close(); |
541 |
539 |
542 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead); |
540 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead); |
543 test(r==KErrNone); |
541 test_KErrNone(r); |
544 file1.Close(); |
542 file1.Close(); |
545 |
543 |
546 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite); |
544 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite); |
547 test(r==KErrNone); |
545 test_KErrNone(r); |
548 file1.Close(); |
546 file1.Close(); |
549 |
547 |
550 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly); |
548 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly); |
551 test(r==KErrNone); |
549 test_KErrNone(r); |
552 |
550 |
553 r=file1.ChangeMode(EFileShareExclusive); |
551 r=file1.ChangeMode(EFileShareExclusive); |
554 test(r==KErrNone); |
552 test_KErrNone(r); |
555 file1.Close(); |
553 file1.Close(); |
556 |
554 |
557 r=file1.Replace(TheFs,KFileRes,EFileWrite); |
555 r=file1.Replace(TheFs,KFileRes,EFileWrite); |
558 test(r==KErrNone); |
556 test_KErrNone(r); |
559 file1.Close(); |
557 file1.Close(); |
560 |
558 |
561 r=TheFs.Delete(KFileRes); |
559 r=TheFs.Delete(KFileRes); |
562 test(r==KErrNone); |
560 test_KErrNone(r); |
563 |
561 |
564 r=TheFs.Delete(KFileRes3); |
562 r=TheFs.Delete(KFileRes3); |
565 test(r==KErrNone); |
563 test_KErrNone(r); |
566 |
564 |
567 r=TheFs.Delete(fromTemp); |
565 r=TheFs.Delete(fromTemp); |
568 test(r==KErrNone); |
566 test_KErrNone(r); |
569 |
567 |
570 __UHEAP_MARKEND; |
568 __UHEAP_MARKEND; |
571 } |
569 } |
572 |
570 |
573 |
571 |
577 // |
575 // |
578 { |
576 { |
579 __UHEAP_MARK; |
577 __UHEAP_MARK; |
580 |
578 |
581 r=TheFs.SetSessionPath(pritestfalseidname); |
579 r=TheFs.SetSessionPath(pritestfalseidname); |
582 test(r==KErrPermissionDenied); |
580 test_Value(r, r == KErrPermissionDenied); |
583 |
581 |
584 // Since can't set the session path to what is required, so use |
582 // Since can't set the session path to what is required, so use |
585 // an explicit path |
583 // an explicit path |
586 pritestfile=pritestfalseidname; |
584 pritestfile=pritestfalseidname; |
587 pritestfile[0]=(TText)('A' + gTheDriveNum); |
585 pritestfile[0]=(TText)('A' + gTheDriveNum); |
588 pritestfile.Append(KFilePri); |
586 pritestfile.Append(KFilePri); |
589 |
587 |
590 r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite); |
588 r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite); |
591 test(r==KErrPermissionDenied); |
589 test_Value(r, r == KErrPermissionDenied); |
592 file1.Close(); |
590 file1.Close(); |
593 |
591 |
594 r=file1.Create(TheFs,pritestfile,EFileWrite); |
592 r=file1.Create(TheFs,pritestfile,EFileWrite); |
595 test(r==KErrPermissionDenied); |
593 test_Value(r, r == KErrPermissionDenied); |
596 file1.Close(); |
594 file1.Close(); |
597 |
595 |
598 r=file1.Open(TheFs,pritestfile,EFileWrite); |
596 r=file1.Open(TheFs,pritestfile,EFileWrite); |
599 test(r==KErrPermissionDenied); |
597 test_Value(r, r == KErrPermissionDenied); |
600 file1.Close(); |
598 file1.Close(); |
601 |
599 |
602 r=file1.Replace(TheFs,pritestfile,EFileWrite); |
600 r=file1.Replace(TheFs,pritestfile,EFileWrite); |
603 test(r==KErrPermissionDenied); |
601 test_Value(r, r == KErrPermissionDenied); |
604 |
602 |
605 // Can't perform this operation since file1 has not been created |
603 // Can't perform this operation since file1 has not been created |
606 /* r=file1.Rename(KFilePri3); |
604 /* r=file1.Rename(KFilePri3); |
607 test(r==KErrPermissionDenied); |
605 test_Value(r, r == KErrPermissionDenied); |
608 file1.Close(); |
606 file1.Close(); |
609 */ |
607 */ |
610 __UHEAP_MARKEND; |
608 __UHEAP_MARKEND; |
611 } |
609 } |
612 |
610 |
618 // |
616 // |
619 { |
617 { |
620 __UHEAP_MARK; |
618 __UHEAP_MARK; |
621 |
619 |
622 r=TheFs.SetSessionPath(pritestname); |
620 r=TheFs.SetSessionPath(pritestname); |
623 test(r==KErrPermissionDenied); |
621 test_Value(r, r == KErrPermissionDenied); |
624 |
622 |
625 r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); |
623 r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); |
626 test(r==KErrPermissionDenied); |
624 test_Value(r, r == KErrPermissionDenied); |
627 file1.Close(); |
625 file1.Close(); |
628 |
626 |
629 // Since can't set session path create explicit path |
627 // Since can't set session path create explicit path |
630 pritestfile=KPrivatePath; |
628 pritestfile=KPrivatePath; |
631 pritestfile[0]=(TText)('A' + gTheDriveNum); |
629 pritestfile[0]=(TText)('A' + gTheDriveNum); |
632 pritestfile.Append(KFilePri); |
630 pritestfile.Append(KFilePri); |
633 |
631 |
634 r=file1.Create(TheFs,pritestfile,EFileWrite); |
632 r=file1.Create(TheFs,pritestfile,EFileWrite); |
635 test(r==KErrPermissionDenied); |
633 test_Value(r, r == KErrPermissionDenied); |
636 file1.Close(); |
634 file1.Close(); |
637 |
635 |
638 r=file1.Open(TheFs,pritestfile,EFileWrite); |
636 r=file1.Open(TheFs,pritestfile,EFileWrite); |
639 test(r==KErrPermissionDenied); |
637 test_Value(r, r == KErrPermissionDenied); |
640 file1.Close(); |
638 file1.Close(); |
641 |
639 |
642 r=file1.Open(TheFs,pritestfile,EFileRead); |
640 r=file1.Open(TheFs,pritestfile,EFileRead); |
643 test(r==KErrPermissionDenied); |
641 test_Value(r, r == KErrPermissionDenied); |
644 file1.Close(); |
642 file1.Close(); |
645 |
643 |
646 r=file1.Replace(TheFs,pritestfile,EFileWrite); |
644 r=file1.Replace(TheFs,pritestfile,EFileWrite); |
647 test(r==KErrPermissionDenied); |
645 test_Value(r, r == KErrPermissionDenied); |
648 |
646 |
649 // Can't rename nor delete since file1 not created |
647 // Can't rename nor delete since file1 not created |
650 /* |
648 /* |
651 r=file1.Rename(KFilePri3); |
649 r=file1.Rename(KFilePri3); |
652 test(r==KErrPermissionDenied); |
650 test_Value(r, r == KErrPermissionDenied); |
653 file1.Close(); |
651 file1.Close(); |
654 |
652 |
655 r=TheFs.Delete(fromTemp); |
653 r=TheFs.Delete(fromTemp); |
656 test(r==KErrNone); |
654 test_KErrNone(r); |
657 */ |
655 */ |
658 |
656 |
659 __UHEAP_MARKEND; |
657 __UHEAP_MARKEND; |
660 } |
658 } |
661 |
659 |
667 // |
665 // |
668 { |
666 { |
669 __UHEAP_MARK; |
667 __UHEAP_MARK; |
670 |
668 |
671 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
669 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
672 test(r==KErrNone); |
670 test_KErrNone(r); |
673 |
671 |
674 r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
672 r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
675 test(r==KErrNone); |
673 test_KErrNone(r); |
676 file1.Close(); |
674 file1.Close(); |
677 |
675 |
678 r=file1.Create(TheFs,KFilePri,EFileWrite); |
676 r=file1.Create(TheFs,KFilePri,EFileWrite); |
679 test(r==KErrNone || r==KErrAlreadyExists); |
677 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
680 file1.Close(); |
678 file1.Close(); |
681 |
679 |
682 r=file1.Open(TheFs,KFilePri,EFileWrite); |
680 r=file1.Open(TheFs,KFilePri,EFileWrite); |
683 test(r==KErrNone); |
681 test_KErrNone(r); |
684 file1.Close(); |
682 file1.Close(); |
685 |
683 |
686 r=file1.Open(TheFs,KFilePri,EFileRead); |
684 r=file1.Open(TheFs,KFilePri,EFileRead); |
687 test(r==KErrNone); |
685 test_KErrNone(r); |
688 file1.Close(); |
686 file1.Close(); |
689 |
687 |
690 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
688 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
691 test(r==KErrNone); |
689 test_KErrNone(r); |
692 |
690 |
693 r=file1.Rename(KFilePri3); |
691 r=file1.Rename(KFilePri3); |
694 test(r==KErrNone); |
692 test_KErrNone(r); |
695 file1.Close(); |
693 file1.Close(); |
696 |
694 |
697 r=TheFs.Delete(KFilePri3); |
695 r=TheFs.Delete(KFilePri3); |
698 test(r==KErrNone); |
696 test_KErrNone(r); |
699 |
697 |
700 r=TheFs.Delete(fromTemp); |
698 r=TheFs.Delete(fromTemp); |
701 test(r==KErrNone); |
699 test_KErrNone(r); |
702 |
700 |
703 __UHEAP_MARKEND; |
701 __UHEAP_MARKEND; |
704 } |
702 } |
705 |
703 |
706 LOCAL_C void RDirtest() |
704 LOCAL_C void RDirtest() |
714 //system |
712 //system |
715 CDir* dirEntries; |
713 CDir* dirEntries; |
716 TBuf<30> dirNameBuf(KSystemPath); |
714 TBuf<30> dirNameBuf(KSystemPath); |
717 dirNameBuf[0]=(TText)gDriveToTest; |
715 dirNameBuf[0]=(TText)gDriveToTest; |
718 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
716 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
719 test(r==KErrPermissionDenied); |
717 test_Value(r, r == KErrPermissionDenied); |
720 dir.Close(); |
718 dir.Close(); |
721 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
719 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
722 test(r==KErrPermissionDenied); |
720 test_Value(r, r == KErrPermissionDenied); |
723 dirNameBuf.Zero(); |
721 dirNameBuf.Zero(); |
724 delete dirEntries; |
722 delete dirEntries; |
725 |
723 |
726 //Private |
724 //Private |
727 dirNameBuf=KPrivatePath; |
725 dirNameBuf=KPrivatePath; |
728 dirNameBuf[0]=(TText)gDriveToTest; |
726 dirNameBuf[0]=(TText)gDriveToTest; |
729 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
727 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
730 test(r==KErrPermissionDenied); |
728 test_Value(r, r == KErrPermissionDenied); |
731 dir.Close(); |
729 dir.Close(); |
732 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
730 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
733 test(r==KErrPermissionDenied); |
731 test_Value(r, r == KErrPermissionDenied); |
734 dirNameBuf.Zero(); |
732 dirNameBuf.Zero(); |
735 delete dirEntries; |
733 delete dirEntries; |
736 |
734 |
737 //Private//<wrong ID>// |
735 //Private//<wrong ID>// |
738 dirNameBuf=KPrivateFalseID; |
736 dirNameBuf=KPrivateFalseID; |
739 dirNameBuf[0]=(TText)gDriveToTest; |
737 dirNameBuf[0]=(TText)gDriveToTest; |
740 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
738 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
741 test(r==KErrPermissionDenied); |
739 test_Value(r, r == KErrPermissionDenied); |
742 dir.Close(); |
740 dir.Close(); |
743 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
741 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
744 test(r==KErrPermissionDenied); |
742 test_Value(r, r == KErrPermissionDenied); |
745 dirNameBuf.Zero(); |
743 dirNameBuf.Zero(); |
746 delete dirEntries; |
744 delete dirEntries; |
747 |
745 |
748 //Private/uid |
746 //Private/uid |
749 TheFs.PrivatePath(dirNameBuf); |
747 TheFs.PrivatePath(dirNameBuf); |
750 dirNameBuf.Insert(0,_L("?:")); |
748 dirNameBuf.Insert(0,_L("?:")); |
751 dirNameBuf[0]=(TText)gDriveToTest; |
749 dirNameBuf[0]=(TText)gDriveToTest; |
752 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
750 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
753 test(r==KErrNone); |
751 test_KErrNone(r); |
754 dir.Close(); |
752 dir.Close(); |
755 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
753 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
756 test(r==KErrNone); |
754 test_KErrNone(r); |
757 dirNameBuf.Zero(); |
755 dirNameBuf.Zero(); |
758 delete dirEntries; |
756 delete dirEntries; |
759 //Resource |
757 //Resource |
760 |
758 |
761 dirNameBuf=KResourcePath; |
759 dirNameBuf=KResourcePath; |
762 dirNameBuf[0]=(TText)gDriveToTest; |
760 dirNameBuf[0]=(TText)gDriveToTest; |
763 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
761 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
764 test(r==KErrNone); |
762 test_KErrNone(r); |
765 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
763 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
766 test(r==KErrNone); |
764 test_KErrNone(r); |
767 dir.Close(); |
765 dir.Close(); |
768 delete dirEntries; |
766 delete dirEntries; |
769 |
767 |
770 __UHEAP_MARKEND; |
768 __UHEAP_MARKEND; |
771 } |
769 } |
777 // |
775 // |
778 { |
776 { |
779 __UHEAP_MARK; |
777 __UHEAP_MARK; |
780 |
778 |
781 r=TheFs.FileSystemName(fsname,gTheDriveNum); |
779 r=TheFs.FileSystemName(fsname,gTheDriveNum); |
782 test(r==KErrNone); |
780 test_KErrNone(r); |
783 r = DismountFileSystem(TheFs, fsname, gTheDriveNum); |
781 r = DismountFileSystem(TheFs, fsname, gTheDriveNum); |
784 test(r==KErrNone || r==KErrNotFound); |
782 test_Value(r, r == KErrNone || r==KErrNotFound); |
785 // r=TheFs.RemoveFileSystem(fsname); //can not test due to bug else where fix exists |
783 // r=TheFs.RemoveFileSystem(fsname); //can not test due to bug else where fix exists |
786 // test(r==KErrNone); |
784 // test_KErrNone(r); |
787 // r=TheFs.AddFileSystem(fsname); |
785 // r=TheFs.AddFileSystem(fsname); |
788 // test(r==KErrNone); |
786 // test_KErrNone(r); |
789 r = MountFileSystem(TheFs, fsname, gTheDriveNum); |
787 r = MountFileSystem(TheFs, fsname, gTheDriveNum); |
790 test(r==KErrNone); |
788 test_KErrNone(r); |
791 r=TheFs.SetDriveName(gTheDriveNum,KDriveName); |
789 r=TheFs.SetDriveName(gTheDriveNum,KDriveName); |
792 test(r==KErrNone); |
790 test_KErrNone(r); |
793 #ifndef __WINS__ |
791 #ifndef __WINS__ |
794 r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum); |
792 r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum); |
795 test(r==KErrNone); |
793 test_KErrNone(r); |
796 #endif |
794 #endif |
797 |
795 |
798 systemRFsTest(); |
796 systemRFsTest(); |
799 ResourceRFsTest(); |
797 ResourceRFsTest(); |
800 privateRFsTest(); |
798 privateRFsTest(); |
816 test(aStat2==KErrPermissionDenied); |
814 test(aStat2==KErrPermissionDenied); |
817 test(aStat3==KErrNone); |
815 test(aStat3==KErrNone); |
818 test(aStat4==KErrNone); |
816 test(aStat4==KErrNone); |
819 |
817 |
820 r=TheFs.SetSessionPath(systestname); |
818 r=TheFs.SetSessionPath(systestname); |
821 test(r==KErrPermissionDenied); |
819 test_Value(r, r == KErrPermissionDenied); |
822 |
820 |
823 //Test RRawDisk class |
821 //Test RRawDisk class |
824 r=rawdisk.Open(TheFs,gTheDriveNum); |
822 r=rawdisk.Open(TheFs,gTheDriveNum); |
825 test(r==KErrNone); |
823 test_KErrNone(r); |
826 rawdisk.Close(); |
824 rawdisk.Close(); |
827 |
825 |
828 RDirtest(); |
826 RDirtest(); |
829 |
827 |
830 #ifdef __WINS__ |
828 #ifdef __WINS__ |
831 if (User::UpperCase(driveBuf[0]) != 'C') |
829 if (User::UpperCase(driveBuf[0]) != 'C') |
832 #endif |
830 #endif |
833 { |
831 { |
834 //Test RFormat class |
832 //Test RFormat class |
835 r=format.Open(TheFs,driveBuf,EHighDensity,count); |
833 r=format.Open(TheFs,driveBuf,EHighDensity,count); |
836 test(r==KErrNone); |
834 test_KErrNone(r); |
837 |
835 |
838 while(count) |
836 while(count) |
839 { |
837 { |
840 TInt r=format.Next(count); |
838 TInt r=format.Next(count); |
841 test(r==KErrNone); |
839 test_KErrNone(r); |
842 } |
840 } |
843 format.Close(); |
841 format.Close(); |
844 } |
842 } |
845 |
843 |
846 driveBuf[0]=(TText)gDriveToTest; |
844 driveBuf[0]=(TText)gDriveToTest; |
847 r=TheFs.ScanDrive(driveBuf); |
845 r=TheFs.ScanDrive(driveBuf); |
848 test(r==KErrNone || r==KErrNotSupported); |
846 test_Value(r, r == KErrNone || r==KErrNotSupported); |
849 r=TheFs.CheckDisk(driveBuf); |
847 r=TheFs.CheckDisk(driveBuf); |
850 test(r==KErrNone || r==KErrNotSupported); |
848 test_Value(r, r == KErrNone || r==KErrNotSupported); |
851 |
849 |
852 __UHEAP_MARKEND; |
850 __UHEAP_MARKEND; |
853 } |
851 } |
854 |
852 |
855 LOCAL_C void TestCaps() |
853 LOCAL_C void TestCaps() |
865 r=RProcess().HasCapability(ECapabilityTCB,ECapabilityDiskAdmin, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
863 r=RProcess().HasCapability(ECapabilityTCB,ECapabilityDiskAdmin, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
866 test(r); |
864 test(r); |
867 |
865 |
868 driveBuf[0]=(TText)gDriveToTest; |
866 driveBuf[0]=(TText)gDriveToTest; |
869 r=TheFs.SessionPath(temp); |
867 r=TheFs.SessionPath(temp); |
870 test(r==KErrNone); |
868 test_KErrNone(r); |
871 |
869 |
872 test.Printf(_L("Session path: %S"),&temp); |
870 test.Printf(_L("Session path: %S"),&temp); |
873 |
871 |
874 r=TheFs.CreatePrivatePath(gTheDriveNum); |
872 r=TheFs.CreatePrivatePath(gTheDriveNum); |
875 test(r==KErrNone || r== KErrAlreadyExists); |
873 test_Value(r, r == KErrNone || r== KErrAlreadyExists); |
876 |
874 |
877 TBuf<18> tempPri; |
875 TBuf<18> tempPri; |
878 r=TheFs.PrivatePath(tempPri); |
876 r=TheFs.PrivatePath(tempPri); |
879 test(r==KErrNone); |
877 test_KErrNone(r); |
880 theprivatepath = _L("?:"); |
878 theprivatepath = _L("?:"); |
881 theprivatepath.Append(tempPri); |
879 theprivatepath.Append(tempPri); |
882 |
880 |
883 TestTcbDiskAdmin(); |
881 TestTcbDiskAdmin(); |
884 |
882 |
885 TFileName thesessionpath; |
883 TFileName thesessionpath; |
886 |
884 |
887 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
885 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
888 test(r==KErrNone); |
886 test_KErrNone(r); |
889 r=TheFs.SessionPath(thesessionpath); |
887 r=TheFs.SessionPath(thesessionpath); |
890 test(r==KErrNone); |
888 test_KErrNone(r); |
891 |
889 |
892 test(thesessionpath == theprivatepath); |
890 test(thesessionpath == theprivatepath); |
893 |
891 |
894 __UHEAP_MARKEND; |
892 __UHEAP_MARKEND; |
895 } |
893 } |
900 // |
898 // |
901 { |
899 { |
902 test.Next(_L("Delete test directory")); |
900 test.Next(_L("Delete test directory")); |
903 CFileMan* fMan=CFileMan::NewL(TheFs); |
901 CFileMan* fMan=CFileMan::NewL(TheFs); |
904 TInt r=fMan->RmDir(gSessionPath); |
902 TInt r=fMan->RmDir(gSessionPath); |
905 test(r==KErrNone || r==KErrPathNotFound); |
903 test_Value(r, r == KErrNone || r==KErrPathNotFound); |
906 |
904 |
907 TBuf<20> delDir; |
905 TBuf<20> delDir; |
908 delDir=KResourcePath; |
906 delDir=KResourcePath; |
909 delDir[0]=(TText)gDriveToTest; |
907 delDir[0]=(TText)gDriveToTest; |
910 r=fMan->RmDir(delDir); |
908 r=fMan->RmDir(delDir); |
911 test(r==KErrNone || r==KErrPathNotFound); |
909 test_Value(r, r == KErrNone || r==KErrPathNotFound); |
912 delete fMan; |
910 delete fMan; |
913 |
911 |
914 delDir=KSystemPath; |
912 delDir=KSystemPath; |
915 delDir[0]=(TText)gDriveToTest; |
913 delDir[0]=(TText)gDriveToTest; |
916 r=TheFs.RmDir(delDir); |
914 r=TheFs.RmDir(delDir); |
917 test(r==KErrNone || r==KErrPathNotFound || r==KErrNotFound); |
915 test_Value(r, r == KErrNone || r==KErrPathNotFound || r==KErrNotFound); |
918 } |
916 } |
919 |
917 |
920 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/) |
918 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/) |
921 // |
919 // |
922 // Do all tests |
920 // Do all tests |
958 //check double mode ie that Defpath still works |
956 //check double mode ie that Defpath still works |
959 RFs fs1; |
957 RFs fs1; |
960 RFs fs2; |
958 RFs fs2; |
961 |
959 |
962 r=fs1.Connect(); |
960 r=fs1.Connect(); |
963 test(r==KErrNone); |
961 test_KErrNone(r); |
964 r=fs1.SessionPath(sesspath); |
962 r=fs1.SessionPath(sesspath); |
965 test(r==KErrNone); |
963 test_KErrNone(r); |
966 test.Printf(_L("session1 Path=%S"),&sesspath); |
964 test.Printf(_L("session1 Path=%S"),&sesspath); |
967 |
965 |
968 TBuf<30> privatepath; |
966 TBuf<30> privatepath; |
969 r=fs1.SetSessionToPrivate(gTheDriveNum); |
967 r=fs1.SetSessionToPrivate(gTheDriveNum); |
970 test(r==KErrNone); |
968 test_KErrNone(r); |
971 r=fs1.PrivatePath(privatepath); |
969 r=fs1.PrivatePath(privatepath); |
972 test(r==KErrNone); |
970 test_KErrNone(r); |
973 r=privatepath.Compare(KExpectedPrivatePath()); |
971 r=privatepath.Compare(KExpectedPrivatePath()); |
974 test(r==0); |
972 test_Value(r, r == 0); |
975 r=fs1.SessionPath(sesspath); |
973 r=fs1.SessionPath(sesspath); |
976 test(r==KErrNone); |
974 test_KErrNone(r); |
977 r=privatepath.Compare(sesspath.Mid(KPathPosition)); |
975 r=privatepath.Compare(sesspath.Mid(KPathPosition)); |
978 test(r==0); |
976 test_Value(r, r == 0); |
979 r=fs1.CreatePrivatePath(gTheDriveNum); |
977 r=fs1.CreatePrivatePath(gTheDriveNum); |
980 test(r==KErrNone); |
978 test_KErrNone(r); |
981 fs1.Close(); |
979 fs1.Close(); |
982 |
980 |
983 r=fs2.Connect(); |
981 r=fs2.Connect(); |
984 test(r==KErrNone); |
982 test_KErrNone(r); |
985 r=fs2.SessionPath(sesspath); |
983 r=fs2.SessionPath(sesspath); |
986 test(r==KErrNone); |
984 test_KErrNone(r); |
987 test.Printf(_L("session2 Path=%S"),&sesspath); |
985 test.Printf(_L("session2 Path=%S"),&sesspath); |
988 fs2.Close(); |
986 fs2.Close(); |
989 |
987 |
990 __UHEAP_MARK; |
988 __UHEAP_MARK; |
991 TestCaps(); |
989 TestCaps(); |