diff -r 667e88a979d7 -r 31a8f755b7fe featuremgmt/featuremgr/test/rtest/src/t_fmgrstartup.cpp --- a/featuremgmt/featuremgr/test/rtest/src/t_fmgrstartup.cpp Mon Mar 15 12:46:30 2010 +0200 +++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrstartup.cpp Thu Apr 01 00:19:42 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -22,27 +22,35 @@ static TInt TheThreadHandleCount = 0; static TInt TheAllocatedCellsCount = 0; -#ifdef EXTENDED_FEATURE_MANAGER_TEST +#ifdef _DEBUG static const TInt KBurstRate = 20; #endif /////////////////////////////////////////////////////////////////////////////////////// static RTest TheTest(_L("t_fmgrstartup")); -_LIT( KZOrgFeaturesFile, "Z:\\Private\\10205054\\features.dat" ); + #ifdef EXTENDED_FEATURE_MANAGER_TEST -_LIT( KZFeaturesFile, "C:\\Private\\102836E5\\features.dat" ); -_LIT( KZFeaturesDir, "C:\\Private\\102836E5\\" ); -#else -_LIT( KZFeaturesFile, "Z:\\Private\\10205054\\features.dat" ); -_LIT( KZFeaturesDir, "Z:\\Private\\10205054\\" ); -#endif // EXTENDED_FEATURE_MANAGER_TEST +_LIT( KZOrgFeaturesFile, "Z:\\Private\\10205054\\features.dat" ); +_LIT( KFeaturesFile, "C:\\Private\\102836E5\\features.dat" ); +_LIT( KFeaturesDir, "C:\\Private\\102836E5\\" ); +#endif /////////////////////////////////////////////////////////////////////////////////////// //Deletes all created test files. void DestroyTestEnv() { + //KFeaturesDir is defined only if EXTENDED_FEATURE_MANAGER_TEST is defined +#ifdef EXTENDED_FEATURE_MANAGER_TEST + RFs fs; + TInt err = fs.Connect(); + if(err == KErrNone) + { + (void)fs.Delete(KFeaturesFile); + } + fs.Close(); +#endif } /////////////////////////////////////////////////////////////////////////////////////// @@ -132,7 +140,6 @@ @SYMDEF DEF144262 */ void FeatMgrServerStartupOomTest() -//TODO - panics in CFeatMgrServer::LoadPluginsL() because the error is KErrNoMemory { TInt err = KErrNoMemory; TInt failingAllocationNo = 0; @@ -171,10 +178,10 @@ TheTest.Printf(_L("===Iteration %d. Simulated error:\r\n"), cnt); for (TInt fsError=KErrNotFound;fsError>=KErrBadName;--fsError) { - if(fsError == KErrNotFound || fsError == KErrCorrupt || fsError == KErrPathNotFound || fsError == KErrEof) - { - continue;//TODO: the server code panics - } +// if(fsError == KErrNotFound || fsError == KErrCorrupt || fsError == KErrPathNotFound || fsError == KErrEof) +// { +// continue;//The server code panics +// } TheTest.Printf(_L("%d "), fsError); (void)fs.SetErrorCondition(fsError, cnt); TRAP(err, CreateAndDestroyFeatMgrServerL()); @@ -186,45 +193,23 @@ TheTest.Printf(_L("\r\n===File I/O error simulation test succeeded on iteration %d===\r\n"), cnt); } -void PreTest() +void CreateTestEnv() { - // Connect session - RFs fsSession; - User::LeaveIfError(fsSession.Connect()); + //KFeaturesDir is defined only if EXTENDED_FEATURE_MANAGER_TEST is defined +#ifdef EXTENDED_FEATURE_MANAGER_TEST + RFs fs; + TInt err = fs.Connect(); + TEST2(err, KErrNone); - TEntry entry; - TInt err = fsSession.Entry(KZFeaturesDir, entry); - if (err == KErrNotFound) - { - err = fsSession.MkDir(KZFeaturesDir); - } - TEST2 (err, KErrNone); - err = BaflUtils::CopyFile(fsSession, KZOrgFeaturesFile, KZFeaturesDir); + err = fs.MkDir(KFeaturesDir); + TEST (err == KErrNone || err == KErrAlreadyExists); + + (void)fs.Delete(KFeaturesFile); + err = BaflUtils::CopyFile(fs, KZOrgFeaturesFile, KFeaturesDir); TEST2 (err, KErrNone); - // close file server session - fsSession.Close(); - - } - -void PostTest() - { - // Connect session - RFs fsSession; - User::LeaveIfError(fsSession.Connect()); - - TEntry entry; - TInt err = fsSession.Entry(KZFeaturesDir, entry); - if (err == KErrNone) - { - err = BaflUtils::DeleteFile(fsSession,KZFeaturesFile); - TEST2 (err, KErrNone); - - } - TEST2 (err, KErrNone); - - // close file server session - fsSession.Close(); + fs.Close(); +#endif } void DoTestsL() @@ -234,12 +219,10 @@ CActiveScheduler::Install(scheduler); TheTest.Start(_L("@SYMTestCaseID:PDS-EFM-CT-4109 CFeatMgrServer::NewLC() OOM test")); - PreTest(); FeatMgrServerStartupOomTest(); TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4110 CFeatMgrServer::NewLC() file I/O error simulation test")); FeatMgrServerStartupFileIoTest(); - PostTest(); delete scheduler; } @@ -253,6 +236,7 @@ __UHEAP_MARK; + CreateTestEnv(); TRAPD(err, DoTestsL()); DestroyTestEnv(); TEST2(err, KErrNone);