Revision: 201011
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 19 Mar 2010 10:00:55 +0200
changeset 14 15018f1726c7
parent 1 c084286672be
child 15 3eacc0623088
Revision: 201011 Kit: 201011
featuremgmt/featuremgr/bwins/featmgru.def
featuremgmt/featuremgr/eabi/featmgru.def
featuremgmt/featuremgr/group/featmgr.mmp
featuremgmt/featuremgr/group/featmgrserver.mmp
featuremgmt/featuremgr/src/clientdll/featmgrclient.cpp
featuremgmt/featuremgr/src/clientdll/featmgrclient.h
featuremgmt/featuremgr/src/clientdll/featmgrresourcetester.cpp
featuremgmt/featuremgr/src/clientdll/featmgrresourcetester.h
featuremgmt/featuremgr/src/clientdll/featmgrtlsdata.cpp
featuremgmt/featuremgr/src/clientdll/featmgrtlsdata.h
featuremgmt/featuremgr/src/clientdll/featurecontrol.cpp
featuremgmt/featuremgr/src/inc/featmgrclientserver.h
featuremgmt/featuremgr/src/serverexe/featmgrsecuritypolicy.h
featuremgmt/featuremgr/src/serverexe/featmgrserver.cpp
featuremgmt/featuremgr/src/serverexe/featmgrserver.h
featuremgmt/featuremgr/src/serverexe/featmgrsession.cpp
featuremgmt/featuremgr/src/serverexe/featmgrsession.h
featuremgmt/featuremgr/src/serverexe/featmgrstartup.cpp
featuremgmt/featuremgr/test/group/bld.inf
featuremgmt/featuremgr/test/group/featmgr_techview_test.iby
featuremgmt/featuremgr/test/group/featmgr_test.iby
featuremgmt/featuremgr/test/group/featmgr_textshell_test.iby
featuremgmt/featuremgr/test/group/featmgrtests.bat
featuremgmt/featuremgr/test/rtest/group/t_fmgrapi.mmp
featuremgmt/featuremgr/test/rtest/group/t_fmgrbackupresponse.mmp
featuremgmt/featuremgr/test/rtest/group/t_fmgrbadclient.mmp
featuremgmt/featuremgr/test/rtest/group/t_fmgrnotify.mmp
featuremgmt/featuremgr/test/rtest/group/t_fmgroom.mmp
featuremgmt/featuremgr/test/rtest/group/t_fmgrpanic.mmp
featuremgmt/featuremgr/test/rtest/group/t_fmgrperformance.mmp
featuremgmt/featuremgr/test/rtest/group/t_fmgrrestoreresponse.mmp
featuremgmt/featuremgr/test/rtest/group/t_fmgrsecurity1.mmp
featuremgmt/featuremgr/test/rtest/group/t_fmgrstartup.mmp
featuremgmt/featuremgr/test/rtest/group/t_fmgrswi.mmp
featuremgmt/featuremgr/test/rtest/group/t_fmgrunitrefcount.mmp
featuremgmt/featuremgr/test/rtest/inc/t_fmgrburdefs.h
featuremgmt/featuremgr/test/rtest/inc/t_fmgrbursim.h
featuremgmt/featuremgr/test/rtest/src/t_fmgrapi.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgrbackupresponse.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgrbadclient.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgrbursim.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgrnotify.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgroom.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgrpanic.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgrperformance.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgrrestoreresponse.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgrsecurity1.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgrstartup.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgrswi.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgrunitrefcount.cpp
featuremgmt/featuremgr/test/tef/tef_efm_bursuite/scripts/tef_efm_bursuite.script
loggingservices/eventlogger/LogServ/src/LOGADD.CPP
loggingservices/eventlogger/test/src/t_logapi.cpp
loggingservices/eventlogger/test/src/t_logcntmatch.cpp
loggingservices/eventlogger/test/src/t_logservercrash.cpp
loggingservices/eventlogger/test/src/t_logview1.cpp
loggingservices/filelogger/SCLI/FLOGCLI.CPP
loggingservices/rfilelogger/Logger/Group/RFileloggerclient.cfg
persistentstorage/centralrepository/cenrepsrv/srvrepos_noc.cpp
persistentstorage/dbms/tdbms/t_dbstress.cpp
persistentstorage/dbms/tdbms/t_dbstress.h
persistentstorage/dbms/tdbms/t_dbthrd.cpp
persistentstorage/sql/SQLite/main.c
persistentstorage/sql/SQLite364/main.c
persistentstorage/sql/SRC/Server/Compact/SqlCompact.cpp
persistentstorage/sql/TEST/t_sqldefect.cpp
persistentstorage/sqlite3api/GROUP/SQLite3_stub.SIS
persistentstorage/sqlite3api/GROUP/SQLite3_stub.pkg
persistentstorage/store/ROM/StoreTests.BAT
persistentstorage/store/TSTOR/t_stordict.cpp
traceservices/tracefw/integ_test/ost/TEF/group/te_ostv2integsuite_disabled.mmp
traceservices/tracefw/integ_test/ost/TEF/group/te_ostv2integsuite_enabled.mmp
traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/inc/te_ctor.h
traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/inc/te_instrumentation_enum.h
traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/src/te_ctor.cpp
traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/src/te_ctor_disabled.cpp
traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/src/te_instrumentationpoints_disabled.cpp
traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/src/te_instrumentationpoints_enabled.cpp
traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/src/te_ostv2integsuite_basewrapper.cpp
traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_functional/inc/te_ostv2tracetestwrapper.h
traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_functional/src/te_ostv2tracetestwrapper.cpp
traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_functional/testdata/scripts/te_integ_tracecollectorclient.script
traceservices/tracefw/integ_test/ost/TEF/traces/OstTraceDefinitions.h
traceservices/tracefw/integ_test/ost/TEF/traces/fixed_id.definitions
traceservices/tracefw/integ_test/ost/TEF/traces/te_advancedfilteringTraces.h
traceservices/tracefw/integ_test/ost/TEF/traces/te_ctorTraces.h
traceservices/tracefw/integ_test/ost/TEF/traces/te_ctor_disabledTraces.h
traceservices/tracefw/integ_test/ost/TEF/traces/te_instrumentationpoints_disabledTraces.h
traceservices/tracefw/integ_test/ost/TEF/traces/te_instrumentationpoints_enabledTraces.h
traceservices/tracefw/integ_test/ost/TEF/traces/te_ostv2tracetestwrapperTraces.h
--- a/featuremgmt/featuremgr/bwins/featmgru.def	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/bwins/featmgru.def	Fri Mar 19 10:00:55 2010 +0200
@@ -46,4 +46,9 @@
 	?DeleteFeature@RFeatureControl@@QAEHVTUid@@@Z @ 45 NONAME ; int RFeatureControl::DeleteFeature(class TUid)
 	?SWIEnd@RFeatureControl@@QAEHXZ @ 46 NONAME ; int RFeatureControl::SWIEnd(void) 
 	?SWIStart@RFeatureControl@@QAEHXZ @ 47 NONAME ; int RFeatureControl::SWIStart(void)
+	?SetHeapFailure@TFeatMgrResourceTester@@SAXHH@Z @ 48 NONAME ; void TFeatMgrResourceTester::SetHeapFailure(int, int)
+	?Mark@TFeatMgrResourceTester@@SAXXZ @ 49 NONAME ; void TFeatMgrResourceTester::Mark(void)
+	?Check@TFeatMgrResourceTester@@SAXXZ @ 50 NONAME ; void TFeatMgrResourceTester::Check(void)
+	?Count@TFeatMgrResourceTester@@SAHXZ @ 51 NONAME ; int TFeatMgrResourceTester::Count(void)
+	?GetClientCount@@YAHXZ @ 52 NONAME ; int GetClientCount(void)
 
--- a/featuremgmt/featuremgr/eabi/featmgru.def	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/eabi/featmgru.def	Fri Mar 19 10:00:55 2010 +0200
@@ -51,5 +51,10 @@
 	_ZN15Dummy10Reserved16E4TUid @ 50 NONAME ABSENT
 	_ZN15RFeatureControl13DeleteFeatureE4TUid @ 51 NONAME
 	_ZN15RFeatureControl6SWIEndEv @ 52 NONAME
-	_ZN15RFeatureControl8SWIStartEv @ 53 NONAME 
+	_ZN15RFeatureControl8SWIStartEv @ 53 NONAME
+	_Z14GetClientCountv @ 54 NONAME
+	_ZN22TFeatMgrResourceTester14SetHeapFailureEii @ 55 NONAME
+	_ZN22TFeatMgrResourceTester4MarkEv @ 56 NONAME
+	_ZN22TFeatMgrResourceTester5CheckEv @ 57 NONAME
+	_ZN22TFeatMgrResourceTester5CountEv @ 58 NONAME
 
--- a/featuremgmt/featuremgr/group/featmgr.mmp	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/group/featmgr.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -32,6 +32,7 @@
 SOURCE          featurecontrol.cpp
 SOURCE          featmgrtlsdata.cpp
 SOURCE          featurenotifier.cpp
+SOURCE          featmgrresourcetester.cpp
 
 SOURCEPATH      ../src/shared
 SOURCE          featurecmn.cpp
--- a/featuremgmt/featuremgr/group/featmgrserver.mmp	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/group/featmgrserver.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -40,6 +40,7 @@
 SOURCE          featmgrpatchdata.cpp
 SOURCE          burstate.cpp
 SOURCE          swilistener.cpp 
+SOURCE          featmgrstartup.cpp 
 
 SOURCEPATH      ../src/shared
 SOURCE          featurecmn.cpp
--- a/featuremgmt/featuremgr/src/clientdll/featmgrclient.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/src/clientdll/featmgrclient.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -614,11 +614,37 @@
 
 // ========================== OTHER EXPORTED FUNCTIONS =========================
 
-
-
 // DEBUG only API functions
 
 #ifdef EXTENDED_FEATURE_MANAGER_TEST
+/** 
+*/
+void RFeatMgrClient::ResourceMark()
+    {
+    (void)SendReceive(EFeatMgrResourceMark);
+    }
+
+/** 
+*/
+void RFeatMgrClient::ResourceCheck()
+    {
+    (void)SendReceive(EFeatMgrResourceCheck);
+    }
+
+/** 
+*/
+TInt RFeatMgrClient::ResourceCount()
+    {
+    return SendReceive(EFeatMgrResourceCount);
+    }
+
+/** 
+*/
+void RFeatMgrClient::SetHeapFailure(TInt aAllocFailType, TInt aRate)
+    {
+    (void)SendReceive(EFeatMgrSetHeapFailure, TIpcArgs(aAllocFailType, aRate));
+    }
+
 // -----------------------------------------------------------------------------
 // RFeatMgrClient::NumberOfNotifyFeatures()
 // -----------------------------------------------------------------------------
--- a/featuremgmt/featuremgr/src/clientdll/featmgrclient.h	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/src/clientdll/featmgrclient.h	Fri Mar 19 10:00:55 2010 +0200
@@ -84,7 +84,7 @@
         TInt SWIStart() const;
         
         TInt SWIEnd() const; 
-        
+                
     private:
 
         /**
@@ -112,7 +112,10 @@
 		#ifdef EXTENDED_FEATURE_MANAGER_TEST
         // Public DEBUG API functions
     public:
-
+        void ResourceMark();
+        void ResourceCheck();
+        TInt ResourceCount();
+        void SetHeapFailure(TInt aAllocFailType, TInt aRate);
 		TInt NumberOfNotifyFeatures( void ) const;
 		TInt CountAllocCells( void ) const;
 		#endif    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/src/clientdll/featmgrresourcetester.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,68 @@
+// Copyright (c) 2007-2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32std.h>
+#include "featmgrtlsdata.h"
+#include "featmgrresourcetester.h"
+
+#define UNUSED_ARG(arg) arg = arg
+
+//Defined in featurecontrol.cpp
+extern CFeatMgrTlsData* TlsData();
+
+/** 
+*/
+EXPORT_C void TFeatMgrResourceTester::Mark()
+    {
+#ifdef EXTENDED_FEATURE_MANAGER_TEST
+    CFeatMgrTlsData* tlsData = ::TlsData();
+    tlsData->ResourceMark();
+#endif    
+    }
+
+/** 
+*/
+EXPORT_C void TFeatMgrResourceTester::Check()
+    {
+#ifdef EXTENDED_FEATURE_MANAGER_TEST
+    CFeatMgrTlsData* tlsData = ::TlsData();
+    tlsData->ResourceCheck();
+#endif    
+    }
+
+/** 
+*/
+EXPORT_C TInt TFeatMgrResourceTester::Count()
+    {
+#ifdef EXTENDED_FEATURE_MANAGER_TEST
+    CFeatMgrTlsData* tlsData = ::TlsData();
+    return tlsData->ResourceCount();
+#else
+    return -1;
+#endif    
+    }
+
+/** 
+*/
+EXPORT_C void TFeatMgrResourceTester::SetHeapFailure(TInt aAllocFailType, TInt aRate)
+    {
+#ifdef EXTENDED_FEATURE_MANAGER_TEST
+    CFeatMgrTlsData* tlsData = ::TlsData();
+    return tlsData->SetHeapFailure(aAllocFailType, aRate);
+#else    
+    UNUSED_ARG(aAllocFailType);
+    UNUSED_ARG(aRate);
+#endif    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/src/clientdll/featmgrresourcetester.h	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,37 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// 
+//
+
+#ifndef FEATMGRRESOURCETESTER_H
+#define FEATMGRRESOURCETESTER_H
+
+/**
+TFeatMgrResourceTester class is used internally by the FeatMgr server out of memory and resource leaking
+tests. 
+It provides methods for heap allocation failure simulation and resource checking and counting.
+
+@internalAll
+@released
+*/
+class TFeatMgrResourceTester
+	{
+public:
+	IMPORT_C static void Mark();
+	IMPORT_C static void Check();
+	IMPORT_C static TInt Count();
+	IMPORT_C static void SetHeapFailure(TInt aAllocFailType, TInt aRate);
+	};
+
+#endif //FEATMGRRESOURCETESTER_H
--- a/featuremgmt/featuremgr/src/clientdll/featmgrtlsdata.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/src/clientdll/featmgrtlsdata.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -30,7 +30,20 @@
 
     return tlsData;
     }
-    
+
+
+EXPORT_C TInt GetClientCount( )
+    {
+        CFeatMgrTlsData* tlsData = STATIC_CAST( CFeatMgrTlsData*, Dll::Tls() );
+        if (tlsData)
+            {
+            return tlsData->ClientCount();
+            }
+        else
+            {
+            return 0;
+            }
+    }
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -120,6 +133,14 @@
     }
 
 // -----------------------------------------------------------------------------
+// CFeatMgrTlsData::ClientCount()
+// -----------------------------------------------------------------------------
+//
+TInt CFeatMgrTlsData::ClientCount()
+    {
+        return iClientCount;
+    }
+// -----------------------------------------------------------------------------
 // CFeatMgrTlsData::FeatureSupported()
 // -----------------------------------------------------------------------------
 //
@@ -275,10 +296,39 @@
     return iFeatMgrClient.SWIEnd(); 
 	}
 
+/////////////////////////////////////////////////////////////////////////////////
 
 // debug only API functions
+#ifdef EXTENDED_FEATURE_MANAGER_TEST
 
-#ifdef EXTENDED_FEATURE_MANAGER_TEST
+/** 
+*/
+void CFeatMgrTlsData::ResourceMark()
+    {
+    iFeatMgrClient.ResourceMark();
+    }
+
+/** 
+*/
+void CFeatMgrTlsData::ResourceCheck()
+    {
+    iFeatMgrClient.ResourceCheck();
+    }
+
+/** 
+*/
+TInt CFeatMgrTlsData::ResourceCount()
+    {
+    return iFeatMgrClient.ResourceCount();
+    }
+
+/** 
+*/
+void CFeatMgrTlsData::SetHeapFailure(TInt aAllocFailType, TInt aRate)
+    {
+    iFeatMgrClient.SetHeapFailure(aAllocFailType, aRate);
+    }
+
 // -----------------------------------------------------------------------------
 // CFeatMgrTlsData::NumberOfNotifyFeatures()
 // -----------------------------------------------------------------------------
--- a/featuremgmt/featuremgr/src/clientdll/featmgrtlsdata.h	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/src/clientdll/featmgrtlsdata.h	Fri Mar 19 10:00:55 2010 +0200
@@ -30,6 +30,9 @@
 // FORWARD DECLARATIONS
 class MFeatureObserver;
 
+//Exported function for test purpose only 
+IMPORT_C TInt GetClientCount();
+
 // CLASS DECLARATION
 
 /**
@@ -67,6 +70,11 @@
         * Decrease client count for this thread
         */
 		void DecreaseClientCount();
+		
+		/**
+        * Get client count for this thread. Used for testing purpose only
+        */
+        int ClientCount();
         
 		/**
         * From MFeatureClient
@@ -128,6 +136,10 @@
 #ifdef EXTENDED_FEATURE_MANAGER_TEST
 		// Debug only API functions
     public:
+        void ResourceMark();
+        void ResourceCheck();
+        TInt ResourceCount();
+        void SetHeapFailure(TInt aAllocFailType, TInt aRate);
 		TInt NumberOfNotifyFeatures( void ) const;
 		TInt CountAllocCells( void ) const;
 #endif
--- a/featuremgmt/featuremgr/src/clientdll/featurecontrol.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/src/clientdll/featurecontrol.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -26,7 +26,7 @@
 
 // ============================= LOCAL FUNCTIONS ===============================
 
-static CFeatMgrTlsData* TlsData( )
+CFeatMgrTlsData* TlsData( )
     {
     CFeatMgrTlsData* tlsData = STATIC_CAST( CFeatMgrTlsData*, Dll::Tls() );
 
--- a/featuremgmt/featuremgr/src/inc/featmgrclientserver.h	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/src/inc/featmgrclientserver.h	Fri Mar 19 10:00:55 2010 +0200
@@ -28,6 +28,9 @@
 // DATA TYPES
 
 // Opcodes used in message passing between client and server
+// Important:   Make sure IsWriteOperation function of CFeatMgrSession
+//              is updated if a new enum for function that will modify
+//              feature (write operation) is added. 
 enum TFeatMgrServRequest
     {
 	/**
@@ -170,7 +173,13 @@
     * Software Installation ended
     * 
     */ 
-    EFeatMgrSWIEnd 
+    EFeatMgrSWIEnd,
+    
+    EFeatMgrResourceMark,
+    EFeatMgrResourceCheck,
+    EFeatMgrResourceCount,
+    EFeatMgrSetHeapFailure
+    
     };
 
 
--- a/featuremgmt/featuremgr/src/serverexe/featmgrsecuritypolicy.h	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/src/serverexe/featmgrsecuritypolicy.h	Fri Mar 19 10:00:55 2010 +0200
@@ -40,8 +40,8 @@
 const TInt KFeatMgrPlatSecRanges[KFeatMgrPlatSecRangeCount] =
     {
     0,  // IPC 0-7 Always passed
-    8,  // IPC 8-13 WriteDeviceData
-    16  // IPC Not supported 16 ->
+    8,  // IPC 8-19 WriteDeviceData
+    20  // IPC Not supported: 20 = 16 messages + 4 "resource check" messages
     };
 
 
@@ -51,8 +51,8 @@
 const TUint8 KFeatMgrPlatSecElementsIndex[KFeatMgrPlatSecRangeCount] =
     {
     CPolicyServer::EAlwaysPass,             // IPC 0-3
-    0,                                      // IPC 8-13
-    CPolicyServer::ENotSupported            // IPC 16 -> 
+    0,                                      // IPC 8-19
+    CPolicyServer::ENotSupported            // IPC 20 -> 
     };
 
 #else
@@ -69,8 +69,8 @@
 const TInt KFeatMgrPlatSecRanges[KFeatMgrPlatSecRangeCount] =
     {
     0,   // IPC 0-9 Always passed
-    10,  // IPC 10-15 WriteDeviceData
-    18   // IPC Not supported 18 ->
+    10,  // IPC 10-21 WriteDeviceData
+    22   // IPC Not supported 22 ->
     };
 /**
  * IPC segments and their capability requirements
@@ -78,8 +78,8 @@
 const TUint8 KFeatMgrPlatSecElementsIndex[KFeatMgrPlatSecRangeCount] =
     {
     CPolicyServer::EAlwaysPass,             // IPC 0-3
-    0,                                      // IPC 10-15
-    CPolicyServer::ENotSupported            // IPC 18 ->
+    0,                                      // IPC 10-21
+    CPolicyServer::ENotSupported            // IPC 22 ->
     };
 
 #endif
--- a/featuremgmt/featuremgr/src/serverexe/featmgrserver.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/src/serverexe/featmgrserver.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -35,9 +35,6 @@
 _LIT( KPanicCategory, "FeatMgrServer" );
 #endif // EXTENDED_FEATURE_MANAGER_TEST
 
-// LOCAL FUNCTION PROTOTYPES
-TInt E32Main(); // Process entry point
-
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -49,6 +46,7 @@
 CFeatMgrServer::CFeatMgrServer( const TInt aPriority, const TServerType aType  )
     :
     CPolicyServer( aPriority, KFeatMgrPlatSecPolicy, aType ), iBurState(this),
+    iBURInProgress(EFalse),
     iPluginsReady(EFalse), 
     iPluginsDeleted( EFalse ),
     iPendingRequests( ETrue ),
@@ -439,6 +437,15 @@
     FUNC_LOG
     return(iPluginsReady);
    	}
+
+// -----------------------------------------------------------------------------
+// CFeatMgrServer::BackupIsInProgress()
+// -----------------------------------------------------------------------------
+TBool CFeatMgrServer::BURIsInProgress() const
+    {
+    FUNC_LOG
+    return(iBURInProgress);
+    }
    	
 // -----------------------------------------------------------------------------
 // CFeatMgrServer::ServicePendingRequests()
@@ -671,7 +678,7 @@
 	switch( aCurrent )
 		{
 		case( EFeatMgrBURState_BackupStarted ) :
-			iPluginsReady = ETrue;
+			iBURInProgress = EFalse;
 			ServicePendingRequests();
 			break;
 		case( EFeatMgrBURState_RestoreStarted ) :
@@ -701,7 +708,7 @@
 BURStatus CFeatMgrServer::Goto_StartBackupState( BURStatus /* aCurrent */ )
 	{
 	BURStatus aNewState = EFeatMgrBURState_BackupStarted;  // state++
-	iPluginsReady = EFalse;
+	iBURInProgress = ETrue;
 	return aNewState;
 	}
 
@@ -709,7 +716,7 @@
 	{
 	BURStatus aNewState = EFeatMgrBURState_BackupEnded;   // state++
 	
-	iPluginsReady = ETrue;
+	iBURInProgress = EFalse;
 	ServicePendingRequests();
 	// no error from ServicePendingRequests() is possible
 	
@@ -720,7 +727,7 @@
 	{
 	// remarkably like Goto_StartBackupState
 	BURStatus aNewState = EFeatMgrBURState_RestoreStarted;  // state++
-	iPluginsReady = EFalse;
+	iBURInProgress = ETrue;
 	return aNewState;
 	}
 
@@ -728,8 +735,8 @@
 	{
 	BURStatus aNewState = EFeatMgrBURState_Error;   // fail safe
 	TInt err( KErrNone );
-	
-    iPluginsReady    = EFalse;
+	iBURInProgress = EFalse;
+	iPluginsReady    = EFalse;
     iPluginsDeleted  = EFalse;
     iPendingRequests = ETrue;
     iFeaturesReady   = EFalse;
@@ -849,68 +856,4 @@
     return;
 }
 
-
-// ============================= LOCAL FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// Function that starts the FeatMgrServer.
-// -----------------------------------------------------------------------------
-//
-static void RunServerL()
-    {
-    FUNC_LOG
-
-    // Naming the server thread after the startup helps to debug panics
-    User::LeaveIfError( User::RenameProcess( KServerProcessName ) );
-    
-    User::LeaveIfError( User::RenameThread( KServerProcessName ) );
-     
-    // Create and install the active scheduler we need
-    CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
-    CleanupStack::PushL( scheduler );
-    
-    CActiveScheduler::Install( scheduler );
-    
-    // Now we are ready to instantiate the actual CServer2 instance
-    CFeatMgrServer* server = CFeatMgrServer::NewLC( KServerCActivePriority );
-
-	// Initialisation complete, now signal the client
-	RProcess::Rendezvous(KErrNone);
-
-    INFO_LOG( "RunServerL() - Starting scheduler..." );
-
-	// Ready to run
-	CActiveScheduler::Start();
-
-    INFO_LOG( "RunServerL() - Scheduler stopped" );
-
-	// Cleanup the server and scheduler
-	CleanupStack::PopAndDestroy( server );
-	CleanupStack::PopAndDestroy( scheduler );
-    }
-
-// -----------------------------------------------------------------------------
-// Main function
-// -----------------------------------------------------------------------------
-//
-TInt E32Main()
-    {
-    FUNC_LOG
-
-	__UHEAP_MARK;
-
-	CTrapCleanup* cleanup = CTrapCleanup::New();
-	TInt ret = KErrNoMemory;
-
-	if ( cleanup )
-		{
-		TRAP( ret, RunServerL() );
-		delete cleanup;
-		}
-
-	__UHEAP_MARKEND;
-
-	return ret;
-    }
-
 //  End of File  
--- a/featuremgmt/featuremgr/src/serverexe/featmgrserver.h	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/src/serverexe/featmgrserver.h	Fri Mar 19 10:00:55 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -107,9 +107,16 @@
          Feature info received. 
          Else returns EFalse.
         
-         @return feature support status
+         @return plugins loading status
         */
         TBool PluginsReady() const;
+        
+        /**
+         Returns ETrue if backup is in progress 
+         Else returns EFalse.
+         @return backup status
+        */
+        TBool BURIsInProgress() const;
 
 #ifdef EXTENDED_FEATURE_MANAGER_TEST
         /**
@@ -269,6 +276,10 @@
         CFeatMgrTimer* iTimer;     
 
         CBurState iBurState;
+        
+        // ETrue when backup in progress
+        TBool iBURInProgress;
+        
         // ETrue when feature info received from all plugins
         TBool iPluginsReady;
                 
--- a/featuremgmt/featuremgr/src/serverexe/featmgrsession.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/src/serverexe/featmgrsession.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -102,6 +102,24 @@
 	aMessage.Panic( KPanicCategory, aPanic );
     }
 
+TBool CFeatMgrSession::IsWriteOperation( const TInt aFunction ) const
+    {
+        switch ( aFunction )
+            {
+            case EFeatMgrEnableFeature:
+            case EFeatMgrDisableFeature:
+            case EFeatMgrAddFeature:
+            case EFeatMgrSetFeatureAndData:
+            case EFeatMgrSetFeatureData:
+            case EFeatMgrDeleteFeature:
+            case EFeatMgrSWIStart:
+            case EFeatMgrSWIEnd:
+                return ETrue;
+            default:
+                return EFalse;
+            }
+    }
+
 // -----------------------------------------------------------------------------
 // CFeatMgrSession::ServiceL
 // Calls request handling functions. Also traps any leaves and signals client if
@@ -111,11 +129,22 @@
 void CFeatMgrSession::ServiceL( const RMessage2& aMessage )
     {
     FUNC_LOG
-    
-    if ( !iFeatMgrServer.PluginsReady() )
+    // If plugins are not ready all request will be queued. 
+    // During backup & restore operation, all write request 
+    //  e.g. EnableFeature will return with KErrServerBusy
+    TInt msgCmd = aMessage.Function();
+    if ( !iFeatMgrServer.PluginsReady() || ( iFeatMgrServer.BURIsInProgress()  && IsWriteOperation( msgCmd ) ) )
         {
-        INFO_LOG( "CFeatMgrSession::ServiceL() - plugins not ready" );
-        iList.AddLast( *CFeatMgrPendingRequest::NewL( aMessage ) );        
+        if ( iFeatMgrServer.BURIsInProgress() )
+            {
+            INFO_LOG( "CFeatMgrSession::ServiceL() - backup/restore is in progress - no write operation allowed" );
+            aMessage.Complete( KErrServerBusy );
+            }
+        else
+            {
+            INFO_LOG( "CFeatMgrSession::ServiceL() - plugins not ready" );
+            iList.AddLast( *CFeatMgrPendingRequest::NewL( aMessage ) );
+            }
         }
     else
         {
@@ -505,8 +534,39 @@
             
     		break;
     	    }
+
+#ifdef EXTENDED_FEATURE_MANAGER_TEST
     	    
-#ifdef EXTENDED_FEATURE_MANAGER_TEST
+        case EFeatMgrResourceMark:
+            ResourceCountMarkStart();
+            break;
+            
+        case EFeatMgrResourceCheck:
+            ResourceCountMarkEnd(aMessage);
+            break;
+        
+        case EFeatMgrResourceCount:
+            {
+            TInt retCode = CountResources();
+            User::Leave(retCode);
+            }
+            break;
+        
+        case EFeatMgrSetHeapFailure:
+            {
+            RAllocator::TAllocFail mode = static_cast <RAllocator::TAllocFail> (aMessage.Int0());
+            TInt failAllocNum = aMessage.Int1();
+            if(mode == RHeap::EBurstFailNext || mode == RHeap::EBurstRandom || mode == RHeap::EBurstTrueRandom || mode == RHeap::EBurstDeterministic)
+                {
+                User::__DbgSetBurstAllocFail(RHeap::EUser, mode, failAllocNum, 20);
+                }
+            else
+                {
+                User::__DbgSetAllocFail(RHeap::EUser, mode, failAllocNum);
+                }
+            }
+            break;
+
     	    // debug only API 
     	    // returns the size of the iNotifyFeatures array
         case EFeatMgrNumberOfNotifyFeatures:
@@ -570,6 +630,10 @@
         }
     }
 
+TInt CFeatMgrSession::CountResources()
+    {
+    return User::CountAllocCells();
+    }
 
 // ============================= LOCAL FUNCTIONS ===============================
 
--- a/featuremgmt/featuremgr/src/serverexe/featmgrsession.h	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/src/serverexe/featmgrsession.h	Fri Mar 19 10:00:55 2010 +0200
@@ -139,6 +139,7 @@
         * @param aMessage The message containing the client request
         */
         virtual void ServiceL( const RMessage2& aMessage );
+        virtual TInt CountResources();
 
     private:
 
@@ -159,6 +160,8 @@
         */
         void DispatchMessageL( const RMessage2& aMessage );
         
+        TBool IsWriteOperation( const TInt aFunction ) const;
+        
     private:    // Data
         
         /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/src/serverexe/featmgrstartup.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,79 @@
+// Copyright (c) 2007-2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "featmgrserver.h"
+#include "featmgrdebug.h"
+#include "featmgrconfiguration.h"
+
+// -----------------------------------------------------------------------------
+// Function that starts the FeatMgrServer.
+// -----------------------------------------------------------------------------
+//
+static void RunServerL()
+    {
+    FUNC_LOG
+
+    // Naming the server thread after the startup helps to debug panics
+    User::LeaveIfError( User::RenameProcess( KServerProcessName ) );
+    
+    User::LeaveIfError( User::RenameThread( KServerProcessName ) );
+     
+    // Create and install the active scheduler we need
+    CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    
+    CActiveScheduler::Install( scheduler );
+    
+    // Now we are ready to instantiate the actual CServer2 instance
+    CFeatMgrServer* server = CFeatMgrServer::NewLC( KServerCActivePriority );
+
+	// Initialisation complete, now signal the client
+	RProcess::Rendezvous(KErrNone);
+
+    INFO_LOG( "RunServerL() - Starting scheduler..." );
+
+	// Ready to run
+	CActiveScheduler::Start();
+
+    INFO_LOG( "RunServerL() - Scheduler stopped" );
+
+	// Cleanup the server and scheduler
+	CleanupStack::PopAndDestroy( server );
+	CleanupStack::PopAndDestroy( scheduler );
+    }
+
+// -----------------------------------------------------------------------------
+// Main function
+// -----------------------------------------------------------------------------
+//
+TInt E32Main()
+    {
+    FUNC_LOG
+
+	__UHEAP_MARK;
+
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	TInt ret = KErrNoMemory;
+
+	if ( cleanup )
+		{
+		TRAP( ret, RunServerL() );
+		delete cleanup;
+		}
+
+	__UHEAP_MARKEND;
+
+	return ret;
+    }
--- a/featuremgmt/featuremgr/test/group/bld.inf	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/test/group/bld.inf	Fri Mar 19 10:00:55 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -18,9 +18,26 @@
 #include "../helper/test_plugins/group/bld.inf"
 #include "../helper/pluginhelper/group/bld.inf"
 #include "../helper/dummyswi/group/bld.inf"
-#include "../helper/helping_exe/group/bld.inf" 
+#include "../helper/helping_exe/group/bld.inf"
 
 PRJ_TESTMMPFILES
+//Rtest project files
+// These backup and restore tests are techview tests, therefore need to be marked as manual for ONB purpose.
+../rtest/group/t_fmgrbackupresponse.mmp manual
+../rtest/group/t_fmgrrestoreresponse.mmp manual
+
+// RTest for Textshell
+../rtest/group/t_fmgrapi.mmp
+../rtest/group/t_fmgroom.mmp
+../rtest/group/t_fmgrstartup.mmp
+../rtest/group/t_fmgrpanic.mmp
+../rtest/group/t_fmgrbadclient.mmp manual
+../rtest/group/t_fmgrsecurity1.mmp
+../rtest/group/t_fmgrnotify.mmp
+../rtest/group/t_fmgrperformance.mmp
+../rtest/group/t_fmgrswi.mmp
+../rtest/group/t_fmgrunitrefcount.mmp
+
 //TEF project files
 ../tef/tef_feature_generator/group/tef_feature_generator.mmp manual
 ../tef/tef_efm_normal/group/efm_normal_testserver.mmp manual
@@ -30,24 +47,24 @@
 
 PRJ_TESTEXPORTS
 //TEF script files
-../tef/group/tef_featmgr.script 							z:/test/efm/scripts/tef_featmgr.script
-../tef/tef_efm_normal/scripts/tef_efm_normal.script 		z:/test/efm/scripts/tef_efm_normal.script
-../tef/tef_efm_normal/scripts/tef_efm_normal.ini			z:/test/efm/scripts/tef_efm_normal.ini
-../tef/tef_efm_normal/scripts/tef_efm_normal_hardware.ini	z:/test/efm/scripts/tef_efm_normal_hardware.ini
-../tef/tef_efm_normal/scripts/tef_efm_fullcap.script	 	z:/test/efm/scripts/tef_efm_fullcap.script
-../tef/tef_efm_normal/scripts/tef_efm_lowcap.script 		z:/test/efm/scripts/tef_efm_lowcap.script
-../tef/tef_efm_configured/scripts/tef_efm_configured.script z:/test/efm/scripts/tef_efm_configured.script
-../tef/tef_efm_configured/scripts/tef_efm_performance.script z:/test/efm/scripts/tef_efm_performance.script
-../tef/tef_efm_unit/scripts/tef_efm_unit.script 			z:/test/efm/scripts/tef_efm_unit.script
-../tef/tef_efm_unit/scripts/tef_efm_unit.ini				z:/test/efm/scripts/tef_efm_unit.ini
-../tef/tef_efm_bursuite/scripts/tef_efm_bursuite.script		z:/test/efm/scripts/tef_efm_bursuite.script
+../tef/group/tef_featmgr.script 								z:/test/efm/scripts/tef_featmgr.script
+../tef/tef_efm_normal/scripts/tef_efm_normal.script 			z:/test/efm/scripts/tef_efm_normal.script
+../tef/tef_efm_normal/scripts/tef_efm_normal.ini				z:/test/efm/scripts/tef_efm_normal.ini
+../tef/tef_efm_normal/scripts/tef_efm_normal_hardware.ini		z:/test/efm/scripts/tef_efm_normal_hardware.ini
+../tef/tef_efm_normal/scripts/tef_efm_fullcap.script			z:/test/efm/scripts/tef_efm_fullcap.script
+../tef/tef_efm_normal/scripts/tef_efm_lowcap.script				z:/test/efm/scripts/tef_efm_lowcap.script
+../tef/tef_efm_configured/scripts/tef_efm_configured.script		z:/test/efm/scripts/tef_efm_configured.script
+../tef/tef_efm_configured/scripts/tef_efm_performance.script	z:/test/efm/scripts/tef_efm_performance.script
+../tef/tef_efm_unit/scripts/tef_efm_unit.script 				z:/test/efm/scripts/tef_efm_unit.script
+../tef/tef_efm_unit/scripts/tef_efm_unit.ini					z:/test/efm/scripts/tef_efm_unit.ini
+../tef/tef_efm_bursuite/scripts/tef_efm_bursuite.script			z:/test/efm/scripts/tef_efm_bursuite.script
 
 // .ini file for characterisation testing.
-../tef/tef_efm_configured/scripts/characterise.ini 		z:/test/efm/scripts/characterise.ini
+../tef/tef_efm_configured/scripts/characterise.ini				z:/test/efm/scripts/characterise.ini
 
 //feature definition files for TEF feature generator
 ../tef/tef_feature_generator/config/reconciliation_features.ini	z:/test/efm/scripts/reconciliation_features.ini
-../tef/tef_feature_generator/config/persistence_features.ini  	z:/test/efm/scripts/persistence_features.ini
+../tef/tef_feature_generator/config/persistence_features.ini	z:/test/efm/scripts/persistence_features.ini
 ../tef/tef_feature_generator/config/dsr_features.ini			z:/test/efm/scripts/dsr_features.ini
 ../tef/tef_feature_generator/config/plugin_features.ini			z:/test/efm/scripts/plugin_features.ini
 ../tef/tef_feature_generator/config/unit_features.ini			z:/test/efm/scripts/unit_features.ini
@@ -55,24 +72,24 @@
 ../tef/tef_feature_generator/config/corruptdat.ini				z:/test/efm/scripts/corruptdat.ini
 
 // TestExecute additional files (urel & udeb)
-../tef/tef_efm_bursuite/scripts/tef_efm_bursuite.ini	z:/test/efm/scripts/tef_efm_bursuite.ini
+../tef/tef_efm_bursuite/scripts/tef_efm_bursuite.ini			z:/test/efm/scripts/tef_efm_bursuite.ini
 
 // 1200 feature data file for characterisation testing.
-../tef/tef_efm_configured/data/fs_1200.dat 		z:/test/efm/scripts/fs_1200.dat
+../tef/tef_efm_configured/data/fs_1200.dat						z:/test/efm/scripts/fs_1200.dat
 
 //corrupt features file
-../tef/tef_efm_configured/data/noheader.dat	z:/test/efm/scripts/noheader.dat
-../tef/tef_efm_configured/data/partial.dat	z:/test/efm/scripts/partial.dat
+../tef/tef_efm_configured/data/noheader.dat						z:/test/efm/scripts/noheader.dat
+../tef/tef_efm_configured/data/partial.dat						z:/test/efm/scripts/partial.dat
 
 //iby files for the test components
-featmgr_test.iby												/epoc32/rom/include/featmgr_test.iby
-../tef/tef_efm_configured/group/efm_configured_testserver.iby 	/epoc32/rom/include/efm_configured_testserver.iby
-../tef/tef_efm_normal/group/efm_normal_testserver.iby 			/epoc32/rom/include/efm_normal_testserver.iby
-../tef/tef_efm_unit/group/efm_unit_testserver.iby 				/epoc32/rom/include/efm_unit_testserver.iby
+featmgr_textshell_test.iby										/epoc32/rom/include/featmgr_textshell_test.iby
+featmgr_techview_test.iby										/epoc32/rom/include/featmgr_techview_test.iby
+
+../tef/tef_efm_configured/group/efm_configured_testserver.iby	/epoc32/rom/include/efm_configured_testserver.iby
+../tef/tef_efm_normal/group/efm_normal_testserver.iby			/epoc32/rom/include/efm_normal_testserver.iby
+../tef/tef_efm_unit/group/efm_unit_testserver.iby				/epoc32/rom/include/efm_unit_testserver.iby
 ../tef/tef_feature_generator/group/tef_feature_generator.iby	/epoc32/rom/include/tef_feature_generator.iby
-../tef/tef_efm_bursuite/group/tef_efm_bursuite.iby           	/epoc32/rom/include/tef_efm_bursuite.iby
+../tef/tef_efm_bursuite/group/tef_efm_bursuite.iby				/epoc32/rom/include/tef_efm_bursuite.iby
 
 //iby file for manual patchable data test
-patch_featmgr_timeout_constant.iby 		/epoc32/rom/include/patch_featmgr_timeout_constant.iby
-
-
+patch_featmgr_timeout_constant.iby								/epoc32/rom/include/patch_featmgr_timeout_constant.iby
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/group/featmgr_techview_test.iby	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,44 @@
+// Copyright (c) 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// For all Techview tests (TEF + RTest).
+// 
+
+#ifndef __FEATMGR_TEST_IBY__
+#define __FEATMGR_TEST_IBY__
+
+// Make sure that the feature manager production code is included in the ROM.
+#include "featmgr.iby"
+
+// Techview RTests.
+file=ABI_DIR\BUILD_DIR\t_fmgrbackupresponse.exe     test\t_fmgrbackupresponse.exe
+file=ABI_DIR\BUILD_DIR\t_fmgrrestoreresponse.exe    test\t_fmgrrestoreresponse.exe
+
+//main efm test script
+data=DATAZ_\test\efm\scripts\tef_featmgr.script		test\efm\scripts\tef_featmgr.script
+
+//tef tests .iby files
+#include "efm_configured_testserver.iby"
+#include "efm_normal_testserver.iby"
+#include "efm_unit_testserver.iby"
+#include "tef_feature_generator.iby"
+#include "tef_efm_bursuite.iby"
+
+// helper .iby files
+#include "test_efm.iby"
+#include "pluginhelper.iby"
+#include "test_plugins.iby"
+#include "dummyswi.iby"
+#include "helping_exe.iby" 
+
+#endif //__FEATMGR_TEST_IBY__
--- a/featuremgmt/featuremgr/test/group/featmgr_test.iby	Tue Jan 26 13:16:24 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-// Copyright (c) 2007-2009 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"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef __FEATMGR_TEST_IBY__
-#define __FEATMGR_TEST_IBY__
-
-// Make sure that the feature manager production code is included in the ROM.
-#include "featmgr.iby"
-
-//main efm test script
-data=DATAZ_\test\efm\scripts\tef_featmgr.script		test\efm\scripts\tef_featmgr.script
-
-//tef tests .iby files
-#include "efm_configured_testserver.iby"
-#include "efm_normal_testserver.iby"
-#include "efm_unit_testserver.iby"
-#include "tef_feature_generator.iby"
-#include "tef_efm_bursuite.iby"
-
-// helper .iby files
-#include "test_efm.iby"
-#include "pluginhelper.iby"
-#include "test_plugins.iby"
-#include "dummyswi.iby"
-#include "helping_exe.iby" 
-
-#endif //__FEATMGR_TEST_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/group/featmgr_textshell_test.iby	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,30 @@
+// Copyright (c) 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef __FEATMGR_RTEST_IBY__
+#define __FEATMGR_RTEST_IBY__
+
+file=ABI_DIR\BUILD_DIR\t_fmgrapi.exe                    test\t_fmgrapi.exe
+file=ABI_DIR\BUILD_DIR\t_fmgroom.exe                    test\t_fmgroom.exe
+file=ABI_DIR\BUILD_DIR\t_fmgrstartup.exe                test\t_fmgrstartup.exe
+file=ABI_DIR\BUILD_DIR\t_fmgrpanic.exe                  test\t_fmgrpanic.exe
+file=ABI_DIR\BUILD_DIR\t_fmgrbadclient.exe              test\t_fmgrbadclient.exe
+file=ABI_DIR\BUILD_DIR\t_fmgrsecurity1.exe              test\t_fmgrsecurity1.exe
+file=ABI_DIR\BUILD_DIR\t_fmgrnotify.exe                 test\t_fmgrnotify.exe
+file=ABI_DIR\BUILD_DIR\t_fmgrperformance.exe            test\t_fmgrperformance.exe
+file=ABI_DIR\BUILD_DIR\t_fmgrswi.exe                    test\t_fmgrswi.exe
+file=ABI_DIR\BUILD_DIR\t_fmgrunitrefcount.exe           test\t_fmgrunitrefcount.exe
+
+#endif // __FEATMGR_RTEST_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/group/featmgrtests.bat	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,28 @@
+@rem
+@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description:
+@rem
+
+t_fmgrbackupresponse.exe
+t_fmgrrestoreresponse.exe
+t_fmgrapi.exe
+t_fmgroom.exe
+t_fmgrstartup.exe
+t_fmgrpanic.exe
+t_fmgrbadclient.exe
+t_fmgrsecurity1.exe
+t_fmgrnotify.exe
+t_fmgrperformance.exe
+t_fmgrswi.exe
+t_fmgrunitrefcount.exe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/t_fmgrapi.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,34 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET			t_fmgrapi.exe
+TARGETTYPE		exe
+
+CAPABILITY		WriteDeviceData
+
+USERINCLUDE 	.
+USERINCLUDE		../../../inc
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH		../src
+SOURCE			t_fmgrapi.cpp
+
+LIBRARY			euser.lib 
+LIBRARY			featmgr.lib 
+LIBRARY			featdiscovery.lib
+
+VENDORID		0x70000001
+
+SMPSAFE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/t_fmgrbackupresponse.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,36 @@
+// Copyright (c) 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET			t_fmgrbackupresponse.exe
+TARGETTYPE		EXE
+CAPABILITY  	ReadDeviceData WriteDeviceData AllFiles
+
+USERINCLUDE 	../inc 
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH		../src
+SOURCE			t_fmgrbursim.cpp
+SOURCE			t_fmgrbackupresponse.cpp
+
+LIBRARY			euser.lib
+LIBRARY     	bafl.lib
+LIBRARY     	efsrv.lib 
+LIBRARY			featmgr.lib
+
+UID				0 0x10281e17
+VENDORID		0x70000001
+
+SMPSAFE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/t_fmgrbadclient.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,34 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET			t_fmgrbadclient.exe
+TARGETTYPE		exe
+
+CAPABILITY		WriteDeviceData
+
+USERINCLUDE 	.
+USERINCLUDE		../../../inc
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH		../src
+SOURCE			t_fmgrbadclient.cpp
+
+LIBRARY			euser.lib 
+LIBRARY			featmgr.lib 
+LIBRARY			featdiscovery.lib
+
+VENDORID		0x70000001
+
+SMPSAFE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/t_fmgrnotify.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,34 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET			t_fmgrnotify.exe
+TARGETTYPE		exe
+
+CAPABILITY		WriteDeviceData
+
+USERINCLUDE 	.
+USERINCLUDE		../../../inc
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH		../src
+SOURCE			t_fmgrnotify.cpp
+
+LIBRARY			euser.lib 
+LIBRARY			featmgr.lib 
+LIBRARY			featdiscovery.lib
+
+VENDORID		0x70000001
+
+SMPSAFE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/t_fmgroom.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,37 @@
+// 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+TARGET			t_fmgroom.exe
+TARGETTYPE		exe
+
+CAPABILITY		WriteDeviceData ProtServ ReadDeviceData AllFiles
+
+USERINCLUDE 	.
+USERINCLUDE		../../../inc
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH		../src
+SOURCE			t_fmgroom.cpp
+
+LIBRARY			euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY			featmgr.lib 
+LIBRARY			featdiscovery.lib
+
+VENDORID		0x70000001
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/t_fmgrpanic.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,34 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET			t_fmgrpanic.exe
+TARGETTYPE		exe
+
+CAPABILITY		WriteDeviceData
+
+USERINCLUDE 	.
+USERINCLUDE		../../../inc
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH		../src
+SOURCE			t_fmgrpanic.cpp
+
+LIBRARY			euser.lib 
+LIBRARY			featmgr.lib 
+LIBRARY			featdiscovery.lib
+
+VENDORID		0x70000001
+
+SMPSAFE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/t_fmgrperformance.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,35 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET			t_fmgrperformance.exe
+TARGETTYPE		exe
+
+CAPABILITY		WriteDeviceData
+
+USERINCLUDE 	.
+USERINCLUDE		../../../inc
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH		../src
+SOURCE			t_fmgrperformance.cpp
+
+LIBRARY			euser.lib 
+LIBRARY			featmgr.lib 
+LIBRARY			featdiscovery.lib
+LIBRARY			hal.lib 
+
+VENDORID		0x70000001
+
+SMPSAFE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/t_fmgrrestoreresponse.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,36 @@
+// Copyright (c) 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET			t_fmgrrestoreresponse.exe
+TARGETTYPE		EXE
+CAPABILITY  	ReadDeviceData WriteDeviceData AllFiles
+
+USERINCLUDE 	../inc 
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH		../src
+SOURCE			t_fmgrbursim.cpp
+SOURCE			t_fmgrrestoreresponse.cpp
+
+LIBRARY			euser.lib
+LIBRARY     	bafl.lib
+LIBRARY     	efsrv.lib 
+LIBRARY			featmgr.lib
+
+UID				0 0x10281e17
+VENDORID		0x70000001
+
+SMPSAFE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/t_fmgrsecurity1.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,34 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET			t_fmgrsecurity1.exe
+TARGETTYPE		exe
+
+CAPABILITY		None
+
+USERINCLUDE 	.
+USERINCLUDE		../../../inc
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH		../src
+SOURCE			t_fmgrsecurity1.cpp
+
+LIBRARY			euser.lib 
+LIBRARY			featmgr.lib 
+LIBRARY			featdiscovery.lib
+
+VENDORID		0x70000001
+
+SMPSAFE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/t_fmgrstartup.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,54 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET			t_fmgrstartup.exe
+TARGETTYPE		exe
+
+MACRO       EXTENDED_FEATURE_MANAGER_TEST
+
+CAPABILITY      ProtServ ReadDeviceData AllFiles
+
+USERINCLUDE 	.
+USERINCLUDE		../../../inc
+USERINCLUDE		../../../src/inc
+USERINCLUDE		../../../src/serverexe
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH		../src
+SOURCE			t_fmgrstartup.cpp
+
+SOURCEPATH		../../../src/serverexe
+SOURCE			featmgrfeatureregistry.cpp
+SOURCE			featmgrfeatureentry.cpp
+SOURCE			featmgrsession.cpp
+SOURCE			featmgrserver.cpp
+SOURCE          burstate.cpp
+SOURCE          swilistener.cpp 
+SOURCE          featmgrpluginhandler.cpp
+SOURCE          featmgrtimer.cpp
+SOURCE          featmgrpatchdata.cpp
+
+SOURCEPATH      ../../../src/shared
+SOURCE          featurecmn.cpp
+
+LIBRARY         efsrv.lib
+LIBRARY         estor.lib
+LIBRARY         euser.lib
+LIBRARY         ecom.lib
+LIBRARY	        bafl.lib
+
+VENDORID		0x70000001
+
+SMPSAFE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/t_fmgrswi.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,36 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET			t_fmgrswi.exe
+TARGETTYPE		exe
+UID             0x0 0x101F7295
+
+CAPABILITY      All -Tcb
+
+USERINCLUDE 	.
+USERINCLUDE		../../../inc
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH		../src
+SOURCE			t_fmgrswi.cpp
+
+LIBRARY			euser.lib 
+LIBRARY			featmgr.lib 
+LIBRARY			featdiscovery.lib
+LIBRARY         efsrv.lib
+
+VENDORID		0x70000001
+
+SMPSAFE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/t_fmgrunitrefcount.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,38 @@
+// Copyright (c) 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET			t_fmgrunitrefcount.exe
+TARGETTYPE		EXE
+CAPABILITY  	WriteDeviceData
+
+USERINCLUDE 	../inc
+USERINCLUDE 	../../../src/clientdll
+USERINCLUDE 	../../../src/inc
+USERINCLUDE 	../../../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH		../src
+SOURCE			t_fmgrunitrefcount.cpp
+
+LIBRARY			euser.lib
+LIBRARY			featmgr.lib
+LIBRARY			featdiscovery.lib
+
+
+UID				0 0
+VENDORID		0x70000001
+
+SMPSAFE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/inc/t_fmgrburdefs.h	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,42 @@
+// Copyright (c) 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @test
+ @internalComponent
+*/
+
+
+#if (!defined __T_FMGRBURDEFS_H__)
+#define __T_FMGRBURDEFS_H__
+
+#include <connect/sbdefs.h>
+
+const TUid KTestUid = TUid::Uid( 0x10283709 );
+
+#ifndef EXTENDED_FEATURE_MANAGER_TEST
+	// for UID 0x10205054
+	_LIT( KEfmBackupFileName,  "C:\\Private\\10205054\\features.dat" );	
+	_LIT( KEfmApplicationDir,  "C:\\Private\\10205054\\" );	
+	_LIT( KRegistrationFile,   "Z:\\private\\10205054\\backup_registration.xml" );
+#else
+	// for UID 0x102836E5 0x102836E5
+	_LIT( KEfmBackupFileName,  "C:\\Private\\102836E5\\runtime\\features.dat" );	
+	_LIT( KEfmApplicationDir,  "C:\\Private\\102836E5\\" );	
+	_LIT( KRegistrationFile,   "Z:\\private\\102836E5\\backup_registration.xml" );
+#endif 
+	
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/inc/t_fmgrbursim.h	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,68 @@
+// Copyright (c) 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @test
+ @internalComponent
+*/
+
+#if (!defined __T_FMGRBURSIM__)
+#define __T_FMGRBURSIM__
+
+#include "t_fmgrburdefs.h"
+#include <babackup.h>
+#include <e32property.h>
+
+/**
+ * Simulation base class for simulating a backup and restore operation.
+ * The functionality allows copying and restoring a feature.dat file, and 
+ * checking that the registration file exists.
+ */ 
+class CFeatMgrBURSim: public CBase
+	{
+public:
+	virtual ~CFeatMgrBURSim();
+	
+	static CFeatMgrBURSim* NewLC();
+public:
+	
+	/** Use external API to start a backup. */
+	void Simulate_StartBackupL();
+	/** Use external API to stop a backup. */
+	void Simulate_EndBackupL( TBool aNormal = ETrue );
+	/** Use external API to start a restore. */
+	void Simulate_StartRestoreL();
+	/** Use external API to stop a restore. */
+	void Simulate_EndRestoreL( TBool aNormal = ETrue );
+	
+	
+	void Simulate_StartUndefinedL();
+	void Simulate_EndUndefinedL( TBool aNormal = ETrue );
+	
+	/** 
+	 * Confirm that the registration.xml file is present.
+	 * @leave KErrNotFound if file not present.
+	 */	
+	void Simulate_CheckRegFileL();	
+
+private:
+	CFeatMgrBURSim();
+	void ConstructL();
+private:
+	CBaBackupSessionWrapper* iBackupClient;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrapi.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,443 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32test.h>
+#include <featmgr.h>
+#include <featureuids.h>
+#include <featurecontrol.h>
+#include <featdiscovery.h>
+
+using namespace NFeature;
+
+const TInt KInvalidFeatureId1    = 90901671;
+const TInt KInvalidNegFeatureId2 = -90901671;
+const TUid KInvalidFeatureUid1  = {KInvalidFeatureId1};
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+static RTest TheTest(_L("t_fmgrapi"));
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+//Deletes all created test files.
+void DestroyTestEnv()
+    {
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+//Test macros and functions
+void Check1(TInt aValue, TInt aLine)
+    {
+    if(!aValue)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expression evaluated to false. Line %d\r\n"), aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+void Check2(TInt aValue, TInt aExpected, TInt aLine)
+    {
+    if(aValue != aExpected)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expected: %d, got: %d. Line %d\r\n"), aExpected, aValue, aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+#define TEST(arg) ::Check1((arg), __LINE__)
+#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4059
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void FeatureSupportedTestL()
+    {
+    FeatureManager::InitializeLibL();
+    FeatureManager::InitializeLibL();
+    
+    //Feature, default present
+    TBool rc = FeatureManager::FeatureSupported(KConnectivity.iUid);
+    TEST(rc);
+    //Feature, default not present
+    rc = FeatureManager::FeatureSupported(KPrint.iUid);
+    TEST(rc);
+    
+    //Ivalid feature UID
+    rc = FeatureManager::FeatureSupported(KInvalidFeatureId1);
+    TEST(!rc);
+    //Ivalid feature UID - negative
+    rc = FeatureManager::FeatureSupported(KInvalidNegFeatureId2);
+    TEST(!rc);
+
+    FeatureManager::UnInitializeLib();  
+    FeatureManager::UnInitializeLib();  
+    FeatureManager::UnInitializeLib();//it should be safe to call UnInitializeLib() even without matching InitializeLibL() call   
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4060
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void FeatureControlTest1()
+    {
+    RFeatureControl ctrl;
+    TInt err = ctrl.Open();
+    TEST2(err, KErrNone);
+    /////////////////////////////////////////////////////////////
+    RFeatureUidArray farray;
+    err = ctrl.ListSupportedFeatures(farray);
+    TEST2(err, KErrNone);
+    TheTest.Printf(_L("RFeatureControl::ListSupportedFeatures()\r\n"));
+    for(TInt i=0;i<farray.Count();++i)
+        {
+        TheTest.Printf(_L("  Feature: %08X\r\n"), farray[i].iUid);
+        }
+    /////////////////////////////////////////////////////////////
+    RFeatureArray farray2;
+    for(TInt i=0;i<farray.Count();++i)
+        {
+        err = farray2.Append(farray[i]); 
+        TEST2(err, KErrNone);
+        }
+    
+    err = ctrl.FeaturesSupported(farray2);
+    TEST2(err, KErrNone);
+
+    TheTest.Printf(_L("RFeatureControl::FeaturesSupported()\r\n"));
+    for(TInt i=0;i<farray2.Count();++i)
+        {
+        TheTest.Printf(_L("  Feature: %08X, Flags: %08X, Data: %08X\r\n"), farray2[i].FeatureUid(), farray2[i].FeatureFlags().iFlags, farray2[i].FeatureData());
+        }
+    
+    RFeatureArray farray3;
+    err = ctrl.FeaturesSupported(farray3);
+    TEST2(err, KErrArgument);
+    
+    /////////////////////////////////////////////////////////////
+    farray2.Close();
+    farray.Close();
+    ctrl.Close();
+    ctrl.Close();//It should be safe to call Close() again
+    }
+
+/** 
+@SYMTestCaseID          PDS-EFM-CT-4061
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void FeatureControlTest2()
+    {
+    RFeatureControl ctrl;
+    TInt err = ctrl.Open();
+    TEST2(err, KErrNone);
+    /////////////////////////////////////////////////////////////
+    RFeatureUidArray farray;
+    err = ctrl.ListSupportedFeatures(farray);
+    TEST2(err, KErrNone);
+    for(TInt i=0;i<farray.Count();++i)
+        {
+        err = ctrl.FeatureSupported(farray[i]);
+        TEST2(err, KFeatureSupported);
+        
+        TFeatureEntry feat(farray[i]);
+        err = ctrl.FeatureSupported(feat);
+        TEST2(err, KFeatureSupported);
+        }
+
+    err = ctrl.FeatureSupported(TUid::Uid(KInvalidFeatureId1));
+    TEST2(err, KErrNotFound);
+
+    TFeatureEntry feat1(TUid::Uid(KInvalidFeatureId1));
+    err = ctrl.FeatureSupported(feat1);
+    TEST2(err, KErrNotFound);
+
+    const TUint KFlags = 0x0134357;
+    const TUint KData = 0xAB5234;
+    TFeatureEntry feat2(TUid::Uid(KInvalidFeatureId1), KFlags, KData);
+    err = ctrl.FeatureSupported(feat2);
+    TEST2(err, KErrNotFound);
+    
+    /////////////////////////////////////////////////////////////
+    farray.Close();
+    ctrl.Close();
+    }
+
+/** 
+@SYMTestCaseID          PDS-EFM-CT-4062
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void FeatureControlTest3()
+    {
+    RFeatureControl ctrl;
+    TInt err = ctrl.Open();
+    TEST2(err, KErrNone);
+    
+    //Retrieve a uid list of all supported features
+    RFeatureUidArray farray;
+    err = ctrl.ListSupportedFeatures(farray);
+    TEST2(err, KErrNone);
+    //Retrieve a TFeaureEntry list of all supported features
+    RFeatureArray farray2;
+    for(TInt i=0;i<farray.Count();++i)
+        {
+        err = farray2.Append(farray[i]); 
+        TEST2(err, KErrNone);
+        }
+    err = ctrl.FeaturesSupported(farray2);
+    TEST2(err, KErrNone);
+    //Play with EnableFeature()/DisableFeature() calls. If the EFeatureModifiable flag is not set then 
+    //the feature cannot be enabled or disabled.
+    for(TInt i=0;i<farray2.Count();++i)
+        {
+        const TFeatureEntry& fentry = farray2[i];
+        TBitFlags32 flags = fentry.FeatureFlags();
+        
+        err = ctrl.DisableFeature(fentry.FeatureUid());
+        TEST2(err, flags.IsSet(EFeatureModifiable) ? KErrNone : KErrAccessDenied);
+        
+        err = ctrl.EnableFeature(fentry.FeatureUid());
+        TEST2(err, flags.IsSet(EFeatureModifiable) ? KErrNone : KErrAccessDenied);
+        }
+    //It is impossible to set non-existing feature
+    const TUid KNewFeatureUid = {0x7888ABCD}; 
+    err = ctrl.SetFeature(KNewFeatureUid, ETrue, 0x0);
+    TEST2(err, KErrNotFound);
+    //It is impossible to set non-modifiable feature
+    TBitFlags32 flags = farray2[0].FeatureFlags();
+    err = ctrl.SetFeature(farray2[0].FeatureUid(), ETrue, 0x0);
+    TEST2(err, flags.IsSet(EFeatureModifiable) ? KErrNone : KErrAccessDenied);
+    //Add new feature
+    flags.ClearAll();
+    flags.Set(EFeatureSupported);
+    flags.Set(EFeatureModifiable);
+    TFeatureEntry fentry(KNewFeatureUid, flags, 0x0);
+    err = ctrl.AddFeature(fentry);
+    TEST2(err, KErrNone);
+    //Retrieve the new feature and check flags
+    err = ctrl.FeatureSupported(fentry);
+    TEST2(err, KFeatureSupported);
+    flags = fentry.FeatureFlags();
+    TEST(flags.IsSet(EFeatureSupported));
+    TEST(flags.IsSet(EFeatureModifiable));
+    //Now, it should be possible to set the new feature - it is modifiable.
+    err = ctrl.SetFeature(fentry.FeatureUid(), ETrue, 0x0);
+    TEST2(err, KErrNone);
+    err = ctrl.SetFeature(fentry.FeatureUid(), EFalse, 0x0);
+    TEST2(err, KErrNone);
+    //Enable/disable
+    err = ctrl.EnableFeature(fentry.FeatureUid());
+    TEST2(err, KErrNone);
+    err = ctrl.DisableFeature(fentry.FeatureUid());
+    TEST2(err, KErrNone);
+    //Delete the added feature
+    err = ctrl.DeleteFeature(fentry.FeatureUid());
+    TEST2(err, KErrNone);
+    err = ctrl.DeleteFeature(fentry.FeatureUid());
+    TEST2(err, KErrNotFound);
+    
+    /////////////////////////////////////////////////////////////
+    farray2.Close();
+    farray.Close();
+    ctrl.Close();
+    }
+
+/** 
+@SYMTestCaseID          PDS-EFM-CT-4063
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void FeatureDiscoveryTest1L()
+    {
+    TBool rc = CFeatureDiscovery::IsFeatureSupportedL(KInvalidFeatureId1);
+    TEST(!rc);
+    rc = CFeatureDiscovery::IsFeatureSupportedL(KLocationManagement.iUid);
+    TEST(rc);
+    
+    rc = CFeatureDiscovery::IsFeatureSupportedL(KInvalidFeatureUid1);
+    TEST(!rc);
+    rc = CFeatureDiscovery::IsFeatureSupportedL(KLocationManagement);
+    TEST(rc);
+
+    CFeatureDiscovery* fdiscovery = CFeatureDiscovery::NewLC();
+    
+    rc = fdiscovery->IsSupported(KInvalidFeatureId1);
+    TEST(!rc);
+    rc = fdiscovery->IsSupported(KLocationManagement.iUid);
+    TEST(rc);
+
+    rc = fdiscovery->IsSupported(KInvalidFeatureUid1);
+    TEST(!rc);
+    rc = fdiscovery->IsSupported(KLocationManagement);
+    TEST(rc);
+    
+    CleanupStack::PopAndDestroy(fdiscovery);
+    }
+
+void DoFeatureDiscoveryTest2(TBool aStaticMethodsUsed)
+    {
+    CFeatureDiscovery* fdiscovery = NULL;
+    if(!aStaticMethodsUsed)
+        {
+        fdiscovery = CFeatureDiscovery::NewL();
+        }
+    //////////////////////////////////////////////////////////
+    //A test with a set: one valid and one invalid feature 
+    TFeatureSet fset;
+    TInt err = fset.Append(KConnectivity);
+    TEST2(err, KErrNone);
+    err = fset.Append(KInvalidFeatureUid1);
+    TEST2(err, KErrNone);
+    TBool rc = fset.IsFeatureSupported(KConnectivity);
+    TEST(!rc);
+    rc = fset.IsFeatureSupported(KInvalidFeatureUid1);
+    TEST(!rc);
+    if(aStaticMethodsUsed)
+        {
+        TRAP(err, CFeatureDiscovery::FeaturesSupportedL(fset));
+        }
+    else
+        {
+        err = fdiscovery->FeaturesSupported(fset);
+        }
+    TEST2(err, KErrNone);
+    rc = fset.IsFeatureSupported(KConnectivity);
+    TEST(rc);
+    rc = fset.IsFeatureSupported(KInvalidFeatureUid1);
+    TEST(!rc);
+    rc = fset.AreAllFeaturesSupported();
+    TEST(!rc);
+    //////////////////////////////////////////////////////////
+    //A test with an empty set 
+    TFeatureSet fset2;
+    rc = fset2.IsFeatureSupported(KConnectivity);
+    TEST(!rc);
+    rc = fset2.IsFeatureSupported(KInvalidFeatureUid1);
+    TEST(!rc);
+    if(aStaticMethodsUsed)
+        {
+        TRAP(err, CFeatureDiscovery::FeaturesSupportedL(fset2));
+        }
+    else
+        {
+        err = fdiscovery->FeaturesSupported(fset2);
+        }
+    TEST2(err, KErrArgument);
+    rc = fset2.IsFeatureSupported(KConnectivity);
+    TEST(!rc);
+    rc = fset2.IsFeatureSupported(KInvalidFeatureUid1);
+    TEST(!rc);
+    rc = fset2.AreAllFeaturesSupported();
+    TEST(rc);//because fset2 is empty
+    //////////////////////////////////////////////////////////
+    //A test with a set: two valid features 
+    TFeatureSet fset3;
+    err = fset3.Append(KConnectivity);
+    TEST2(err, KErrNone);
+    err = fset3.Append(KSip);
+    TEST2(err, KErrNone);
+    if(aStaticMethodsUsed)
+        {
+        TRAP(err, CFeatureDiscovery::FeaturesSupportedL(fset3));
+        }
+    else
+        {
+        err = fdiscovery->FeaturesSupported(fset3);
+        }
+    TEST2(err, KErrNone);
+    rc = fset3.IsFeatureSupported(KConnectivity);
+    TEST(rc);
+    rc = fset3.IsFeatureSupported(KSip);
+    TEST(rc);
+    rc = fset3.AreAllFeaturesSupported();
+    TEST(rc);
+    //////////////////////////////////////////////////////////
+    delete fdiscovery;
+   }
+
+/** 
+@SYMTestCaseID          PDS-EFM-CT-4064
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void FeatureDiscoveryTest2L()
+    {
+    DoFeatureDiscoveryTest2(ETrue);
+    DoFeatureDiscoveryTest2(EFalse);
+    }
+
+void DoTestsL()
+    {
+    TheTest.Start(_L("@SYMTestCaseID:PDS-EFM-CT-4059 FeatureManager::FeatureSupported() test"));
+    FeatureSupportedTestL();
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4060 RFeatureControl tests-1"));
+    FeatureControlTest1();
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4061 RFeatureControl tests-2"));
+    FeatureControlTest2();
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4062 RFeatureControl tests-3"));
+    FeatureControlTest3();
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4063 CFeatureDiscovery tests-1"));
+    FeatureDiscoveryTest1L();
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4064 CFeatureDiscovery & TFeatureSet tests"));
+    FeatureDiscoveryTest2L();
+    }
+
+TInt E32Main()
+    {
+    TheTest.Title();
+    
+    CTrapCleanup* tc = CTrapCleanup::New();
+    TheTest(tc != NULL);
+    
+    __UHEAP_MARK;
+    
+    TRAPD(err, DoTestsL());
+    DestroyTestEnv();
+    TEST2(err, KErrNone);
+
+    __UHEAP_MARKEND;
+    
+    TheTest.End();
+    TheTest.Close();
+    
+    delete tc;
+
+    User::Heap().Check();
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrbackupresponse.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,182 @@
+// Copyright (c) 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32test.h>
+#include <e32debug.h>
+#include <bautils.h>
+#include <featurecontrol.h>
+#include "t_fmgrbursim.h"
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+RTest TheTest(_L("t_fmgrbackupresponse"));
+
+const TUint threadTimeout = 2000000;    // thread timeout = 2 seconds 
+
+static RSemaphore MainThreadCrS;
+static TBool featMgrIsResponsive = EFalse;
+
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+//Test macros and functions
+void Check1(TInt aValue, TInt aLine, TBool aPrintThreadName = EFalse)
+    {
+    if(!aValue)
+        {
+        //DeleteTestFiles();
+        if(aPrintThreadName)
+            {
+            RThread th;
+            TName name = th.Name();
+            RDebug::Print(_L("*** Thread %S, Line %d\r\n"), &name, aLine);
+            }
+        else
+            {
+            RDebug::Print(_L("*** Line %d\r\n"), aLine);
+            }
+        TheTest(EFalse, aLine);
+        }
+    }
+
+void Check2(TInt aValue, TInt aExpected, TInt aLine, TBool aPrintThreadName = EFalse)
+    {
+    if(aValue != aExpected)
+        {
+        //DeleteTestFiles();
+        if(aPrintThreadName)
+            {
+            RThread th;
+            TName name = th.Name();
+            RDebug::Print(_L("*** Thread %S, Line %d Expected error: %d, got: %d\r\n"), &name, aLine, aExpected, aValue);
+            }
+        else
+            {
+            RDebug::Print(_L("*** Line %d, Expected error: %d, got: %d\r\n"), aLine, aExpected, aValue);
+            }
+        TheTest(EFalse, aLine);
+        }
+    }
+#define TEST(arg) ::Check1((arg), __LINE__)
+#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
+#define TTEST(arg) ::Check1((arg), __LINE__, ETrue)
+#define TTEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__, ETrue)
+
+// ------------------------- ------------------------- 
+// setup and cleanup functions
+
+TInt TestThreadL(void*)
+    {
+        __UHEAP_MARK;
+        
+        CTrapCleanup* tc = CTrapCleanup::New();
+        RFeatureControl rfc;
+        TTEST2( rfc.Connect(), KErrNone );
+        
+        // During backup, feature manager server should be responsive and return KErrServerBusy for write request 
+        TInt err = rfc.EnableFeature( TUid::Uid(0x00000001) );
+        TTEST2(err, KErrServerBusy);
+        
+        // During backup, feature manager server should be responsive and NOT return KErrServerBusy for read request
+        err = rfc.FeatureSupported( TUid::Uid(0x00000001) );
+        TTEST(err != KErrServerBusy);
+		
+        rfc.Close();
+        featMgrIsResponsive = ETrue;
+        RDebug::Print(_L("+++:TestThread: Query and Modification completed\r\n"));
+        MainThreadCrS.Signal();
+        delete tc;
+        
+        __UHEAP_MARKEND;
+        
+        return KErrNone;
+    }
+/**
+@SYMTestCaseID          PDS-EFM-CT-4057
+@SYMTestCaseDesc        Querying and modifying a feature during backup operation.
+                        Verify that a response is returned from the server during backup.
+@SYMTestPriority        High
+@SYMTestActions         Start simulating backup operation
+                        Create a thread that will:
+                        Modify a feature and verify that a response (KErrServerBusy) is received 
+                        Query a feature and verify that a response is received (doesn't matter what the result is)
+                        The thread should finished in less than 2 seconds.
+                        Otherwise the test fail.          
+@SYMTestExpectedResults Test must not fail
+@SYMREQ                 
+*/  
+void TestBackupResponseL()
+    {
+        _LIT(KThreadName, "BakTh");
+        featMgrIsResponsive = EFalse;
+        
+        CFeatMgrBURSim* simulate = CFeatMgrBURSim::NewLC();
+        RThread testThread;
+        TRequestStatus testStatus;
+        CleanupClosePushL( testThread );
+        
+        simulate->Simulate_CheckRegFileL();
+        
+        // Simulate a backup
+        RDebug::Print(_L("Simulating Backup of FeatMgr\r\n"));
+        simulate->Simulate_StartBackupL();
+
+        TEST2( testThread.Create(KThreadName, &TestThreadL, 0x2000, 0x1000, 0x10000, NULL, EOwnerProcess), KErrNone );
+        testThread.Logon(testStatus);
+        TEST2( testStatus.Int(), KRequestPending );
+        testThread.Resume();
+        // Wait for 1.5 second for the query thread to finish. 
+        RDebug::Print(_L("+++:MainThread: Wait for query and modification completion...\r\n"));
+        MainThreadCrS.Wait(threadTimeout);
+        // If query is responsive within the 1.5 second frame the following check should pass.
+        TEST (featMgrIsResponsive);
+        simulate->Simulate_EndBackupL();
+        
+        CleanupStack::PopAndDestroy(&testThread);
+        CleanupStack::PopAndDestroy(simulate);
+    }
+
+////////////////////////////////////////////////////////////////////////////////////
+void DoTestsL()
+	{
+    MainThreadCrS.CreateLocal(0);
+    
+    TheTest.Start(_L(" @SYMTestCaseID:PDS-EFM-CT-4057 Backup Query and Modification Response"));
+    TestBackupResponseL();
+    
+    MainThreadCrS.Close();
+
+	}
+
+TInt E32Main()
+	{
+	TheTest.Title();
+	
+	CTrapCleanup* tc = CTrapCleanup::New();
+	
+	__UHEAP_MARK;
+	
+	TRAPD(err, DoTestsL());
+	TEST2(err, KErrNone);
+
+	__UHEAP_MARKEND;
+	
+	TheTest.End();
+	TheTest.Close();
+	
+	delete tc;
+	
+	User::Heap().Check();
+	return KErrNone;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrbadclient.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,425 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32test.h>
+#include <e32math.h>
+#include <featmgr.h>
+#include <featureuids.h>
+#include "featurepanics.h"
+#include <featurecontrol.h>
+#include <featurenotifier.h>
+#include "..\src\inc\featmgrconfiguration.h"
+#include "..\src\inc\featmgrclientserver.h"
+
+using namespace NFeature;
+
+static RTest TheTest(_L("t_fmgrbadclient"));
+
+const TInt KTestIterCount = 5000;
+
+enum TArgType 
+    {
+    EIntArgType, 
+    ETextArgType, 
+    EBinArgType, 
+    ELastArgType
+    };
+
+const TInt KMaxDesArgLen = 1000;
+
+//If the FeatMgr server crashes and the test receives KErrServerTerminated error, then the 
+//next set will contain the last:
+// - iteration number;
+// - handle type;
+// - function code;
+// - handle;
+// - IPC arguments values;
+struct TThreadData
+    {
+    TInt                iIteration;
+    TInt                iFunction;
+    TArgType            iArgType[KMaxMessageArguments];
+    TInt                iIntArg[KMaxMessageArguments];
+    TBuf<KMaxDesArgLen> iTextArg[KMaxMessageArguments];
+    TBuf8<KMaxDesArgLen> iBinArg[KMaxMessageArguments];
+    TInt64              iSeed;
+    };
+
+_LIT(KPanicCategory, "SrvTerm");
+_LIT(KPanicCategory2, "InvArg");
+const TInt KPanicCode = 1111;
+const TInt KPanicCode2 = 2222;
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+//Deletes all created test files.
+void DestroyTestEnv()
+    {
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+//Test macros and functions
+void Check1(TInt aValue, TInt aLine, TBool aPrintThreadName = EFalse)
+    {
+    if(!aValue)
+        {
+        DestroyTestEnv();
+        if(aPrintThreadName)
+            {
+            RThread th;
+            TName name = th.Name();
+            RDebug::Print(_L("*** Expression evaluated to false. Thread %S, Line %d\r\n"), &name, aLine);
+            }
+        else
+            {
+            RDebug::Print(_L("*** Expression evaluated to false. Line %d\r\n"), aLine);
+            }
+        TheTest(EFalse, aLine);
+        }
+    }
+void Check2(TInt aValue, TInt aExpected, TInt aLine, TBool aPrintThreadName = EFalse)
+    {
+    if(aValue != aExpected)
+        {
+        DestroyTestEnv();
+        if(aPrintThreadName)
+            {
+            RThread th;
+            TName name = th.Name();
+            RDebug::Print(_L("*** Thread %S, Line %d Expected error: %d, got: %d\r\n"), &name, aLine, aExpected, aValue);
+            }
+        else
+            {
+            RDebug::Print(_L("*** Line %d, Expected error: %d, got: %d\r\n"), aLine, aExpected, aValue);
+            }
+        TheTest(EFalse, aLine);
+        }
+    }
+#define TEST(arg) ::Check1((arg), __LINE__)
+#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
+#define TTEST(arg) ::Check1((arg), __LINE__, ETrue)
+#define TTEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__, ETrue)
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+static TInt StartFeatMgrServer()
+    {
+    RProcess server;
+    const TUidType serverUid( KNullUid, KServerUid2, KNullUid );
+    TInt err = server.Create( KServerExeName, // FeatMgrServer.exe
+                           KNullDesC, // A descriptor containing data passed as 
+                                      // an argument to the thread function of 
+                                      // the new process's main thread, when it 
+                                      // is first scheduled.
+                           serverUid, // FeatMgr server UID
+                           EOwnerProcess ); // Ownership of this process handle 
+
+    // Return error code if we couldn't create a process
+    if ( err == KErrNone )
+        {
+        // Rendezvous is used to detect server start
+        TRequestStatus stat;
+        server.Rendezvous( stat );
+
+        if ( stat != KRequestPending )
+            {
+            server.Kill( KErrNone ); // Abort startup
+            }
+        else
+            {
+            server.Resume();  // Logon OK - start the server
+            }
+
+        User::WaitForRequest( stat ); // Wait for start or death
+
+        // We can't use the 'exit reason' if the server paniced as this
+        // is the panic 'reason' and may be '0' which cannot be distinguished
+        // from KErrNone
+        err = (server.ExitType() == EExitPanic)? KErrGeneral : stat.Int();
+
+        // We can close the handle now
+        server.Close();        
+        }
+
+    return err;
+    }
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////        RTestFeatMgrSession          ////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+class RTestFeatMgrSession : public RSessionBase
+    {
+public: 
+    TInt Connect();
+    void Close();
+    TInt SendReceive(TInt aFunction);
+    TInt SendReceive(TInt aFunction, const TIpcArgs& aArgs);
+
+private:
+    TInt DoCreateSession();
+    };
+    
+TInt RTestFeatMgrSession::Connect()
+    {
+    TInt err = DoCreateSession();
+    if(err != KErrNone && err != KErrAlreadyExists)
+        {
+        Close();
+        }
+    return err;
+    }
+
+void RTestFeatMgrSession::Close()
+    {
+    RSessionBase::Close();
+    }
+
+TInt RTestFeatMgrSession::SendReceive(TInt aFunction)
+    {
+    return RSessionBase::SendReceive(aFunction);    
+    }
+    
+TInt RTestFeatMgrSession::SendReceive(TInt aFunction, const TIpcArgs& aArgs)
+    {
+    return RSessionBase::SendReceive(aFunction, aArgs); 
+    }
+
+TInt RTestFeatMgrSession::DoCreateSession()
+    {
+    const TInt KRetry( 2 );
+    // Try this twice
+    TInt retry( KRetry );
+    TInt err( KErrNone );
+
+    while ( retry > 0 )
+        {
+        // Try to create a FeatMgr Server session
+        err = CreateSession(KServerProcessName, 
+                            TVersion(KServerVersionMajor, KServerVersionMinor, KServerVersionBuild), 
+                            KDefaultAsyncSlots);
+
+        if ( err != KErrNotFound && err != KErrServerTerminated )
+            {
+            // KErrNone or unrecoverable error
+            retry = 0;
+            }
+        else
+            {
+            // Return code was KErrNotFound or KErrServerTerminated.
+            // Try to start a new FeatMgr Server
+            err = StartFeatMgrServer();
+
+            if ( err != KErrNone && err != KErrAlreadyExists )
+                {
+                // Unrecoverable error
+                retry = 0;
+                }
+            }
+            
+        retry--;
+        }
+            
+    return err;
+    }
+    
+void PrintIterationCount(TInt aIteration)
+    {
+    if((aIteration % 100) == 0)
+        {
+        TTime time;
+        time.HomeTime();
+        TDateTime dt = time.DateTime();
+        TBuf<16> tbuf;
+        tbuf.Format(_L("%02d:%02d:%02d.%06d"), dt.Hour(), dt.Minute(), dt.Second(), dt.MicroSecond());
+        RDebug::Print(_L("-----[%S] Test iterations: %d\r\n"), &tbuf, aIteration);
+        }
+    }
+
+//Worker thread function.
+//It behaves as a malicious client. Connects to the FeatMgr server. In each test iteration generates some random values
+//for the function number, handle, IPC arguments. Then sends a command to the server using these
+//randomly generated values. If the server crashes and the thread function receives KErrServerTerminated error,
+//then the thread kills itself and the main thread will get KPanicCategory and KPanicCode as a reason for the
+//worker thread's death. The last set of randomly generated values will be stored in the memory, pointed by aData argument.
+TInt ThreadFunc1(void* aData)
+    {
+    __UHEAP_MARK;
+    
+    CTrapCleanup* tc = CTrapCleanup::New();
+    TTEST(tc != NULL);
+
+    TThreadData* p = static_cast <TThreadData*> (aData);
+    TTEST(p != NULL);
+    TThreadData& data = *p;
+
+    RTestFeatMgrSession sess;
+    TInt err = sess.Connect();
+    TTEST2(err, KErrNone);
+
+    while(++data.iIteration <= KTestIterCount)
+        {
+        RDebug::Print(_L("++++ %d\r\n"), data.iIteration);
+        
+        PrintIterationCount(data.iIteration);
+        TIpcArgs args;
+        data.iFunction = Math::Rand(data.iSeed) % (EFeatMgrSWIEnd + 1);//EFeatMgrSWIEnd - the last server message number (without resource checking IPCs))
+        for(TInt i=0;i<KMaxMessageArguments;++i)
+            {
+            //Initialize arguments
+            data.iArgType[i] = static_cast <TArgType> (Math::Rand(data.iSeed) % ELastArgType);
+            switch(data.iArgType[i])
+                {
+                case EIntArgType:
+                    data.iIntArg[i] = Math::Rand(data.iSeed) % 9711;
+                    args.Set(i, data.iIntArg[i]);
+                    break;
+                case ETextArgType:
+                    {
+                    TInt len = Math::Rand(data.iSeed) % KMaxDesArgLen;  
+                    data.iTextArg[i].SetLength(len);
+                    args.Set(i, &data.iTextArg[i]);
+                    }
+                    break;
+                case EBinArgType:
+                    {
+                    TInt len = Math::Rand(data.iSeed) % KMaxDesArgLen;  
+                    data.iBinArg[i].SetLength(len);
+                    args.Set(i, &data.iBinArg[i]);
+                    }
+                    break;
+                default:
+                    User::Panic(KPanicCategory2, KPanicCode2);
+                    break;
+                }
+            }
+        //Send arguments
+        User::SetJustInTime(EFalse);
+        TInt err = KErrNone;
+        err = sess.SendReceive(data.iFunction, args);
+        if(err == KErrServerTerminated)
+            {
+            User::Panic(KPanicCategory, KPanicCode);
+            }
+        User::SetJustInTime(ETrue);
+        }
+
+    sess.Close();
+
+    delete tc;  
+    
+    __UHEAP_MARKEND;
+    
+    return KErrNone;        
+    }
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4065
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void BadClientTest()
+    {
+    TThreadData* p = new TThreadData;
+    TEST(p != NULL);
+    TThreadData& data = *p;
+    data.iFunction = 0;
+    TTime now;
+    now.UniversalTime();
+    data.iSeed = now.Int64();
+    
+    _LIT(KThreadName, "WorkThrd");
+    
+    for(data.iIteration=0;data.iIteration<KTestIterCount;++data.iIteration)
+        {
+        PrintIterationCount(data.iIteration);
+        //Run the malicious client (one worker theread which will try to crash the FeatMgr server)
+        RThread thread;
+        TEST2(thread.Create(KThreadName, &ThreadFunc1, 0x2000, 0x1000, 0x10000, &data, EOwnerProcess), KErrNone);
+        TRequestStatus status;
+        thread.Logon(status);
+        TEST2(status.Int(), KRequestPending);
+        thread.Resume();
+        User::WaitForRequest(status);
+        User::SetJustInTime(ETrue); // enable debugger panic handling
+        if(thread.ExitType() == EExitPanic)
+            {
+            if(thread.ExitReason() == KPanicCode)
+                {
+                TheTest.Printf(_L("##Server terminated!\r\n"));
+                TheTest.Printf(_L("##Iteration=%d, Function(hex)=%X, Handle=%d\r\n"), data.iIteration, data.iFunction);
+                for(TInt i=0;i<KMaxMessageArguments;++i)
+                    {
+                    switch(data.iArgType[i])
+                        {
+                        case EIntArgType:
+                            TheTest.Printf(_L("##Arg %d, Integer, value=%d\r\n"), i, data.iIntArg[i]);
+                            break;
+                        case ETextArgType:
+                            TheTest.Printf(_L("##Arg %d, Text,    length=%d\r\n"), i, data.iTextArg[i].Length());
+                            break;
+                        case EBinArgType:
+                            TheTest.Printf(_L("##Arg %d, Binary,  length=%d\r\n"), i, data.iBinArg[i].Length());
+                            break;
+                        default:
+                            TheTest.Printf(_L("##Arg %d, Invalid argument type: %d\r\n"), i, data.iArgType[i]);
+                            break;
+                        }
+                    }
+                TEST(0);
+                }
+            }
+        thread.Close();
+        }
+    User::SetJustInTime(ETrue); // enable debugger panic handling
+    delete p;
+    }
+
+void DoTestsL()
+    {
+    //TODO: this test won't pass
+    TheTest.Start(_L("@SYMTestCaseID:PDS-EFM-CT-4065 Bad client test"));
+    BadClientTest();
+    }
+
+TInt E32Main()
+    {
+    TheTest.Title();
+    
+    CTrapCleanup* tc = CTrapCleanup::New();
+    TheTest(tc != NULL);
+    
+    __UHEAP_MARK;
+    
+    TRAPD(err, DoTestsL());
+    DestroyTestEnv();
+    TEST2(err, KErrNone);
+
+    __UHEAP_MARKEND;
+    
+    TheTest.End();
+    TheTest.Close();
+    
+    delete tc;
+
+    User::Heap().Check();
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrbursim.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,164 @@
+// Copyright (c) 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @test
+ @internalComponent
+*/
+
+#include "t_fmgrbursim.h"
+#include "t_fmgrburdefs.h"
+
+CFeatMgrBURSim* CFeatMgrBURSim::NewLC()
+	{
+	CFeatMgrBURSim* newInstance = new (ELeave) CFeatMgrBURSim();
+	CleanupStack::PushL( newInstance );
+	newInstance->ConstructL();
+	return newInstance;	
+	}
+
+void CFeatMgrBURSim::ConstructL()
+	{
+	iBackupClient = CBaBackupSessionWrapper::NewL();
+	}
+
+CFeatMgrBURSim::CFeatMgrBURSim()
+	{
+	}
+
+CFeatMgrBURSim::~CFeatMgrBURSim()
+	{
+	delete iBackupClient;	
+	}
+
+// BUR simulation functions
+
+/** 
+ * Use the babackup API to "start" a backup.  
+ * Ultimate effect is to cause the correct case statement inside 
+ * ChangeFileLockL to be called.
+ */
+void CFeatMgrBURSim::Simulate_StartBackupL()
+	{
+	iBackupClient->CloseFileL( KEfmBackupFileName, MBackupObserver::EReleaseLockReadOnly );		
+
+	// Set BUR property to trigger 
+	TInt ret = RProperty::Set(KTestUid , conn::KUidBackupRestoreKey, conn::EBackupBase|conn::EBURBackupPartial);
+	if (ret != KErrNone && ret != KErrNotFound)
+		{
+		User::Leave(ret);
+		}
+	
+	// allow observers to be notified
+	User::After(100000);
+	}
+
+
+/** 
+ * Use the babackup API to "end" a backup.  
+ * Ultimate effect is to cause the correct case statement inside 
+ * ChangeFileLockL to be called. 
+ */
+void CFeatMgrBURSim::Simulate_EndBackupL( TBool /* aNormal */ )
+	{
+	iBackupClient->CloseFileL( KEfmBackupFileName, MBackupObserver::ETakeLock );
+
+	// allow observers to be notified
+	User::After(100000);
+	}
+
+// Restore type
+
+/** 
+ * Use the babackup API to "start" a restore.  
+ * Ultimate effect is to cause the correct case statement inside 
+ * ChangeFileLockL to be called.
+ */
+void CFeatMgrBURSim::Simulate_StartRestoreL()
+	{
+	iBackupClient->CloseFileL( KEfmBackupFileName, MBackupObserver::EReleaseLockNoAccess );
+
+	// Set BUR property to trigger 
+	TInt ret = RProperty::Set(KTestUid , conn::KUidBackupRestoreKey, conn::EBackupBase|conn::EBURRestorePartial);
+	if (ret != KErrNone && ret != KErrNotFound)
+		{
+		User::Leave(ret);
+		}
+
+	// allow observers to be notified
+	User::After(100000);
+	}
+
+
+/** 
+ * Use the babackup API to "end" a restore.  
+ * Ultimate effect is to cause the correct case statement inside 
+ * ChangeFileLockL to be called.
+ */
+void CFeatMgrBURSim::Simulate_EndRestoreL( TBool /* aNormal */ )
+	{
+	iBackupClient->CloseFileL( KEfmBackupFileName, MBackupObserver::ETakeLock );		
+	
+	// allow observers to be notified
+	User::After(100000);
+	}
+
+
+// Undefined type
+
+
+// Edge cases
+
+void CFeatMgrBURSim::Simulate_StartUndefinedL()
+	{
+	// Use the babackup API to "start" (neither a backup or restore explicitly).  
+	// Ultimate effect is to cause the correct case statement inside 
+	// CFeatMgrFeatureRegistry::HandleBackupOperationEventL
+	// to be called.
+	User::Leave( KErrNotSupported );
+	}
+
+
+void CFeatMgrBURSim::Simulate_EndUndefinedL( TBool /* aNormal */ )
+	{
+	// Use the babackup API to "end" (neither a backup or restore explicitly).  
+	// Ultimate effect is to cause the correct case statement inside 
+	// CFeatMgrFeatureRegistry::HandleBackupOperationEventL
+	// to be called.
+	User::Leave( KErrNotSupported );
+	}
+
+/** 
+ * CheckRegFileL
+ * Open the babackup file to confirm that the file is present
+ * this leaves if the KErrNotFound is returned
+ */
+void CFeatMgrBURSim::Simulate_CheckRegFileL()
+	{
+	RFs fs;
+	User::LeaveIfError(fs.Connect());
+	CleanupClosePushL(fs);
+	RFile file;
+	TInt err = file.Open(fs, KRegistrationFile, EFileRead);
+	
+	if( err != KErrNone )
+		{
+		User::Leave(err);
+		}
+
+	file.Close();
+	CleanupStack::PopAndDestroy(&fs);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrnotify.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,293 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32test.h>
+#include <featmgr.h>
+#include <featureuids.h>
+#include <featurecontrol.h>
+#include <featurenotifier.h>
+
+using namespace NFeature;
+
+const TUid KNewFeatureUid = {0x7888ABCD}; 
+const TUid KNewFeatureUid2 = {0x7888ABCF}; 
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+static RTest TheTest(_L("t_fmgrnotify"));
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+//Deletes all created test files.
+void DestroyTestEnv()
+    {
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+//Test macros and functions
+void Check1(TInt aValue, TInt aLine)
+    {
+    if(!aValue)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expression evaluated to false. Line %d\r\n"), aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+void Check2(TInt aValue, TInt aExpected, TInt aLine)
+    {
+    if(aValue != aExpected)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expected: %d, got: %d. Line %d\r\n"), aExpected, aValue, aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+#define TEST(arg) ::Check1((arg), __LINE__)
+#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+_LIT(KFeatureNoChange,          "FeatureNoChange");
+_LIT(KFeatureStatusUpdated,     "FeatureStatusUpdated");
+_LIT(KFeatureDataUpdated,       "FeatureDataUpdated");
+_LIT(KFeatureStatusDataUpdated, "FeatureStatusDataUpdated");
+_LIT(KFeatureRediscover,        "FeatureRediscover");
+_LIT(KFeatureCreated,           "FeatureCreated");
+_LIT(KFeatureDeleted,           "FeatureDeleted");
+
+const TPtrC KNotificationText[] = {KFeatureNoChange(), KFeatureStatusUpdated(), KFeatureDataUpdated(), 
+                                   KFeatureStatusDataUpdated(), KFeatureRediscover(), KFeatureCreated(), 
+                                   KFeatureDeleted()};
+
+class TTestFeatureObserver : public MFeatureObserver
+    {
+public:
+    TTestFeatureObserver() :
+        iType(static_cast <TFeatureChangeType> (-1)),
+        iFeatureUid(KNullUid)    
+        {
+        }
+    void SetExpected(TFeatureChangeType aType, TUid aFeatureUid)
+        {
+        iType = aType;
+        iFeatureUid = aFeatureUid;    
+        }
+    void Reset()
+        {
+        iType = static_cast <TFeatureChangeType> (-1);
+        iFeatureUid = KNullUid;    
+        }
+    virtual void HandleNotifyChange(TFeatureChangeType aType, TFeatureEntry aFeature)
+        {
+        TheTest.Printf(_L("=== HandleNotifyChange() called with aType=\"%S\" and aFeature.FeatureUid()=0x%X\r\n"), &KNotificationText[aType], aFeature.FeatureUid());
+        CActiveScheduler::Stop();
+        TEST2(aType, iType);
+        TEST(aFeature.FeatureUid() == iFeatureUid);
+        }
+    virtual void HandleNotifyError(TInt aError)
+        {
+        TheTest.Printf(_L("=== HandleNotifyError() called with error=%d\r\n"), aError);
+        CActiveScheduler::Stop();
+        TEST2(aError, KErrNone);
+        }
+private:
+        TFeatureChangeType  iType;
+        TUid                iFeatureUid;    
+    };
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+void AddFeature(RFeatureControl& aCtrl, TUid aFeatureUid)
+    {
+    TBitFlags32 flags;
+    flags.ClearAll();
+    flags.Set(EFeatureSupported);
+    flags.Set(EFeatureModifiable);
+    TFeatureEntry fentry(aFeatureUid, flags, 0x0);
+    TInt err = aCtrl.AddFeature(fentry);
+    TEST2(err, KErrNone);
+    }
+
+void DeleteFeature(RFeatureControl& aCtrl, TUid aFeatureUid)
+    {
+    TInt err = aCtrl.DeleteFeature(aFeatureUid);
+    TEST2(err, KErrNone);
+    }
+
+/**
+@SYMTestCaseID          PDS-FEATMGR-CT-????
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void NotificationsTest1()
+    {
+    TTestFeatureObserver observer;
+    CFeatureNotifier* notifier = NULL;
+    TRAPD(err, notifier = CFeatureNotifier::NewL(observer));
+    TEST2(err, KErrNone);
+    //Request notification for feature with KNewFeatureUid uid.
+    err = notifier->NotifyRequest(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    err = notifier->NotifyRequest(KNewFeatureUid);
+    TEST2(err, KErrAlreadyExists);
+    
+    RFeatureControl ctrl;
+    err = ctrl.Connect();
+    TEST2(err, KErrNone);
+    //Add a feature with KNewFeatureUid uid and check the notification
+    AddFeature(ctrl, KNewFeatureUid);
+    observer.SetExpected(EFeatureFeatureCreated, KNewFeatureUid);
+    CActiveScheduler::Start();
+    //Set the feature status and data and check the notification
+    err = ctrl.SetFeature(KNewFeatureUid, ETrue, 100);
+    TEST2(err, KErrNone);
+    observer.SetExpected(EFeatureStatusDataUpdated, KNewFeatureUid);
+    CActiveScheduler::Start();
+    //Set the feature data and check the notification
+    err = ctrl.SetFeature(KNewFeatureUid, 200);
+    TEST2(err, KErrNone);
+    observer.SetExpected(EFeatureDataUpdated, KNewFeatureUid);
+    CActiveScheduler::Start();
+    //Enable the feature (it is already enabled) and check the notification
+    err = ctrl.EnableFeature(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    observer.SetExpected(EFeatureNoChange, KNewFeatureUid);//the feature is enabled - no status change
+    CActiveScheduler::Start();
+    //Disable the feature and check the notification
+    err = ctrl.DisableFeature(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    observer.SetExpected(EFeatureStatusUpdated, KNewFeatureUid);
+    CActiveScheduler::Start();
+    //Cancel notifications
+    err = notifier->NotifyCancel(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    err = notifier->NotifyCancel(KNewFeatureUid);
+    TEST2(err, KErrNotFound);
+    //Request notifications again    
+    err = notifier->NotifyRequest(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    //Delete the feature and check the notification
+    DeleteFeature(ctrl, KNewFeatureUid);
+    observer.SetExpected(EFeatureFeatureDeleted, KNewFeatureUid);
+    CActiveScheduler::Start();
+    //Cleanup
+    ctrl.Close();
+    delete notifier;
+    }
+
+/**
+@SYMTestCaseID          PDS-FEATMGR-CT-????
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void NotificationsTest2()
+    {
+    TTestFeatureObserver observer;
+    CFeatureNotifier* notifier = NULL;
+    TRAPD(err, notifier = CFeatureNotifier::NewL(observer));
+    TEST2(err, KErrNone);
+    
+    RFeatureControl ctrl;
+    err = ctrl.Connect();
+    TEST2(err, KErrNone);
+    //Add two features
+    AddFeature(ctrl, KNewFeatureUid);
+    AddFeature(ctrl, KNewFeatureUid2);
+    //Request notifications for the added features. One of them - duplicated in the array.
+    RFeatureUidArray farray;
+    err = farray.Append(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    err = farray.Append(KNewFeatureUid2);
+    TEST2(err, KErrNone);
+    err = farray.Append(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    //
+    err = notifier->NotifyRequest(farray);
+    TEST2(err, KErrNone);
+    //Enable one of the features (already enabled) and check the notification
+    err = ctrl.EnableFeature(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    observer.SetExpected(EFeatureNoChange, KNewFeatureUid);//the feature is enabled - no status change
+    CActiveScheduler::Start();
+    //Disable the second feature and check the notification
+    err = ctrl.DisableFeature(KNewFeatureUid2);
+    TEST2(err, KErrNone);
+    observer.SetExpected(EFeatureStatusUpdated, KNewFeatureUid2);
+    CActiveScheduler::Start();
+    //Cancel notifications for the second feature
+    err = notifier->NotifyCancel(KNewFeatureUid2);
+    TEST2(err, KErrNone);
+    //Disable the first feature and check notification
+    err = ctrl.DisableFeature(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    observer.SetExpected(EFeatureStatusUpdated, KNewFeatureUid);
+    CActiveScheduler::Start();
+    //Cancel all notifications
+    err = notifier->NotifyCancelAll();
+    TEST2(err, KErrNone);
+    err = notifier->NotifyCancelAll();
+    TEST2(err, KErrNone);
+    //Cleanup
+    farray.Close();
+    ctrl.Close();
+    delete notifier;
+    }
+
+void DoTestsL()
+    {
+    CActiveScheduler* scheduler = new CActiveScheduler;
+    TEST(scheduler != NULL);
+    CActiveScheduler::Install(scheduler);
+    
+    TheTest.Start(_L("@SYMTestCaseID:PDS-EFM-CT-4066 Notifications test 1"));
+    NotificationsTest1();
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4067 Notifications test 2"));
+    NotificationsTest2();
+    
+    delete scheduler;
+    }
+
+TInt E32Main()
+    {
+    TheTest.Title();
+    
+    CTrapCleanup* tc = CTrapCleanup::New();
+    TheTest(tc != NULL);
+    
+    __UHEAP_MARK;
+    
+    TRAPD(err, DoTestsL());
+    DestroyTestEnv();
+    TEST2(err, KErrNone);
+
+    __UHEAP_MARKEND;
+    
+    TheTest.End();
+    TheTest.Close();
+    
+    delete tc;
+
+    User::Heap().Check();
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgroom.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,669 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32test.h>
+#include <bautils.h>
+#include <featmgr.h>
+#include <featureuids.h>
+#include <featurecontrol.h>
+#include <featdiscovery.h>
+#include <featurenotifier.h>
+#include "../../../src/clientdll/featmgrresourcetester.h"
+
+using namespace NFeature;
+
+_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
+
+const TInt KInvalidFeatureId    = 90901671;
+const TUid KInvalidFeatureUid   = {KInvalidFeatureId};
+
+static TInt TheProcessHandleCount = 0;
+static TInt TheThreadHandleCount = 0;
+static TInt TheAllocatedCellsCount = 0;
+
+#ifdef EXTENDED_FEATURE_MANAGER_TEST
+static const TInt KBurstRate = 20;
+#endif
+
+enum TFeatMgrOomTestMode
+    {
+    EFeatMgrOomServerTestMode,
+    EFeatMgrOomClientTestMode,
+    };
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+static RTest TheTest(_L("t_fmgroom"));
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+//Deletes all created test files.
+void DestroyTestEnv()
+    {
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+//Test macros and functions
+void Check1(TInt aValue, TInt aLine)
+    {
+    if(!aValue)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expression evaluated to false. Line %d\r\n"), aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+void Check2(TInt aValue, TInt aExpected, TInt aLine)
+    {
+    if(aValue != aExpected)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expected: %d, got: %d. Line %d\r\n"), aExpected, aValue, aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+#define TEST(arg) ::Check1((arg), __LINE__)
+#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+static void MarkHandles()
+    {
+    RThread().HandleCount(TheProcessHandleCount, TheThreadHandleCount);
+    }
+
+static void MarkAllocatedCells()
+    {
+    TheAllocatedCellsCount = User::CountAllocCells();
+    }
+
+static void CheckAllocatedCells()
+    {
+    TInt allocatedCellsCount = User::CountAllocCells();
+    TEST2(allocatedCellsCount, TheAllocatedCellsCount);
+    }
+
+static void CheckHandles()
+    {
+    TInt endProcessHandleCount;
+    TInt endThreadHandleCount;
+    
+    RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
+
+    TEST2(TheProcessHandleCount, endProcessHandleCount);
+    TEST2(TheThreadHandleCount, endThreadHandleCount);
+    }
+
+static void OomPreStep(TInt aFailingAllocationNo, TFeatMgrOomTestMode aMode = EFeatMgrOomClientTestMode)
+    {
+    if(aMode == EFeatMgrOomClientTestMode)
+        {
+        MarkHandles();
+        MarkAllocatedCells();
+        __UHEAP_MARK;
+        __UHEAP_SETBURSTFAIL(RAllocator::EBurstFailNext, aFailingAllocationNo, KBurstRate);
+        }
+    else
+        {
+        TFeatMgrResourceTester::Mark();
+        TFeatMgrResourceTester::SetHeapFailure(RHeap::EBurstFailNext, aFailingAllocationNo);
+        }
+    }
+
+static void OomPostStep(TFeatMgrOomTestMode aMode = EFeatMgrOomClientTestMode)
+    {
+    if(aMode == EFeatMgrOomClientTestMode)
+        {
+        __UHEAP_RESET;
+        __UHEAP_MARKEND;
+        CheckAllocatedCells();
+        CheckHandles();
+        }
+    else
+        {
+        TFeatMgrResourceTester::SetHeapFailure(RHeap::ENone, 0);
+        TFeatMgrResourceTester::Check();
+        }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4068
+@SYMTestCaseDesc        Include test case 4069 too
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void ControlOpenOomTest(TBool aUseConnect)
+    {
+    TInt err = KErrNoMemory;
+    TInt failingAllocationNo = 0;
+    RFeatureControl ctrl;
+    TheTest.Printf(_L("Iteration:\r\n"));
+    while(err == KErrNoMemory)
+        {
+        TheTest.Printf(_L(" %d"), ++failingAllocationNo);
+        OomPreStep(failingAllocationNo);
+        err = aUseConnect ? ctrl.Connect() : ctrl.Open();
+        ctrl.Close();
+        OomPostStep();
+        }
+    if(err != KErrNoMemory)
+        {
+        TEST2(err, KErrNone);   
+        }
+    TheTest.Printf(_L("\r\n===OOM test succeeded at heap failure rate of %d ===\r\n"), failingAllocationNo);
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4070
+@SYMTestCaseDesc        Include test case 4071-4077 too
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void ControlFeatureSupportedOomTest(TBool aUseUid, TBool aInvalidFeature, TFeatMgrOomTestMode aMode)
+    {
+    RFeatureControl ctrl;
+    TInt err = ctrl.Open();
+    TEST2(err, KErrNone);
+    
+    const TUid KFeatureUid(aInvalidFeature ? KInvalidFeatureUid : KConnectivity);
+    TFeatureEntry fentry(KFeatureUid);
+    
+    err = KErrNoMemory;
+    TInt failingAllocationNo = 0;
+    TheTest.Printf(_L("Iteration:\r\n"));
+    while(err == KErrNoMemory)
+        {
+        TheTest.Printf(_L(" %d"), ++failingAllocationNo);
+        OomPreStep(failingAllocationNo, aMode);
+        err = aUseUid ? ctrl.FeatureSupported(KFeatureUid) : ctrl.FeatureSupported(fentry);
+        OomPostStep(aMode);
+        }
+    ctrl.Close();
+    if(err != KErrNoMemory)
+        {
+        TEST2(err, aInvalidFeature ? KErrNotFound : KFeatureSupported);   
+        }
+    TheTest.Printf(_L("\r\n===OOM test succeeded at heap failure rate of %d ===\r\n"), failingAllocationNo);
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4078
+@SYMTestCaseDesc        Include test case 4079 too
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void ControlListSupportedFeaturesOomTest(TFeatMgrOomTestMode aMode)
+    {
+    RFeatureControl ctrl;
+    TInt err = ctrl.Open();
+    TEST2(err, KErrNone);
+    
+    err = KErrNoMemory;
+    TInt failingAllocationNo = 0;
+    TheTest.Printf(_L("Iteration:\r\n"));
+    while(err == KErrNoMemory)
+        {
+        TheTest.Printf(_L(" %d"), ++failingAllocationNo);
+        OomPreStep(failingAllocationNo, aMode);
+        const TInt KGranularity = 1;
+        RFeatureUidArray farray(KGranularity);
+        err = ctrl.ListSupportedFeatures(farray);
+        if(err != KErrNoMemory)
+            {
+            TEST2(err, KErrNone);
+            TInt count = farray.Count();
+            TheTest.Printf(_L("===Features count: %d\r\n"), count);
+            TEST(count > 0);
+            }
+        farray.Close();
+        OomPostStep(aMode);
+        }
+    ctrl.Close();
+    TheTest.Printf(_L("\r\n===OOM test succeeded at heap failure rate of %d ===\r\n"), failingAllocationNo);
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4080
+@SYMTestCaseDesc        Include test case 4081 too
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void ControlFeaturesSupportedOomTest(TFeatMgrOomTestMode aMode)
+    {
+    RFeatureControl ctrl;
+    TInt err = ctrl.Open();
+    TEST2(err, KErrNone);
+    RFeatureUidArray farray;
+    err = ctrl.ListSupportedFeatures(farray);
+    TEST2(err, KErrNone);
+    
+    err = KErrNoMemory;
+    TInt failingAllocationNo = 0;
+    TheTest.Printf(_L("Iteration:\r\n"));
+    while(err == KErrNoMemory)
+        {
+        TheTest.Printf(_L(" %d"), ++failingAllocationNo);
+        OomPreStep(failingAllocationNo, aMode);
+        RFeatureArray farray2;
+        err = KErrNone;
+        for(TInt i=0;i<farray.Count() && err==KErrNone;++i)
+            {
+            err = farray2.Append(farray[i]); 
+            }
+        if(err == KErrNone)
+            {
+            err = ctrl.FeaturesSupported(farray2);
+            }
+        if(err != KErrNoMemory)
+            {
+            TEST2(err, KErrNone);
+            TInt count = farray2.Count();
+            TheTest.Printf(_L("===Features count: %d\r\n"), count);
+            TEST(count > 0);
+            }
+        farray2.Close();
+        OomPostStep(aMode);
+        }
+    farray.Close();
+    ctrl.Close();
+    TheTest.Printf(_L("\r\n===OOM test succeeded at heap failure rate of %d ===\r\n"), failingAllocationNo);
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4082
+@SYMTestCaseDesc        Include test case 4083 too
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void ControlAddFeatureOomTest(TFeatMgrOomTestMode aMode)
+    {
+    RFeatureControl ctrl;
+    TInt err = ctrl.Open();
+    TEST2(err, KErrNone);
+
+    const TUid KNewFeatureUid = {0x7888ABCE}; 
+    TBitFlags32 flags;
+    flags.Set(EFeatureSupported);
+    flags.Set(EFeatureModifiable);
+    TFeatureEntry fentry(KNewFeatureUid, flags, 0x0);
+    
+    err = KErrNoMemory;
+    TInt failingAllocationNo = 0;
+    TheTest.Printf(_L("Iteration:\r\n"));
+    while(err == KErrNoMemory)
+        {
+        TheTest.Printf(_L(" %d"), ++failingAllocationNo);
+        OomPreStep(failingAllocationNo, aMode);
+        err = ctrl.AddFeature(fentry);
+        OomPostStep(aMode);
+        if(err == KErrNoMemory)
+            {
+            err = ctrl.EnableFeature(fentry.FeatureUid());
+            TEST2(err, KErrNotFound);
+            }
+        }
+    TEST2(err, KErrNone);
+    err = ctrl.DeleteFeature(fentry.FeatureUid());
+    TEST2(err, KErrNone);
+    
+    ctrl.Close();
+    TheTest.Printf(_L("\r\n===OOM test succeeded at heap failure rate of %d ===\r\n"), failingAllocationNo);
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4084
+@SYMTestCaseDesc        Include test case 4085 too
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void ControlDeleteFeatureOomTest(TFeatMgrOomTestMode aMode)
+    {
+    RFeatureControl ctrl;
+    TInt err = ctrl.Open();
+    TEST2(err, KErrNone);
+
+    const TUid KNewFeatureUid = {0x7888ABCE}; 
+    TBitFlags32 flags;
+    flags.Set(EFeatureSupported);
+    flags.Set(EFeatureModifiable);
+    TFeatureEntry fentry(KNewFeatureUid, flags, 0x0);
+    err = ctrl.AddFeature(fentry);
+    TEST2(err, KErrNone);
+    
+    err = KErrNoMemory;
+    TInt failingAllocationNo = 0;
+    TheTest.Printf(_L("Iteration:\r\n"));
+    while(err == KErrNoMemory)
+        {
+        TheTest.Printf(_L(" %d"), ++failingAllocationNo);
+        OomPreStep(failingAllocationNo, aMode);
+        err = ctrl.DeleteFeature(fentry.FeatureUid());
+        OomPostStep(aMode);
+        if(err == KErrNoMemory)
+            {
+            err = ctrl.EnableFeature(fentry.FeatureUid());
+            TEST2(err, KErrNone);
+            }
+        }
+    TEST2(err, KErrNone);
+    
+    ctrl.Close();
+    TheTest.Printf(_L("\r\n===OOM test succeeded at heap failure rate of %d ===\r\n"), failingAllocationNo);
+    }
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class TTestFeatureObserver : public MFeatureObserver
+    {
+    public: 
+        virtual void HandleNotifyChange(TFeatureChangeType /*aType*/, TFeatureEntry /*aFeature*/)
+            {
+            }
+        virtual void HandleNotifyError(TInt /*aError*/)
+            {
+            }
+    };
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4086
+@SYMTestCaseDesc        Include test case 4087 too
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void NotifierNewLOomTest(TFeatMgrOomTestMode aMode)
+    {
+    CActiveScheduler* scheduler = new CActiveScheduler;
+    TEST(scheduler != NULL);
+    CActiveScheduler::Install(scheduler);
+    
+    RFeatureControl ctrl;
+    TInt err = ctrl.Open();
+    TEST2(err, KErrNone);
+    
+    TTestFeatureObserver observer;
+    err = KErrNoMemory;
+    TInt failingAllocationNo = 0;
+    TheTest.Printf(_L("Iteration:\r\n"));
+    while(err == KErrNoMemory)
+        {
+        TheTest.Printf(_L(" %d"), ++failingAllocationNo);
+        OomPreStep(failingAllocationNo, aMode);
+        CFeatureNotifier* notifier = NULL;
+        TRAP(err, notifier = CFeatureNotifier::NewL(observer));
+        delete notifier;
+        OomPostStep(aMode);
+        }
+    TEST2(err, KErrNone);
+    ctrl.Close();
+    delete scheduler;
+    TheTest.Printf(_L("\r\n===OOM test succeeded at heap failure rate of %d ===\r\n"), failingAllocationNo);
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4088
+@SYMTestCaseDesc        Include test case 4089-4091 too
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void NotifierNotifyRequestOomTest(TBool aInvalidFeature, TFeatMgrOomTestMode aMode)
+    {
+    CActiveScheduler* scheduler = new CActiveScheduler;
+    TEST(scheduler != NULL);
+    CActiveScheduler::Install(scheduler);
+    
+    RFeatureControl ctrl;
+    TInt err = ctrl.Open();
+    TEST2(err, KErrNone);
+    
+    TTestFeatureObserver observer;
+    CFeatureNotifier* notifier = NULL;
+    TRAP(err, notifier = CFeatureNotifier::NewL(observer));
+    TEST2(err, KErrNone);
+
+    const TUid KFeatureUid(aInvalidFeature ? KInvalidFeatureUid : KConnectivity);
+    
+    err = KErrNoMemory;
+    TInt failingAllocationNo = 0;
+    TheTest.Printf(_L("Iteration:\r\n"));
+    while(err == KErrNoMemory)
+        {
+        TheTest.Printf(_L(" %d"), ++failingAllocationNo);
+        OomPreStep(failingAllocationNo, aMode);
+        err = notifier->NotifyRequest(KFeatureUid);
+        (void)notifier->NotifyCancelAll();
+        OomPostStep(aMode);
+        }
+    TEST2(err, KErrNone);
+    delete notifier;
+    ctrl.Close();
+    delete scheduler;
+    TheTest.Printf(_L("\r\n===OOM test succeeded at heap failure rate of %d ===\r\n"), failingAllocationNo);
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4092
+@SYMTestCaseDesc        Include test case 4093 too
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void NotifierNotifyRequestsOomTest(TFeatMgrOomTestMode aMode)
+    {
+    CActiveScheduler* scheduler = new CActiveScheduler;
+    TEST(scheduler != NULL);
+    CActiveScheduler::Install(scheduler);
+    
+    RFeatureControl ctrl;
+    TInt err = ctrl.Open();
+    TEST2(err, KErrNone);
+    
+    TTestFeatureObserver observer;
+    CFeatureNotifier* notifier = NULL;
+    TRAP(err, notifier = CFeatureNotifier::NewL(observer));
+    TEST2(err, KErrNone);
+
+    RFeatureUidArray features;
+    err = features.Append(KConnectivity);
+    TEST2(err, KErrNone);
+    err = features.Append(KFax);
+    TEST2(err, KErrNone);
+    err = features.Append(KConnectivity);
+    TEST2(err, KErrNone);
+    err = features.Append(KLocationManagement);
+    TEST2(err, KErrNone);
+    
+    err = KErrNoMemory;
+    TInt failingAllocationNo = 0;
+    TheTest.Printf(_L("Iteration:\r\n"));
+    while(err == KErrNoMemory)
+        {
+        TheTest.Printf(_L(" %d"), ++failingAllocationNo);
+        OomPreStep(failingAllocationNo, aMode);
+        err = notifier->NotifyRequest(features);
+        (void)notifier->NotifyCancelAll();
+        OomPostStep(aMode);
+        }
+    TEST2(err, KErrNone);
+    features.Close();
+    delete notifier;
+    ctrl.Close();
+    delete scheduler;
+    TheTest.Printf(_L("\r\n===OOM test succeeded at heap failure rate of %d ===\r\n"), failingAllocationNo);
+    }
+
+void PreTest()
+    {
+    // Connect session
+    RFs fsSession;
+    User::LeaveIfError(fsSession.Connect()); 
+    
+    TEntry entry;
+    TInt err = fsSession.Entry(KZFeaturesDir, entry);
+    if (err == KErrNotFound)
+        {
+        err = fsSession.MkDir(KZFeaturesDir);
+        }
+    TEST2 (err, KErrNone);
+    err = BaflUtils::CopyFile(fsSession, KZOrgFeaturesFile, KZFeaturesDir);
+    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();
+    }
+
+void DoTestsL()
+    {
+    
+    TheTest.Start(_L("@SYMTestCaseID:PDS-EFM-CT-4068 RFeatureControl::Connect() OOM test"));
+    PreTest();
+    ControlOpenOomTest(ETrue);
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4069 RFeatureControl::Open() OOM test"));
+    ControlOpenOomTest(EFalse);
+    
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4070 RFeatureControl::FeatureSupported(UID) + valid feature, client side OOM test"));
+    ControlFeatureSupportedOomTest(ETrue, EFalse, EFeatMgrOomClientTestMode);
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4071 RFeatureControl::FeatureSupported(UID) + valid feature, server side OOM test"));
+    ControlFeatureSupportedOomTest(ETrue, EFalse, EFeatMgrOomServerTestMode);
+    
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4072 RFeatureControl::FeatureSupported() + valid feature, client side OOM test"));
+    ControlFeatureSupportedOomTest(EFalse, EFalse, EFeatMgrOomClientTestMode);
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4073 RFeatureControl::FeatureSupported() + valid feature, server side OOM test"));
+    ControlFeatureSupportedOomTest(EFalse, EFalse, EFeatMgrOomServerTestMode);
+    
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4074 RFeatureControl::FeatureSupported(UID) + invalid feature, client side OOM test"));
+    ControlFeatureSupportedOomTest(ETrue, ETrue, EFeatMgrOomClientTestMode);
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4075 RFeatureControl::FeatureSupported(UID) + invalid feature, server side OOM test"));
+    ControlFeatureSupportedOomTest(ETrue, ETrue, EFeatMgrOomServerTestMode);
+    
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4076 RFeatureControl::FeatureSupported() + invalid feature, client side OOM OOM test"));
+    ControlFeatureSupportedOomTest(EFalse, ETrue, EFeatMgrOomClientTestMode);
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4077 RFeatureControl::FeatureSupported() + invalid feature, server side OOM OOM test"));
+    ControlFeatureSupportedOomTest(EFalse, ETrue, EFeatMgrOomServerTestMode);
+    
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4078 RFeatureControl::ListSupportedFeatures(), client side OOM test"));
+    ControlListSupportedFeaturesOomTest(EFeatMgrOomClientTestMode);
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4079 RFeatureControl::ListSupportedFeatures(), server side OOM test"));
+    ControlListSupportedFeaturesOomTest(EFeatMgrOomServerTestMode);
+    
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4080 RFeatureControl::FeaturesSupported(), client side OOM test"));
+    ControlFeaturesSupportedOomTest(EFeatMgrOomClientTestMode);
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4081 RFeatureControl::FeaturesSupported(),server side OOM test"));
+    ControlFeaturesSupportedOomTest(EFeatMgrOomServerTestMode);
+    
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4082 RFeatureControl::AddFeature(), client side OOM test"));
+    ControlAddFeatureOomTest(EFeatMgrOomClientTestMode);
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4083 RFeatureControl::AddFeature(), server side OOM test"));
+    ControlAddFeatureOomTest(EFeatMgrOomServerTestMode);
+    
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4084 RFeatureControl::DeleteFeature(), client side OOM test"));
+    ControlDeleteFeatureOomTest(EFeatMgrOomClientTestMode);
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4085 RFeatureControl::DeleteFeature(), server side OOM test"));
+    ControlDeleteFeatureOomTest(EFeatMgrOomServerTestMode);
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4086 CFeatureNotifier::NewL(), client side OOM test"));
+    NotifierNewLOomTest(EFeatMgrOomClientTestMode);
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4087 CFeatureNotifier::NewL(), server side OOM test"));
+    NotifierNewLOomTest(EFeatMgrOomServerTestMode);
+    
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4088 CFeatureNotifier::NotifyRequest(), valid feature, client side OOM test"));
+    NotifierNotifyRequestOomTest(ETrue, EFeatMgrOomClientTestMode);
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4089 CFeatureNotifier::NotifyRequest(), valid feature, server side OOM test"));
+    NotifierNotifyRequestOomTest(ETrue, EFeatMgrOomServerTestMode);
+    
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4090 CFeatureNotifier::NotifyRequest(), invalid feature, client side OOM test"));
+    NotifierNotifyRequestOomTest(EFalse, EFeatMgrOomClientTestMode);
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4091 CFeatureNotifier::NotifyRequest(), invalid feature, server side OOM test"));
+    NotifierNotifyRequestOomTest(EFalse, EFeatMgrOomServerTestMode);
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4092 CFeatureNotifier::NotifyRequest(<array>), valid feature, client side OOM test"));
+    NotifierNotifyRequestsOomTest(EFeatMgrOomClientTestMode);
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4093 CFeatureNotifier::NotifyRequest(<array>), valid feature, server side OOM test"));
+    NotifierNotifyRequestsOomTest(EFeatMgrOomServerTestMode);
+    
+    PostTest();
+    }
+
+TInt E32Main()
+    {
+    TheTest.Title();
+    
+    CTrapCleanup* tc = CTrapCleanup::New();
+    TheTest(tc != NULL);
+    
+    __UHEAP_MARK;
+    
+    TRAPD(err, DoTestsL());
+    DestroyTestEnv();
+    TEST2(err, KErrNone);
+
+    __UHEAP_MARKEND;
+    
+    TheTest.End();
+    TheTest.Close();
+    
+    delete tc;
+
+    User::Heap().Check();
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrpanic.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,337 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32test.h>
+#include <featmgr.h>
+#include <featureuids.h>
+#include "featurepanics.h"
+#include <featurecontrol.h>
+#include <featurenotifier.h>
+
+using namespace NFeature;
+
+static RTest TheTest(_L("t_fmgrpanic"));
+
+_LIT(KPanicCategory, "RFeatureControl");
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+//Deletes all created test files.
+void DestroyTestEnv()
+    {
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+//Test macros and functions
+void Check1(TInt aValue, TInt aLine)
+    {
+    if(!aValue)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expression evaluated to false. Line %d\r\n"), aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+void Check2(TInt aValue, TInt aExpected, TInt aLine)
+    {
+    if(aValue != aExpected)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expected: %d, got: %d. Line %d\r\n"), aExpected, aValue, aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+#define TEST(arg) ::Check1((arg), __LINE__)
+#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+//Panic thread function. 
+//It will cast aData parameter to a TFunctor pointer and call it.
+//The expectation is that the called function will panic and kill the panic thread.
+TInt ThreadFunc(void* aData)
+    {
+    CTrapCleanup* tc = CTrapCleanup::New();
+    TEST(tc != NULL);
+    
+    User::SetJustInTime(EFalse);    // disable debugger panic handling
+    
+    TFunctor* obj = reinterpret_cast<TFunctor*> (aData);
+    TEST(obj != NULL);
+    (*obj)();//call the panic function
+    
+    delete tc;
+    
+    return KErrNone;        
+    }
+
+//Panic test.
+//PanicTest function will create a new thread - panic thread, giving it a pointer to the function which has to
+//be executed and the expectation is that the function will panic and kill the panic thread.
+//PanicTest function will check the panic thread exit code, exit category and the panic code.
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4094
+@SYMTestCaseDesc        Include test case 4105 too
+@SYMTestPriority        High
+@SYMTestActions         PanicTest function will create a new thread - panic 
+                        thread, giving it a pointer to the function which has to
+                        be executed and the expectation is that the function 
+                        will panic and kill the panic thread.
+                        PanicTest function will check the panic thread exit code,
+                        exit category and the panic code.         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void PanicTest(TFunctor& aFunctor, TExitType aExpectedExitType, const TDesC& aExpectedCategory, TInt aExpectedPanicCode)
+    {
+    RThread thread;
+    _LIT(KThreadName,"FeatMgrPanicThread");
+    TEST2(thread.Create(KThreadName, &ThreadFunc, 0x2000, 0x1000, 0x10000, (void*)&aFunctor, EOwnerThread), KErrNone);
+    
+    TRequestStatus status;
+    thread.Logon(status);
+    TEST2(status.Int(), KRequestPending);
+    thread.Resume();
+    User::WaitForRequest(status);
+    User::SetJustInTime(ETrue); // enable debugger panic handling
+
+    TEST2(thread.ExitType(), aExpectedExitType);
+    TEST(thread.ExitCategory() == aExpectedCategory);
+    TEST2(thread.ExitReason(), aExpectedPanicCode);
+    
+    CLOSE_AND_WAIT(thread);
+    }
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////     Panic test functions    /////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//1 Panic when calling RFeatureControl::FeatureSupported() on an invalid RFeatureControl object.
+class TFeatureControl_NotCreated_FeatureSupported1 : public TFunctor
+    {
+private:        
+    virtual void operator()()
+        {
+        RFeatureControl ctrl;
+        (void)ctrl.FeatureSupported(KConnectivity);
+        }
+    };
+static TFeatureControl_NotCreated_FeatureSupported1 TheFeatureControl_NotCreated_FeatureSupported1;
+
+//2 Panic when calling RFeatureControl::FeatureSupported() on an invalid RFeatureControl object.
+class TFeatureControl_NotCreated_FeatureSupported2 : public TFunctor
+    {
+private:        
+    virtual void operator()()
+        {
+        RFeatureControl ctrl;
+        TFeatureEntry fentry;
+        (void)ctrl.FeatureSupported(fentry);
+        }
+    };
+static TFeatureControl_NotCreated_FeatureSupported2 TheFeatureControl_NotCreated_FeatureSupported2;
+
+//Panic when calling RFeatureControl::FeaturesSupported() on an invalid RFeatureControl object.
+class TFeatureControl_NotCreated_FeaturesSupported : public TFunctor
+    {
+private:        
+    virtual void operator()()
+        {
+        RFeatureControl ctrl;
+        RFeatureArray farray;
+        TFeatureEntry fentry;
+        TInt err = farray.Append(fentry);
+        TEST2(err, KErrNone);
+        (void)ctrl.FeaturesSupported(farray);
+        }
+    };
+static TFeatureControl_NotCreated_FeaturesSupported TheFeatureControl_NotCreated_FeaturesSupported;
+
+//Panic when calling RFeatureControl::EnableFeature() on an invalid RFeatureControl object.
+class TFeatureControl_NotCreated_EnableFeature : public TFunctor
+    {
+private:        
+    virtual void operator()()
+        {
+        RFeatureControl ctrl;
+        (void)ctrl.EnableFeature(KConnectivity);
+        }
+    };
+static TFeatureControl_NotCreated_EnableFeature TheFeatureControl_NotCreated_EnableFeature;
+
+//Panic when calling RFeatureControl::DisableFeature() on an invalid RFeatureControl object.
+class TFeatureControl_NotCreated_DisableFeature : public TFunctor
+    {
+private:        
+    virtual void operator()()
+        {
+        RFeatureControl ctrl;
+        (void)ctrl.DisableFeature(KConnectivity);
+        }
+    };
+static TFeatureControl_NotCreated_DisableFeature TheFeatureControl_NotCreated_DisableFeature;
+
+//1 Panic when calling RFeatureControl::SetFeature() on an invalid RFeatureControl object.
+class TFeatureControl_NotCreated_SetFeature1 : public TFunctor
+    {
+private:        
+    virtual void operator()()
+        {
+        RFeatureControl ctrl;
+        (void)ctrl.SetFeature(KConnectivity, EFalse, 0);
+        }
+    };
+static TFeatureControl_NotCreated_SetFeature1 TheFeatureControl_NotCreated_SetFeature1;
+
+//2 Panic when calling RFeatureControl::SetFeature() on an invalid RFeatureControl object.
+class TFeatureControl_NotCreated_SetFeature2 : public TFunctor
+    {
+private:        
+    virtual void operator()()
+        {
+        RFeatureControl ctrl;
+        (void)ctrl.SetFeature(KConnectivity, 0);
+        }
+    };
+static TFeatureControl_NotCreated_SetFeature2 TheFeatureControl_NotCreated_SetFeature2;
+
+//Panic when calling RFeatureControl::AddFeature() on an invalid RFeatureControl object.
+class TFeatureControl_NotCreated_AddFeature : public TFunctor
+    {
+private:        
+    virtual void operator()()
+        {
+        RFeatureControl ctrl;
+        TFeatureEntry fentry;
+        (void)ctrl.AddFeature(fentry);
+        }
+    };
+static TFeatureControl_NotCreated_AddFeature TheFeatureControl_NotCreated_AddFeature;
+
+//Panic when calling RFeatureControl::DeleteFeature() on an invalid RFeatureControl object.
+class TFeatureControl_NotCreated_DeleteFeature : public TFunctor
+    {
+private:        
+    virtual void operator()()
+        {
+        RFeatureControl ctrl;
+        (void)ctrl.DeleteFeature(KConnectivity);
+        }
+    };
+static TFeatureControl_NotCreated_DeleteFeature TheFeatureControl_NotCreated_DeleteFeature;
+
+//Panic when calling RFeatureControl::ListSupportedFeatures() on an invalid RFeatureControl object.
+class TFeatureControl_NotCreated_ListSupportedFeatures : public TFunctor
+    {
+private:        
+    virtual void operator()()
+        {
+        RFeatureControl ctrl;
+        RFeatureUidArray farray;
+        (void)ctrl.ListSupportedFeatures(farray);
+        }
+    };
+static TFeatureControl_NotCreated_ListSupportedFeatures TheFeatureControl_NotCreated_ListSupportedFeatures;
+
+//Panic when calling RFeatureControl::SWIStart() on an invalid RFeatureControl object.
+class TFeatureControl_NotCreated_SWIStart : public TFunctor
+    {
+private:        
+    virtual void operator()()
+        {
+        RFeatureControl ctrl;
+        (void)ctrl.SWIStart();
+        }
+    };
+static TFeatureControl_NotCreated_SWIStart TheFeatureControl_NotCreated_SWIStart;
+
+//Panic when calling RFeatureControl::SWIEnd() on an invalid RFeatureControl object.
+class TFeatureControl_NotCreated_SWIEnd : public TFunctor
+    {
+private:        
+    virtual void operator()()
+        {
+        RFeatureControl ctrl;
+        (void)ctrl.SWIEnd();
+        }
+    };
+static TFeatureControl_NotCreated_SWIEnd TheFeatureControl_NotCreated_SWIEnd;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void DoTestsL()
+    {
+    TheTest.Start(_L("@SYMTestCaseID:PDS-EFM-CT-4094 RFeatureControl::FeatureSupported() panic test 1"));
+    PanicTest(TheFeatureControl_NotCreated_FeatureSupported1, EExitPanic, KPanicCategory, EPanicBadHandle);
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4095 RFeatureControl::FeatureSupported() panic test 2"));
+    PanicTest(TheFeatureControl_NotCreated_FeatureSupported2, EExitPanic, KPanicCategory, EPanicBadHandle);
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4096 RFeatureControl::FeaturesSupported() panic test"));
+    PanicTest(TheFeatureControl_NotCreated_FeaturesSupported, EExitPanic, KPanicCategory, EPanicBadHandle);
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4097 RFeatureControl::EnableFeature() panic test"));
+    PanicTest(TheFeatureControl_NotCreated_EnableFeature, EExitPanic, KPanicCategory, EPanicBadHandle);
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4098 RFeatureControl::DisableFeature() panic test"));
+    PanicTest(TheFeatureControl_NotCreated_DisableFeature, EExitPanic, KPanicCategory, EPanicBadHandle);
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4099 RFeatureControl::SetFeature() panic test 1"));
+    PanicTest(TheFeatureControl_NotCreated_SetFeature1, EExitPanic, KPanicCategory, EPanicBadHandle);
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4100 RFeatureControl::SetFeature() panic test 2"));
+    PanicTest(TheFeatureControl_NotCreated_SetFeature2, EExitPanic, KPanicCategory, EPanicBadHandle);
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4101 RFeatureControl::AddFeature() panic test"));
+    PanicTest(TheFeatureControl_NotCreated_AddFeature, EExitPanic, KPanicCategory, EPanicBadHandle);
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4102 RFeatureControl::DeleteFeature() panic test"));
+    PanicTest(TheFeatureControl_NotCreated_DeleteFeature, EExitPanic, KPanicCategory, EPanicBadHandle);
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4103 RFeatureControl::ListSupportedFeatures() panic test"));
+    PanicTest(TheFeatureControl_NotCreated_ListSupportedFeatures, EExitPanic, KPanicCategory, EPanicBadHandle);
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4104 RFeatureControl::SWIStart() panic test"));
+    PanicTest(TheFeatureControl_NotCreated_SWIStart, EExitPanic, KPanicCategory, EPanicBadHandle);
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4105 RFeatureControl::SWIEnd() panic test"));
+    PanicTest(TheFeatureControl_NotCreated_SWIEnd, EExitPanic, KPanicCategory, EPanicBadHandle);
+    }
+
+TInt E32Main()
+    {
+    TheTest.Title();
+    
+    CTrapCleanup* tc = CTrapCleanup::New();
+    TheTest(tc != NULL);
+    
+    __UHEAP_MARK;
+    
+    TRAPD(err, DoTestsL());
+    DestroyTestEnv();
+    TEST2(err, KErrNone);
+
+    __UHEAP_MARKEND;
+    
+    TheTest.End();
+    TheTest.Close();
+    
+    delete tc;
+
+    User::Heap().Check();
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrperformance.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,299 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32test.h>
+#include <hal.h>
+#include <featmgr.h>
+#include <featureuids.h>
+#include <featurecontrol.h>
+#include <featdiscovery.h>
+
+using namespace NFeature;
+
+TInt TheFastCounterFreq = 0;
+
+const TInt KInvalidFeatureId1 = 90901671;
+const TUid KInvalidFeatureUid1 = {KInvalidFeatureId1};
+const TUid KNewFeatureUid = {0x7888ABC1}; 
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+static RTest TheTest(_L("t_fmgrperformance"));
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+//Deletes all created test files.
+void DestroyTestEnv()
+    {
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+//Test macros and functions
+void Check1(TInt aValue, TInt aLine)
+    {
+    if(!aValue)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expression evaluated to false. Line %d\r\n"), aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+void Check2(TInt aValue, TInt aExpected, TInt aLine)
+    {
+    if(aValue != aExpected)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expected: %d, got: %d. Line %d\r\n"), aExpected, aValue, aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+#define TEST(arg) ::Check1((arg), __LINE__)
+#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+TInt TimeDiffUs(TUint32 aStartTicks, TUint32 aEndTicks)
+    {
+    if(TheFastCounterFreq == 0)
+        {
+        TEST2(HAL::Get(HAL::EFastCounterFrequency, TheFastCounterFreq), KErrNone);
+        TheTest.Printf(_L("===Fast counter frequency = %d Hz\r\n"), TheFastCounterFreq);
+        }
+    TInt64 diffTicks = (TInt64)aEndTicks - (TInt64)aStartTicks;
+    if(diffTicks < 0)
+        {
+        diffTicks = KMaxTUint32 + diffTicks + 1;
+        }
+    const TInt KMicroSecIn1Sec = 1000000;
+    TInt us = (diffTicks * KMicroSecIn1Sec) / TheFastCounterFreq;
+    return us;
+    }
+
+void PrintTime(const TDesC& aFmt, TUint32 aStartTicks, TUint32 aEndTicks)
+    {
+    TInt us = TimeDiffUs(aStartTicks, aEndTicks);
+    TheTest.Printf(aFmt, us);
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4106
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void FeatureControlTest()
+    {
+    TFeatureEntry fentry;
+    
+    TUint32 start = User::FastCounter();
+    RFeatureControl ctrl;
+    
+    TInt err = ctrl.Open();
+    TEST2(err, KErrNone);
+    TUint32 end = User::FastCounter();
+    PrintTime(_L("===1 RFeatureControl::Open(), time=%d us\r\n"), start, end);
+    
+    //The second RFeatureControl::Open() call is "free", because only one connection per thread is kept in TLS 
+    RFeatureControl ctrl2;
+    start = User::FastCounter();
+    err = ctrl2.Open();
+    TEST2(err, KErrNone);
+    end = User::FastCounter();
+    PrintTime(_L("===2 RFeatureControl::Open(), time=%d us\r\n"), start, end);
+    
+    //
+    start = User::FastCounter();
+    ctrl2.Close();
+    end = User::FastCounter();
+    PrintTime(_L("===2 RFeatureControl::Close(), time=%d us\r\n"), start, end);
+    
+    //
+    TBitFlags32 flags;
+    flags.ClearAll();
+    flags.Set(EFeatureSupported);
+    flags.Set(EFeatureModifiable);
+    
+    fentry = TFeatureEntry(KNewFeatureUid, flags, 0x0);
+    start = User::FastCounter();
+    err = ctrl.AddFeature(fentry);
+    TEST2(err, KErrNone);
+    end = User::FastCounter();
+    PrintTime(_L("===RFeatureControl::AddFeature(), time=%d us\r\n"), start, end);
+    //
+    start = User::FastCounter();
+    err = ctrl.FeatureSupported(KNewFeatureUid);
+    TEST2(err, 1);
+    end = User::FastCounter();
+    PrintTime(_L("===RFeatureControl::FeatureSupported(TUid), time=%d us\r\n"), start, end);
+    //
+    start = User::FastCounter();
+    err = ctrl.FeatureSupported(KInvalidFeatureUid1);
+    TEST2(err, KErrNotFound);
+    end = User::FastCounter();
+    PrintTime(_L("===RFeatureControl::FeatureSupported(invalid TUid), time=%d us\r\n"), start, end);
+    //
+    fentry = TFeatureEntry(KNewFeatureUid);
+    start = User::FastCounter();
+    err = ctrl.FeatureSupported(fentry);
+    TEST2(err, 1);
+    end = User::FastCounter();
+    PrintTime(_L("===RFeatureControl::FeatureSupported(TFeatureEntry), time=%d us\r\n"), start, end);
+    //
+    RFeatureArray farray;
+    err = farray.Append(TFeatureEntry(KNewFeatureUid));
+    TEST2(err, KErrNone);
+    err = farray.Append(TFeatureEntry(KInvalidFeatureUid1));
+    TEST2(err, KErrNone);
+    err = farray.Append(TFeatureEntry(KConnectivity));
+    TEST2(err, KErrNone);
+    err = farray.Append(TFeatureEntry(KUsb));
+    TEST2(err, KErrNone);
+    start = User::FastCounter();
+    err = ctrl.FeaturesSupported(farray);
+    end = User::FastCounter();
+    PrintTime(_L("===RFeatureControl::FeaturesSupported(), time=%d us\r\n"), start, end);
+    TEST2(farray.Count(), 3);//KInvalidFeatureUid1 should have been removed from the array
+    farray.Close();
+    //
+    start = User::FastCounter();
+    err = ctrl.DisableFeature(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    end = User::FastCounter();
+    PrintTime(_L("===1 RFeatureControl::DisableFeature(), time=%d us\r\n"), start, end);
+    //Disable the same feature again
+    start = User::FastCounter();
+    err = ctrl.DisableFeature(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    end = User::FastCounter();
+    PrintTime(_L("===2 RFeatureControl::DisableFeature(already disabled), time=%d us\r\n"), start, end);
+    //
+    start = User::FastCounter();
+    err = ctrl.DisableFeature(KFax);
+    TEST2(err, KErrAccessDenied);
+    end = User::FastCounter();
+    PrintTime(_L("===3 RFeatureControl::DisableFeature(access denied), time=%d us\r\n"), start, end);
+    //
+    start = User::FastCounter();
+    err = ctrl.EnableFeature(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    end = User::FastCounter();
+    PrintTime(_L("===1 RFeatureControl::EnableFeature(), time=%d us\r\n"), start, end);
+    //Enable the same feature again
+    start = User::FastCounter();
+    err = ctrl.EnableFeature(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    end = User::FastCounter();
+    PrintTime(_L("===2 RFeatureControl::EnableFeature(already enabled), time=%d us\r\n"), start, end);
+    //
+    start = User::FastCounter();
+    err = ctrl.EnableFeature(KFax);
+    TEST2(err, KErrAccessDenied);
+    end = User::FastCounter();
+    PrintTime(_L("===3 RFeatureControl::EnableFeature(access denied), time=%d us\r\n"), start, end);
+    //
+    start = User::FastCounter();
+    err = ctrl.SetFeature(KNewFeatureUid, EFalse, 100);
+    TEST2(err, KErrNone);
+    end = User::FastCounter();
+    PrintTime(_L("===1 RFeatureControl::SetFeature(), time=%d us\r\n"), start, end);
+    //
+    start = User::FastCounter();
+    err = ctrl.SetFeature(KNewFeatureUid, 200);
+    TEST2(err, KErrNone);
+    end = User::FastCounter();
+    PrintTime(_L("===2 RFeatureControl::SetFeature(), time=%d us\r\n"), start, end);
+    //
+    RFeatureUidArray farray2;
+    start = User::FastCounter();
+    err = ctrl.ListSupportedFeatures(farray2);
+    TEST2(err, KErrNone);
+    end = User::FastCounter();
+    PrintTime(_L("===RFeatureControl::ListSupportedFeatures(), time=%d us\r\n"), start, end);
+    TEST(farray2.Count() > 0);
+    farray2.Close();
+    //
+    start = User::FastCounter();
+    ctrl.DeleteFeature(KNewFeatureUid);
+    end = User::FastCounter();
+    PrintTime(_L("===RFeatureControl::DeleteFeature(), time=%d us\r\n"), start, end);
+    //
+    start = User::FastCounter();
+    ctrl.Close();
+    end = User::FastCounter();
+    PrintTime(_L("===1 RFeatureControl::Close(), time=%d us\r\n"), start, end);
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4107
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void FeatureManagerTest()
+    {
+    TUint32 start = User::FastCounter();
+    FeatureManager::InitializeLibL();
+    TUint32 end = User::FastCounter();
+    PrintTime(_L("===FeatureManager::InitializeLibL(server already loaded by the previous test), time=%d us\r\n"), start, end);
+    //
+    start = User::FastCounter();
+    TBool rc = FeatureManager::FeatureSupported(KConnectivity.iUid);
+    TEST(rc);
+    end = User::FastCounter();
+    PrintTime(_L("===FeatureManager::FeatureSupported(), time=%d us\r\n"), start, end);
+    //
+    start = User::FastCounter();
+    FeatureManager::UnInitializeLib();  
+    end = User::FastCounter();
+    PrintTime(_L("===FeatureManager::UnInitializeLib(), time=%d us\r\n"), start, end);
+    }
+
+void DoTestsL()
+    {
+    TheTest.Start(_L("@SYMTestCaseID:PDS-EFM-CT-4106 RFeatureControl performance test"));
+    FeatureControlTest();
+
+    TheTest.Next(_L("@SYMTestCaseID:PDS-EFM-CT-4107 FeatureManager performance test"));
+    FeatureManagerTest();
+    }
+
+TInt E32Main()
+    {
+    TheTest.Title();
+    
+    CTrapCleanup* tc = CTrapCleanup::New();
+    TheTest(tc != NULL);
+    
+    __UHEAP_MARK;
+    
+    TRAPD(err, DoTestsL());
+    DestroyTestEnv();
+    TEST2(err, KErrNone);
+
+    __UHEAP_MARKEND;
+    
+    TheTest.End();
+    TheTest.Close();
+    
+    delete tc;
+
+    User::Heap().Check();
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrrestoreresponse.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,182 @@
+// Copyright (c) 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32test.h>
+#include <e32debug.h>
+#include <bautils.h>
+#include <featurecontrol.h>
+#include "t_fmgrbursim.h"
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+RTest TheTest(_L("t_fmgrrestoreresponse"));
+
+const TUint threadTimeout = 2000000;    // thread timeout = 2 seconds 
+
+static RSemaphore MainThreadCrS;
+static TBool featMgrIsResponsive = EFalse;
+
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+//Test macros and functions
+void Check1(TInt aValue, TInt aLine, TBool aPrintThreadName = EFalse)
+    {
+    if(!aValue)
+        {
+        //DeleteTestFiles();
+        if(aPrintThreadName)
+            {
+            RThread th;
+            TName name = th.Name();
+            RDebug::Print(_L("*** Thread %S, Line %d\r\n"), &name, aLine);
+            }
+        else
+            {
+            RDebug::Print(_L("*** Line %d\r\n"), aLine);
+            }
+        TheTest(EFalse, aLine);
+        }
+    }
+
+void Check2(TInt aValue, TInt aExpected, TInt aLine, TBool aPrintThreadName = EFalse)
+    {
+    if(aValue != aExpected)
+        {
+        //DeleteTestFiles();
+        if(aPrintThreadName)
+            {
+            RThread th;
+            TName name = th.Name();
+            RDebug::Print(_L("*** Thread %S, Line %d Expected error: %d, got: %d\r\n"), &name, aLine, aExpected, aValue);
+            }
+        else
+            {
+            RDebug::Print(_L("*** Line %d, Expected error: %d, got: %d\r\n"), aLine, aExpected, aValue);
+            }
+        TheTest(EFalse, aLine);
+        }
+    }
+#define TEST(arg) ::Check1((arg), __LINE__)
+#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
+#define TTEST(arg) ::Check1((arg), __LINE__, ETrue)
+#define TTEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__, ETrue)
+
+// ------------------------- ------------------------- 
+// setup and cleanup functions
+
+TInt TestThreadL(void*)
+    {
+        __UHEAP_MARK;
+        
+        CTrapCleanup* tc = CTrapCleanup::New();
+        RFeatureControl rfc;
+        TTEST2( rfc.Connect(), KErrNone );
+        
+        // During restore, feature manager server should be responsive and return KErrServerBusy for write request 
+        TInt err = rfc.EnableFeature( TUid::Uid(0x00000001) );
+        TTEST2(err, KErrServerBusy);
+		
+        // During restore, feature manager server should be responsive and NOT return KErrServerBusy for read request
+		err = rfc.FeatureSupported( TUid::Uid(0x00000001) );
+		TTEST(err != KErrServerBusy);
+		
+        rfc.Close();
+        featMgrIsResponsive = ETrue;
+        RDebug::Print(_L("+++:TestThread: Query and Modification completed\r\n"));
+        MainThreadCrS.Signal();
+        delete tc;
+        
+        __UHEAP_MARKEND;
+        
+        return KErrNone;
+    }
+/**
+@SYMTestCaseID          PDS-EFM-CT-4058
+@SYMTestCaseDesc        Querying and modifying a feature during restore operation. 
+                        Verify that a response is returned from the server during restore.
+@SYMTestPriority        High
+@SYMTestActions         Start simulating restore operation
+                        Create a thread that will:
+                        Modify a feature and verify that a response (KErrServerBusy) is received 
+                        Query a feature and verify that a response is received (doesn't matter what the result is)
+                        The thread should finished in less than 2 seconds.
+                        Otherwise the test fail.          
+@SYMTestExpectedResults Test must not fail
+@SYMREQ                 
+*/  
+void TestRestoreResponseL()
+    {
+        _LIT(KThreadName, "RstTh");
+        featMgrIsResponsive = EFalse;
+        
+        CFeatMgrBURSim* simulate = CFeatMgrBURSim::NewLC();
+        RThread testThread;
+        TRequestStatus testStatus;
+        CleanupClosePushL( testThread );
+        
+        simulate->Simulate_CheckRegFileL();
+        
+        // Simulate a restore
+        RDebug::Print(_L("Simulating Restore of FeatMgr\r\n"));
+        simulate->Simulate_StartRestoreL();
+
+        TEST2( testThread.Create(KThreadName, &TestThreadL, 0x2000, 0x1000, 0x10000, NULL, EOwnerProcess), KErrNone );
+        testThread.Logon(testStatus);
+        TEST2( testStatus.Int(), KRequestPending );
+        testThread.Resume();
+        // Wait for 1.5 second for the query thread to finish. 
+        RDebug::Print(_L("+++:MainThread: Wait for query and modification completion...\r\n"));
+        MainThreadCrS.Wait(threadTimeout);
+        // If query is responsive within the 1.5 second frame the following check should pass.
+        TEST (featMgrIsResponsive);
+        simulate->Simulate_EndRestoreL();
+        
+        CleanupStack::PopAndDestroy(&testThread);
+        CleanupStack::PopAndDestroy(simulate);
+    }
+
+////////////////////////////////////////////////////////////////////////////////////
+void DoTestsL()
+	{
+    MainThreadCrS.CreateLocal(0);
+    
+    TheTest.Start(_L(" @SYMTestCaseID:PDS-EFM-CT-4058 Restore Query and Modification Response"));
+    TestRestoreResponseL();
+    
+    MainThreadCrS.Close();
+
+	}
+
+TInt E32Main()
+	{
+	TheTest.Title();
+	
+	CTrapCleanup* tc = CTrapCleanup::New();
+	
+	__UHEAP_MARK;
+	
+	TRAPD(err, DoTestsL());
+	TEST2(err, KErrNone);
+
+	__UHEAP_MARKEND;
+	
+	TheTest.End();
+	TheTest.Close();
+	
+	delete tc;
+	
+	User::Heap().Check();
+	return KErrNone;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrsecurity1.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,144 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32test.h>
+#include <featmgr.h>
+#include <featureuids.h>
+#include <featurecontrol.h>
+#include <featdiscovery.h>
+
+using namespace NFeature;
+
+const TInt KInvalidFeatureId1    = 90901671;
+const TUid KInvalidFeatureUid1  = {KInvalidFeatureId1};
+
+///////////////////////////////////////////////////////////////////////////////////////
+//////  Note: This test has no platsec capabilities. It should not be possible to /////
+//////        call platsec protected FeatMgr methods.                             /////
+///////////////////////////////////////////////////////////////////////////////////////
+
+static RTest TheTest(_L("t_fmgrsecurity1"));
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+//Deletes all created test files.
+void DestroyTestEnv()
+    {
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+//Test macros and functions
+void Check1(TInt aValue, TInt aLine)
+    {
+    if(!aValue)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expression evaluated to false. Line %d\r\n"), aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+void Check2(TInt aValue, TInt aExpected, TInt aLine)
+    {
+    if(aValue != aExpected)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expected: %d, got: %d. Line %d\r\n"), aExpected, aValue, aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+#define TEST(arg) ::Check1((arg), __LINE__)
+#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+/**
+@SYMTestCaseID          PDS-FEATMGR-CT-????
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 ????
+*/
+void FeatureControlPlatSecTest()
+    {
+    RFeatureControl ctrl;
+    TInt err = ctrl.Open();
+    TEST2(err, KErrNone);
+
+    err = ctrl.EnableFeature(KConnectivity);
+    TEST2(err, KErrPermissionDenied);
+    err = ctrl.EnableFeature(KInvalidFeatureUid1);
+    TEST2(err, KErrPermissionDenied);
+    
+    err = ctrl.DisableFeature(KConnectivity);
+    TEST2(err, KErrPermissionDenied);
+    err = ctrl.DisableFeature(KInvalidFeatureUid1);
+    TEST2(err, KErrPermissionDenied);
+
+    err = ctrl.SetFeature(KConnectivity, ETrue, 0);
+    TEST2(err, KErrPermissionDenied);
+    err = ctrl.SetFeature(KInvalidFeatureUid1, ETrue, 0);
+    TEST2(err, KErrPermissionDenied);
+    err = ctrl.SetFeature(KConnectivity, 0);
+    TEST2(err, KErrPermissionDenied);
+    err = ctrl.SetFeature(KInvalidFeatureUid1, 0);
+    TEST2(err, KErrPermissionDenied);
+
+    TFeatureEntry fentry;
+    err = ctrl.AddFeature(fentry);
+    TEST2(err, KErrPermissionDenied);
+    err = ctrl.DeleteFeature(KConnectivity);
+    TEST2(err, KErrPermissionDenied);
+    err = ctrl.DeleteFeature(KInvalidFeatureUid1);
+    TEST2(err, KErrPermissionDenied);
+    
+    err = ctrl.SWIStart();
+    TEST2(err, KErrPermissionDenied);
+    err = ctrl.SWIEnd();
+    TEST2(err, KErrPermissionDenied);
+    
+    ctrl.Close();
+    }
+
+void DoTestsL()
+    {
+    TheTest.Start(_L("@SYMTestCaseID:PDS-EFM-CT-4108 RFeatureControl platsec test"));
+    FeatureControlPlatSecTest();
+    }
+
+TInt E32Main()
+    {
+    TheTest.Title();
+    
+    CTrapCleanup* tc = CTrapCleanup::New();
+    TheTest(tc != NULL);
+    
+    __UHEAP_MARK;
+    
+    TRAPD(err, DoTestsL());
+    DestroyTestEnv();
+    TEST2(err, KErrNone);
+
+    __UHEAP_MARKEND;
+    
+    TheTest.End();
+    TheTest.Close();
+    
+    delete tc;
+
+    User::Heap().Check();
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrstartup.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,269 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32test.h>
+#include <bautils.h>
+#include "featmgrserver.h"
+#include "featmgrconfiguration.h"
+
+static TInt TheProcessHandleCount = 0;
+static TInt TheThreadHandleCount = 0;
+static TInt TheAllocatedCellsCount = 0;
+
+#ifdef EXTENDED_FEATURE_MANAGER_TEST
+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
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+//Deletes all created test files.
+void DestroyTestEnv()
+    {
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+//Test macros and functions
+void Check1(TInt aValue, TInt aLine)
+    {
+    if(!aValue)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expression evaluated to false. Line %d\r\n"), aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+void Check2(TInt aValue, TInt aExpected, TInt aLine)
+    {
+    if(aValue != aExpected)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expected: %d, got: %d. Line %d\r\n"), aExpected, aValue, aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+#define TEST(arg) ::Check1((arg), __LINE__)
+#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+static void MarkHandles()
+    {
+    RThread().HandleCount(TheProcessHandleCount, TheThreadHandleCount);
+    }
+
+static void MarkAllocatedCells()
+    {
+    TheAllocatedCellsCount = User::CountAllocCells();
+    }
+
+static void CheckAllocatedCells()
+    {
+    TInt allocatedCellsCount = User::CountAllocCells();
+    TEST2(allocatedCellsCount, TheAllocatedCellsCount);
+    }
+
+static void CheckHandles()
+    {
+    TInt endProcessHandleCount;
+    TInt endThreadHandleCount;
+    
+    RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
+
+    TEST2(TheProcessHandleCount, endProcessHandleCount);
+    TEST2(TheThreadHandleCount, endThreadHandleCount);
+    }
+
+static void OomPreStep(TInt aFailingAllocationNo)
+    {
+    aFailingAllocationNo = aFailingAllocationNo; //to silent the warning in urel build
+    MarkHandles();
+    MarkAllocatedCells();
+    __UHEAP_MARK;
+    __UHEAP_SETBURSTFAIL(RAllocator::EBurstFailNext, aFailingAllocationNo, KBurstRate);
+    }
+
+static void OomPostStep()
+    {
+    __UHEAP_RESET;
+    __UHEAP_MARKEND;
+    CheckAllocatedCells();
+    CheckHandles();
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+static void CreateAndDestroyFeatMgrServerL()
+    {
+    CFeatMgrServer* server = CFeatMgrServer::NewLC(KServerCActivePriority);
+    CleanupStack::PopAndDestroy(server);
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4109
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void FeatMgrServerStartupOomTest()
+//TODO - panics in CFeatMgrServer::LoadPluginsL() because the error is KErrNoMemory
+    {
+    TInt err = KErrNoMemory;
+    TInt failingAllocationNo = 0;
+    TheTest.Printf(_L("Iteration:\r\n"));
+    while(err == KErrNoMemory)
+        {
+        TheTest.Printf(_L(" %d"), ++failingAllocationNo);
+        OomPreStep(failingAllocationNo);
+        TRAP(err, CreateAndDestroyFeatMgrServerL());
+        OomPostStep();
+        }
+    if(err != KErrNoMemory)
+        {
+        TEST2(err, KErrNone);   
+        }
+    TheTest.Printf(_L("\r\n===OOM test succeeded at heap failure rate of %d ===\r\n"), failingAllocationNo);
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4110
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void FeatMgrServerStartupFileIoTest()
+    {
+    RFs fs;
+    TInt err = fs.Connect();
+    TEST2(err, KErrNone);
+    err = KErrNotFound;
+    TInt cnt=1;
+    for(;err<KErrNone;++cnt)
+        {
+        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
+                }
+            TheTest.Printf(_L("%d "), fsError);
+            (void)fs.SetErrorCondition(fsError, cnt);
+            TRAP(err, CreateAndDestroyFeatMgrServerL());
+            (void)fs.SetErrorCondition(KErrNone);
+            }
+        TheTest.Printf(_L("\r\n"));
+        }
+    fs.Close();
+    TheTest.Printf(_L("\r\n===File I/O error simulation test succeeded on iteration %d===\r\n"), cnt);
+    }
+
+void PreTest()
+    {
+    // Connect session
+    RFs fsSession;
+    User::LeaveIfError(fsSession.Connect()); 
+    
+    TEntry entry;
+    TInt err = fsSession.Entry(KZFeaturesDir, entry);
+    if (err == KErrNotFound)
+        {
+        err = fsSession.MkDir(KZFeaturesDir);
+        }
+    TEST2 (err, KErrNone);
+    err = BaflUtils::CopyFile(fsSession, KZOrgFeaturesFile, KZFeaturesDir);
+    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();
+    }
+
+void DoTestsL()
+    {
+    CActiveScheduler* scheduler = new CActiveScheduler;
+    TEST(scheduler != NULL);
+    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;
+    }
+
+TInt E32Main()
+    {
+    TheTest.Title();
+    
+    CTrapCleanup* tc = CTrapCleanup::New();
+    TheTest(tc != NULL);
+    
+    __UHEAP_MARK;
+    
+    TRAPD(err, DoTestsL());
+    DestroyTestEnv();
+    TEST2(err, KErrNone);
+
+    __UHEAP_MARKEND;
+    
+    TheTest.End();
+    TheTest.Close();
+    
+    delete tc;
+
+    User::Heap().Check();
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrswi.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,195 @@
+// Copyright (c) 2009 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32test.h>
+#include <f32file.h>
+#include <sacls.h>
+#include <e32property.h>
+#include <featmgr.h>
+#include <featureuids.h>
+#include <featurecontrol.h>
+#include <featdiscovery.h>
+#include "..\src\inc\featmgrconfiguration.h"
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+static RTest TheTest(_L("t_fmgrswi"));
+
+const TUid KNewFeatureUid = {0x7888ABC2}; 
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+//Deletes all created test files.
+void DestroyTestEnv()
+    {
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+//Test macros and functions
+void Check1(TInt aValue, TInt aLine)
+    {
+    if(!aValue)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expression evaluated to false. Line %d\r\n"), aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+void Check2(TInt aValue, TInt aExpected, TInt aLine)
+    {
+    if(aValue != aExpected)
+        {
+        DestroyTestEnv();
+        RDebug::Print(_L("*** Expected: %d, got: %d. Line %d\r\n"), aExpected, aValue, aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+#define TEST(arg) ::Check1((arg), __LINE__)
+#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+TInt KillProcess(const TDesC& aProcessName)
+    {
+    TFullName name;
+    //RDebug::Print(_L("Find and kill \"%S\" process.\n"), &aProcessName);
+    TBuf<64> pattern(aProcessName);
+    TInt length = pattern.Length();
+    pattern += _L("*");
+    TFindProcess procFinder(pattern);
+
+    while (procFinder.Next(name) == KErrNone)
+        {
+        if (name.Length() > length)
+            {//If found name is a string containing aProcessName string.
+            TChar c(name[length]);
+            if (c.IsAlphaDigit() ||
+                c == TChar('_') ||
+                c == TChar('-'))
+                {
+                // If the found name is other valid application name
+                // starting with aProcessName string.
+                //RDebug::Print(_L(":: Process name: \"%S\".\n"), &name);
+                continue;
+                }
+            }
+        RProcess proc;
+        if (proc.Open(name) == KErrNone)
+            {
+            proc.Kill(0);
+            //RDebug::Print(_L("\"%S\" process killed.\n"), &name);
+            }
+        proc.Close();
+        }
+    return KErrNone;
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-CT-4111
+@SYMTestCaseDesc        
+@SYMTestPriority        High
+@SYMTestActions         
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/
+void SWItest()
+    {
+    RFs fs;
+    TInt err = fs.Connect();
+    TEST2(err, KErrNone);
+    //
+    RFeatureControl ctrl;
+    err = ctrl.Open();
+    TEST2(err, KErrNone);
+    //Simulate SWI start
+    err = RProperty::Set(KUidSystemCategory, KSAUidSoftwareInstallKeyValue, ESASwisInstall);
+    TEST2(err, KErrNone);
+    //Notify FeatMgr server that SWI started
+    err = ctrl.SWIStart();
+    TEST2(err, KErrNone);
+    //Add a new persistent feature (using the same SWI connection) 
+    TBitFlags32 flags;
+    flags.ClearAll();
+    flags.Set(EFeatureSupported);
+    flags.Set(EFeatureModifiable);
+    flags.Set(EFeaturePersisted);
+    TFeatureEntry fentry(KNewFeatureUid, flags, 9876);
+    err = ctrl.AddFeature(fentry);
+    TEST2(err, KErrNone);
+    //Simulate file I/O error
+    (void)fs.SetErrorCondition(KErrGeneral, 4);
+    //Complete the SWI simulation
+    err = RProperty::Set(KUidSystemCategory, KSAUidSoftwareInstallKeyValue, ESASwisInstall | ESASwisStatusSuccess);
+    TEST2(err, KErrNone);
+    //Notify FeatMgr server that SWI completed
+    err = ctrl.SWIEnd();
+    TEST2(err, KErrNone);
+    //Cleanup
+    ctrl.Close();
+    (void)fs.SetErrorCondition(KErrNone);
+    fs.Close();
+    //Kill FeatMgr server
+    err = KillProcess(KServerProcessName);
+    TEST2(err, KErrNone);
+    //Open new connection
+    err = ctrl.Open();
+    TEST2(err, KErrNone);
+    //The feature should be there
+    TFeatureEntry fentry2(KNewFeatureUid);
+    err = ctrl.FeatureSupported(fentry2);
+    TEST2(err, KFeatureSupported);
+    TEST2(fentry2.FeatureData(), fentry.FeatureData());
+    //Cleanup
+    err = ctrl.DeleteFeature(KNewFeatureUid);
+    TEST2(err, KErrNone);
+    ctrl.Close();
+    }
+
+void DoTestsL()
+    {
+    CActiveScheduler* scheduler = new CActiveScheduler;
+    TEST(scheduler != NULL);
+    CActiveScheduler::Install(scheduler);
+    
+    TheTest.Start(_L("@SYMTestCaseID:PDS-EFM-CT-4111 SWI test"));
+    SWItest();
+    
+    delete scheduler;
+    }
+
+TInt E32Main()
+    {
+    TheTest.Title();
+    
+    CTrapCleanup* tc = CTrapCleanup::New();
+    TheTest(tc != NULL);
+    
+    __UHEAP_MARK;
+    
+    TRAPD(err, DoTestsL());
+    DestroyTestEnv();
+    TEST2(err, KErrNone);
+
+    __UHEAP_MARKEND;
+    
+    TheTest.End();
+    TheTest.Close();
+    
+    delete tc;
+
+    User::Heap().Check();
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/src/t_fmgrunitrefcount.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,146 @@
+// Copyright (c) 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32test.h>
+#include <e32debug.h>
+#include <bautils.h>
+#include <featmgr/featurecontrol.h>
+#include <featmgr/featmgr.h>
+#include <featdiscovery.h>
+#include "featmgrtlsdata.h"
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+RTest TheTest(_L("t_fmgrunitrefcount test"));
+
+const TUid KDummyFeatUid = {0x12345678};
+
+///////////////////////////////////////////////////////////////////////////////////////
+//Test macros and functions
+void Check1(TInt aValue, TInt aLine)
+    {
+    if(!aValue)
+        {
+        //DeleteTestFiles();
+        RDebug::Print(_L("*** Line %d\r\n"), aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+
+void Check2(TInt aValue, TInt aExpected, TInt aLine)
+    {
+    if(aValue != aExpected)
+        {
+        RDebug::Print(_L("*** Line %d, Expected error: %d, got: %d\r\n"), aLine, aExpected, aValue);
+        TheTest(EFalse, aLine);
+        }
+    }
+#define TEST(arg) ::Check1((arg), __LINE__)
+#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
+
+/**
+@SYMTestCaseID          PDS-EFM-UT-4112
+@SYMTestCaseDesc        Unit test for client reference counting.
+@SYMTestPriority        High
+@SYMTestActions         Initialise FeatureManager and check the client reference count
+                        Connect using RFeatureControl and check the client reference count
+                        Uninitialise FeatureManager and check the client reference count
+                        Close RFeatureControl and check the client reference count
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/  
+void TestRefCountFeatureManagerL()
+    {
+        RFeatureControl featCtrl;    
+        
+        CleanupClosePushL(featCtrl);
+        FeatureManager::InitializeLibL();
+        TEST2 (GetClientCount(), 1); // Client count should be 1 at this point
+        
+        featCtrl.Connect();
+        TEST2 (GetClientCount(), 2); // Client count should be 2 at this point
+        
+        // Both should return same result
+        TEST2 (FeatureManager::FeatureSupported(KDummyFeatUid.iUid), featCtrl.FeatureSupported(KDummyFeatUid)==KFeatureSupported);
+        
+        FeatureManager::UnInitializeLib();
+        TEST2 (GetClientCount(), 1); // Client count should be 1 at this point
+        
+        CleanupStack::PopAndDestroy(&featCtrl);
+        TEST2 (GetClientCount(), 0); // Client count should be 0 at this point
+    }
+
+/**
+@SYMTestCaseID          PDS-EFM-UT-4113
+@SYMTestCaseDesc        Unit test for client reference counting.
+@SYMTestPriority        High
+@SYMTestActions         Create CFeatureDiscovery object and check the client reference count
+                        Connect using RFeatureControl and check the client reference count
+                        Delete the CFeatureDiscovery object and check the client reference count
+                        Close RFeatureControl and check the client reference count
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 DEF144262
+*/  
+void TestRefCountCFeatureDiscoveryL()
+    {
+        RFeatureControl featCtrl;
+        CleanupClosePushL(featCtrl);
+        CFeatureDiscovery* featDisc = CFeatureDiscovery::NewLC();    
+        TEST2 (GetClientCount(), 1); // Client count should be 1 at this point
+        featCtrl.Connect();
+        TEST2 (GetClientCount(), 2); // Client count should be 2 at this point
+
+        // Both should return same result
+        TEST2 (featDisc->IsSupported(KDummyFeatUid), featCtrl.FeatureSupported(KDummyFeatUid)==KFeatureSupported);
+        
+        CleanupStack::PopAndDestroy(featDisc);
+        TEST2 (GetClientCount(), 1); // Client count should be 1 at this point
+        
+        CleanupStack::PopAndDestroy(&featCtrl);
+        TEST2 (GetClientCount(), 0); // Client count should be 0 at this point
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+void DoTestsL()
+	{
+    TheTest.Start(_L(" @SYMTestCaseID:PDS-EFM-UT-4112 Client Reference Count using FeatureManager"));
+    TestRefCountFeatureManagerL();
+    TheTest.Next(_L(" @SYMTestCaseID:PDS-EFM-UT-4113 Client Reference Count using CFeatureDiscovery"));
+    TestRefCountCFeatureDiscoveryL();
+    
+	}
+
+TInt E32Main()
+	{
+	TheTest.Title();
+	
+	CTrapCleanup* tc = CTrapCleanup::New();
+	
+	__UHEAP_MARK;
+	
+	TRAPD(err, DoTestsL());
+	TEST2(err, KErrNone);
+
+	__UHEAP_MARKEND;
+	
+	TheTest.End();
+	TheTest.Close();
+	
+	delete tc;
+	
+	User::Heap().Check();
+	return KErrNone;
+	}
--- a/featuremgmt/featuremgr/test/tef/tef_efm_bursuite/scripts/tef_efm_bursuite.script	Tue Jan 26 13:16:24 2010 +0200
+++ b/featuremgmt/featuremgr/test/tef/tef_efm_bursuite/scripts/tef_efm_bursuite.script	Fri Mar 19 10:00:55 2010 +0200
@@ -102,7 +102,7 @@
 
 // -------------------------
 
-START_TESTCASE SYSLIB-EFM-CT-4047
+//START_TESTCASE SYSLIB-EFM-CT-4047
 //! @SYMTestCaseID           SYSLIB-EFM-CT-4047
 //! @SYMTestCaseDesc         Check that feature requests made during a BUR operation are queued and then 
 //!							implemented after the BUR operation has completed. This is to test the queue 
@@ -173,13 +173,13 @@
 //!							on all occasions.
 //! @SYMDEF                  DEF107378
 
-RUN_TEST_STEP  100  tef_efm_bursuite  QueueBackupStep
-RUN_TEST_STEP  100  tef_efm_bursuite  QueueRestoreStep
-END_TESTCASE SYSLIB-EFM-CT-4047
+//RUN_TEST_STEP  100  tef_efm_bursuite  QueueBackupStep
+//RUN_TEST_STEP  100  tef_efm_bursuite  QueueRestoreStep
+//END_TESTCASE SYSLIB-EFM-CT-4047
 
 // -------------------------
 
-START_TESTCASE SYSLIB-EFM-CT-4048
+//START_TESTCASE SYSLIB-EFM-CT-4048
 //! @SYMTestCaseID           SYSLIB-EFM-CT-4048
 //! @SYMTestCaseDesc         To test that a notification occurs when a feature is notified during a BUR operation. 
 //!							This is to test the queue mechanism of the feature manager. 
@@ -238,9 +238,9 @@
 //! @SYMDEF                  DEF107378
 
 
-RUN_TEST_STEP 100 tef_efm_bursuite NotifyBackupStep
-RUN_TEST_STEP 100 tef_efm_bursuite NotifyRestoreStep
-END_TESTCASE SYSLIB-EFM-CT-4048
+//RUN_TEST_STEP 100 tef_efm_bursuite NotifyBackupStep
+//RUN_TEST_STEP 100 tef_efm_bursuite NotifyRestoreStep
+//END_TESTCASE SYSLIB-EFM-CT-4048
 
 // -------------------------
 
--- a/loggingservices/eventlogger/LogServ/src/LOGADD.CPP	Tue Jan 26 13:16:24 2010 +0200
+++ b/loggingservices/eventlogger/LogServ/src/LOGADD.CPP	Fri Mar 19 10:00:55 2010 +0200
@@ -480,11 +480,15 @@
 	//Sometimes, after a sequence of OpenContactsL()/CloseContacts() calls the Contacts server crashes
 	//and OpenContactsL() leaves with error -15. In order to avoid that the following delay has been added.
 	//(something related to Contacts server state machine)
-    User::After(100);
+    User::After(1000);
 	// Attempt to open DB
 	TRAPD(err,iContactPlugin->OpenContactsL());
 	if(KErrNone!=err)
 		{
+		if(err == KErrServerTerminated)
+		    {
+		    RDebug::Print(_L("+++LogEng, LogAdd.cpp, Contacts server crashed!\r\n"));
+		    }
 		// If DB doesn't open delete plugin
 		delete iContactPlugin;
 		iContactPlugin = NULL;
--- a/loggingservices/eventlogger/test/src/t_logapi.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/loggingservices/eventlogger/test/src/t_logapi.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -743,8 +743,9 @@
 */
 LOCAL_C void TestGetConfigSettingsFromRepositoryFileL(CLogClient& aClient)
 	{
-	//Note: if this tests starts failing, then go and check the CentralRepository private data cage (c:\\private\\10202be9) , if this file - 101f401d.txt, is there.
-	//If it is - delete it and try the test again.
+	//Note: if this test starts failing, then go and check the CentralRepository private data cage 
+	//(c:\\private\\10202be9 or z:\\private\\10202be9) if 101f401d.txt file is there.
+	//If it is then delete it and try the test again.
 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-UT-4015 "));
 	//Get the contact match count and contact name format.This should be from resource file.
 	TInt16 contactMatchCount;
--- a/loggingservices/eventlogger/test/src/t_logcntmatch.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/loggingservices/eventlogger/test/src/t_logcntmatch.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -11,9 +11,12 @@
 // Contributors:
 //
 // Description:
-// The "contacts matching" part of the test will work only if r_log_contact_match_count 
-// resource value is not 0. See LogServ.rss file.
-// 
+//
+// If this test starts failing, then go and check the CentralRepository private data cage 
+// (c:\\private\\10202be9 or z:\\private\\10202be9) if 101f401d.txt file is there.
+// If it is then delete it and try the test again.
+// (The problem is that if there is an existing 101f401d.txt file, then the contact match count value
+// will be loaded from that file, not from the LogEng resource file)
 //
 
 #include <bautils.h>
@@ -370,6 +373,8 @@
 	CLogClient* client = CLogClient::NewL(theFs);
 	CleanupStack::PushL(client);
 	
+	//All tests bellow are likely to fail if 101f401d.txt file exists in CentralRepository private data cage
+	//and the contact mach count is set to 0 in that file.
     test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1392: DEF068087: Chinese names don't display in Chinese name format"));
 	::DEF068087L(*client);
     test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1016: Contacts matching - test1"));
--- a/loggingservices/eventlogger/test/src/t_logservercrash.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/loggingservices/eventlogger/test/src/t_logservercrash.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -14,6 +14,11 @@
 // T_LOGSERVCRASH.CPP
 // This tests the fix implemented for DEF047320
 // 
+// If this test starts failing, then go and check the CentralRepository private data cage 
+// (c:\\private\\10202be9 or z:\\private\\10202be9) if 101f401d.txt file is there.
+// If it is then delete it and try the test again.
+// (The problem is that if there is an existing 101f401d.txt file, then the contact match count value
+// will be loaded from that file, not from the LogEng resource file)
 //
 
 #include <s32file.h>
@@ -135,6 +140,8 @@
 		aClient.ChangeEvent(*event, active->iStatus);
 		CActiveScheduler::Start();
 
+		//If the test fails on the next line with -1 or -12 error, it is possible that the contacts database is missing:
+		//c:\private\10003a73\SQLite__Contacts.cdb. Copy it to the specified location and rerun the test.
 		TEST2(active->iStatus.Int(), KErrNone);
 		TEST(event->EventType() == KLogCallEventTypeUid);
 		TEST(event->RemoteParty() == KTestRemoteParty1);
@@ -155,6 +162,9 @@
 			{
 			eventFlags=KTestFlags1;
 			}
+		//If the test fails on the next line, it is quite possible that there is a
+		//z:\private\10202be9a\101f401d.txt file that sets the contacts match count to 0.
+		//Delete the file and run the test again.
 		TEST(event->Flags() == eventFlags);
 		TEST(event->Contact()==(TLogContactItemId) count+1);
 
--- a/loggingservices/eventlogger/test/src/t_logview1.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/loggingservices/eventlogger/test/src/t_logview1.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -12,6 +12,12 @@
 //
 // Description:
 //
+// If this test starts failing, then go and check the CentralRepository private data cage 
+// (c:\\private\\10202be9 or z:\\private\\10202be9) if 101f401d.txt file is there.
+// If it is then delete it and try the test again.
+// (The problem is that if there is an existing 101f401d.txt file, then the contact match count value
+// will be loaded from that file, not from the LogEng resource file)
+//
 
 #include <s32file.h>
 #include <s32mem.h>
--- a/loggingservices/filelogger/SCLI/FLOGCLI.CPP	Tue Jan 26 13:16:24 2010 +0200
+++ b/loggingservices/filelogger/SCLI/FLOGCLI.CPP	Fri Mar 19 10:00:55 2010 +0200
@@ -595,14 +595,8 @@
 		{
 		TBuf<KLogBufferSize> n;
 		n.Copy(aBuf);
- 	 	if (iLogFile.Valid())
-			{
-			TFileName logFileName = iLogFile.Name();
-			RDebug::Print(_L("FLG %S %S"),&logFileName,&n);
-			} else
-				{
-				RDebug::Print(_L("FLG %S "),&n);
-				}
+		TFileName logFileName = iLogFile.Name();
+		RDebug::Print(_L("FLG %S %S"),&logFileName,&n);
 		} else 		
 			{
 			TPckg<TLogFile> logFilePckg(iLogFile);
@@ -628,15 +622,8 @@
  		{
  	 	TBuf<KLogBufferSize> n;
  	 	n.Copy(aBuf);
- 	 	if (iLogFile.Valid())
-			{
-			TFileName logFileName = iLogFile.Name();
-			RDebug::Print(_L("FLG %S %S"),&logFileName,&n);
-			} else
-				{
-				RDebug::Print(_L("FLG %S "),&n);
-				}
- 	 	
+		TFileName logFileName = iLogFile.Name();
+		RDebug::Print(_L("FLG %S %S"),&logFileName,&n);
  		} else
  			{
  			SendReceive(ECreateWriteAndCloseLog, TIpcArgs( &logFilePckg, &aBuf));		// ignore error
--- a/loggingservices/rfilelogger/Logger/Group/RFileloggerclient.cfg	Tue Jan 26 13:16:24 2010 +0200
+++ b/loggingservices/rfilelogger/Logger/Group/RFileloggerclient.cfg	Fri Mar 19 10:00:55 2010 +0200
@@ -1,9 +1,9 @@
 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of the License "Symbian Foundation License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
-// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
 // Initial Contributors:
 // Nokia Corporation - initial contribution.
--- a/persistentstorage/centralrepository/cenrepsrv/srvrepos_noc.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/persistentstorage/centralrepository/cenrepsrv/srvrepos_noc.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -448,7 +448,9 @@
 		TServerResources::iObserver->LoadRepositoryLC(uid, ETrue, defaultRepository, CIniFileIn::EInstallOnly);		
 		}
 	else
-		{	
+		{
+        // The repository must exist in the ROM or install directory (or both). 
+        ASSERT(romExists || installExists);
 		// Reset against empty repository if neither ROM or install file are found
 		defaultRepository = CSharedRepository::NewL(uid);
 		CleanupStack::PushL(defaultRepository);
--- a/persistentstorage/dbms/tdbms/t_dbstress.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/persistentstorage/dbms/tdbms/t_dbstress.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -20,7 +20,7 @@
 //#define _INSTALL_FILE_SYSTEM
 #endif
 
-GLDEF_D RTest test(_L("t_dbstress: Stress testing DBMS"));
+GLDEF_D RTest TheTest(_L("t_dbstress: Stress testing DBMS"));
 
 GLDEF_D TPtrC KTestDir=_S("\\DBMS-TST\\");
 GLDEF_D TPtrC KLogFile=_L("T_STRESS.LOG");
@@ -61,7 +61,7 @@
 void Timer::Print()
 	{
 	TInt64 milli=Stop();
-	test.Printf(_L("  %u milliseconds\n"), I64LOW(milli) );
+	TheTest.Printf(_L("  %u milliseconds\n"), I64LOW(milli) );
 	}
 
 class Set
@@ -128,16 +128,41 @@
 	return (Math::Random()>>11)%aRange;
 	}
 
-#undef test
-LOCAL_C void Test(TInt aValue,TInt anExpected,TInt aLine)
-	{
-	if (aValue==anExpected)
-		return;
-	test.Printf(_L("** Expected %d, was %d\n"),anExpected,aValue);
-	test(EFalse,aLine);
-	}
-#define test1(aTest) test(aTest,__LINE__)
-#define test2(aValue,anExpected) Test(aValue,anExpected,__LINE__)
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+
+TPtrC FileName(const TText* aFile)
+    {
+    TPtrC p(aFile);
+    TInt ix=p.LocateReverse('\\');
+    if (ix<0)
+        ix=p.LocateReverse('/');
+    if (ix>=0)
+        p.Set(p.Mid(1+ix));
+    return p;
+    }
+
+//Test macros and functions
+void Check1(TInt aValue, const TText* aFile, TInt aLine)
+    {
+    if(!aValue)
+        {
+        TPtrC fname(FileName(aFile));
+        TheTest.Printf(_L("*** Expression evaluated to false. %S-%d\r\n"), &fname, aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+void Check2(TInt aValue, TInt aExpected, const TText* aFile, TInt aLine)
+    {
+    if(aValue != aExpected)
+        {
+        TPtrC fname(FileName(aFile));
+        TheTest.Printf(_L("*** Expected %d, got %d. %S-%d\r\n"), aExpected, aValue, &fname, aLine);
+        TheTest(EFalse, aLine);
+        }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
 
 LOCAL_C void CreateIndexL(RDbDatabase& aDatabase,const TDesC& aTable,const TDesC& aColumn,TBool aUnique)
 	{
@@ -145,7 +170,7 @@
 	key->AddL(aColumn);
 	if (aUnique)
 		key->MakeUnique();
-	test2(aDatabase.CreateIndex(aColumn,aTable,*key),KErrNone);
+	TEST2(aDatabase.CreateIndex(aColumn,aTable,*key),KErrNone);
 	CleanupStack::PopAndDestroy();
 	}
 
@@ -160,19 +185,19 @@
 //	create the tables
 	TheDatabase.Begin();
 	CDbColSet* set=Set::CreateL(AccountsDef);
-	test2(TheDatabase.CreateTable(KAccounts,*set),KErrNone);
+	TEST2(TheDatabase.CreateTable(KAccounts,*set),KErrNone);
 	delete set;
 	CreateIndexL(TheDatabase,KAccounts,KAccountsID,ETrue);
 	CreateIndexL(TheDatabase,KAccounts,KAccountsBalance,EFalse);
 	set=Set::CreateL(TransactionsDef);
-	test2(TheDatabase.CreateTable(KTransactions,*set),KErrNone);
+	TEST2(TheDatabase.CreateTable(KTransactions,*set),KErrNone);
 	delete set;
 	CreateIndexL(TheDatabase,KTransactions,KTransactionDate,EFalse);
-	test2(TheDatabase.Commit(),KErrNone);
+	TEST2(TheDatabase.Commit(),KErrNone);
 	OldCount=NewCount=0;
 // prepare Accs table
 	TheDatabase.Begin();
-	test2(Accs.Prepare(TheDatabase,_L("select * from accounts"),Accs.EInsertOnly),KErrNone);
+	TEST2(Accs.Prepare(TheDatabase,_L("select * from accounts"),Accs.EInsertOnly),KErrNone);
 	Accs.InsertL();
 	Accs.SetColL(1,TInt32(ECash));
 	Accs.SetColL(2,KInitialCash);
@@ -188,7 +213,7 @@
 		Accs.PutL();
 		TotalMonies+=KInitialBalance;
 		}
-	test2(TheDatabase.Commit(),KErrNone);
+	TEST2(TheDatabase.Commit(),KErrNone);
 	Accs.Close();
 	TheDatabase.Close();
 	CleanupStack::PopAndDestroy();	// store
@@ -207,7 +232,7 @@
 		{
 		Buf.Format(_L("id=%d"),id);
 		Accs.FirstL();
-		test1(Accs.FindL(Accs.EForwards,Buf)>=0);
+		TEST(Accs.FindL(Accs.EForwards,Buf)>=0);
 		Accs.GetL();
 		TInt balance=Accs.ColInt(2);
 		Buf.Format(_L("\nStatement for account %d: Previous balance %d\n"),id,balance);
@@ -235,7 +260,7 @@
 		User::LeaveIfError(file.Write(Buf));
 		}
 	CleanupStack::PopAndDestroy(2);
-	test1(0);
+	TEST(0);
 	}
 #endif
 
@@ -246,77 +271,77 @@
 	{
 	TheDatabase.OpenL(&aStore,aStore.Root());
 // check any indexes
-	test2(TheTable.Open(TheDatabase,KAccounts,TheTable.EReadOnly),KErrNone);
-	test2(TheTable.CountL(),KAccountIDs);
+	TEST2(TheTable.Open(TheDatabase,KAccounts,TheTable.EReadOnly),KErrNone);
+	TEST2(TheTable.CountL(),KAccountIDs);
 	TInt r=TheTable.SetIndex(KAccountsID);
 	if (r!=KErrCorrupt)
 		{
-		test2(r,KErrNone);
-		test2(TheTable.CountL(),KAccountIDs);
+		TEST2(r,KErrNone);
+		TEST2(TheTable.CountL(),KAccountIDs);
 		for (TInt id=ECash;id<=EPenny;++id)
 			{
-			test1(TheTable.NextL());
+			TEST(TheTable.NextL());
 			TheTable.GetL();
-			test2(TheTable.ColInt(1),id);
+			TEST2(TheTable.ColInt(1),id);
 			}
-		test1(!TheTable.NextL());
+		TEST(!TheTable.NextL());
 		}
 	r=TheTable.SetIndex(KAccountsBalance);
 	if (r!=KErrCorrupt)
 		{
-		test2(r,KErrNone);
-		test2(TheTable.CountL(),KAccountIDs);
-		test1(TheTable.FirstL());
+		TEST2(r,KErrNone);
+		TEST2(TheTable.CountL(),KAccountIDs);
+		TEST(TheTable.FirstL());
 		TheTable.GetL();
 		TInt last=TheTable.ColInt(2);
 		for (TInt ii=1;ii<KAccountIDs;++ii)
 			{
-			test1(TheTable.NextL());
+			TEST(TheTable.NextL());
 			TheTable.GetL();
 			TInt bal=TheTable.ColInt(2);
-			test1(bal>=last);
+			TEST(bal>=last);
 			last=bal;
 			}
-		test1(!TheTable.NextL());
+		TEST(!TheTable.NextL());
 		}
 	TheTable.Close();
-	test2(TheTable.Open(TheDatabase,KTransactions,TheTable.EReadOnly),KErrNone);
+	TEST2(TheTable.Open(TheDatabase,KTransactions,TheTable.EReadOnly),KErrNone);
 	TInt count=TheTable.CountL();
 	r=TheTable.SetIndex(KTransactionDate);
 	if (r!=KErrCorrupt)
 		{
-		test2(r,KErrNone);
-		test2(TheTable.CountL(),count);
+		TEST2(r,KErrNone);
+		TEST2(TheTable.CountL(),count);
 		if (count)
 			{
-			test1(TheTable.FirstL());
+			TEST(TheTable.FirstL());
 			TheTable.GetL();
 			TInt last=TheTable.ColInt(1);
 			while (--count!=0)
 				{
-				test1(TheTable.NextL());
+				TEST(TheTable.NextL());
 				TheTable.GetL();
 				TInt date=TheTable.ColInt(1);
-				test1(date>last);
+				TEST(date>last);
 				last=date;
 				}
-			test1(!TheTable.NextL());
+			TEST(!TheTable.NextL());
 			}
 		else
-			test1(!TheTable.FirstL());
+			TEST(!TheTable.FirstL());
 		}
 	TheTable.Close();
 // verify database integrity
 	TInt balance[KAccountIDs];
-	test2(Accs.Prepare(TheDatabase,_L("select id,statement_balance,balance from accounts"),Accs.EReadOnly),KErrNone);
-	test2(Accs.CountL(),KAccountIDs);
+	TEST2(Accs.Prepare(TheDatabase,_L("select id,statement_balance,balance from accounts"),Accs.EReadOnly),KErrNone);
+	TEST2(Accs.CountL(),KAccountIDs);
 	while (Accs.NextL())
 		{
 		Accs.GetL();
 		TInt id=Accs.ColInt(1);
 		balance[id]=Accs.ColInt(2);
 		}
-	test2(Trans.Prepare(TheDatabase,_L("select t_date,from_id,to_id,amount from Transactions"),Trans.EReadOnly),KErrNone);
+	TEST2(Trans.Prepare(TheDatabase,_L("select t_date,from_id,to_id,amount from Transactions"),Trans.EReadOnly),KErrNone);
 	TInt transact=0;
 	while (Trans.NextL())
 		{
@@ -328,10 +353,10 @@
 		balance[from]-=amount;
 		balance[to]+=amount;
 		}
-	test2(transact,Trans.CountL());
+	TEST2(transact,Trans.CountL());
 	if (NewCount!=-1 && transact!=NewCount)
 		{
-		test2(transact,OldCount);
+		TEST2(transact,OldCount);
 		++ShotDuringCommit;
 		}
 	OldCount=NewCount=transact;
@@ -344,11 +369,11 @@
 		if (balance[id]!=Accs.ColInt(3))
 			DumpStateL();
 #else
-		test(balance[id]==Accs.ColInt(3));
+		TEST(balance[id]==Accs.ColInt(3));
 #endif
 		total+=balance[id];
 		}
-	test2(total,TotalMonies);
+	TEST2(total,TotalMonies);
 	Trans.Close();
 	Accs.Close();
 	TheDatabase.Close();
@@ -376,7 +401,7 @@
 	TInt t=aStore.ReclaimL();
 	Stopwatch.Start();
 	t-=aStore.CompactL();
-	test.Printf(_L("  compacted %d byte(s) in"),t);
+	TheTest.Printf(_L("  compacted %d byte(s) in"),t);
 	Stopwatch.Print();
 	aStore.CommitL();
 	}
@@ -408,7 +433,7 @@
 	__ASSERT_ALWAYS(aTestExecutionTime >= 0, User::Invariant());
 
 	RThread().SetPriority(EPriorityMore);
-	test.Start(_L("Create the database"));
+	TheTest.Start(_L("Create the database"));
 	CreateDatabaseL();
 
 	TTimeIntervalMinutes timeInterval(aTestExecutionTime);
@@ -420,9 +445,9 @@
 
 	for (TBool condition=ETrue; condition; condition = aTestExecutionTime > 0 ? (timeCurrent < timeEnd) : ETrue)
 		{
-		test.Next(_L("Main loop"));
-		test.Start(_L("Kick off the thread"));
-		test2 (StartThread(TheThread,TheStatus),KErrNone);
+		TheTest.Next(_L("Main loop"));
+		TheTest.Start(_L("Kick off the thread"));
+		TEST2 (StartThread(TheThread,TheStatus),KErrNone);
 		// random delay
 		for (;;)
 			{
@@ -432,50 +457,50 @@
 			if (Random(1000)<30)
 				break;
 			}
-		test.Next(_L("End the thread"));
+		TheTest.Next(_L("End the thread"));
 		TInt exit=EndThread();
 		if (exit!=1)
-			test.Printf(_L("  thread failed with error %d\n"),exit);
+		    TheTest.Printf(_L("  thread failed with error %d\n"),exit);
 //
 		++Shot;
 		CFileStore* store=NULL;
 		for (TInt ii=0;;++ii)
 			{
-			test.Printf(_L("Opening %d\r"),ii);
+			TheTest.Printf(_L("Opening %d\r"),ii);
 			TRAPD(r,store=CFileStore::OpenL(TheFs,KTestDatabase,EFileRead|EFileWrite));
 			if (r==KErrNone)
 				break;
-			test (r==KErrInUse);
+			TEST2(r, KErrInUse);
 			User::After(100000);
 			}
-		test.Next(_L("Verify & Recover"));
-		test2 (Verify(*store),KErrNone);
+		TheTest.Next(_L("Verify & Recover"));
+		TEST2 (Verify(*store),KErrNone);
 		TInt64 tps(TransId);
 		tps*=1000u;
 		tps/=RunningTime;
-		test.Printf(_L("    Iteration %d, TPS %d, during commit %d%%\n"),Shot,I64LOW(tps),(100*ShotDuringCommit)/Shot);
+		TheTest.Printf(_L("    Iteration %d, TPS %d, during commit %d%%\n"),Shot,I64LOW(tps),(100*ShotDuringCommit)/Shot);
 		TInt r=Recover(*store);
 		if (r==KErrNoMemory || r==KErrDiskFull)
 			{	// need to compact before completing recovery
-			test.Next(_L("No space, compacting"));
-			test2 (Compact(*store),KErrNone);
-			test.Next(_L("Verify & Recover again"));
-			test2 (Verify(*store),KErrNone);
+			TheTest.Next(_L("No space, compacting"));
+			TEST2 (Compact(*store),KErrNone);
+			TheTest.Next(_L("Verify & Recover again"));
+			TEST2 (Verify(*store),KErrNone);
 			r=Recover(*store);
 			}
-		test2 (r,KErrNone);
-		test.Next(_L("Verify & Compact"));
-//		test2 (Verify(*store),KErrNone);
-		test2 (Compact(*store),KErrNone);
-		test.Next(_L("Verify"));
-		test2 (Verify(*store),KErrNone);
+		TEST2 (r,KErrNone);
+		TheTest.Next(_L("Verify & Compact"));
+//		TEST2 (Verify(*store),KErrNone);
+		TEST2 (Compact(*store),KErrNone);
+		TheTest.Next(_L("Verify"));
+		TEST2 (Verify(*store),KErrNone);
 //
 		delete store;
-		test.End();
+		TheTest.End();
 
 		timeCurrent.UniversalTime();
 		}
-		test.End();
+	TheTest.End();
 	}
 
 /**
@@ -488,20 +513,20 @@
 */
 static void RunVerify()
 	{
-	test.Start(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0636 Open store "));
+	TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0636 Open store "));
 	CFileStore* store=NULL;
 	TRAPD(r,store=CFileStore::OpenL(TheFs,KTestDatabase,EFileRead|EFileWrite));
-	test2 (r,KErrNone);
-	test.Next(_L("Verify"));
+	TEST2 (r,KErrNone);
+	TheTest.Next(_L("Verify"));
 	NewCount=-1;
 	TotalMonies=KInitialCash + (EPenny-EJohn+1)*KInitialBalance;
-	test2 (Verify(*store),KErrNone);
-	test.Next(_L("Recover"));
-	test2 (Recover(*store),KErrNone);
-	test.Next(_L("Verify"));
-	test2 (Verify(*store),KErrNone);
+	TEST2 (Verify(*store),KErrNone);
+	TheTest.Next(_L("Recover"));
+	TEST2 (Recover(*store),KErrNone);
+	TheTest.Next(_L("Verify"));
+	TEST2 (Verify(*store),KErrNone);
 	delete store;
-	test.End();
+	TheTest.End();
 	}
 
 //
@@ -510,28 +535,28 @@
 LOCAL_C void setupTestDirectory()
     {
 	TInt r=TheFs.Connect();
-	test2(r,KErrNone);
+	TEST2(r,KErrNone);
 //
 	r=TheFs.MkDir(KTestDir);
-	test1(r==KErrNone || r==KErrAlreadyExists);
+	TEST(r==KErrNone || r==KErrAlreadyExists);
 	r=TheFs.SetSessionPath(KTestDir);
-	test2(r,KErrNone);
+	TEST2(r,KErrNone);
 	}
 
-LOCAL_C CTrapCleanup* setupCleanup()
 //
 // Initialise the cleanup stack.
 //
+LOCAL_C CTrapCleanup* setupCleanup()
     {
 	CTrapCleanup* cleanup=CTrapCleanup::New();
-	test1(cleanup!=NULL);
+	TEST(cleanup!=NULL);
 	TRAPD(r,\
 		{\
 		for (TInt i=KTestCleanupStack;i>0;i--)\
 			CleanupStack::PushL((TAny*)0);\
 		CleanupStack::Pop(KTestCleanupStack);\
 		});
-	test2(r,KErrNone);
+	TEST2(r,KErrNone);
 	return cleanup;
 	}
 
@@ -548,7 +573,7 @@
 // (KDefaultTestExecutionTime constant bellow).
 GLDEF_C TInt E32Main()
     {
-	test.Title();
+    TheTest.Title();
 	setupTestDirectory();
 	CTrapCleanup* cleanup=setupCleanup();
 	__UHEAP_MARK;
@@ -590,11 +615,11 @@
 		{
 		RDebug::Print(_L("Error %d deleting \"%S\" file.\n"), err2, &KLogFile);
 		}
-	test2(err, KErrNone);
+	TEST2(err, KErrNone);
 //
 	__UHEAP_MARKEND;
 	delete cleanup;
 	TheFs.Close();
-	test.Close();
+	TheTest.Close();
 	return 0;
     }
--- a/persistentstorage/dbms/tdbms/t_dbstress.h	Tue Jan 26 13:16:24 2010 +0200
+++ b/persistentstorage/dbms/tdbms/t_dbstress.h	Fri Mar 19 10:00:55 2010 +0200
@@ -12,13 +12,8 @@
 //
 // Description:
 //
-
-// MSVC++ up to 5.0 has problems with expanding inline functions
-// This disables the mad warnings for the whole project
-#if defined(NDEBUG) && defined(__VC32__) && _MSC_VER<=1100
-#pragma warning(disable : 4710)			// function not expanded. MSVC 5.0 is stupid
-#endif
-
+#ifndef T_DBSTRESS_H
+#define T_DBSTRESS_H
 
 #include <d32dbms.h>
 #include <s32file.h>
@@ -32,7 +27,7 @@
 GLREF_C TInt Random(TInt aRange);
 
 GLREF_D TPtrC KTestDatabase,KTestDir,KLogFile;
-GLREF_D RTest test;
+GLREF_D RTest TheTest;
 GLREF_D TInt NewCount;
 GLREF_D TInt OldCount;
 GLREF_D TInt TransId;
@@ -49,3 +44,13 @@
 
 GLREF_D Timer RunTimer;
 
+#undef  TEST_STRING
+#define TEST_STRING(s) _S(s)
+
+void Check1(TInt aValue, const TText* aFile, TInt aLine);
+void Check2(TInt aValue, TInt aExpected, const TText* aFile, TInt aLine);
+
+#define TEST(arg) ::Check1((arg), TEST_STRING(__FILE__), __LINE__)
+#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, TEST_STRING(__FILE__), __LINE__)
+
+#endif// T_DBSTRESS_H
--- a/persistentstorage/dbms/tdbms/t_dbthrd.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/persistentstorage/dbms/tdbms/t_dbthrd.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -170,7 +170,7 @@
 void CThread::Reset()
 	{
 	iLog.Write(_L8("\nReset"));
-	test(iOpen);
+	TEST(iOpen);
 	iAccs.Reset();
 	iTrans.Reset();
 	}
@@ -256,7 +256,7 @@
 	{
 	Sql.Format(_L("id=%d"),anAccount);
 	iAccs.FirstL();
-	test(iAccs.FindL(iAccs.EForwards,Sql)>=0);
+	TEST(iAccs.FindL(iAccs.EForwards,Sql)>=0);
 	}
 
 //
@@ -274,7 +274,7 @@
 	TInt to=(Random(KAccountIDs-1)+from+1)%KAccountIDs;
 	AccountL(from);
 	iAccs.GetL();
-	test(iAccs.ColInt(1)==from);
+	TEST(iAccs.ColInt(1)==from);
 	TInt avail=iAccs.ColInt(2)+KOverdraftLimit;
 	TInt amount;
 	if (to==ECash)
@@ -370,7 +370,7 @@
 void CThread::VerifyL()
 	{
 	TInt balance[KAccountIDs];
-	test(iAccs.CountL()==KAccountIDs);
+	TEST(iAccs.CountL()==KAccountIDs);
 	for (iAccs.BeginningL();iAccs.NextL();)
 		{
 		iAccs.GetL();
@@ -388,7 +388,7 @@
 		balance[from]-=amount;
 		balance[to]+=amount;
 		}
-	test(transact==iTrans.CountL());
+	TEST(transact==iTrans.CountL());
 	for (iAccs.BeginningL();iAccs.NextL();)
 		{
 		iAccs.GetL();
--- a/persistentstorage/sql/SQLite/main.c	Tue Jan 26 13:16:24 2010 +0200
+++ b/persistentstorage/sql/SQLite/main.c	Fri Mar 19 10:00:55 2010 +0200
@@ -1131,31 +1131,24 @@
 ** error.
 */
 const void *sqlite3_errmsg16(sqlite3 *db){
-  /* Because all the characters in the string are in the unicode
-  ** range 0x00-0xFF, if we pad the big-endian string with a 
-  ** zero byte, we can obtain the little-endian string with
-  ** &big_endian[1].
-  */
-  static const char outOfMemBe[] = {
-    0, 'o', 0, 'u', 0, 't', 0, ' ', 
-    0, 'o', 0, 'f', 0, ' ', 
-    0, 'm', 0, 'e', 0, 'm', 0, 'o', 0, 'r', 0, 'y', 0, 0, 0
+  static const u16 outOfMem[] = {
+    'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0
   };
-  static const char misuseBe [] = {
-    0, 'l', 0, 'i', 0, 'b', 0, 'r', 0, 'a', 0, 'r', 0, 'y', 0, ' ', 
-    0, 'r', 0, 'o', 0, 'u', 0, 't', 0, 'i', 0, 'n', 0, 'e', 0, ' ', 
-    0, 'c', 0, 'a', 0, 'l', 0, 'l', 0, 'e', 0, 'd', 0, ' ', 
-    0, 'o', 0, 'u', 0, 't', 0, ' ', 
-    0, 'o', 0, 'f', 0, ' ', 
-    0, 's', 0, 'e', 0, 'q', 0, 'u', 0, 'e', 0, 'n', 0, 'c', 0, 'e', 0, 0, 0
+  static const u16 misuse[] = {
+    'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ',
+    'r', 'o', 'u', 't', 'i', 'n', 'e', ' ',
+    'c', 'a', 'l', 'l', 'e', 'd', ' ',
+    'o', 'u', 't', ' ',
+    'o', 'f', ' ',
+    's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 0
   };
 
   const void *z;
   if( !db ){
-    return (void *)(&outOfMemBe[SQLITE_UTF16NATIVE==SQLITE_UTF16LE?1:0]);
+    return (void *)outOfMem;
   }
   if( !sqlite3SafetyCheckSickOrOk(db) ){
-    return (void *)(&misuseBe[SQLITE_UTF16NATIVE==SQLITE_UTF16LE?1:0]);
+    return (void *)misuse;
   }
   sqlite3_mutex_enter(db->mutex);
   assert( !db->mallocFailed );
--- a/persistentstorage/sql/SQLite364/main.c	Tue Jan 26 13:16:24 2010 +0200
+++ b/persistentstorage/sql/SQLite364/main.c	Fri Mar 19 10:00:55 2010 +0200
@@ -1208,31 +1208,24 @@
 ** error.
 */
 const void *sqlite3_errmsg16(sqlite3 *db){
-  /* Because all the characters in the string are in the unicode
-  ** range 0x00-0xFF, if we pad the big-endian string with a 
-  ** zero byte, we can obtain the little-endian string with
-  ** &big_endian[1].
-  */
-  static const char outOfMemBe[] = {
-    0, 'o', 0, 'u', 0, 't', 0, ' ', 
-    0, 'o', 0, 'f', 0, ' ', 
-    0, 'm', 0, 'e', 0, 'm', 0, 'o', 0, 'r', 0, 'y', 0, 0, 0
+  static const u16 outOfMem[] = {
+    'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0
   };
-  static const char misuseBe [] = {
-    0, 'l', 0, 'i', 0, 'b', 0, 'r', 0, 'a', 0, 'r', 0, 'y', 0, ' ', 
-    0, 'r', 0, 'o', 0, 'u', 0, 't', 0, 'i', 0, 'n', 0, 'e', 0, ' ', 
-    0, 'c', 0, 'a', 0, 'l', 0, 'l', 0, 'e', 0, 'd', 0, ' ', 
-    0, 'o', 0, 'u', 0, 't', 0, ' ', 
-    0, 'o', 0, 'f', 0, ' ', 
-    0, 's', 0, 'e', 0, 'q', 0, 'u', 0, 'e', 0, 'n', 0, 'c', 0, 'e', 0, 0, 0
+  static const u16 misuse[] = {
+    'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ',
+    'r', 'o', 'u', 't', 'i', 'n', 'e', ' ',
+    'c', 'a', 'l', 'l', 'e', 'd', ' ',
+    'o', 'u', 't', ' ',
+    'o', 'f', ' ',
+    's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 0
   };
 
   const void *z;
   if( !db ){
-    return (void *)(&outOfMemBe[SQLITE_UTF16NATIVE==SQLITE_UTF16LE?1:0]);
+    return (void *)outOfMem;
   }
   if( !sqlite3SafetyCheckSickOrOk(db) ){
-    return (void *)(&misuseBe[SQLITE_UTF16NATIVE==SQLITE_UTF16LE?1:0]);
+    return (void *)misuse;
   }
   sqlite3_mutex_enter(db->mutex);
   assert( !db->mallocFailed );
--- a/persistentstorage/sql/SRC/Server/Compact/SqlCompact.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/persistentstorage/sql/SRC/Server/Compact/SqlCompact.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -173,7 +173,14 @@
 			{
 			if(entry->Release() == 0)
 				{
-				iEntries.Remove(idx);
+				iEntries.Remove(idx);			
+#ifdef _DEBUG
+//This is used prevent the failure of the resource allocation checking for debug mode. 
+				if(iEntries.Count() == 0)
+				    {
+                    iEntries.Reset();
+				    }
+#endif  
 				}
 			}
 		}
--- a/persistentstorage/sql/TEST/t_sqldefect.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/persistentstorage/sql/TEST/t_sqldefect.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -733,8 +733,8 @@
 						of the available memory and the amount of free disk space - factors which cannot be easily 
 						resolved on target hardware.
 						The test creates a database with a table: T(Id INTEGER, Data BLOB). 
-						One record with a BLOB (0.9Mb size) is inserted using RSqlDatabase::Exec().
-						Another record with a BLOB (1.8Mb size) is inserted using RSqlStatement and BLOB parameter.
+						One record with a BLOB (either 0.79Mb or 0.9Mb) is inserted using RSqlDatabase::Exec().
+						Another record with a BLOB (either 1.58 or 1.8Mb) is inserted using RSqlStatement and BLOB parameter.
 						If the defect is not fixed, after the first INSERT the SQL server will not free occupied by
 						the statement memory. The available heap memory won't be enough for the execution of the second INSERT statement.
 						The second INSERT will fail with KErrNoMemory.
@@ -746,7 +746,12 @@
 void DEF106391()
 	{
 #if defined __WINS__ ||	defined __WINSCW__
-	const TInt KBlobSize = 900 * 1024;
+#ifndef SYMBIAN_USE_SQLITE_VERSION_3_6_4
+    const TInt KBlobSize = 900 * 1024;
+#else
+    const TInt KBlobSize = 790 * 1024;
+#endif    
+
 	_LIT8(KConfigStr, "encoding=UTF-8");
 
 	HBufC8* sqlBuf = HBufC8::New(KBlobSize * 2 + 200);//"+ 200" - for the SQL INSERT statement
@@ -1504,6 +1509,79 @@
     (void)RSqlDatabase::Delete(KTestDatabase1);
     }
 
+/**
+@SYMTestCaseID          PDS-SQL-UT-4157
+@SYMTestCaseDesc        Test for PDEF143461  Calling CSqlSrvDatabase::LastErrorMessage() does not panic with the descriptor alignment error
+@SYMTestPriority        Normal
+@SYMTestActions         Test for PDEF143461  - CSqlSrvDatabase::LastErrorMessage() alignment problem.
+                        This tests the following SQLite Error messages to make sure it doesn't panic:
+                        1)library routine called out of sequence
+                        2)out of memory
+@SYMTestExpectedResults Test must not fail
+@SYMDEF                 PDEF143461 
+*/
+void PDEF143461L()
+    {
+    (void) RSqlDatabase::Delete(KTestDatabase6);
+    
+    //Create and setup the database file
+    RSqlDatabase db;
+    TInt err =0;
+    err = db.Create(KTestDatabase6);
+    TEST2(err, KErrNone);
+    err = db.Exec(_L("CREATE TABLE t(num INTEGER)"));
+    TEST2(err, 1);
+    err = db.Exec(_L("INSERT INTO t VALUES(1)"));
+    TEST2(err, 1);
+    err = db.Exec(_L("INSERT INTO t VALUES(2)"));
+    TEST2(err, 1);
+
+    
+    //Purposely commit an error so LastErrorMessage can be called 
+    RSqlStatement stmt;
+    err = stmt.Prepare(db, _L("DELETE FROM t WHERE ROWID=?"));
+    TEST2(err, KErrNone);
+    err = stmt.BindInt(0, 1);
+    TEST2(err, KErrNone);        
+    err = stmt.Exec();
+    TEST2(err, 1);
+    
+    //Should have reset stmt here
+    err = stmt.BindInt(0, 2);
+    TEST2(err, KErrNone); 
+    err = stmt.Exec();
+    TEST2(err, KSqlErrMisuse);
+    
+    //Test "library routine called out of sequence" error message 
+    //If the defect is not fixed then it will panic here   
+    TPtrC errMsg = db.LastErrorMessage();
+    RDebug::Print(_L("errMsg=%S\r\n"), &errMsg);
+
+    stmt.Close();
+    db.Close();
+    
+    TInt allocationNo = 0;
+    //The mask allows the out of memory simulation of the SQL Server to be delayed until the database is opened
+    const TInt KDelayedDbHeapFailureMask = 0x1000;
+    
+    do
+        {
+        TSqlResourceTester::SetDbHeapFailure(RHeap::EDeterministic |KDelayedDbHeapFailureMask, ++allocationNo);
+        err = db.Open(KTestDatabase6);
+        TEST2(err, KErrNone);
+        err = db.Exec(_L("INSERT INTO t VALUES(3)"));
+        TSqlResourceTester::SetDbHeapFailure(RHeap::ENone, 0);
+        
+        TheTest.Printf(_L("%d    \r"), allocationNo);
+        //Test "out of memory" error message, if the defect is not fixed then it will panic here   
+        TPtrC errMsg = db.LastErrorMessage();
+        RDebug::Print(_L("errMsg=%S\r\n"), &errMsg);
+        db.Close();
+        }
+    while (err == KErrNoMemory);
+    TEST2(err, 1);
+    }
+
 void DoTestsL()
 	{
 	
@@ -1584,6 +1662,9 @@
     
     TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-CT-4153 DEF143047: SQL, default \"max parameter count\" value, compatibility problem."));
     DEF143047();
+    
+    TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-CT-4157 PDEF143461 : CSqlSrvDatabase::LastErrorMessage() alignment problem"));
+    PDEF143461L();
 	}
 
 TInt E32Main()
Binary file persistentstorage/sqlite3api/GROUP/SQLite3_stub.SIS has changed
--- a/persistentstorage/sqlite3api/GROUP/SQLite3_stub.pkg	Tue Jan 26 13:16:24 2010 +0200
+++ b/persistentstorage/sqlite3api/GROUP/SQLite3_stub.pkg	Fri Mar 19 10:00:55 2010 +0200
@@ -18,7 +18,7 @@
 &EN
 
 ;Header
-#{"sqlite3"}, (0x2002533B), 1,0,0, TYPE=SA
+#{"sqlite3"}, (0x2002AF5F), 1,0,0, TYPE=SA
 
 ;Localised vendor name
 %{"Nokia"}
--- a/persistentstorage/store/ROM/StoreTests.BAT	Tue Jan 26 13:16:24 2010 +0200
+++ b/persistentstorage/store/ROM/StoreTests.BAT	Fri Mar 19 10:00:55 2010 +0200
@@ -31,7 +31,7 @@
 t_stordictfs
 t_storembed
 t_storshape
-t_stortdict
+t_stordict
 t_storstrm
 t_storverify
 t_storconv
--- a/persistentstorage/store/TSTOR/t_stordict.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/persistentstorage/store/TSTOR/t_stordict.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -12,30 +12,37 @@
 //
 // Description:
 //
-
-#if !defined(__E32TEST_H__)
 #include <e32test.h>
-#endif
-
 #include <s32mem.h>
 
 //
 // CTestStreamDictionary
+// The only reason this class to be used here is to 
+// get an access to CStreamDictionary::iArray (private data member). 
 //
-
 class CTestStreamDictionary : public CStreamDictionary
 	{
 public:
-	struct TEntry {TUid uid;TStreamId id;};
+	struct TEntry 
+	    {
+	    TUid uid;
+	    TStreamId id;
+	    };
 public:
 	static CTestStreamDictionary* NewL();
 	CTestStreamDictionary();
-//*	TUid Uid(TInt aInt) { return (*iEntryList)[aInt].iUid; }
-//*	TStreamId StreamId(TInt aInt) { return (*iEntryList)[aInt].iStreamId; }
-//*	TInt Count() { return iEntryList->Count(); }
-	TUid Uid(TInt aInt) { return (*iCheat)[aInt].uid; }
-	TStreamId StreamId(TInt aInt) { return (*iCheat)[aInt].id; }
-	TInt Count() { return iCheat->Count(); }
+	TUid Uid(TInt aInt) 
+	    { 
+	    return (*iCheat)[aInt].uid; 
+	    }
+	TStreamId StreamId(TInt aInt) 
+	    { 
+	    return (*iCheat)[aInt].id; 
+	    }
+	TInt Count() 
+	    { 
+	    return iCheat->Count(); 
+	    }
 private:
 	CArrayFixSeg<TEntry>* iCheat;
 	};
@@ -43,38 +50,65 @@
 CTestStreamDictionary* CTestStreamDictionary::NewL()
 	{
 	CTestStreamDictionary* thing=new(ELeave) CTestStreamDictionary();
-//*	CleanupStack::PushL(thing);
-//*	thing->ConstructL();
-//*	CleanupStack::Pop();
 	return thing;
 	}
 
 CTestStreamDictionary::CTestStreamDictionary()
-	: iCheat((CArrayFixSeg<TEntry>*)&iCheat-1) // modification to get to count etc
-	{}
+	: iCheat((CArrayFixSeg<TEntry>*)&iCheat-1) //Now iCheat points to the base class' private data member: 
+	                                           //CStreamDictionary::iArray.
+                                               //This way it is possible to call iArray's methods (even though it is private).
+	{
+	}
 
 
 //
 // Test code
 //
 
-const TInt KTestCleanupStack=0x40;
 const TInt KTestExpandSize=0x20;
 
-LOCAL_D RTest test(_L("t_stordict"));
-LOCAL_D CTrapCleanup* TheTrapCleanup;
+static RTest TheTest(_L("t_stordict"));
 
 // some uid-stream pairs to use for testing
 const TUid testUid1={1};
-LOCAL_D TStreamId testStreamId1=TStreamId(1);
+static TStreamId testStreamId1=TStreamId(1);
 //
 const TUid testUid2={57};
-LOCAL_D TStreamId testStreamId2=TStreamId(57);
+static TStreamId testStreamId2=TStreamId(57);
 //
 const TUid testUid3={99999};
-LOCAL_D TStreamId testStreamId3=TStreamId(425);
+static TStreamId testStreamId3=TStreamId(425);
 //
 
+//Put test data files to be deleted at the end here!
+void DeleteDataFiles()
+    {
+    }
+
+//Tests macros and functions.
+//If (!aValue) then the test will be panicked, the test data files will be deleted.
+static void Check(TInt aValue, TInt aLine)
+    {
+    if(!aValue)
+        {
+        DeleteDataFiles();
+        TheTest(EFalse, aLine);
+        }
+    }
+//If (aValue != aExpected) then the test will be panicked, the test data files will be deleted.
+static void Check(TInt aValue, TInt aExpected, TInt aLine)
+    {
+    if(aValue != aExpected)
+        {
+        RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
+        DeleteDataFiles();
+        TheTest(EFalse, aLine);
+        }
+    }
+//Use these to test conditions.
+#define TEST(arg) ::Check((arg), __LINE__)
+#define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
+
 /**
 @SYMTestCaseID          SYSLIB-STORE-CT-1201
 @SYMTestCaseDesc	    Tests for copy operations on dictionary files
@@ -86,32 +120,30 @@
 template <class T1,class T2>
 void testCopyL(T1& aCopy,const T2& anOriginal)
 	{
-	test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1201 "));
+	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1201 "));
 	CBufSeg* buf=0;
 	TRAPD(r,buf=CBufSeg::NewL(KTestExpandSize));
-	if (r!=KErrNone)
-		test.Panic(_L("Allocating buffer"));
+    TEST2(r, KErrNone);
 //
 // Write anOriginal out to the buffer.
 //
 	RBufWriteStream out;
 	out.Append(*buf);
 	TRAP(r,out<<anOriginal);
-	test(r==KErrNone);
+	TEST2(r, KErrNone);
 	TRAP(r,out.CommitL());
-	if (r!=KErrNone)
-		test.Panic(_L("Committing write stream"));
+    TEST2(r, KErrNone);
 //
 // Read anOriginal in from the buffer.
 //
 	RBufReadStream in(*buf);
 	TRAP(r,in>>aCopy);
-	test(r==KErrNone);
+    TEST2(r, KErrNone);
 //
 // See if it's consumed the lot.
 //
 	TUint8 b;
-	test(in.Source()->ReadL(&b,1)==0);
+	TEST2(in.Source()->ReadL(&b,1), 0);
 //
 	delete buf;
 	}
@@ -126,14 +158,14 @@
 */
 void testIsEqual(CTestStreamDictionary* aCopy,CTestStreamDictionary* aOrig)
 	{
-	test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1202 "));
+	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1202 "));
 	TInt origCount=aOrig->Count();
-	test(origCount==aCopy->Count());
+	TEST(origCount==aCopy->Count());
 	//
 	for (TInt i=0 ; i<origCount ; i++)
 		{
-		test(aOrig->Uid(i)==aCopy->Uid(i));
-		test(aOrig->StreamId(i)==aCopy->StreamId(i));
+		TEST(aOrig->Uid(i)==aCopy->Uid(i));
+		TEST(aOrig->StreamId(i)==aCopy->StreamId(i));
 		}
 	}
 
@@ -149,51 +181,51 @@
 	{
 	CTestStreamDictionary* dic=CTestStreamDictionary::NewL();
 	// attempt finding and removing with an empty dictionary
-	test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1203 Manipulating an empty dictionary "));
-	test(dic->Count()==0);
-	test(dic->At(testUid1)==KNullStreamId);
+	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1203 Manipulating an empty dictionary "));
+	TEST2(dic->Count(), 0);
+	TEST(dic->At(testUid1)==KNullStreamId);
 	dic->Remove(testUid1);
-	test(dic->Count()==0);
-	test(dic->IsNull());
+	TEST2(dic->Count(), 0);
+	TEST(dic->IsNull());
 	//
 	// assign an entry
-	test.Next(_L("Assigning entries and manipulating them"));
+	TheTest.Next(_L("Assigning entries and manipulating them"));
 	TRAPD(ret,dic->AssignL(testUid1,testStreamId1));
-	test(ret==KErrNone);
-	test(dic->Count()==1);
-	test(!dic->IsNull());
-	test(dic->At(testUid1)==testStreamId1);
+	TEST2(ret, KErrNone);
+	TEST2(dic->Count(), 1);
+	TEST(!dic->IsNull());
+	TEST(dic->At(testUid1)==testStreamId1);
 	//
 	// assign another entry
 	TRAP(ret,dic->AssignL(testUid2,testStreamId2));
-	test(ret==KErrNone);
-	test(dic->Count()==2);
-	test(dic->At(testUid2)==testStreamId2);
+	TEST2(ret, KErrNone);
+	TEST2(dic->Count(), 2);
+	TEST(dic->At(testUid2)==testStreamId2);
 	//
 	// re-assign uid1
 	TRAP(ret,dic->AssignL(testUid1,testStreamId3));
-	test(ret==KErrNone);
-	test(dic->Count()==2);
-	test(dic->At(testUid1)==testStreamId3);
+	TEST2(ret, KErrNone);
+	TEST2(dic->Count(), 2);
+	TEST(dic->At(testUid1)==testStreamId3);
 	//
 	// test finding and removing a non-existant entry from a non-empty dictionary
-	test(dic->At(testUid3)==KNullStreamId);
+	TEST(dic->At(testUid3)==KNullStreamId);
 	dic->Remove(testUid3);
-	test(dic->Count()==2);
+	TEST2(dic->Count(), 2);
 	//
 	// test removing an entry
 	dic->Remove(testUid1);
-	test(dic->Count()==1);
-	test(dic->At(testUid1)==KNullStreamId);
-	test(dic->At(testUid2)==testStreamId2);
-	test(!dic->IsNull());
+	TEST2(dic->Count(), 1);
+	TEST(dic->At(testUid1)==KNullStreamId);
+	TEST(dic->At(testUid2)==testStreamId2);
+	TEST(!dic->IsNull());
 	//
 	// test removing the other entry
 	dic->Remove(testUid2);
-	test(dic->Count()==0);
-	test(dic->IsNull());
-	test(dic->At(testUid1)==KNullStreamId);
-	test(dic->At(testUid2)==KNullStreamId);
+	TEST2(dic->Count(), 0);
+	TEST(dic->IsNull());
+	TEST(dic->At(testUid1)==KNullStreamId);
+	TEST(dic->At(testUid2)==KNullStreamId);
 	//
 	delete dic;
 	}
@@ -213,63 +245,53 @@
 	CTestStreamDictionary* copy=CTestStreamDictionary::NewL();
 	//
 	// copy an empty dictionary
-	test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1204 Streaming an empty dictionary "));
-	test(orig->IsNull());
+	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1204 Streaming an empty dictionary "));
+	TEST(orig->IsNull());
 	testCopyL(*copy,*orig);
-	test(copy->IsNull());
+	TEST(copy->IsNull());
 	//
 	// copy a dictionary containing a range of entries
-	test.Next(_L("Streaming a dictionary containing entries"));
+	TheTest.Next(_L("Streaming a dictionary containing entries"));
 	TRAPD(ret,orig->AssignL(testUid1,testStreamId1));
 	TRAP(ret,orig->AssignL(testUid2,testStreamId2));
 	TRAP(ret,orig->AssignL(testUid3,testStreamId3));
 	testCopyL(*copy,*orig);
 	testIsEqual(copy,orig);
-	test(!copy->IsNull());
+	TEST(!copy->IsNull());
 	//
 	delete orig;
 	delete copy;
 	}
 
-
-//
-// Initialise the cleanup stack.
-//
-LOCAL_C void setupCleanup()
+void DoTestL()
     {
-	TheTrapCleanup=CTrapCleanup::New();
-	TRAPD(r,\
-		{\
-		for (TInt i=KTestCleanupStack;i>0;i--)\
-			CleanupStack::PushL((TAny*)1);\
-		test(r==KErrNone);\
-		CleanupStack::Pop(KTestCleanupStack);\
-		});
-	}
+    simpleTestsL();
+    streamingTestsL();
+    }
 
-
-GLDEF_C TInt E32Main()
+TInt E32Main()
 	{
-	setupCleanup();
-	//
-	test.Title();
-	test.Start(_L("Testing CStreamDictionary..."));
-	//
-	// run the testcode (inside an alloc heaven harness)
-	__UHEAP_MARK;
+    __UHEAP_MARK;
+	
+    TheTest.Title();
+	
+    CTrapCleanup* trapCleanup = CTrapCleanup::New();
+    TheTest(trapCleanup != NULL);
 
-	TRAPD(r,simpleTestsL());
-		test(r==KErrNone);
-
-	TRAP(r,streamingTestsL());
-		test(r==KErrNone);
+	TheTest.Start(_L("Testing CStreamDictionary..."));
+	
+	TRAPD(err, DoTestL());
+    TEST2(err, KErrNone);
 
-	__UHEAP_MARKEND;
+    DeleteDataFiles();
+    
+    TheTest.End();
+    TheTest.Close();
 
- 	test.End();
-	test.Close();
-
-	delete TheTrapCleanup;
+    delete trapCleanup;
+    
+    __UHEAP_MARKEND;
+    
 	return KErrNone;
 	}
 
--- a/traceservices/tracefw/integ_test/ost/TEF/group/te_ostv2integsuite_disabled.mmp	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/group/te_ostv2integsuite_disabled.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -38,6 +38,7 @@
 SOURCE			te_tracecontrolclearconfig.cpp
 SOURCE			te_tracecontrolcmds.cpp
 SOURCE			te_tracecontroldefaultconfig.cpp
+SOURCE			te_ctor_disabled.cpp
 
 SOURCEPATH    	../te_ostv2integsuite_functional/src/
 SOURCE        	te_tracecollectorclient.cpp
--- a/traceservices/tracefw/integ_test/ost/TEF/group/te_ostv2integsuite_enabled.mmp	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/group/te_ostv2integsuite_enabled.mmp	Fri Mar 19 10:00:55 2010 +0200
@@ -43,7 +43,7 @@
 SOURCE			te_tracecontrolclearconfig.cpp
 SOURCE			te_tracecontrolcmds.cpp
 SOURCE			te_tracecontroldefaultconfig.cpp
-
+SOURCE			te_ctor.cpp
 
 SOURCEPATH    	../te_ostv2integsuite_functional/src/
 SOURCE        	te_tracecollectorclient.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/inc/te_ctor.h	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,38 @@
+// Copyright (c) 2007-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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef TE_CTOR
+#define TE_CTOR
+#include <e32std.h>
+#include "te_dataparameters.h"
+
+// dummy/unimportant value, only used for initialisation
+_LIT(KTestCtorString, "ABCDE" );
+
+class TTestCtor
+    {
+public:
+    TTestCtor( TUint32 aArg1, TUint32 aArg2 );
+
+    TTestCtor( TUint32 aArg1 );
+ 
+private:
+    // define arbitrary data members
+    TUint32     iNum1;
+    TUint32     iNum2;
+    TBuf<10>    iStr;
+    };
+
+#endif //TE_CTOR
--- a/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/inc/te_instrumentation_enum.h	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/inc/te_instrumentation_enum.h	Fri Mar 19 10:00:55 2010 +0200
@@ -90,36 +90,38 @@
     EOstTraceFunctionEntry0,
     EOstTraceFunctionEntry1,
     EOstTraceFunctionEntryExt,
-    EOstTraceFunctionExit0,//40
+    EOstTraceFunctionEntryExtCtorInitList,//40
+    EOstTraceFunctionEntryExtCtorNoInitList,
+    EOstTraceFunctionExit0,
     EOstTraceFunctionExit1,
     EOstTraceFunctionExitExt,
-    EOstTraceEventStart0,
+    EOstTraceEventStart0,//45
     EOstTraceEventStart1,
-    EOstTraceState0,//45
+    EOstTraceState0,
     EOstTraceState1,
     EOstTraceEventStop,
-    EOstTraceData96,
+    EOstTraceData96,//50
     EOstTraceData1000,
-    EUptIsTraceActive,//50
+    EUptIsTraceActive,
 
 //kernel side
 	//printf
 	EUptKernelPrintfchar,
 	EUptKernelPrintfTRefByValueTDesC8, 
-	EUptKernelPrintfDesc8_big,
+	EUptKernelPrintfDesc8_big,//55
 	EUptKernelPrintfDesc8_huge,
 	//trace
-	EUptKernelTrace,//55
+	EUptKernelTrace,
 	EUptKernelTraceTUint32,
 	EUptKernelTraceTUint32TUint32,
-	EUptKernelTraceTAnySmallStruct,
+	EUptKernelTraceTAnySmallStruct,//60
 	EUptKernelTraceTAnyBigStruct,
-	EUptKernelTraceTAnyHugeStruct,//60
+	EUptKernelTraceTAnyHugeStruct,
 	EUptKernelTraceTemplatedSmallStruct,
 	EUptKernelTraceTemplatedBigStruct,
-	EUptKernelTraceTemplatedHugeStruct,
+	EUptKernelTraceTemplatedHugeStruct,//65
 	EUptKernelIsTraceActive,
-	EUptKernelTraceDesc8_big,//65
+	EUptKernelTraceDesc8_big,
 	EUptKernelTraceDesc8_huge, 
 
 
@@ -132,22 +134,22 @@
 	 * Stackbase: 400 byte
 	 */
 	UPTTraceTest,
-	UPTKernelTraceTest,
+	UPTKernelTraceTest,//70
 	UPTKernelNegativeFunctionalityTest,
-	UPTKernelMultipleFunctionalityTest,//70
+	UPTKernelMultipleFunctionalityTest,
 //btrace
 	BTraceFiltered4,//equivalent of EUptTrace
 	BTraceFiltered8,// equivalent of EUptTraceTUint32
-	BTraceFiltered12,// equivalent of EUptTraceTUint32TUint32
+	BTraceFiltered12,//75 // equivalent of EUptTraceTUint32TUint32
 	BTraceFilteredBig,//equivalent of EUptTraceTemplatedHugeStruct
-	BTrace0,//75
+	BTrace0,
 	BTrace4,
 	BTrace8,
-	BTrace12,
+	BTrace12,//80
 
 //baseline
 	UPTBaseline,
-	UPTKernelBaseline,//80
+	UPTKernelBaseline,
 
 //foo definitions
 	UPTFooUserTime,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/src/te_ctor.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,51 @@
+// Copyright (c) 2007-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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Test class generating trace data from contructor with/without initialiser list.
+//
+
+#include "te_ctor.h"
+#include "te_ctorTraces.h"
+
+/**
+ * Constructor
+ *
+ * Trace producing constructor with initialiser list.
+ *
+ * Previous versions of the TraceCompiler do not handle initialiser lists correctly.
+ * For such a TC the following code will not compile.
+ */
+
+TTestCtor::TTestCtor( TUint32 aArg1, TUint32 aArg2 )
+:
+    iNum1( aArg1 ),
+    iNum2( aArg2 ),
+    iStr( KTestCtorString )
+    {
+    OstTraceFunctionEntryExt( CTESTCTOR_INITLIST_TRACE, KData1 );
+    }
+
+/**
+ * Constructor
+ *
+ * Trace producing constructor without initialiser list.
+ */
+
+TTestCtor::TTestCtor( TUint32 aArg1 )
+    {
+    iNum1 =  aArg1;
+    iNum2 = 0;
+    iStr = KTestCtorString;
+
+    OstTraceFunctionEntryExt( CTESTCTOR_NO_INITLIST_TRACE, KData1 );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/src/te_ctor_disabled.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,37 @@
+// Copyright (c) 2007-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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Test class generating trace data from contructor with/without initialiser list.
+// used in (logging) disabled mode.
+//
+
+#include "te_ctor.h"
+#include "te_ctor_disabledTraces.h"
+
+TTestCtor::TTestCtor( TUint32 aArg1, TUint32 aArg2 )
+:
+    iNum1( aArg1 ),
+    iNum2( aArg2 ),
+    iStr( KTestCtorString )
+    {
+    OstTraceFunctionEntryExt( CTESTCTOR_INITLIST_TRACE, KData1 );
+    }
+
+TTestCtor::TTestCtor( TUint32 aArg1 )
+    {
+    iNum1 =  aArg1;
+    iNum2 = 0;
+    iStr = KTestCtorString;
+
+    OstTraceFunctionEntryExt( CTESTCTOR_NO_INITLIST_TRACE, KData1 );
+    }
--- a/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/src/te_instrumentationpoints_disabled.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/src/te_instrumentationpoints_disabled.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -32,7 +32,7 @@
 #include "te_perfstackinfo.h"
 #include "te_dataparameters.h"
 #include "sanity/te_perfsanityhelpers.h"
-
+#include "te_ctor.h"
 
 
 
@@ -661,7 +661,7 @@
         {
         __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before);
         OstTraceFunctionEntry0( TEST_OSTTraceFunctionalityEntry0 );
-        logged = ETrue;
+        logged = EFalse;
         __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before,  aApiRunResults.iApiStackUsage); 
         }
     break;
@@ -687,6 +687,26 @@
         }
     break;
     
+    case EOstTraceFunctionEntryExtCtorInitList:
+        {        
+        __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before);
+        TTestCtor       testCtorA( 1, 2 );
+        logged = EFalse;
+        __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before,  aApiRunResults.iApiStackUsage); 
+
+        }
+    break;
+    
+    case EOstTraceFunctionEntryExtCtorNoInitList:
+        {        
+        __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before);
+        TTestCtor       testCtorB( 3 );
+        logged = EFalse;
+        __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before,  aApiRunResults.iApiStackUsage); 
+
+        }
+    break;
+    
     case EOstTraceFunctionExit0:
         {
         __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before);
@@ -750,7 +770,7 @@
         {
         __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before);
         OstTraceState0( TEST_OSTTRACESTATE0, "Test State Name", "Test State Value" );
-        logged = ETrue;
+        logged = EFalse;
         __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before,  aApiRunResults.iApiStackUsage); 
         }
     break;
@@ -761,7 +781,7 @@
         
         __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before);
         OstTraceState1( TEST_OSTTRACESTATE1,  "Test State Name", "Test State Value", KData1 );
-        logged = ETrue;
+        logged = EFalse;
         __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before,  aApiRunResults.iApiStackUsage); 
 
         }
--- a/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/src/te_instrumentationpoints_enabled.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/src/te_instrumentationpoints_enabled.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -32,7 +32,7 @@
 #include "te_perfstackinfo.h"
 #include "te_dataparameters.h"
 #include "sanity/te_perfsanityhelpers.h"
-
+#include "te_ctor.h"
 
 
 
@@ -690,6 +690,26 @@
         }
     break;
     
+    case EOstTraceFunctionEntryExtCtorInitList:
+        {        
+        __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before);
+        TTestCtor       testCtorA( 1, 2 );
+        logged = ETrue;
+        __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before,  aApiRunResults.iApiStackUsage); 
+
+        }
+    break;
+    
+    case EOstTraceFunctionEntryExtCtorNoInitList:
+        {        
+        __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before);
+        TTestCtor       testCtorB( 3 );
+        logged = ETrue;
+        __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before,  aApiRunResults.iApiStackUsage); 
+
+        }
+    break;
+    
     case EOstTraceFunctionExit0:
         {
         __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before);
--- a/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/src/te_ostv2integsuite_basewrapper.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_common/src/te_ostv2integsuite_basewrapper.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -697,13 +697,39 @@
             ASSERT(trace);
             TTraceConfigsOperator::Init(*trace);
             TTraceConfigsOperator::SetOptions(*trace, aApi, ETrue, ETrue);
-            TTraceConfigsOperator::SetHeader(*trace,  TRACE_FLOW, KComponentId, EAddThreadIdentification, ENoProgramCounter, (0x8a0003&TRACEIDMASK)>>TRACEIDSHIFT);
+            TTraceConfigsOperator::SetHeader(*trace,  TRACE_FLOW, KComponentId, EAddThreadIdentification, ENoProgramCounter, (0x8a0005&TRACEIDMASK)>>TRACEIDSHIFT);
             //fix this - should be a list of the function arguments of this method all these traces are insturmented in
 			TTraceConfigsOperator::SetData(*trace, KData1);
             setThreadId = aHasContext;
             aTraceObjects.Append(trace);
             }
             break;
+        case EOstTraceFunctionEntryExtCtorInitList:
+            {
+            TTraceConfigs* trace = new TTraceConfigs;
+            ASSERT(trace);
+            TTraceConfigsOperator::Init(*trace);
+            TTraceConfigsOperator::SetOptions(*trace, aApi, ETrue, ETrue);
+            TTraceConfigsOperator::SetHeader(*trace,  TRACE_FLOW, KComponentId, EAddThreadIdentification, ENoProgramCounter, (0x8a0001&TRACEIDMASK)>>TRACEIDSHIFT);
+            //fix this - should be a list of the function arguments of this method all these traces are insturmented in
+            TTraceConfigsOperator::SetData(*trace,1,2,KData1);
+            setThreadId = aHasContext;
+            aTraceObjects.Append(trace);
+            }
+            break;
+        case EOstTraceFunctionEntryExtCtorNoInitList:
+            {
+            TTraceConfigs* trace = new TTraceConfigs;
+            ASSERT(trace);
+            TTraceConfigsOperator::Init(*trace);
+            TTraceConfigsOperator::SetOptions(*trace, aApi, ETrue, ETrue);
+            TTraceConfigsOperator::SetHeader(*trace,  TRACE_FLOW, KComponentId, EAddThreadIdentification, ENoProgramCounter, (0x8a0002&TRACEIDMASK)>>TRACEIDSHIFT);
+            //fix this - should be a list of the function arguments of this method all these traces are insturmented in
+            TTraceConfigsOperator::SetData(*trace,3, KData1);
+            setThreadId = aHasContext;
+            aTraceObjects.Append(trace);
+            }
+            break;
         case EOstTraceFunctionExit0:
             {
             TTraceConfigs* trace = new TTraceConfigs;
--- a/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_functional/inc/te_ostv2tracetestwrapper.h	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_functional/inc/te_ostv2tracetestwrapper.h	Fri Mar 19 10:00:55 2010 +0200
@@ -44,6 +44,9 @@
 
 private:
 	TInt CheckResults(const TDesC& aLogFilename);
+	void TestDuplicatesL();
+	void TestOstDebugOnlyWrapL();
+	TInt OpenUlogger(RULogger& aLogger);
 	};
 
 _LIT(KOstTraceTestWrapper, "OstTraceTestWrapper");
--- a/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_functional/src/te_ostv2tracetestwrapper.cpp	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_functional/src/te_ostv2tracetestwrapper.cpp	Fri Mar 19 10:00:55 2010 +0200
@@ -15,237 +15,422 @@
 //
 
 
-
 /**
  @file te_tracecontroldefaultconfig.cpp
  @internalTechnology
-*/
+ */
+#ifndef OST_TRACE_COMPILER_IN_USE
+#define OST_TRACE_COMPILER_IN_USE
+#endif //OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+
+
 #include "te_ostv2tracetestwrapper.h"
-#include "opensystemtrace_types.h"
 #include "te_ostv2tracetestwrapperTraces.h"
 
-const TUint32 KTestTInt1 =  0x123;
-const TUint32 KTestTInt2 =  0x456;
-
+const TUint32 KTestTInt1 = 0x123;
+const TUint32 KTestTInt2 = 0x456;
 _LIT(KTestDuplicates, "TestDuplicates");
 
-using namespace Ulogger; 
-CTOstv2TraceTestWrapper::~CTOstv2TraceTestWrapper()
+_LIT(KTestOstDebugOnlyWrap, "TestOstDebugOnlyWrap");
+
+//macro wrapper that works only in _DEBUG mode
+#ifndef OST_DEBUG_ONLY
+#ifdef _DEBUG
+#define OST_DEBUG_ONLY(x) x
+#else
+#define OST_DEBUG_ONLY(x)
+#endif
+#endif //ifndef OST_DEBUG_ONLY
+
+using namespace Ulogger;
 /**
  * Destructor
  */
-	{
-	}
+CTOstv2TraceTestWrapper::~CTOstv2TraceTestWrapper()
+    {
+    }
 
-CTOstv2TraceTestWrapper::CTOstv2TraceTestWrapper()
 /**
  * Constructor
  */
-	{
-	}
+CTOstv2TraceTestWrapper::CTOstv2TraceTestWrapper()
+    {
+    }
 
 CTOstv2TraceTestWrapper* CTOstv2TraceTestWrapper::NewLC()
-	{
-	CTOstv2TraceTestWrapper* self = new (ELeave)CTOstv2TraceTestWrapper();
-	CleanupStack::PushL(self);
-	self->ConstructL();
-	return self;
-	}
+    {
+    CTOstv2TraceTestWrapper* self = new (ELeave) CTOstv2TraceTestWrapper();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
 
 CTOstv2TraceTestWrapper* CTOstv2TraceTestWrapper::NewL()
-	{
-	CTOstv2TraceTestWrapper* self=CTOstv2TraceTestWrapper::NewLC();
-	CleanupStack::Pop(); // self;
-	return self;
-	}
+    {
+    CTOstv2TraceTestWrapper* self = CTOstv2TraceTestWrapper::NewLC();
+    CleanupStack::Pop(); // self;
+    return self;
+    }
 
 void CTOstv2TraceTestWrapper::ConstructL()
-	{
-	}
+    {
+    }
 
 TAny* CTOstv2TraceTestWrapper::GetObject()
-	{
-	return NULL;
-	}
-TBool CTOstv2TraceTestWrapper::DoCommandL(	const TTEFFunction& aCommand,
-											const TTEFSectionName& /*aSection*/, 
-											const TInt /*aAsyncErrorIndex*/)
-	{
-	
-	if(aCommand == KTestDuplicates())
-		{
-		
-		
-		INFO_PRINTF1(_L("CTOstv2TraceTestWrapper::DoCommandL Testing duplicates"));
-		
-		INFO_PRINTF1(_L("Opening Ulogger connection"));
-		RULogger logger;
-		TInt result=logger.Connect();
-		INFO_PRINTF2(_L("Connection to Ulogger: %d, attempt: 1"), result);
-		if (result!=KErrNone)
-			 {
-			 INFO_PRINTF1(_L("Connection to Ulogger failed. Will try to connect max. 10 times"));
-			 for (TInt i=2; i<12;i++)
-				 {
-					 User::After(1000);
-					 result = logger.Connect();
-					 INFO_PRINTF3(_L("Connection to Ulogger: %d, attempt: %d"), result, i);
-					 if (result==KErrNone)
-					 {
-					 break;
-					 }
-				 }
-			 }
-		
-	
-		// clear the config file
-		CClearConfig configIni;
-		configIni.Clear(logger);
+    {
+    return NULL;
+    }
+TBool CTOstv2TraceTestWrapper::DoCommandL(const TTEFFunction& aCommand,
+        const TTEFSectionName& /*aSection*/, const TInt /*aAsyncErrorIndex*/)
+    {
+
+    TBool ret = ETrue;
+    
+    if (aCommand == KTestDuplicates())
+        {
+        TestDuplicatesL();
+        }
+    else if (aCommand == KTestOstDebugOnlyWrap())
+        {
+        TestOstDebugOnlyWrapL();
+        }
+    else
+        {
+        ret = EFalse;
+        }
+    
+    return ret;
+    }
+
+
+TInt CTOstv2TraceTestWrapper::OpenUlogger(RULogger& aLogger)
+    {
+
+    INFO_PRINTF1(_L("Opening Ulogger connection"));
+    TInt result = aLogger.Connect();
+      INFO_PRINTF2(_L("Connection to Ulogger: %d, attempt: 1"), result);
+      if (result != KErrNone)
+          {
+          INFO_PRINTF1(_L("Connection to Ulogger failed. Will try to connect max. 10 times"));
+          for (TInt i = 2; i < 12; i++)
+              {
+              User::After(1000);
+              result = aLogger.Connect();
+              INFO_PRINTF3(_L("Connection to Ulogger: %d, attempt: %d"), result, i);
+              if (result == KErrNone)
+                  {
+                  break;
+                  }
+              }
+          }
+      
+      if(result != KErrNone)
+          {
+          ERR_PRINTF2(_L("Failed to open Ulogger: error (%d)"), result);
+          }
+      
+      return result;
+    }
+
+void CTOstv2TraceTestWrapper::TestDuplicatesL()
+    {
+
+    INFO_PRINTF1(_L("CTOstv2TraceTestWrapper::TestDuplicates"));
+
+    RULogger logger;
+
+    
+    User::LeaveIfError(OpenUlogger(logger));
+    // clear the config file
+    CClearConfig configIni;
+    configIni.Clear(logger);
+
+    // extract the user ids from the values generated by tracecompiler
+    const TUint8 USER_DEFINED_GID_1 = TEST_OSTTRACEWRAPPER7 >> 16;
+    const TUint8 USER_DEFINED_GID_2 = TEST_OSTTRACEWRAPPER8 >> 16;
 
-		// extract the user ids from the values generated by tracecompiler
-		const TUint8 USER_DEFINED_GID_1 = TEST_OSTTRACEWRAPPER7 >> 16;
-		const TUint8 USER_DEFINED_GID_2 = TEST_OSTTRACEWRAPPER8 >> 16;
-		
-		// switch on primary filtering mechanism
-		CArrayFixFlat<TUint8> *setprimfilter = new (ELeave)CArrayFixFlat<TUint8>(22);
-		setprimfilter->AppendL(KGroupId);
-		setprimfilter->AppendL(TRACE_FATAL); 
-		setprimfilter->AppendL(TRACE_DUMP);
-		setprimfilter->AppendL(TRACE_DEBUG);				
-		setprimfilter->AppendL(USER_DEFINED_GID_1);
-		setprimfilter->AppendL(USER_DEFINED_GID_2);
-		
-		result = logger.SetPrimaryFiltersEnabled(*setprimfilter, ETrue);
-				
-		if(result != KErrNone)
-			{
-			ERR_PRINTF2(_L("Failed to set Ulogger primary filters result(%d"), result);
-			SetBlockResult(EFail);	
-			}
-				
-		// switch off secondary filtering
-		result = logger.SetSecondaryFilteringEnabled(EFalse);
-		if(result != KErrNone)
-			{
-			ERR_PRINTF2(_L("Failed to set Ulogger secondary filters result(%d"), result);
-			SetBlockResult(EFail);	
-			}
-		
-		delete setprimfilter;
-		setprimfilter = NULL;
+    // switch on primary filtering mechanism
+    CArrayFixFlat<TUint8> *setprimfilter =
+            new (ELeave) CArrayFixFlat<TUint8> (22);
+    setprimfilter->AppendL(KGroupId);
+    setprimfilter->AppendL(TRACE_FATAL);
+    setprimfilter->AppendL(TRACE_DUMP);
+    setprimfilter->AppendL(TRACE_DUMP);
+    setprimfilter->AppendL(USER_DEFINED_GID_1);
+    setprimfilter->AppendL(USER_DEFINED_GID_2);
+
+    TInt result = logger.SetPrimaryFiltersEnabled(*setprimfilter, ETrue);
+
+    if (result != KErrNone)
+        {
+        ERR_PRINTF2(_L("Failed to set Ulogger primary filters result(%d"), result);
+        SetBlockResult(EFail);
+        }
+
+    // switch off secondary filtering
+    result = logger.SetSecondaryFilteringEnabled(EFalse);
+    if (result != KErrNone)
+        {
+        ERR_PRINTF2(_L("Failed to set Ulogger secondary filters result(%d"), result);
+        SetBlockResult(EFail);
+        }
+
+    delete setprimfilter;
+    setprimfilter = NULL;
+    // setup output file
+    _LIT(KLogFilename, "C:\\logs\\duplicate_trace_test.utf");
+    EmptyFile(KLogFilename);
+    // setup ulogger to write to the file using its output plugin
+    _LIT8(KTextmedia,"uloggerfileplugin");
+    TPtrC8 mediaptr(KTextmedia);
+    result = logger.ActivateOutputPlugin(mediaptr);
+    if (result == KErrNone)
+        {
+        INFO_PRINTF1(_L("file set as active output plugin ok"));
+        TPluginConfiguration pluginConfig;
+        _LIT(KTextsetting, "output_path");
+        pluginConfig.SetKey(KTextsetting);
+        pluginConfig.SetValue(KLogFilename());
+        result = logger.SetPluginConfigurations(mediaptr, pluginConfig);
+        if (result == KErrNone)
+            {
+            INFO_PRINTF1(_L("output plugin settings set ok"));
+
+            result = logger.Start();
+            if (result == KErrNone)
+                {
+                // add some traces TRACE_DUMP & TRACE_DUMP equate to the same numeric value
+
+                AddTraceHelper((TGroupId) TRACE_FATAL,
+                        (TTraceId) TEST_OSTTRACEWRAPPER1, KTestTInt1);
+                OstTrace1(TRACE_FATAL, TEST_OSTTRACEWRAPPER1, "CTOstv2TraceTestWrapper TRACE_FATAL test 1 KTestTInt1 (%d)" , KTestTInt1);
+
+                AddTraceHelper((TGroupId) TRACE_DUMP,
+                        (TTraceId) TEST_OSTTRACEWRAPPER2, KTestTInt1);
+                OstTrace1(TRACE_DUMP, TEST_OSTTRACEWRAPPER2, "CTOstv2TraceTestWrapper TRACE_DUMP test 1 KTestTInt1 (%d)" , KTestTInt1);
+
+                AddTraceHelper((TGroupId) TRACE_DUMP,
+                        (TTraceId) TEST_OSTTRACEWRAPPER3, KTestTInt1);
+                OstTrace1(TRACE_DUMP, TEST_OSTTRACEWRAPPER3, "CTOstv2TraceTestWrapper TRACE_DUMP  test 1 KTestTInt1 (%d)" , KTestTInt1);
+
+                AddTraceHelper((TGroupId) TRACE_FATAL,
+                        (TTraceId) TEST_OSTTRACEWRAPPER4, KTestTInt2);
+                OstTrace1(TRACE_FATAL, TEST_OSTTRACEWRAPPER4, "CTOstv2TraceTestWrapper TRACE_FATAL test 2 KTestTInt2 (%d)" , KTestTInt2);
+
+                AddTraceHelper((TGroupId) TRACE_DUMP,
+                        (TTraceId) TEST_OSTTRACEWRAPPER5, KTestTInt2);
+                OstTrace1(TRACE_DUMP, TEST_OSTTRACEWRAPPER5, "CTOstv2TraceTestWrapper TRACE_DUMP test 2 KTestTInt2 (%d)" , KTestTInt2);
+
+                AddTraceHelper((TGroupId) TRACE_DUMP,
+                        (TTraceId) TEST_OSTTRACEWRAPPER6, KTestTInt2);
+                OstTrace1(TRACE_DUMP, TEST_OSTTRACEWRAPPER6, "CTOstv2TraceTestWrapper TRACE_DUMP  test 2 KTestTInt2 (%d)" , KTestTInt2);
+
+                AddTraceHelper((TGroupId) USER_DEFINED_GID_1,
+                        (TTraceId) TEST_OSTTRACEWRAPPER7, KTestTInt1);
+                OstTrace1(USER_DEFINED_GID_1, TEST_OSTTRACEWRAPPER7, "CTOstv2TraceTestWrapper USER_DEFINED_GID_1  test 2 KTestTInt2 (%d)" , KTestTInt1);
 
-		
-		// setup output file
-		_LIT(KLogFilename, "C:\\logs\\duplicate_trace_test.utf");
-		EmptyFile(KLogFilename);
-		// setup ulogger to write to the file using its output plugin
-		_LIT8(KTextmedia,"uloggerfileplugin");
-		TPtrC8 mediaptr(KTextmedia);
-		result=logger.ActivateOutputPlugin(mediaptr);
-		if(result == KErrNone)
-			{
-			INFO_PRINTF1(_L("file set as active output plugin ok"));
-			TPluginConfiguration pluginConfig;
-			_LIT(KTextsetting, "output_path");
-			pluginConfig.SetKey(KTextsetting);
-			pluginConfig.SetValue(KLogFilename());
-			result=logger.SetPluginConfigurations(mediaptr, pluginConfig);
-			if(result == KErrNone)
-				{
-				INFO_PRINTF1(_L("output plugin settings set ok"));
+                AddTraceHelper((TGroupId) USER_DEFINED_GID_2,
+                        (TTraceId) TEST_OSTTRACEWRAPPER8, KTestTInt2);
+                OstTrace1(USER_DEFINED_GID_2, TEST_OSTTRACEWRAPPER8, "CTOstv2TraceTestWrapper USER_DEFINED_GID_1  test 2 KTestTInt2 (%d)" , KTestTInt2);
+                
+                result = logger.Stop();
+
+                if (result == KErrNone)
+                    {
+                    SetBlockResult(
+                            CheckResults(KLogFilename()) == KErrNone
+                                                                     ? EPass
+                                                                        : EFail);
+                    }
+                }
+            else
+                {
+                INFO_PRINTF2(_L("ulogger start returns error %d"), result);
+                }
+            }
+        else
+            {
+            INFO_PRINTF2(_L("setting output plugin settings failed with err %d"), result);
+            }
+        }
+    else
+        {
+        INFO_PRINTF2(_L("add file as output plugin failed with err %d"), result);
+        }
+    }
+
+
+void CTOstv2TraceTestWrapper::TestOstDebugOnlyWrapL()
+    {
+    INFO_PRINTF1(_L("CTOstv2TraceTestWrapper::TestDuplicates"));
 
-				result=logger.Start();
-				if(result == KErrNone)
-					{	
-					// add some traces TRACE_DEBUG & TRACE_DUMP equate to the same numeric value
-					
-					AddTraceHelper((TGroupId)TRACE_FATAL, (TTraceId)TEST_OSTTRACEWRAPPER1, KTestTInt1);
-					OstTrace1(TRACE_FATAL, 	TEST_OSTTRACEWRAPPER1, "CTOstv2TraceTestWrapper TRACE_FATAL test 1 KTestTInt1 (%d)" , KTestTInt1);
-					
-					
-					AddTraceHelper((TGroupId)TRACE_DEBUG, (TTraceId)TEST_OSTTRACEWRAPPER2, KTestTInt1);
-					OstTrace1(TRACE_DEBUG, 	TEST_OSTTRACEWRAPPER2, "CTOstv2TraceTestWrapper TRACE_DEBUG test 1 KTestTInt1 (%d)" , KTestTInt1);
-					
-					AddTraceHelper((TGroupId)TRACE_DUMP, (TTraceId)TEST_OSTTRACEWRAPPER3, KTestTInt1);
-					OstTrace1(TRACE_DUMP, 	TEST_OSTTRACEWRAPPER3, "CTOstv2TraceTestWrapper TRACE_DUMP  test 1 KTestTInt1 (%d)" , KTestTInt1);
+    RULogger logger;
+
+    
+    User::LeaveIfError(OpenUlogger(logger));
+    // clear the config file
+    CClearConfig configIni;
+    configIni.Clear(logger);
+
+    // extract the user ids from the values generated by tracecompiler
+    const TUint8 USER_DEFINED_GID_1w = TEST_OSTTRACEWRAPPER7w >> 16;
+    const TUint8 USER_DEFINED_GID_2w = TEST_OSTTRACEWRAPPER8w >> 16;
+
+    // switch on primary filtering mechanism
+    CArrayFixFlat<TUint8> *setprimfilter =
+            new (ELeave) CArrayFixFlat<TUint8> (22);
+    setprimfilter->AppendL(KGroupId);
+    setprimfilter->AppendL(TRACE_FATAL);
+    setprimfilter->AppendL(TRACE_DUMP);
+    setprimfilter->AppendL(TRACE_DUMP);
+    setprimfilter->AppendL(USER_DEFINED_GID_1w);
+    setprimfilter->AppendL(USER_DEFINED_GID_2w);
+
+    TInt result = logger.SetPrimaryFiltersEnabled(*setprimfilter, ETrue);
+
+    if (result != KErrNone)
+        {
+        ERR_PRINTF2(_L("Failed to set Ulogger primary filters result(%d"), result);
+        SetBlockResult(EFail);
+        }
+
+    // switch off secondary filtering
+    result = logger.SetSecondaryFilteringEnabled(EFalse);
+    if (result != KErrNone)
+        {
+        ERR_PRINTF2(_L("Failed to set Ulogger secondary filters result(%d"), result);
+        SetBlockResult(EFail);
+        }
 
-					AddTraceHelper((TGroupId)TRACE_FATAL, (TTraceId)TEST_OSTTRACEWRAPPER4, KTestTInt2);
-					OstTrace1(TRACE_FATAL, 	TEST_OSTTRACEWRAPPER4, "CTOstv2TraceTestWrapper TRACE_FATAL test 2 KTestTInt2 (%d)" , KTestTInt2);
-					
-					AddTraceHelper((TGroupId)TRACE_DEBUG, (TTraceId)TEST_OSTTRACEWRAPPER5, KTestTInt2);
-					OstTrace1(TRACE_DEBUG, 	TEST_OSTTRACEWRAPPER5, "CTOstv2TraceTestWrapper TRACE_DEBUG test 2 KTestTInt2 (%d)" , KTestTInt2);
+    delete setprimfilter;
+    setprimfilter = NULL;
+    // setup output file
+    _LIT(KLogFilename, "C:\\logs\\duplicate_trace_test.utf");
+    EmptyFile(KLogFilename);
+    // setup ulogger to write to the file using its output plugin
+    _LIT8(KTextmedia,"uloggerfileplugin");
+    TPtrC8 mediaptr(KTextmedia);
+    result = logger.ActivateOutputPlugin(mediaptr);
+    if (result == KErrNone)
+        {
+        INFO_PRINTF1(_L("file set as active output plugin ok"));
+        TPluginConfiguration pluginConfig;
+        _LIT(KTextsetting, "output_path");
+        pluginConfig.SetKey(KTextsetting);
+        pluginConfig.SetValue(KLogFilename());
+        result = logger.SetPluginConfigurations(mediaptr, pluginConfig);
+        if (result == KErrNone)
+            {
+            INFO_PRINTF1(_L("output plugin settings set ok"));
 
-					AddTraceHelper((TGroupId)TRACE_DUMP, (TTraceId)TEST_OSTTRACEWRAPPER6, KTestTInt2);
-					OstTrace1(TRACE_DUMP, TEST_OSTTRACEWRAPPER6, "CTOstv2TraceTestWrapper TRACE_DUMP  test 2 KTestTInt2 (%d)" , KTestTInt2);					
-			
-					AddTraceHelper((TGroupId)USER_DEFINED_GID_1, (TTraceId)TEST_OSTTRACEWRAPPER7, KTestTInt1);
-					OstTrace1(USER_DEFINED_GID_1, TEST_OSTTRACEWRAPPER7, "CTOstv2TraceTestWrapper USER_DEFINED_GID_1  test 2 KTestTInt2 (%d)" , KTestTInt1);					
+            result = logger.Start();
+            if (result == KErrNone)
+                {
+                // now try the same traces again but with the OST_DEBUG_ONLY wrapper
+                OST_DEBUG_ONLY(AddTraceHelper((TGroupId) TRACE_FATAL,
+                        (TTraceId) TEST_OSTTRACEWRAPPER1w, KTestTInt1));
+                OST_DEBUG_ONLY(OstTrace1(TRACE_FATAL, TEST_OSTTRACEWRAPPER1w, "CTOstv2TraceTestWrapper TRACE_FATAL test 1 KTestTInt1 (%d)" , KTestTInt1));
+
+                OST_DEBUG_ONLY(AddTraceHelper((TGroupId) TRACE_DUMP,
+                        (TTraceId) TEST_OSTTRACEWRAPPER2w, KTestTInt1));
+                OST_DEBUG_ONLY(OstTrace1(TRACE_DUMP, TEST_OSTTRACEWRAPPER2w, "CTOstv2TraceTestWrapper TRACE_DUMP test 1 KTestTInt1 (%d)" , KTestTInt1));
+
+                OST_DEBUG_ONLY(AddTraceHelper((TGroupId) TRACE_DUMP,
+                        (TTraceId) TEST_OSTTRACEWRAPPER3w, KTestTInt1));
+                OST_DEBUG_ONLY(OstTrace1(TRACE_DUMP, TEST_OSTTRACEWRAPPER3w, "CTOstv2TraceTestWrapper TRACE_DUMP  test 1 KTestTInt1 (%d)" , KTestTInt1));
+
+                OST_DEBUG_ONLY(AddTraceHelper((TGroupId) TRACE_FATAL,
+                        (TTraceId) TEST_OSTTRACEWRAPPER4w, KTestTInt2));
+                OST_DEBUG_ONLY(OstTrace1(TRACE_FATAL, TEST_OSTTRACEWRAPPER4w, "CTOstv2TraceTestWrapper TRACE_FATAL test 2 KTestTInt2 (%d)" , KTestTInt2));
 
-					AddTraceHelper((TGroupId)USER_DEFINED_GID_2, (TTraceId)TEST_OSTTRACEWRAPPER8, KTestTInt2);
-					OstTrace1(USER_DEFINED_GID_2, TEST_OSTTRACEWRAPPER8, "CTOstv2TraceTestWrapper USER_DEFINED_GID_1  test 2 KTestTInt2 (%d)" , KTestTInt2);					
-					
-					result=logger.Stop();
-					
-					if(result == KErrNone)
-						{
-						SetBlockResult(CheckResults(KLogFilename()) == KErrNone ? EPass : EFail);
-						}					
-					}
-				else
-					{
-					INFO_PRINTF2(_L("ulogger start returns error %d"), result);	
-					}
-				}
-			else
-				{
-				INFO_PRINTF2(_L("setting output plugin settings failed with err %d"), result);
-				}			
-			}
-		else
-			{
-			INFO_PRINTF2(_L("add file as output plugin failed with err %d"), result);
-			}
-		}
-		return ETrue;
-	}
+                OST_DEBUG_ONLY(AddTraceHelper((TGroupId) TRACE_DUMP,
+                        (TTraceId) TEST_OSTTRACEWRAPPER5w, KTestTInt2));
+                OST_DEBUG_ONLY(OstTrace1(TRACE_DUMP, TEST_OSTTRACEWRAPPER5w, "CTOstv2TraceTestWrapper TRACE_DUMP test 2 KTestTInt2 (%d)" , KTestTInt2));
+
+                OST_DEBUG_ONLY(AddTraceHelper((TGroupId) TRACE_DUMP,
+                        (TTraceId) TEST_OSTTRACEWRAPPER6w, KTestTInt2));
+                OST_DEBUG_ONLY(OstTrace1(TRACE_DUMP, TEST_OSTTRACEWRAPPER6w, "CTOstv2TraceTestWrapper TRACE_DUMP  test 2 KTestTInt2 (%d)" , KTestTInt2));
+
+                OST_DEBUG_ONLY(AddTraceHelper((TGroupId) USER_DEFINED_GID_1w,
+                        (TTraceId) TEST_OSTTRACEWRAPPER7w, KTestTInt1));
+                OST_DEBUG_ONLY(OstTrace1(USER_DEFINED_GID_1, TEST_OSTTRACEWRAPPER7w, "CTOstv2TraceTestWrapper USER_DEFINED_GID_1  test 2 KTestTInt2 (%d)" , KTestTInt1));
+
+                OST_DEBUG_ONLY(AddTraceHelper((TGroupId) USER_DEFINED_GID_2w,
+                        (TTraceId) TEST_OSTTRACEWRAPPER8w, KTestTInt2));
+                OST_DEBUG_ONLY(OstTrace1(USER_DEFINED_GID_2, TEST_OSTTRACEWRAPPER8w, "CTOstv2TraceTestWrapper USER_DEFINED_GID_1  test 2 KTestTInt2 (%d)" , KTestTInt2));
+
+                                
+                result = logger.Stop();
+
+                if (result == KErrNone)
+                    {
+                    SetBlockResult(
+                            CheckResults(KLogFilename()) == KErrNone
+                                                                     ? EPass
+                                                                        : EFail);
+                    }
+                }
+            else
+                {
+                INFO_PRINTF2(_L("ulogger start returns error %d"), result);
+                }
+            }
+        else
+            {
+            INFO_PRINTF2(_L("setting output plugin settings failed with err %d"), result);
+            }
+        }
+    else
+        {
+        INFO_PRINTF2(_L("add file as output plugin failed with err %d"), result);
+        }
+    }
 
 
 TInt CTOstv2TraceTestWrapper::CheckResults(const TDesC& aLogFilename)
-	{
-	// read the logged traces from the log file	
-	TInt  err = ReadFromLogFile(aLogFilename);
-	if(err == KErrNone)
-		{
-		err = CompareTraces();
-		if(err == KErrNone)
-			{
-			
-			}
-		else{
-			ERR_PRINTF2(_L("CompareTraces returned err (%d)"), err);
-			}
-		}
-	else
-		{
-		ERR_PRINTF2(_L("ReadFromLogFile returned err (%d)"), err);
-		}
-	
-	return err;
-	}
+    {
+    // read the logged traces from the log file	
+    TInt err = ReadFromLogFile(aLogFilename);
+    if (err == KErrNone)
+        {
+        err = CompareTraces();
+        if (err == KErrNone)
+            {
+
+            }
+        else
+            {
+            ERR_PRINTF2(_L("CompareTraces returned err (%d)"), err);
+            }
+        }
+    else
+        {
+        ERR_PRINTF2(_L("ReadFromLogFile returned err (%d)"), err);
+        }
+
+    return err;
+    }
+
+void CTOstv2TraceTestWrapper::CTOstv2TraceTestWrapper::AddTraceHelper(
+        const TGroupId aGroupId, const TTraceId aTraceId, TUint32 aValue)
+    {
+    if (CreateTraceObject(KOstTraceComponentID, aGroupId,
+            EAddThreadIdentification, ENoProgramCounter, iSentTraces))
+        {
+        TTraceConfigs& config = *iSentTraces[iSentTraces.Count() - 1];
+        TTraceConfigsOperator::SetData(config, aValue);
+        TTraceConfigsOperator::SetHeader(config, aGroupId,
+                KOstTraceComponentID, EAddThreadIdentification,
+                ENoProgramCounter, aTraceId);
+        }
+    else
+        {
+        ERR_PRINTF2(_L("CreateTraceObject failed with for traceid (%d)"), aTraceId);
+        SetBlockResult(EFail);
+        }
+    }
 
 
 
-void CTOstv2TraceTestWrapper::CTOstv2TraceTestWrapper::AddTraceHelper(const TGroupId aGroupId, const TTraceId aTraceId, TUint32 aValue)
-	{	
-	if( CreateTraceObject(KOstTraceComponentID, aGroupId, EAddThreadIdentification , ENoProgramCounter, iSentTraces))
-		{
-		TTraceConfigs& config = *iSentTraces[iSentTraces.Count()-1];
-		TTraceConfigsOperator::SetData(config, aValue );					
-		TTraceConfigsOperator::SetHeader(config, aGroupId, KOstTraceComponentID, EAddThreadIdentification , ENoProgramCounter, aTraceId);
-		}
-	else
-		{
-		ERR_PRINTF2(_L("CreateTraceObject failed with for traceid (%d)"),  aTraceId);
-		SetBlockResult(EFail);
-		}	
-	}
+
--- a/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_functional/testdata/scripts/te_integ_tracecollectorclient.script	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_functional/testdata/scripts/te_integ_tracecollectorclient.script	Fri Mar 19 10:00:55 2010 +0200
@@ -39,6 +39,12 @@
 	COMMAND                     OstTraceTestWrapper               		TestDuplicates
 END_TEST_BLOCK
 
+PRINT Run OstTrace OST_DEBUG_ONLY wrapped trace points
+
+START_TEST_BLOCK    20000       te_ostv2integsuite_enabled              \testdata\configs\te_integ_tracecollectorclient.ini
+    CREATE_OBJECT               OstTraceTestWrapper                     OstTraceTestWrapper
+    COMMAND                     OstTraceTestWrapper                     TestOstDebugOnlyWrap
+END_TEST_BLOCK
 
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/traceservices/tracefw/integ_test/ost/TEF/traces/OstTraceDefinitions.h	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- a/traceservices/tracefw/integ_test/ost/TEF/traces/fixed_id.definitions	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/traces/fixed_id.definitions	Fri Mar 19 10:00:55 2010 +0200
@@ -1,6 +1,5 @@
 #Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
 [GROUP]TEST_GROUP=0xde
-[GROUP]TRACE_DEBUG=0x89
 [GROUP]TRACE_DUMP=0x89
 [GROUP]TRACE_FATAL=0x81
 [GROUP]TRACE_FLOW=0x8a
@@ -9,10 +8,14 @@
 [GROUP]USER_DEFINED_GID_1=0xdf
 [GROUP]USER_DEFINED_GID_2=0xe0
 [TRACE]TEST_GROUP[0xDE]_OstTesting=0x1
-[TRACE]TRACE_DEBUG[0x89]_TEST_OSTTRACEWRAPPER2=0x1
-[TRACE]TRACE_DEBUG[0x89]_TEST_OSTTRACEWRAPPER5=0x2
-[TRACE]TRACE_DUMP[0x89]_TEST_OSTTRACEWRAPPER3=0x1
-[TRACE]TRACE_DUMP[0x89]_TEST_OSTTRACEWRAPPER6=0x2
+[TRACE]TRACE_DUMP[0x89]_TEST_OSTTRACEWRAPPER2=0x1
+[TRACE]TRACE_DUMP[0x89]_TEST_OSTTRACEWRAPPER2w=0x5
+[TRACE]TRACE_DUMP[0x89]_TEST_OSTTRACEWRAPPER3=0x2
+[TRACE]TRACE_DUMP[0x89]_TEST_OSTTRACEWRAPPER3w=0x6
+[TRACE]TRACE_DUMP[0x89]_TEST_OSTTRACEWRAPPER5=0x3
+[TRACE]TRACE_DUMP[0x89]_TEST_OSTTRACEWRAPPER5w=0x7
+[TRACE]TRACE_DUMP[0x89]_TEST_OSTTRACEWRAPPER6=0x4
+[TRACE]TRACE_DUMP[0x89]_TEST_OSTTRACEWRAPPER6w=0x8
 [TRACE]TRACE_FATAL[0x81]_TEST_OSTTRACE0=0x9
 [TRACE]TRACE_FATAL[0x81]_TEST_OSTTRACE1=0xa
 [TRACE]TRACE_FATAL[0x81]_TEST_OSTTRACEDATA=0xb
@@ -24,7 +27,9 @@
 [TRACE]TRACE_FATAL[0x81]_TEST_OSTTRACEEXT4=0xf
 [TRACE]TRACE_FATAL[0x81]_TEST_OSTTRACEEXT5=0x10
 [TRACE]TRACE_FATAL[0x81]_TEST_OSTTRACEWRAPPER1=0x13
+[TRACE]TRACE_FATAL[0x81]_TEST_OSTTRACEWRAPPER1w=0x15
 [TRACE]TRACE_FATAL[0x81]_TEST_OSTTRACEWRAPPER4=0x14
+[TRACE]TRACE_FATAL[0x81]_TEST_OSTTRACEWRAPPER4w=0x16
 [TRACE]TRACE_FATAL[0x81]_TEST_OstTraceDef0=0x1
 [TRACE]TRACE_FATAL[0x81]_TEST_OstTraceDef1=0x2
 [TRACE]TRACE_FATAL[0x81]_TEST_OstTraceDefData=0x3
@@ -33,16 +38,20 @@
 [TRACE]TRACE_FATAL[0x81]_TEST_OstTraceDefExt3=0x6
 [TRACE]TRACE_FATAL[0x81]_TEST_OstTraceDefExt4=0x7
 [TRACE]TRACE_FATAL[0x81]_TEST_OstTraceDefExt5=0x8
-[TRACE]TRACE_FLOW[0x8A]_TEST_OSTTRACEFUNCTIONEXIT1=0x5
-[TRACE]TRACE_FLOW[0x8A]_TEST_OSTTRACEFUNCTIONEXITEXT=0x6
-[TRACE]TRACE_FLOW[0x8A]_TEST_OSTTraceFunctionalityEntry0=0x1
-[TRACE]TRACE_FLOW[0x8A]_TEST_OSTTraceFunctionalityEntry1=0x2
-[TRACE]TRACE_FLOW[0x8A]_TEST_OSTTraceFunctionalityExt=0x3
-[TRACE]TRACE_FLOW[0x8A]_TEST_OstTraceFunctionExit0=0x4
+[TRACE]TRACE_FLOW[0x8A]_CTESTCTOR_INITLIST_TRACE=0x1
+[TRACE]TRACE_FLOW[0x8A]_CTESTCTOR_NO_INITLIST_TRACE=0x2
+[TRACE]TRACE_FLOW[0x8A]_TEST_OSTTRACEFUNCTIONEXIT1=0x7
+[TRACE]TRACE_FLOW[0x8A]_TEST_OSTTRACEFUNCTIONEXITEXT=0x8
+[TRACE]TRACE_FLOW[0x8A]_TEST_OSTTraceFunctionalityEntry0=0x3
+[TRACE]TRACE_FLOW[0x8A]_TEST_OSTTraceFunctionalityEntry1=0x4
+[TRACE]TRACE_FLOW[0x8A]_TEST_OSTTraceFunctionalityExt=0x5
+[TRACE]TRACE_FLOW[0x8A]_TEST_OstTraceFunctionExit0=0x6
 [TRACE]TRACE_PERFORMANCE[0x8B]_TEST_OSTTRACEEVENTSTART0=0x1
 [TRACE]TRACE_PERFORMANCE[0x8B]_TEST_OSTTRACEEVENTSTART1=0x2
 [TRACE]TRACE_PERFORMANCE[0x8B]_TEST_OSTTRACEEVENTSTOP=0x3
 [TRACE]TRACE_STATE[0x87]_TEST_OSTTRACESTATE0=0x1
 [TRACE]TRACE_STATE[0x87]_TEST_OSTTRACESTATE1=0x2
 [TRACE]USER_DEFINED_GID_1[0xDF]_TEST_OSTTRACEWRAPPER7=0x1
+[TRACE]USER_DEFINED_GID_1[0xDF]_TEST_OSTTRACEWRAPPER7w=0x2
 [TRACE]USER_DEFINED_GID_2[0xE0]_TEST_OSTTRACEWRAPPER8=0x1
+[TRACE]USER_DEFINED_GID_2[0xE0]_TEST_OSTTRACEWRAPPER8w=0x2
--- a/traceservices/tracefw/integ_test/ost/TEF/traces/te_advancedfilteringTraces.h	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/traces/te_advancedfilteringTraces.h	Fri Mar 19 10:00:55 2010 +0200
@@ -1,4 +1,4 @@
-// Created by TraceCompiler 1.3.1
+// Created by TraceCompiler 2.1.3
 // DO NOT EDIT, CHANGES WILL BE LOST
 
 #ifndef __TE_ADVANCEDFILTERINGTRACES_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/traceservices/tracefw/integ_test/ost/TEF/traces/te_ctorTraces.h	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,90 @@
+// Created by TraceCompiler 2.1.3
+// DO NOT EDIT, CHANGES WILL BE LOST
+
+#ifndef __TE_CTORTRACES_H__
+#define __TE_CTORTRACES_H__
+
+#define KOstTraceComponentID 0x1028722e
+
+#define CTESTCTOR_INITLIST_TRACE 0x8a0001, ( TUint )( aArg1 ), ( TUint )( aArg2 )
+#define CTESTCTOR_NO_INITLIST_TRACE 0x8a0002, ( TUint )( aArg1 )
+
+
+inline TBool OstTraceGenExt( TUint32 aTraceID, TUint aParam1, TUint aParam2, TUint aParam3 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 12 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam2;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam3;
+        ptr += sizeof ( TUint );
+        ptr -= 12;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 12 );
+        }
+    return retval;
+    }
+
+inline TBool OstTraceGenExt( TUint32 aTraceID, TUint32 aParam1, TUint32 aParam2, TUint32 aParam3 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 12 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam2;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam3;
+        ptr += sizeof ( TUint );
+        ptr -= 12;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 12 );
+        }
+    return retval;
+    }
+
+
+inline TBool OstTraceGenExt( TUint32 aTraceID, TUint aParam1, TUint aParam2 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 8 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam2;
+        ptr += sizeof ( TUint );
+        ptr -= 8;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
+        }
+    return retval;
+    }
+
+inline TBool OstTraceGenExt( TUint32 aTraceID, TUint32 aParam1, TUint32 aParam2 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 8 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam2;
+        ptr += sizeof ( TUint );
+        ptr -= 8;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
+        }
+    return retval;
+    }
+
+
+#endif
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/traceservices/tracefw/integ_test/ost/TEF/traces/te_ctor_disabledTraces.h	Fri Mar 19 10:00:55 2010 +0200
@@ -0,0 +1,90 @@
+// Created by TraceCompiler 2.1.3
+// DO NOT EDIT, CHANGES WILL BE LOST
+
+#ifndef __TE_CTOR_DISABLEDTRACES_H__
+#define __TE_CTOR_DISABLEDTRACES_H__
+
+#define KOstTraceComponentID 0x1028722f
+
+#define CTESTCTOR_INITLIST_TRACE 0x8a0001, ( TUint )( aArg1 ), ( TUint )( aArg2 )
+#define CTESTCTOR_NO_INITLIST_TRACE 0x8a0002, ( TUint )( aArg1 )
+
+
+inline TBool OstTraceGenExt( TUint32 aTraceID, TUint aParam1, TUint aParam2, TUint aParam3 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 12 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam2;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam3;
+        ptr += sizeof ( TUint );
+        ptr -= 12;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 12 );
+        }
+    return retval;
+    }
+
+inline TBool OstTraceGenExt( TUint32 aTraceID, TUint32 aParam1, TUint32 aParam2, TUint32 aParam3 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 12 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam2;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam3;
+        ptr += sizeof ( TUint );
+        ptr -= 12;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 12 );
+        }
+    return retval;
+    }
+
+
+inline TBool OstTraceGenExt( TUint32 aTraceID, TUint aParam1, TUint aParam2 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 8 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam2;
+        ptr += sizeof ( TUint );
+        ptr -= 8;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
+        }
+    return retval;
+    }
+
+inline TBool OstTraceGenExt( TUint32 aTraceID, TUint32 aParam1, TUint32 aParam2 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 8 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam2;
+        ptr += sizeof ( TUint );
+        ptr -= 8;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
+        }
+    return retval;
+    }
+
+
+#endif
+
+// End of file
+
--- a/traceservices/tracefw/integ_test/ost/TEF/traces/te_instrumentationpoints_disabledTraces.h	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/traces/te_instrumentationpoints_disabledTraces.h	Fri Mar 19 10:00:55 2010 +0200
@@ -1,4 +1,4 @@
-// Created by TraceCompiler 1.3.1
+// Created by TraceCompiler 2.1.3
 // DO NOT EDIT, CHANGES WILL BE LOST
 
 #ifndef __TE_INSTRUMENTATIONPOINTS_DISABLEDTRACES_H__
@@ -6,6 +6,12 @@
 
 #define KOstTraceComponentID 0x1028722f
 
+#define TEST_OSTTraceFunctionalityEntry0 0x8a0003
+#define TEST_OSTTraceFunctionalityEntry1 0x8a0004
+#define TEST_OSTTraceFunctionalityExt 0x8a0005, ( TUint )&( aApiRunConfig ), ( TUint )&( aApiRunResults )
+#define TEST_OstTraceFunctionExit0 0x8a0006
+#define TEST_OSTTRACEFUNCTIONEXIT1 0x8a0007
+#define TEST_OSTTRACEFUNCTIONEXITEXT 0x8a0008
 #define TEST_OstTraceDef0 0x810001
 #define TEST_OstTraceDef1 0x810002
 #define TEST_OstTraceDefData 0x810003
@@ -24,12 +30,6 @@
 #define TEST_OSTTRACEEXT5 0x810010
 #define TEST_OSTTRACEDATA96 0x810011
 #define TEST_OSTTRACEDATA1000 0x810012
-#define TEST_OSTTraceFunctionalityEntry0 0x8a0001
-#define TEST_OSTTraceFunctionalityEntry1 0x8a0002
-#define TEST_OSTTraceFunctionalityExt 0x8a0003, ( TUint )&( aApiRunConfig ), ( TUint )&( aApiRunResults )
-#define TEST_OstTraceFunctionExit0 0x8a0004
-#define TEST_OSTTRACEFUNCTIONEXIT1 0x8a0005
-#define TEST_OSTTRACEFUNCTIONEXITEXT 0x8a0006
 #define TEST_OSTTRACEEVENTSTART0 0x8b0001
 #define TEST_OSTTRACEEVENTSTART1 0x8b0002
 #define TEST_OSTTRACEEVENTSTOP 0x8b0003
@@ -37,6 +37,80 @@
 #define TEST_OSTTRACESTATE1 0x870002
 
 
+inline TBool OstTraceGenExt( TUint32 aTraceID, TUint aParam1, TUint aParam2, TUint aParam3 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 12 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam2;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam3;
+        ptr += sizeof ( TUint );
+        ptr -= 12;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 12 );
+        }
+    return retval;
+    }
+
+inline TBool OstTraceGenExt( TUint32 aTraceID, TUint32 aParam1, TUint32 aParam2, TUint32 aParam3 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 12 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam2;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam3;
+        ptr += sizeof ( TUint );
+        ptr -= 12;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 12 );
+        }
+    return retval;
+    }
+
+
+inline TBool OstTraceGen2( TUint32 aTraceID, TUint aParam1, TInt aParam2 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 8 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TInt* )ptr ) = aParam2;
+        ptr += sizeof ( TInt );
+        ptr -= 8;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
+        }
+    return retval;
+    }
+
+inline TBool OstTraceGen2( TUint32 aTraceID, TUint32 aParam1, TInt32 aParam2 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 8 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TInt* )ptr ) = aParam2;
+        ptr += sizeof ( TInt );
+        ptr -= 8;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
+        }
+    return retval;
+    }
+
+
 inline TBool OstTraceGen1( TUint32 aTraceID, const TDesC8& aParam1 )
     {
     TBool retval;
@@ -259,80 +333,6 @@
     }
 
 
-inline TBool OstTraceGenExt( TUint32 aTraceID, TUint aParam1, TUint aParam2, TUint aParam3 )
-    {
-    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
-    if ( retval )
-        {
-        TUint8 data[ 12 ];
-        TUint8* ptr = data;
-        *( ( TUint* )ptr ) = aParam1;
-        ptr += sizeof ( TUint );
-        *( ( TUint* )ptr ) = aParam2;
-        ptr += sizeof ( TUint );
-        *( ( TUint* )ptr ) = aParam3;
-        ptr += sizeof ( TUint );
-        ptr -= 12;
-        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 12 );
-        }
-    return retval;
-    }
-
-inline TBool OstTraceGenExt( TUint32 aTraceID, TUint32 aParam1, TUint32 aParam2, TUint32 aParam3 )
-    {
-    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
-    if ( retval )
-        {
-        TUint8 data[ 12 ];
-        TUint8* ptr = data;
-        *( ( TUint* )ptr ) = aParam1;
-        ptr += sizeof ( TUint );
-        *( ( TUint* )ptr ) = aParam2;
-        ptr += sizeof ( TUint );
-        *( ( TUint* )ptr ) = aParam3;
-        ptr += sizeof ( TUint );
-        ptr -= 12;
-        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 12 );
-        }
-    return retval;
-    }
-
-
-inline TBool OstTraceGen2( TUint32 aTraceID, TUint aParam1, TInt aParam2 )
-    {
-    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
-    if ( retval )
-        {
-        TUint8 data[ 8 ];
-        TUint8* ptr = data;
-        *( ( TUint* )ptr ) = aParam1;
-        ptr += sizeof ( TUint );
-        *( ( TInt* )ptr ) = aParam2;
-        ptr += sizeof ( TInt );
-        ptr -= 8;
-        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
-        }
-    return retval;
-    }
-
-inline TBool OstTraceGen2( TUint32 aTraceID, TUint32 aParam1, TInt32 aParam2 )
-    {
-    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
-    if ( retval )
-        {
-        TUint8 data[ 8 ];
-        TUint8* ptr = data;
-        *( ( TUint* )ptr ) = aParam1;
-        ptr += sizeof ( TUint );
-        *( ( TInt* )ptr ) = aParam2;
-        ptr += sizeof ( TInt );
-        ptr -= 8;
-        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
-        }
-    return retval;
-    }
-
-
 inline TBool OstTraceGen2( TUint32 aTraceID, TInt aParam1, TUint aParam2 )
     {
     TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
--- a/traceservices/tracefw/integ_test/ost/TEF/traces/te_instrumentationpoints_enabledTraces.h	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/traces/te_instrumentationpoints_enabledTraces.h	Fri Mar 19 10:00:55 2010 +0200
@@ -1,4 +1,4 @@
-// Created by TraceCompiler 1.3.1
+// Created by TraceCompiler 2.1.3
 // DO NOT EDIT, CHANGES WILL BE LOST
 
 #ifndef __TE_INSTRUMENTATIONPOINTS_ENABLEDTRACES_H__
@@ -6,6 +6,12 @@
 
 #define KOstTraceComponentID 0x1028722e
 
+#define TEST_OSTTraceFunctionalityEntry0 0x8a0003
+#define TEST_OSTTraceFunctionalityEntry1 0x8a0004
+#define TEST_OSTTraceFunctionalityExt 0x8a0005, ( TUint )&( aApiRunConfig ), ( TUint )&( aApiRunResults )
+#define TEST_OstTraceFunctionExit0 0x8a0006
+#define TEST_OSTTRACEFUNCTIONEXIT1 0x8a0007
+#define TEST_OSTTRACEFUNCTIONEXITEXT 0x8a0008
 #define TEST_OstTraceDef0 0x810001
 #define TEST_OstTraceDef1 0x810002
 #define TEST_OstTraceDefData 0x810003
@@ -24,12 +30,6 @@
 #define TEST_OSTTRACEEXT5 0x810010
 #define TEST_OSTTRACEDATA96 0x810011
 #define TEST_OSTTRACEDATA1000 0x810012
-#define TEST_OSTTraceFunctionalityEntry0 0x8a0001
-#define TEST_OSTTraceFunctionalityEntry1 0x8a0002
-#define TEST_OSTTraceFunctionalityExt 0x8a0003, ( TUint )&( aApiRunConfig ), ( TUint )&( aApiRunResults )
-#define TEST_OstTraceFunctionExit0 0x8a0004
-#define TEST_OSTTRACEFUNCTIONEXIT1 0x8a0005
-#define TEST_OSTTRACEFUNCTIONEXITEXT 0x8a0006
 #define TEST_OSTTRACEEVENTSTART0 0x8b0001
 #define TEST_OSTTRACEEVENTSTART1 0x8b0002
 #define TEST_OSTTRACEEVENTSTOP 0x8b0003
@@ -37,6 +37,80 @@
 #define TEST_OSTTRACESTATE1 0x870002
 
 
+inline TBool OstTraceGenExt( TUint32 aTraceID, TUint aParam1, TUint aParam2, TUint aParam3 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 12 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam2;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam3;
+        ptr += sizeof ( TUint );
+        ptr -= 12;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 12 );
+        }
+    return retval;
+    }
+
+inline TBool OstTraceGenExt( TUint32 aTraceID, TUint32 aParam1, TUint32 aParam2, TUint32 aParam3 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 12 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam2;
+        ptr += sizeof ( TUint );
+        *( ( TUint* )ptr ) = aParam3;
+        ptr += sizeof ( TUint );
+        ptr -= 12;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 12 );
+        }
+    return retval;
+    }
+
+
+inline TBool OstTraceGen2( TUint32 aTraceID, TUint aParam1, TInt aParam2 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 8 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TInt* )ptr ) = aParam2;
+        ptr += sizeof ( TInt );
+        ptr -= 8;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
+        }
+    return retval;
+    }
+
+inline TBool OstTraceGen2( TUint32 aTraceID, TUint32 aParam1, TInt32 aParam2 )
+    {
+    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
+    if ( retval )
+        {
+        TUint8 data[ 8 ];
+        TUint8* ptr = data;
+        *( ( TUint* )ptr ) = aParam1;
+        ptr += sizeof ( TUint );
+        *( ( TInt* )ptr ) = aParam2;
+        ptr += sizeof ( TInt );
+        ptr -= 8;
+        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
+        }
+    return retval;
+    }
+
+
 inline TBool OstTraceGen1( TUint32 aTraceID, const TDesC8& aParam1 )
     {
     TBool retval;
@@ -259,80 +333,6 @@
     }
 
 
-inline TBool OstTraceGenExt( TUint32 aTraceID, TUint aParam1, TUint aParam2, TUint aParam3 )
-    {
-    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
-    if ( retval )
-        {
-        TUint8 data[ 12 ];
-        TUint8* ptr = data;
-        *( ( TUint* )ptr ) = aParam1;
-        ptr += sizeof ( TUint );
-        *( ( TUint* )ptr ) = aParam2;
-        ptr += sizeof ( TUint );
-        *( ( TUint* )ptr ) = aParam3;
-        ptr += sizeof ( TUint );
-        ptr -= 12;
-        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 12 );
-        }
-    return retval;
-    }
-
-inline TBool OstTraceGenExt( TUint32 aTraceID, TUint32 aParam1, TUint32 aParam2, TUint32 aParam3 )
-    {
-    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
-    if ( retval )
-        {
-        TUint8 data[ 12 ];
-        TUint8* ptr = data;
-        *( ( TUint* )ptr ) = aParam1;
-        ptr += sizeof ( TUint );
-        *( ( TUint* )ptr ) = aParam2;
-        ptr += sizeof ( TUint );
-        *( ( TUint* )ptr ) = aParam3;
-        ptr += sizeof ( TUint );
-        ptr -= 12;
-        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 12 );
-        }
-    return retval;
-    }
-
-
-inline TBool OstTraceGen2( TUint32 aTraceID, TUint aParam1, TInt aParam2 )
-    {
-    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
-    if ( retval )
-        {
-        TUint8 data[ 8 ];
-        TUint8* ptr = data;
-        *( ( TUint* )ptr ) = aParam1;
-        ptr += sizeof ( TUint );
-        *( ( TInt* )ptr ) = aParam2;
-        ptr += sizeof ( TInt );
-        ptr -= 8;
-        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
-        }
-    return retval;
-    }
-
-inline TBool OstTraceGen2( TUint32 aTraceID, TUint32 aParam1, TInt32 aParam2 )
-    {
-    TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
-    if ( retval )
-        {
-        TUint8 data[ 8 ];
-        TUint8* ptr = data;
-        *( ( TUint* )ptr ) = aParam1;
-        ptr += sizeof ( TUint );
-        *( ( TInt* )ptr ) = aParam2;
-        ptr += sizeof ( TInt );
-        ptr -= 8;
-        retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 );
-        }
-    return retval;
-    }
-
-
 inline TBool OstTraceGen2( TUint32 aTraceID, TInt aParam1, TUint aParam2 )
     {
     TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID );
--- a/traceservices/tracefw/integ_test/ost/TEF/traces/te_ostv2tracetestwrapperTraces.h	Tue Jan 26 13:16:24 2010 +0200
+++ b/traceservices/tracefw/integ_test/ost/TEF/traces/te_ostv2tracetestwrapperTraces.h	Fri Mar 19 10:00:55 2010 +0200
@@ -1,4 +1,4 @@
-// Created by TraceCompiler 1.3.1
+// Created by TraceCompiler 2.1.3
 // DO NOT EDIT, CHANGES WILL BE LOST
 
 #ifndef __TE_OSTV2TRACETESTWRAPPERTRACES_H__
@@ -8,12 +8,20 @@
 
 #define TEST_OSTTRACEWRAPPER1 0x810013
 #define TEST_OSTTRACEWRAPPER4 0x810014
+#define TEST_OSTTRACEWRAPPER1w 0x810015
+#define TEST_OSTTRACEWRAPPER4w 0x810016
 #define TEST_OSTTRACEWRAPPER2 0x890001
-#define TEST_OSTTRACEWRAPPER5 0x890002
-#define TEST_OSTTRACEWRAPPER3 0x890001
-#define TEST_OSTTRACEWRAPPER6 0x890002
+#define TEST_OSTTRACEWRAPPER3 0x890002
+#define TEST_OSTTRACEWRAPPER5 0x890003
+#define TEST_OSTTRACEWRAPPER6 0x890004
+#define TEST_OSTTRACEWRAPPER2w 0x890005
+#define TEST_OSTTRACEWRAPPER3w 0x890006
+#define TEST_OSTTRACEWRAPPER5w 0x890007
+#define TEST_OSTTRACEWRAPPER6w 0x890008
 #define TEST_OSTTRACEWRAPPER7 0xdf0001
+#define TEST_OSTTRACEWRAPPER7w 0xdf0002
 #define TEST_OSTTRACEWRAPPER8 0xe00001
+#define TEST_OSTTRACEWRAPPER8w 0xe00002
 
 
 #endif