251 { |
252 { |
252 test.Next(_L("test functions supported with critical notifier")); |
253 test.Next(_L("test functions supported with critical notifier")); |
253 // used for EFsSubClose |
254 // used for EFsSubClose |
254 RFile file; |
255 RFile file; |
255 TInt r=file.Create(TheFs,File1,EFileShareAny|EFileWrite); |
256 TInt r=file.Create(TheFs,File1,EFileShareAny|EFileWrite); |
256 test(r==KErrNone||KErrAlreadyExists); |
257 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
257 if(r==KErrAlreadyExists) |
258 if(r==KErrAlreadyExists) |
258 { |
259 { |
259 r=file.Open(TheFs,File1,EFileShareAny|EFileWrite); |
260 r=file.Open(TheFs,File1,EFileShareAny|EFileWrite); |
260 test(r==KErrNone); |
261 test_KErrNone(r); |
261 } |
262 } |
262 TBuf8<16> buf=_L8("abcdefghijklmnop"); |
263 TBuf8<16> buf=_L8("abcdefghijklmnop"); |
263 r=file.Write(buf); |
264 r=file.Write(buf); |
264 test(r==KErrNone); |
265 test_KErrNone(r); |
265 |
266 |
266 r=TheFs.MkDir(NotifyDir); |
267 r=TheFs.MkDir(NotifyDir); |
267 test(r==KErrNone); |
268 test_KErrNone(r); |
268 |
269 |
269 RThread thread; |
270 RThread thread; |
270 PutCriticalNotifier(ETrue,thread); |
271 PutCriticalNotifier(ETrue,thread); |
271 |
272 |
272 // test functions that are supported with critical notifier |
273 // test functions that are supported with critical notifier |
298 |
299 |
299 // test some functions that are not supported when critcical notifier up |
300 // test some functions that are not supported when critcical notifier up |
300 // EFsFileOpen |
301 // EFsFileOpen |
301 test.Next(_L("test functions that are not supported with critical notifier")); |
302 test.Next(_L("test functions that are not supported with critical notifier")); |
302 r=file.Open(TheFs,File2,EFileShareAny); |
303 r=file.Open(TheFs,File2,EFileShareAny); |
303 test(r==KErrInUse); |
304 test_Value(r, r == KErrInUse); |
304 // EFsFileCreate |
305 // EFsFileCreate |
305 r=file.Create(TheFs,File2,EFileShareAny); |
306 r=file.Create(TheFs,File2,EFileShareAny); |
306 test(r==KErrInUse); |
307 test_Value(r, r == KErrInUse); |
307 // EFsMkDir |
308 // EFsMkDir |
308 r=TheFs.MkDir(Dir1); |
309 r=TheFs.MkDir(Dir1); |
309 test(r==KErrInUse); |
310 test_Value(r, r == KErrInUse); |
310 // EFsVolume |
311 // EFsVolume |
311 TVolumeInfo info; |
312 TVolumeInfo info; |
312 r=TheFs.Volume(info,gSessionDrive); |
313 r=TheFs.Volume(info,gSessionDrive); |
313 test(r==KErrInUse); |
314 test_Value(r, r == KErrInUse); |
314 |
315 |
315 // get rid of critical notifier |
316 // get rid of critical notifier |
316 test.Printf(_L("Press escape on the critical notifier\n")); |
317 test.Printf(_L("Press escape on the critical notifier\n")); |
317 TRequestStatus deathStat; |
318 TRequestStatus deathStat; |
318 thread.Logon(deathStat); |
319 thread.Logon(deathStat); |
327 // test that notification setup on default drive has had the drive changed |
328 // test that notification setup on default drive has had the drive changed |
328 // to * since the critical notifier was up |
329 // to * since the critical notifier was up |
329 TFileName notDir=gLockedBase; |
330 TFileName notDir=gLockedBase; |
330 notDir+=NotifyDir; |
331 notDir+=NotifyDir; |
331 r=TheFs.MkDir(notDir); |
332 r=TheFs.MkDir(notDir); |
332 test(r==KErrNone); |
333 test_KErrNone(r); |
333 test(status==KRequestPending&&status2==KErrNone); |
334 test(status==KRequestPending&&status2==KErrNone); |
334 TheFs.NotifyChangeCancel(); |
335 TheFs.NotifyChangeCancel(); |
335 test(status==KErrCancel); |
336 test(status==KErrCancel); |
336 r=TheFs.Delete(File1); |
337 r=TheFs.Delete(File1); |
337 test(r==KErrNone); |
338 test_KErrNone(r); |
338 r=TheFs.RmDir(notDir); |
339 r=TheFs.RmDir(notDir); |
339 test(r==KErrNone); |
340 test_KErrNone(r); |
340 r=TheFs.RmDir(NotifyDir); |
341 r=TheFs.RmDir(NotifyDir); |
341 test(r==KErrNone); |
342 test_KErrNone(r); |
342 } |
343 } |
343 |
344 |
344 void TestParsingFunctions() |
345 void TestParsingFunctions() |
345 // |
346 // |
346 // Test functions that use Parse* and Validate* functions with |
347 // Test functions that use Parse* and Validate* functions with |
355 test.Next(_L("test parsing functions on same drive")); |
356 test.Next(_L("test parsing functions on same drive")); |
356 // Using ParseSubst |
357 // Using ParseSubst |
357 TFileName dir=gLockedBase; |
358 TFileName dir=gLockedBase; |
358 dir+=Dir1; |
359 dir+=Dir1; |
359 TInt r=TheFs.MkDir(dir); |
360 TInt r=TheFs.MkDir(dir); |
360 test(r==KErrInUse); |
361 test_Value(r, r == KErrInUse); |
361 TFileName file=gLockedPath; |
362 TFileName file=gLockedPath; |
362 file+=File1; |
363 file+=File1; |
363 RFile f; |
364 RFile f; |
364 r=f.Create(TheFs,file,EFileShareAny); |
365 r=f.Create(TheFs,file,EFileShareAny); |
365 test(r==KErrInUse); |
366 test_Value(r, r == KErrInUse); |
366 // Using ParsePathPtr0 |
367 // Using ParsePathPtr0 |
367 r=TheFs.SetSubst(gLockedPath,EDriveO); |
368 r=TheFs.SetSubst(gLockedPath,EDriveO); |
368 test(r==KErrInUse); |
369 test_Value(r, r == KErrInUse); |
369 // ValidateDrive |
370 // ValidateDrive |
370 TVolumeInfo info; |
371 TVolumeInfo info; |
371 r=TheFs.Volume(info,gLockedDrive); |
372 r=TheFs.Volume(info,gLockedDrive); |
372 test(r==KErrInUse); |
373 test_Value(r, r == KErrInUse); |
373 |
374 |
374 TFileName origSessPath; |
375 TFileName origSessPath; |
375 r=TheFs.SessionPath(origSessPath); |
376 r=TheFs.SessionPath(origSessPath); |
376 test(r==KErrNone); |
377 test_KErrNone(r); |
377 |
378 |
378 // test these work ok |
379 // test these work ok |
379 r=TheFs.SetSessionPath(gLockedPath); |
380 r=TheFs.SetSessionPath(gLockedPath); |
380 test(r==KErrNone); |
381 test_KErrNone(r); |
381 r=TheFs.SetSessionPath(origSessPath); |
382 r=TheFs.SetSessionPath(origSessPath); |
382 test(r==KErrNone); |
383 test_KErrNone(r); |
383 |
384 |
384 // test on different drive from notifier - the session path |
385 // test on different drive from notifier - the session path |
385 test.Next(_L("test parsing functions on a different drive")); |
386 test.Next(_L("test parsing functions on a different drive")); |
386 // Using ParseSubst |
387 // Using ParseSubst |
387 r=TheFs.MkDir(Dir1); |
388 r=TheFs.MkDir(Dir1); |
388 test(r==KErrNone); |
389 test_KErrNone(r); |
389 r=TheFs.RmDir(Dir1); |
390 r=TheFs.RmDir(Dir1); |
390 test(r==KErrNone); |
391 test_KErrNone(r); |
391 r=f.Create(TheFs,File1,EFileShareAny); |
392 r=f.Create(TheFs,File1,EFileShareAny); |
392 test(r==KErrNone); |
393 test_KErrNone(r); |
393 f.Close(); |
394 f.Close(); |
394 r=TheFs.Delete(File1); |
395 r=TheFs.Delete(File1); |
395 test(r==KErrNone); |
396 test_KErrNone(r); |
396 // Using ParsePathPtr0 |
397 // Using ParsePathPtr0 |
397 r=TheFs.SetSubst(gSessionPath,EDriveO); |
398 r=TheFs.SetSubst(gSessionPath,EDriveO); |
398 test(r==KErrNone); |
399 test_KErrNone(r); |
399 r=TheFs.SetSubst(_L(""),EDriveO); |
400 r=TheFs.SetSubst(_L(""),EDriveO); |
400 test(r==KErrNone); |
401 test_KErrNone(r); |
401 // ValidateDrive |
402 // ValidateDrive |
402 r=TheFs.Volume(info,gSessionDrive); |
403 r=TheFs.Volume(info,gSessionDrive); |
403 test(r==KErrNone); |
404 test_KErrNone(r); |
404 |
405 |
405 // get rid of non-critical notifier |
406 // get rid of non-critical notifier |
406 test.Printf(_L("Enter %S on the notifier\n"),&KPassword); |
407 test.Printf(_L("Enter %S on the notifier\n"),&KPassword); |
407 |
408 |
408 TRequestStatus deathStat; |
409 TRequestStatus deathStat; |
421 // |
422 // |
422 { |
423 { |
423 test.Next(_L("TestTFsFunctions")); |
424 test.Next(_L("TestTFsFunctions")); |
424 TFileName sessName,lockedName; |
425 TFileName sessName,lockedName; |
425 TInt r=TheFs.FileSystemName(sessName,gSessionDrive); |
426 TInt r=TheFs.FileSystemName(sessName,gSessionDrive); |
426 test(r==KErrNone); |
427 test_KErrNone(r); |
427 r=TheFs.FileSystemName(lockedName,gLockedDrive); |
428 r=TheFs.FileSystemName(lockedName,gLockedDrive); |
428 test(r==KErrNone); |
429 test_KErrNone(r); |
429 |
430 |
430 RThread thread; |
431 RThread thread; |
431 PutNonCriticalNotifier(NULL,thread); |
432 PutNonCriticalNotifier(NULL,thread); |
432 |
433 |
433 // test functions on hung drive - should return KErrInUse |
434 // test functions on hung drive - should return KErrInUse |
434 test.Next(_L("test TFs functions on hung drive")); |
435 test.Next(_L("test TFs functions on hung drive")); |
435 // TFsDismountFileSystem |
436 // TFsDismountFileSystem |
436 r=TheFs.DismountFileSystem(lockedName,gLockedDrive); |
437 r=TheFs.DismountFileSystem(lockedName,gLockedDrive); |
437 test(r==KErrInUse); |
438 test_Value(r, r == KErrInUse); |
438 // TFsMountFileSystem |
439 // TFsMountFileSystem |
439 r=TheFs.MountFileSystem(lockedName,gLockedDrive); |
440 r=TheFs.MountFileSystem(lockedName,gLockedDrive); |
440 test(r==KErrInUse); |
441 test_Value(r, r == KErrInUse); |
441 // TFsFileSystemName |
442 // TFsFileSystemName |
442 r=TheFs.FileSystemName(lockedName,gLockedDrive); |
443 r=TheFs.FileSystemName(lockedName,gLockedDrive); |
443 test(r==KErrInUse); |
444 test_Value(r, r == KErrInUse); |
444 |
445 |
445 // test functions on drive other than hung drive |
446 // test functions on drive other than hung drive |
446 test.Next(_L("test TFs functions on drive that is not hung")); |
447 test.Next(_L("test TFs functions on drive that is not hung")); |
447 // TFsDismountFileSystem |
448 // TFsDismountFileSystem |
448 #if defined(__WINS__) |
449 #if defined(__WINS__) |
449 // bug in TFsMountFileSystem which needs to be fixed before running on EDriveC on WINS |
450 // bug in TFsMountFileSystem which needs to be fixed before running on EDriveC on WINS |
450 if(gSessionDrive!=EDriveC) |
451 if(gSessionDrive!=EDriveC) |
451 { |
452 { |
452 #endif |
453 #endif |
453 r=TheFs.DismountFileSystem(sessName,gSessionDrive); |
454 r=TheFs.DismountFileSystem(sessName,gSessionDrive); |
454 test(r==KErrNone); |
455 test_KErrNone(r); |
455 // TFsMountFileSystem |
456 // TFsMountFileSystem |
456 r=TheFs.MountFileSystem(sessName,gSessionDrive); |
457 r=TheFs.MountFileSystem(sessName,gSessionDrive); |
457 test(r==KErrNone); |
458 test_KErrNone(r); |
458 #if defined(__WINS__) |
459 #if defined(__WINS__) |
459 } |
460 } |
460 #endif |
461 #endif |
461 // TFsFileSystemName |
462 // TFsFileSystemName |
462 TFileName fsName; |
463 TFileName fsName; |
463 r=TheFs.FileSystemName(fsName,gSessionDrive); |
464 r=TheFs.FileSystemName(fsName,gSessionDrive); |
464 test(r==KErrNone); |
465 test_KErrNone(r); |
465 test(fsName==sessName); |
466 test(fsName==sessName); |
466 |
467 |
467 // test functions that fail on all drives |
468 // test functions that fail on all drives |
468 test.Next(_L("test TFs functions that fail on all drives")); |
469 test.Next(_L("test TFs functions that fail on all drives")); |
469 // TFsListOpenFiles |
470 // TFsListOpenFiles |
470 CFileList* list=NULL; |
471 CFileList* list=NULL; |
471 TOpenFileScan fileScan(TheFs); |
472 TOpenFileScan fileScan(TheFs); |
472 TRAP(r,fileScan.NextL(list)); |
473 TRAP(r,fileScan.NextL(list)); |
473 test(r==KErrInUse); |
474 test_Value(r, r == KErrInUse); |
474 |
475 |
475 // test functions that should pass on any drive |
476 // test functions that should pass on any drive |
476 test.Next(_L("test TFs functions that pass on all drives")); |
477 test.Next(_L("test TFs functions that pass on all drives")); |
477 // TFsSetDefaultPath |
478 // TFsSetDefaultPath |
478 // TFsSetSessionPath |
479 // TFsSetSessionPath |
479 r=TheFs.SetSessionPath(gLockedPath); |
480 r=TheFs.SetSessionPath(gLockedPath); |
480 test(r==KErrNone); |
481 test_KErrNone(r); |
481 r=TheFs.SetSessionPath(gSessionPath); |
482 r=TheFs.SetSessionPath(gSessionPath); |
482 test(r==KErrNone); |
483 test_KErrNone(r); |
483 |
484 |
484 // get rid of non-critical notifier |
485 // get rid of non-critical notifier |
485 test.Printf(_L("Enter %S on the notifier\n"),&KPassword); |
486 test.Printf(_L("Enter %S on the notifier\n"),&KPassword); |
486 TRequestStatus deathStat; |
487 TRequestStatus deathStat; |
487 thread.Logon( deathStat ); |
488 thread.Logon( deathStat ); |
507 // EFsFileCreate |
508 // EFsFileCreate |
508 RFile file; |
509 RFile file; |
509 TFileName fileName=gLockedPath; |
510 TFileName fileName=gLockedPath; |
510 fileName+=File1; |
511 fileName+=File1; |
511 TInt r=file.Create(TheFs,fileName,EFileShareAny); |
512 TInt r=file.Create(TheFs,fileName,EFileShareAny); |
512 test(r==KErrInUse); |
513 test_Value(r, r == KErrInUse); |
513 // EFsFormatOpen |
514 // EFsFormatOpen |
514 RFormat format; |
515 RFormat format; |
515 TInt count; |
516 TInt count; |
516 r=format.Open(TheFs,gLockedPath,EHighDensity,count); |
517 r=format.Open(TheFs,gLockedPath,EHighDensity,count); |
517 test(r==KErrInUse); |
518 test_Value(r, r == KErrInUse); |
518 // EFsDirOpen |
519 // EFsDirOpen |
519 RDir dir; |
520 RDir dir; |
520 r=dir.Open(TheFs,gLockedPath,KEntryAttMaskSupported); |
521 r=dir.Open(TheFs,gLockedPath,KEntryAttMaskSupported); |
521 test(r==KErrInUse); |
522 test_Value(r, r == KErrInUse); |
522 // EFsRawDiskOpen |
523 // EFsRawDiskOpen |
523 RRawDisk raw; |
524 RRawDisk raw; |
524 r=raw.Open(TheFs,gLockedDrive); |
525 r=raw.Open(TheFs,gLockedDrive); |
525 test(r==KErrInUse); |
526 test_Value(r, r == KErrInUse); |
526 |
527 |
527 // get rid of non-critical notifier |
528 // get rid of non-critical notifier |
528 test.Printf(_L("Enter %S on the notifier\n"),&KPassword); |
529 test.Printf(_L("Enter %S on the notifier\n"),&KPassword); |
529 TRequestStatus deathStat; |
530 TRequestStatus deathStat; |
530 thread.Logon( deathStat ); |
531 thread.Logon( deathStat ); |
533 User::WaitForRequest( deathStat ); |
534 User::WaitForRequest( deathStat ); |
534 thread.Close(); |
535 thread.Close(); |
535 |
536 |
536 // now open the subsessions |
537 // now open the subsessions |
537 r=file.Create(TheFs,fileName,EFileShareAny); |
538 r=file.Create(TheFs,fileName,EFileShareAny); |
538 test(r==KErrNone||KErrAlreadyExists); |
539 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
539 if(r==KErrAlreadyExists) |
540 if(r==KErrAlreadyExists) |
540 { |
541 { |
541 r=file.Open(TheFs,fileName,EFileShareAny); |
542 r=file.Open(TheFs,fileName,EFileShareAny); |
542 test(r==KErrNone); |
543 test_KErrNone(r); |
543 } |
544 } |
544 r=dir.Open(TheFs,gLockedPath,KEntryAttMaskSupported); |
545 r=dir.Open(TheFs,gLockedPath,KEntryAttMaskSupported); |
545 test(r==KErrNone); |
546 test_KErrNone(r); |
546 |
547 |
547 // put notifier back up |
548 // put notifier back up |
548 PutNonCriticalNotifier(NULL,thread); |
549 PutNonCriticalNotifier(NULL,thread); |
549 |
550 |
550 // test subsession operations fail on a hung drive |
551 // test subsession operations fail on a hung drive |
551 test.Next(_L("test subsession operations fail on a hung drive")); |
552 test.Next(_L("test subsession operations fail on a hung drive")); |
552 // EFsFileRead |
553 // EFsFileRead |
553 TBuf8<16> readBuf; |
554 TBuf8<16> readBuf; |
554 r=file.Read(readBuf); |
555 r=file.Read(readBuf); |
555 test(r==KErrInUse); |
556 test_Value(r, r == KErrInUse); |
556 // subsession should be able to be closed ok |
557 // subsession should be able to be closed ok |
557 file.Close(); |
558 file.Close(); |
558 // EFsDelete |
559 // EFsDelete |
559 r=TheFs.Delete(fileName); |
560 r=TheFs.Delete(fileName); |
560 test(r==KErrInUse); |
561 test_Value(r, r == KErrInUse); |
561 // EFsDirRead |
562 // EFsDirRead |
562 TEntry entry; |
563 TEntry entry; |
563 r=dir.Read(entry); |
564 r=dir.Read(entry); |
564 test(r==KErrInUse); |
565 test_Value(r, r == KErrInUse); |
565 // subsession should be able to be closed ok |
566 // subsession should be able to be closed ok |
566 dir.Close(); |
567 dir.Close(); |
567 |
568 |
568 // not going to test operations on a drive the is not hung |
569 // not going to test operations on a drive the is not hung |
569 // since this will be tested on other tests |
570 // since this will be tested on other tests |
656 _LIT(file2Name,"\\SubFile2"); |
657 _LIT(file2Name,"\\SubFile2"); |
657 _LIT(file3Name,"\\SubFile3"); |
658 _LIT(file3Name,"\\SubFile3"); |
658 _LIT(file4Name,"\\SubFile4"); |
659 _LIT(file4Name,"\\SubFile4"); |
659 TFileName origSession; |
660 TFileName origSession; |
660 TInt r=TheFs.SessionPath(origSession); |
661 TInt r=TheFs.SessionPath(origSession); |
661 test(r==KErrNone); |
662 test_KErrNone(r); |
662 TFileName file1Path(gLockedBase); |
663 TFileName file1Path(gLockedBase); |
663 file1Path+=file1Name; |
664 file1Path+=file1Name; |
664 TFileName file2Path(file2Name); |
665 TFileName file2Path(file2Name); |
665 TFileName file3Path(gLockedBase); |
666 TFileName file3Path(gLockedBase); |
666 file3Path+=file3Name; |
667 file3Path+=file3Name; |
667 TFileName file4Path(file4Name); |
668 TFileName file4Path(file4Name); |
668 // create file that will be used to hang file server |
669 // create file that will be used to hang file server |
669 r=SubFile1.Create(TheFs,file1Path,EFileWrite); |
670 r=SubFile1.Create(TheFs,file1Path,EFileWrite); |
670 test(r==KErrNone); |
671 test_KErrNone(r); |
671 // create file with same session but on different drive |
672 // create file with same session but on different drive |
672 RFile subfile2; |
673 RFile subfile2; |
673 r=subfile2.Create(TheFs,file2Path,EFileWrite); |
674 r=subfile2.Create(TheFs,file2Path,EFileWrite); |
674 test(r==KErrNone); |
675 test_KErrNone(r); |
675 // create file on unhung drive and with different session |
676 // create file on unhung drive and with different session |
676 RFs fs2; |
677 RFs fs2; |
677 r=fs2.Connect(); |
678 r=fs2.Connect(); |
678 test(r==KErrNone); |
679 test_KErrNone(r); |
679 r=fs2.SetSessionPath(origSession); |
680 r=fs2.SetSessionPath(origSession); |
680 test(r==KErrNone); |
681 test_KErrNone(r); |
681 RFile subfile3; |
682 RFile subfile3; |
682 r=subfile3.Create(fs2,file3Path,EFileWrite); |
683 r=subfile3.Create(fs2,file3Path,EFileWrite); |
683 test(r==KErrNone); |
684 test_KErrNone(r); |
684 // create file on unhung drive and with different session |
685 // create file on unhung drive and with different session |
685 RFile subfile4; |
686 RFile subfile4; |
686 r=subfile4.Create(fs2,file4Path,EFileWrite); |
687 r=subfile4.Create(fs2,file4Path,EFileWrite); |
687 test(r==KErrNone); |
688 test_KErrNone(r); |
688 // in a different thread cause the server to hang using one of the File1 subsession |
689 // in a different thread cause the server to hang using one of the File1 subsession |
689 // put notifier up using TheFs session |
690 // put notifier up using TheFs session |
690 SNonCriticalInfo info={ETrue,ETrue}; |
691 SNonCriticalInfo info={ETrue,ETrue}; |
691 RThread thread; |
692 RThread thread; |
692 PutNonCriticalNotifier(&info,thread); |
693 PutNonCriticalNotifier(&info,thread); |
694 // check only file4 can be written to |
695 // check only file4 can be written to |
695 _LIT8(buffer,"abc"); |
696 _LIT8(buffer,"abc"); |
696 TBuf8<8> buf(buffer); |
697 TBuf8<8> buf(buffer); |
697 // File1 caused hung file server |
698 // File1 caused hung file server |
698 r=SubFile1.Write(buf); |
699 r=SubFile1.Write(buf); |
699 test(r==KErrInUse); |
700 test_Value(r, r == KErrInUse); |
700 // file2 is same session as subsession that caused hung file server |
701 // file2 is same session as subsession that caused hung file server |
701 r=subfile2.Write(buf); |
702 r=subfile2.Write(buf); |
702 test(r==KErrInUse); |
703 test_Value(r, r == KErrInUse); |
703 // file3 is opened on hung drive |
704 // file3 is opened on hung drive |
704 r=subfile3.Write(buf); |
705 r=subfile3.Write(buf); |
705 test(r==KErrInUse); |
706 test_Value(r, r == KErrInUse); |
706 // file4 should be ok |
707 // file4 should be ok |
707 r=subfile4.Write(buf); |
708 r=subfile4.Write(buf); |
708 test(r==KErrNone); |
709 test_KErrNone(r); |
709 // hard to test EFsSubClose since does not return an error value |
710 // hard to test EFsSubClose since does not return an error value |
710 test.Next(_L("test closing down the subsessions")); |
711 test.Next(_L("test closing down the subsessions")); |
711 subfile4.Close(); |
712 subfile4.Close(); |
712 // calling close on the same subsession as is hung will cause this subsession |
713 // calling close on the same subsession as is hung will cause this subsession |
713 // to be closed once the original request is completed |
714 // to be closed once the original request is completed |
749 TRequestStatus status; |
750 TRequestStatus status; |
750 TheFs.NotifyChange(ENotifyAll,status,notDir); |
751 TheFs.NotifyChange(ENotifyAll,status,notDir); |
751 test(status==KRequestPending); |
752 test(status==KRequestPending); |
752 // now do an operation on c: and test no notification |
753 // now do an operation on c: and test no notification |
753 TInt r=TheFs.MkDir(NotifyDir); |
754 TInt r=TheFs.MkDir(NotifyDir); |
754 test(r==KErrNone); |
755 test_KErrNone(r); |
755 r=TheFs.RmDir(NotifyDir); |
756 r=TheFs.RmDir(NotifyDir); |
756 test(r==KErrNone); |
757 test_KErrNone(r); |
757 User::After(1000000); |
758 User::After(1000000); |
758 test(status==KRequestPending); |
759 test(status==KRequestPending); |
759 TheFs.NotifyChangeCancel(status); |
760 TheFs.NotifyChangeCancel(status); |
760 test(status==KErrCancel); |
761 test(status==KErrCancel); |
761 |
762 |
769 test.Next(_L("test with wildcard for drive")); |
770 test.Next(_L("test with wildcard for drive")); |
770 TheFs.NotifyChange(ENotifyAll,status,notDir); |
771 TheFs.NotifyChange(ENotifyAll,status,notDir); |
771 test(status==KRequestPending); |
772 test(status==KRequestPending); |
772 // test notification does not go off with wrong path |
773 // test notification does not go off with wrong path |
773 r=TheFs.MkDir(NotifyDir2); |
774 r=TheFs.MkDir(NotifyDir2); |
774 test(r==KErrNone); |
775 test_KErrNone(r); |
775 r=TheFs.RmDir(NotifyDir2); |
776 r=TheFs.RmDir(NotifyDir2); |
776 test(r==KErrNone); |
777 test_KErrNone(r); |
777 test(status==KRequestPending); |
778 test(status==KRequestPending); |
778 // now do an operation on c: and test there has been a notification |
779 // now do an operation on c: and test there has been a notification |
779 r=TheFs.MkDir(NotifyDir); |
780 r=TheFs.MkDir(NotifyDir); |
780 test(r==KErrNone); |
781 test_KErrNone(r); |
781 r=TheFs.RmDir(NotifyDir); |
782 r=TheFs.RmDir(NotifyDir); |
782 test(r==KErrNone); |
783 test_KErrNone(r); |
783 User::After(1000000); |
784 User::After(1000000); |
784 // request should be completed this time |
785 // request should be completed this time |
785 test(status==KErrNone); |
786 test(status==KErrNone); |
786 |
787 |
787 // set up a notification on drive that is not removable |
788 // set up a notification on drive that is not removable |
790 TheFs.NotifyChange(ENotifyAll,status,notDir); |
791 TheFs.NotifyChange(ENotifyAll,status,notDir); |
791 test(status==KRequestPending); |
792 test(status==KRequestPending); |
792 TRequestStatus status2; |
793 TRequestStatus status2; |
793 TFileName origSession; |
794 TFileName origSession; |
794 r=TheFs.SessionPath(origSession); |
795 r=TheFs.SessionPath(origSession); |
795 test(r==KErrNone); |
796 test_KErrNone(r); |
796 RFs fs2; |
797 RFs fs2; |
797 r=fs2.Connect(); |
798 r=fs2.Connect(); |
798 test(r==KErrNone); |
799 test_KErrNone(r); |
799 r=fs2.SetSessionPath(origSession); |
800 r=fs2.SetSessionPath(origSession); |
800 test(r==KErrNone); |
801 test_KErrNone(r); |
801 _LIT(notifyDirZ,"z:\\test\\"); |
802 _LIT(notifyDirZ,"z:\\test\\"); |
802 _LIT(notifyDirSess,"\\test\\"); |
803 _LIT(notifyDirSess,"\\test\\"); |
803 // notifyDirZ already exists, create test dir in session path |
804 // notifyDirZ already exists, create test dir in session path |
804 r=fs2.MkDir(notifyDirSess); |
805 r=fs2.MkDir(notifyDirSess); |
805 test(r==KErrNone); |
806 test_KErrNone(r); |
806 fs2.NotifyChange(ENotifyDir,status2,notifyDirZ); |
807 fs2.NotifyChange(ENotifyDir,status2,notifyDirZ); |
807 test(status2==KRequestPending); |
808 test(status2==KRequestPending); |
808 TRequestStatus status3; |
809 TRequestStatus status3; |
809 fs2.NotifyChange(ENotifyDir,status3,notifyDirSess); |
810 fs2.NotifyChange(ENotifyDir,status3,notifyDirSess); |
810 test(status3==KRequestPending); |
811 test(status3==KRequestPending); |
811 // now delete session dir and test no notification |
812 // now delete session dir and test no notification |
812 r=TheFs.RmDir(notifyDirSess); |
813 r=TheFs.RmDir(notifyDirSess); |
813 test(r==KErrNone); |
814 test_KErrNone(r); |
814 test(status2==KRequestPending && status3==KErrNone); |
815 test(status2==KRequestPending && status3==KErrNone); |
815 |
816 |
816 // get rid of non-critical notifier |
817 // get rid of non-critical notifier |
817 test.Printf(_L("Enter %S on the notifier\n"),&KPassword); |
818 test.Printf(_L("Enter %S on the notifier\n"),&KPassword); |
818 TRequestStatus deathStat; |
819 TRequestStatus deathStat; |
839 threadC.Close(); |
840 threadC.Close(); |
840 // test that notification has not gone off |
841 // test that notification has not gone off |
841 test(status==KRequestPending); |
842 test(status==KRequestPending); |
842 // create directory on locked drive |
843 // create directory on locked drive |
843 r=TheFs.MkDir(notDir); |
844 r=TheFs.MkDir(notDir); |
844 test(r==KErrNone); |
845 test_KErrNone(r); |
845 // test notifier goes off |
846 // test notifier goes off |
846 test(status==KErrNone); |
847 test(status==KErrNone); |
847 r=TheFs.RmDir(notDir); |
848 r=TheFs.RmDir(notDir); |
848 test(r==KErrNone); |
849 test_KErrNone(r); |
849 // get rid of critical notifier |
850 // get rid of critical notifier |
850 } |
851 } |
851 |
852 |
852 LOCAL_C TBool TestSessionPath() |
853 LOCAL_C TBool TestSessionPath() |
853 // |
854 // |
854 // |
855 // |
855 // |
856 // |
856 { |
857 { |
857 #if defined(__WINS__) |
858 #if defined(__WINS__) |
858 TInt r=TheFs.CharToDrive(gSessionPath[0],gSessionDrive); |
859 TInt r=TheFs.CharToDrive(gSessionPath[0],gSessionDrive); |
859 test(r==KErrNone); |
860 test_KErrNone(r); |
860 if(gSessionDrive==EDriveX) |
861 if(gSessionDrive==EDriveX) |
861 return(EFalse); |
862 return(EFalse); |
862 #else |
863 #else |
863 TInt r=TheFs.CharToDrive(gSessionPath[0],gSessionDrive); |
864 TInt r=TheFs.CharToDrive(gSessionPath[0],gSessionDrive); |
864 test(r==KErrNone); |
865 test_KErrNone(r); |
865 TDriveList list; |
866 TDriveList list; |
866 r=TheFs.DriveList(list); |
867 r=TheFs.DriveList(list); |
867 test(r==KErrNone); |
868 test_KErrNone(r); |
868 if((list[gSessionDrive])&KDriveAttRemovable) |
869 if((list[gSessionDrive])&KDriveAttRemovable) |
869 return(EFalse); |
870 return(EFalse); |
870 #endif |
871 #endif |
871 return(ETrue); |
872 return(ETrue); |
872 } |
873 } |