featuremgmt/featuremgr/test/rtest/src/t_fmgrstartup.cpp
branchRCL_3
changeset 23 26645d81f48d
parent 10 31a8f755b7fe
child 24 cc28652e0254
--- a/featuremgmt/featuremgr/test/rtest/src/t_fmgrstartup.cpp	Thu Aug 19 11:36:21 2010 +0300
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrstartup.cpp	Tue Aug 31 16:57:14 2010 +0300
@@ -26,6 +26,7 @@
 static const TInt KBurstRate = 20;
 #endif
 
+void DestroyTestEnv();
 ///////////////////////////////////////////////////////////////////////////////////////
 
 static RTest TheTest(_L("t_fmgrstartup"));
@@ -37,24 +38,6 @@
 #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        
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////
 //Test macros and functions
 void Check1(TInt aValue, TInt aLine)
     {
@@ -78,6 +61,45 @@
 #define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
 
 ///////////////////////////////////////////////////////////////////////////////////////
+void CreateTestEnv()
+    {
+    //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);
+    
+    err = fs.MkDir(KFeaturesDir);
+    TEST (err == KErrNone || err == KErrAlreadyExists);
+    
+    (void)fs.Delete(KFeaturesFile);
+    err = BaflUtils::CopyFile(fs, KZOrgFeaturesFile, KFeaturesDir);
+    TEST2 (err, KErrNone);
+    err = fs.SetAtt(KFeaturesFile, KEntryAttNormal, KEntryAttReadOnly);
+    TEST2 (err, KErrNone);
+    fs.Close();
+#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)
+        {
+        err = fs.Delete(KFeaturesFile);
+        if (err != KErrNone)
+            {
+            RDebug::Print(_L("Warning: Clean test enviroment failed with error %d"), err);
+            }
+        }
+    fs.Close();
+#endif        
+    }
+///////////////////////////////////////////////////////////////////////////////////////
 
 static void MarkHandles()
     {
@@ -193,24 +215,6 @@
     TheTest.Printf(_L("\r\n===File I/O error simulation test succeeded on iteration %d===\r\n"), cnt);
     }
 
-void CreateTestEnv()
-    {
-    //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);
-    
-    err = fs.MkDir(KFeaturesDir);
-    TEST (err == KErrNone || err == KErrAlreadyExists);
-    
-    (void)fs.Delete(KFeaturesFile);
-    err = BaflUtils::CopyFile(fs, KZOrgFeaturesFile, KFeaturesDir);
-    TEST2 (err, KErrNone);
-    
-    fs.Close();
-#endif
-    }
 
 void DoTestsL()
     {