Revision: 201007 RCL_3 PDK_3.0.h
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Sat, 20 Feb 2010 00:33:55 +0200
branchRCL_3
changeset 6 5ffdb8f2067f
parent 2 6862383cf555
child 9 54410521b707
child 10 fa9941cf3867
Revision: 201007 Kit: 201007
featuremgmt/featuremgr/src/inc/featmgrclientserver.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/test/group/bld.inf
featuremgmt/featuremgr/test/group/featmgr_test.iby
featuremgmt/featuremgr/test/rtest/group/featmgr_rtest.iby
featuremgmt/featuremgr/test/rtest/group/t_fmgrbackupmod.mmp
featuremgmt/featuremgr/test/rtest/group/t_fmgrbackupquery.mmp
featuremgmt/featuremgr/test/rtest/inc/t_fmgrburdefs.h
featuremgmt/featuremgr/test/rtest/inc/t_fmgrbursim.h
featuremgmt/featuremgr/test/rtest/src/t_fmgrbackupmod.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgrbackupquery.cpp
featuremgmt/featuremgr/test/rtest/src/t_fmgrbursim.cpp
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
persistentstorage/dbms/tdbms/t_dbstress.cpp
persistentstorage/dbms/tdbms/t_dbstress.h
persistentstorage/dbms/tdbms/t_dbthrd.cpp
persistentstorage/sql/OsLayer/os_symbian.cpp
persistentstorage/sql/SQLite/main.c
persistentstorage/sql/SQLite364/main.c
persistentstorage/sql/SRC/Server/Compact/SqlCompact.cpp
persistentstorage/sql/SRC/Server/SqlSrvGetFirstSqlStmt.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/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/te_ostv2tracetestwrapperTraces.h
--- a/featuremgmt/featuremgr/src/inc/featmgrclientserver.h	Wed Feb 03 12:02:34 2010 +0000
+++ b/featuremgmt/featuremgr/src/inc/featmgrclientserver.h	Sat Feb 20 00:33: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
     {
 	/**
--- a/featuremgmt/featuremgr/src/serverexe/featmgrserver.cpp	Wed Feb 03 12:02:34 2010 +0000
+++ b/featuremgmt/featuremgr/src/serverexe/featmgrserver.cpp	Sat Feb 20 00:33: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"
@@ -49,6 +49,7 @@
 CFeatMgrServer::CFeatMgrServer( const TInt aPriority, const TServerType aType  )
     :
     CPolicyServer( aPriority, KFeatMgrPlatSecPolicy, aType ), iBurState(this),
+    iBackupInProgress(EFalse),
     iPluginsReady(EFalse), 
     iPluginsDeleted( EFalse ),
     iPendingRequests( ETrue ),
@@ -439,6 +440,15 @@
     FUNC_LOG
     return(iPluginsReady);
    	}
+
+// -----------------------------------------------------------------------------
+// CFeatMgrServer::BackupIsInProgress()
+// -----------------------------------------------------------------------------
+TBool CFeatMgrServer::BackupIsInProgress() const
+    {
+    FUNC_LOG
+    return(iBackupInProgress);
+    }
    	
 // -----------------------------------------------------------------------------
 // CFeatMgrServer::ServicePendingRequests()
@@ -671,7 +681,7 @@
 	switch( aCurrent )
 		{
 		case( EFeatMgrBURState_BackupStarted ) :
-			iPluginsReady = ETrue;
+			iBackupInProgress = EFalse;
 			ServicePendingRequests();
 			break;
 		case( EFeatMgrBURState_RestoreStarted ) :
@@ -701,7 +711,7 @@
 BURStatus CFeatMgrServer::Goto_StartBackupState( BURStatus /* aCurrent */ )
 	{
 	BURStatus aNewState = EFeatMgrBURState_BackupStarted;  // state++
-	iPluginsReady = EFalse;
+	iBackupInProgress = ETrue;
 	return aNewState;
 	}
 
@@ -709,7 +719,7 @@
 	{
 	BURStatus aNewState = EFeatMgrBURState_BackupEnded;   // state++
 	
-	iPluginsReady = ETrue;
+	iBackupInProgress = EFalse;
 	ServicePendingRequests();
 	// no error from ServicePendingRequests() is possible
 	
@@ -728,8 +738,7 @@
 	{
 	BURStatus aNewState = EFeatMgrBURState_Error;   // fail safe
 	TInt err( KErrNone );
-	
-    iPluginsReady    = EFalse;
+	iPluginsReady    = EFalse;
     iPluginsDeleted  = EFalse;
     iPendingRequests = ETrue;
     iFeaturesReady   = EFalse;
--- a/featuremgmt/featuremgr/src/serverexe/featmgrserver.h	Wed Feb 03 12:02:34 2010 +0000
+++ b/featuremgmt/featuremgr/src/serverexe/featmgrserver.h	Sat Feb 20 00:33: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 BackupIsInProgress() const;
 
 #ifdef EXTENDED_FEATURE_MANAGER_TEST
         /**
@@ -269,6 +276,10 @@
         CFeatMgrTimer* iTimer;     
 
         CBurState iBurState;
+        
+        // ETrue when backup in progress
+        TBool iBackupInProgress;
+        
         // ETrue when feature info received from all plugins
         TBool iPluginsReady;
                 
--- a/featuremgmt/featuremgr/src/serverexe/featmgrsession.cpp	Wed Feb 03 12:02:34 2010 +0000
+++ b/featuremgmt/featuremgr/src/serverexe/featmgrsession.cpp	Sat Feb 20 00:33: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,10 +129,12 @@
 void CFeatMgrSession::ServiceL( const RMessage2& aMessage )
     {
     FUNC_LOG
-    
-    if ( !iFeatMgrServer.PluginsReady() )
+    // If plugins are not ready all request will be queued. 
+    // During backup operation, all write request e.g. EnableFeature will be queued
+    TInt msgCmd = aMessage.Function();
+    if ( !iFeatMgrServer.PluginsReady() || ( iFeatMgrServer.BackupIsInProgress() && IsWriteOperation( msgCmd ) ) )
         {
-        INFO_LOG( "CFeatMgrSession::ServiceL() - plugins not ready" );
+        INFO_LOG( "CFeatMgrSession::ServiceL() - plugins not ready or backup is in progress" );
         iList.AddLast( *CFeatMgrPendingRequest::NewL( aMessage ) );        
         }
     else
--- a/featuremgmt/featuremgr/src/serverexe/featmgrsession.h	Wed Feb 03 12:02:34 2010 +0000
+++ b/featuremgmt/featuremgr/src/serverexe/featmgrsession.h	Sat Feb 20 00:33:55 2010 +0200
@@ -159,6 +159,8 @@
         */
         void DispatchMessageL( const RMessage2& aMessage );
         
+        TBool IsWriteOperation( const TInt aFunction ) const;
+        
     private:    // Data
         
         /**
--- a/featuremgmt/featuremgr/test/group/bld.inf	Wed Feb 03 12:02:34 2010 +0000
+++ b/featuremgmt/featuremgr/test/group/bld.inf	Sat Feb 20 00:33: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"
@@ -21,6 +21,10 @@
 #include "../helper/helping_exe/group/bld.inf" 
 
 PRJ_TESTMMPFILES
+//RTest project files
+//../rtest/group/t_fmgrbackupmod.mmp
+//../rtest/group/t_fmgrbackupquery.mmp
+
 //TEF project files
 ../tef/tef_feature_generator/group/tef_feature_generator.mmp manual
 ../tef/tef_efm_normal/group/efm_normal_testserver.mmp manual
@@ -66,6 +70,7 @@
 
 //iby files for the test components
 featmgr_test.iby												/epoc32/rom/include/featmgr_test.iby
+../rtest/group/featmgr_rtest.iby                                /epoc32/rom/include/featmgr_rtest.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
--- a/featuremgmt/featuremgr/test/group/featmgr_test.iby	Wed Feb 03 12:02:34 2010 +0000
+++ b/featuremgmt/featuremgr/test/group/featmgr_test.iby	Sat Feb 20 00:33:55 2010 +0200
@@ -22,6 +22,9 @@
 //main efm test script
 data=DATAZ_\test\efm\scripts\tef_featmgr.script		test\efm\scripts\tef_featmgr.script
 
+//rtest tests .iby files
+//#include "featmgr_rtest.iby"
+
 //tef tests .iby files
 #include "efm_configured_testserver.iby"
 #include "efm_normal_testserver.iby"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/featmgr_rtest.iby	Sat Feb 20 00:33:55 2010 +0200
@@ -0,0 +1,22 @@
+// Copyright (c) 2008-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_RTEST_IBY__
+#define __FEATMGR_RTEST_IBY__
+
+file=ABI_DIR\BUILD_DIR\t_fmgrbackupquery.exe						test\t_fmgrbackupquery.exe
+file=ABI_DIR\BUILD_DIR\t_fmgrbackupmod.exe						test\t_fmgrbackupmod.exe
+
+#endif // __FEATMGR_RTEST_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/featuremgmt/featuremgr/test/rtest/group/t_fmgrbackupmod.mmp	Sat Feb 20 00:33:55 2010 +0200
@@ -0,0 +1,37 @@
+// 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_fmgrbackupmod.exe
+TARGETTYPE		EXE
+CAPABILITY  	ReadDeviceData WriteDeviceData AllFiles
+
+USERINCLUDE 	../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH		../src
+SOURCE			t_fmgrbursim.cpp
+SOURCE			t_fmgrbackupmod.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_fmgrbackupquery.mmp	Sat Feb 20 00:33: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_fmgrbackupquery.exe
+TARGETTYPE		EXE
+CAPABILITY  	ReadDeviceData WriteDeviceData AllFiles
+
+USERINCLUDE 	../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH		../src
+SOURCE			t_fmgrbursim.cpp
+SOURCE			t_fmgrbackupquery.cpp
+
+LIBRARY			euser.lib
+LIBRARY     	bafl.lib
+LIBRARY     	efsrv.lib 
+LIBRARY			featdiscovery.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/inc/t_fmgrburdefs.h	Sat Feb 20 00:33: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	Sat Feb 20 00:33: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_fmgrbackupmod.cpp	Sat Feb 20 00:33:55 2010 +0200
@@ -0,0 +1,181 @@
+// 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_fmgrbur test"));
+
+const TUint threadTimeout = 1500000;    // thread timeout = 1.5 second 
+
+static RSemaphore MainThreadCrS;
+static TInt featMgrIsResponsive = 0;
+
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+//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 TestModifyThreadL(void*)
+    {
+        __UHEAP_MARK;
+        
+        CTrapCleanup* tc = CTrapCleanup::New();
+        // Modify a feature. We don't care about its result. 
+        //  It is fine as long as it returns.
+        RFeatureControl rfc;
+        TEST2( rfc.Connect(), KErrNone );
+        rfc.EnableFeature( TUid::Uid(0x00000001) );
+        rfc.Close();
+        featMgrIsResponsive = 1;
+        RDebug::Print(_L("+++:TestModifyThread: Modification completed\r\n"));
+        MainThreadCrS.Signal();
+        delete tc;
+        
+        __UHEAP_MARKEND;
+        
+        return KErrNone;
+    }
+/**
+@SYMTestCaseID          PDS-FEATMGR-CT-XXXX
+@SYMTestCaseDesc        Querying 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 query a feature
+                        Verify that a response is received in not more than 1.5 second.
+                        Otherwise the test fail.          
+@SYMTestExpectedResults Test must not fail
+@SYMREQ                 
+*/  
+void TestBackupModificationResponseL()
+    {
+        _LIT(KThreadName, "MdfTh");
+        featMgrIsResponsive = 0;
+        
+        CFeatMgrBURSim* simulate = CFeatMgrBURSim::NewLC();
+        RThread modifyThread;
+        TRequestStatus modifyStatus;
+        
+        CleanupClosePushL( modifyThread );
+        
+        
+        // Simulate a backup
+        RDebug::Print(_L("Simulating Backup of BUR\r\n"));
+        simulate->Simulate_StartBackupL();
+
+        TEST2( modifyThread.Create(KThreadName, &TestModifyThreadL, 0x2000, 0x1000, 0x10000, NULL, EOwnerProcess), KErrNone );
+        modifyThread.Logon(modifyStatus);
+        TEST2( modifyStatus.Int(), KRequestPending );
+        modifyThread.Resume();
+        // Wait for 1.5 second for the query thread to finish. 
+        RDebug::Print(_L("+++:MainThread: Wait for modification completion...\r\n"));
+        MainThreadCrS.Wait(threadTimeout);
+        // The modification request should NOT be responsive within the 1.5 second frame.
+        // It should only be responsive after back up ended.
+        TEST2 (featMgrIsResponsive, 0);
+        simulate->Simulate_EndBackupL();
+        
+        MainThreadCrS.Wait(threadTimeout);
+        
+        // The modification request now must be responsive within the 1.5 second frame.
+        TEST2 (featMgrIsResponsive, 1);
+        
+        CleanupStack::PopAndDestroy(&modifyThread);
+        CleanupStack::PopAndDestroy(simulate);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+void DoTestsL()
+	{
+    MainThreadCrS.CreateLocal(0);
+    
+    TheTest.Start(_L(" @SYMTestCaseID:PDS-FEATMGR-CT-XXXX Backup Modification Response"));
+    TestBackupModificationResponseL();
+    
+    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_fmgrbackupquery.cpp	Sat Feb 20 00:33:55 2010 +0200
@@ -0,0 +1,194 @@
+// 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 <featdiscovery.h>
+#include "t_fmgrbursim.h"
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+RTest TheTest(_L("t_fmgrbur test"));
+
+const TUint threadTimeout = 1500000;    // thread timeout = 1.5 second 
+
+static RSemaphore MainThreadCrS;
+static TInt featMgrIsResponsive = 0;
+
+///////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////
+//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
+
+/**
+ * Creates the direcory structure required for the backup to take place. 
+ * Will leave if an error occurs other then KErrNone or KErrAlreadyExists as this 
+ * indicates the directory structure has not been created. 
+ */
+
+TInt TestQueryThreadL(void*)
+    {
+        __UHEAP_MARK;
+        
+        CTrapCleanup* tc = CTrapCleanup::New();
+        // Query a feature. We don't care about its result. 
+        //  It is fine as long as it returns.
+        CFeatureDiscovery::IsFeatureSupportedL( TUid::Uid(0x00000001) );
+        featMgrIsResponsive = 1;
+        RDebug::Print(_L("+++:TestQueryThread: Query completed\r\n"));
+        MainThreadCrS.Signal();
+        delete tc;
+        
+        __UHEAP_MARKEND;
+        
+        return KErrNone;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+/**
+@SYMTestCaseID          PDS-FEATMGR-CT-XXXX
+@SYMTestCaseDesc        Querying 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 query a feature
+                        Verify that a response is received in not more than 1.5 second.
+                        Otherwise the test fail.          
+@SYMTestExpectedResults Test must not fail
+@SYMREQ                 
+*/  
+void TestBackupQueryResponseL()
+    {
+        _LIT(KThreadName, "QryTh");
+        featMgrIsResponsive = 0;
+        
+        CFeatMgrBURSim* simulate = CFeatMgrBURSim::NewLC();
+        RThread queryThread;
+        TRequestStatus queryStatus;
+        
+        CleanupClosePushL( queryThread );
+        
+        // Simulate a backup
+        RDebug::Print(_L("Simulating Backup of BUR\r\n"));
+        simulate->Simulate_StartBackupL();
+
+        TEST2( queryThread.Create(KThreadName, &TestQueryThreadL, 0x2000, 0x1000, 0x10000, NULL, EOwnerProcess), KErrNone );
+        queryThread.Logon(queryStatus);
+        TEST2( queryStatus.Int(), KRequestPending );
+        queryThread.Resume();
+        // Wait for 1.5 second for the query thread to finish. 
+        RDebug::Print(_L("+++:MainThread: Wait for query completion...\r\n"));
+        MainThreadCrS.Wait(threadTimeout);
+        // If query is responsive within the 1.5 second frame the following check should pass.
+        TEST2 (featMgrIsResponsive, 1);
+        
+        simulate->Simulate_EndBackupL();
+
+        CleanupStack::PopAndDestroy(&queryThread);
+        CleanupStack::PopAndDestroy(simulate);
+    }
+
+/**
+@SYMTestCaseID          PDS-FEATMGR-CT-XXXX
+@SYMTestCaseDesc        Querying 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 query a feature
+                        Verify that a response is received in not more than 1.5 second.
+                        Otherwise the test fail.          
+@SYMTestExpectedResults Test must not fail
+@SYMREQ                 
+*/  
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+void DoTestsL()
+	{
+    MainThreadCrS.CreateLocal(0);
+    
+    TheTest.Start(_L(" @SYMTestCaseID:PDS-FEATMGR-CT-XXXX Backup Query Response"));
+    TestBackupQueryResponseL();
+    
+    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_fmgrbursim.cpp	Sat Feb 20 00:33: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);
+	}
--- a/loggingservices/eventlogger/LogServ/src/LOGADD.CPP	Wed Feb 03 12:02:34 2010 +0000
+++ b/loggingservices/eventlogger/LogServ/src/LOGADD.CPP	Sat Feb 20 00:33:55 2010 +0200
@@ -485,6 +485,10 @@
 	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	Wed Feb 03 12:02:34 2010 +0000
+++ b/loggingservices/eventlogger/test/src/t_logapi.cpp	Sat Feb 20 00:33: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	Wed Feb 03 12:02:34 2010 +0000
+++ b/loggingservices/eventlogger/test/src/t_logcntmatch.cpp	Sat Feb 20 00:33: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	Wed Feb 03 12:02:34 2010 +0000
+++ b/loggingservices/eventlogger/test/src/t_logservercrash.cpp	Sat Feb 20 00:33: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	Wed Feb 03 12:02:34 2010 +0000
+++ b/loggingservices/eventlogger/test/src/t_logview1.cpp	Sat Feb 20 00:33: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	Wed Feb 03 12:02:34 2010 +0000
+++ b/loggingservices/filelogger/SCLI/FLOGCLI.CPP	Sat Feb 20 00:33: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/persistentstorage/dbms/tdbms/t_dbstress.cpp	Wed Feb 03 12:02:34 2010 +0000
+++ b/persistentstorage/dbms/tdbms/t_dbstress.cpp	Sat Feb 20 00:33: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	Wed Feb 03 12:02:34 2010 +0000
+++ b/persistentstorage/dbms/tdbms/t_dbstress.h	Sat Feb 20 00:33: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	Wed Feb 03 12:02:34 2010 +0000
+++ b/persistentstorage/dbms/tdbms/t_dbthrd.cpp	Sat Feb 20 00:33: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/OsLayer/os_symbian.cpp	Wed Feb 03 12:02:34 2010 +0000
+++ b/persistentstorage/sql/OsLayer/os_symbian.cpp	Sat Feb 20 00:33:55 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -819,7 +819,7 @@
 	static TInt DoGetDeviceCharacteristics(const TDriveInfo& aDriveInfo, const TVolumeIOParamInfo& aVolumeInfo);
 	static TInt DoGetSectorSize(const TDriveInfo& aDriveInfo, const TVolumeIOParamInfo& aVolumeInfo);
 	static TInt DoGetDeviceCharacteristicsAndSectorSize(TDbFile& aDbFile, TInt& aRecReadBufSize);
-	
+	static TInt DoFileSizeCorruptionCheck(TDbFile& aDbFile, const TDesC& aFname, TInt aFmode);
 	};
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -2107,6 +2107,64 @@
 /**
 SQLite OS porting layer API.
 
+The behaviour of the RFile/RFile64::SetSize operation is not atomic for non-rugged drives. 
+When RFile/RFile64::SetSize() is called 2 operations occurs:-
+
+1)The cluster chain of the file is updated.
+2)The new file size is added to the file cache.
+
+If a power loss occurs after a SetSize there is a chance that the cluster chain was updated 
+but the new file size is not yet flushed to the file. This puts the file into an inconsistent state.
+This is most likely to occur in the journal file where the time between a SetSize and Flush can 
+be long. 
+
+For this reason this check is added when the file is opened to see if the end of the file can 
+be read straight away, if an error is returned then it is assumed that the SetSize has not be 
+completed previously. In this case the file is deleted and re-created.
+ 
+@param aDbFile A pointer to a TDbFile instance, that contains the file handle.
+@param aFname A string of 16-bit wide characters containing name of the file to be checked.
+@param aFmode The mode in which the file is opened. These mode are documented in TFileMode.
+
+@return KErrNone,          The operation has completed succesfully;
+                           Note that other system-wide error codes may also be returned.
+@see TFileMode
+@see TVfs::Open()
+@see TDbFile
+*/
+/* static */ TInt TVfs::DoFileSizeCorruptionCheck(TDbFile& aDbFile, const TDesC& aFname, TInt aFmode)
+    {
+    const TInt KMinSize = 16;
+    TInt64 size;
+    TInt err = KErrNone ;
+    TBuf8<KMinSize> buf;
+
+    err = aDbFile.iFileBuf.Size(size);
+    if (err != KErrNone)
+        {
+        return err;
+        }
+    TBool IsMinFileSize = (size >= KMinSize);
+    
+    if (IsMinFileSize)
+        {
+        err = aDbFile.iFileBuf.Read(size - KMinSize, buf);
+        }
+    
+    if (err == KErrCorrupt || err == KErrEof || !IsMinFileSize)
+        {
+        COsLayerData& osLayerData = COsLayerData::Instance();
+    
+        aDbFile.iFileBuf.Close();
+        (void) osLayerData.iFs.Delete(aFname);
+        err = aDbFile.iFileBuf.Create(osLayerData.iFs, aFname, aFmode);
+        }
+    return err;
+    }
+
+/**
+SQLite OS porting layer API.
+
 Opens or creates a file which name is in the aFileName parameter.
 If the function succeeds, the file handle and other related information will be stored in the place pointed by the 
 aDbFile parameter, a memory block of sizeof(TDbFile) size for which is allocated by the caller.
@@ -2211,6 +2269,12 @@
 				{
 				__FS_CALL(EFsOpFileOpen, 0);
 				err = dbFile.iFileBuf.Open(osLayerData.iFs, fname, fmode);
+				
+				if(err == KErrNone && ((aFlags & SQLITE_OPEN_MAIN_JOURNAL) || (aFlags & SQLITE_OPEN_TEMP_JOURNAL) || 
+                        (aFlags & SQLITE_OPEN_SUBJOURNAL) || (aFlags & SQLITE_OPEN_MASTER_JOURNAL)))
+				    {
+                    err = TVfs::DoFileSizeCorruptionCheck(dbFile, fname, fmode);
+				    }
 				}
 			if((err != KErrNone && err != KErrNoMemory && err != KErrDiskFull) && (aFlags & SQLITE_OPEN_READWRITE))
 				{
@@ -2219,7 +2283,7 @@
 				fmode &= ~EFileWrite;
 				__FS_CALL(EFsOpFileOpen, 0);
    				err = dbFile.iFileBuf.Open(osLayerData.iFs, fname, fmode);
-   				}
+				}
 			if(err != KErrNone && prevErr == KErrAccessDenied)
 				{
 				err = KErrAccessDenied;
--- a/persistentstorage/sql/SQLite/main.c	Wed Feb 03 12:02:34 2010 +0000
+++ b/persistentstorage/sql/SQLite/main.c	Sat Feb 20 00:33: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	Wed Feb 03 12:02:34 2010 +0000
+++ b/persistentstorage/sql/SQLite364/main.c	Sat Feb 20 00:33: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	Wed Feb 03 12:02:34 2010 +0000
+++ b/persistentstorage/sql/SRC/Server/Compact/SqlCompact.cpp	Sat Feb 20 00:33: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/SRC/Server/SqlSrvGetFirstSqlStmt.cpp	Wed Feb 03 12:02:34 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-// Copyright (c) 2006-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 "sqlite3.h"
-
-//This function searches aString argument for ';' occurences.
-//Every time when it finds a ';' character, the function places a 0 right after the ';' and
-//tests the just created, zero-terminated substring if it is a comlpete SQL statement.
-//
-//If it is a SQL statement, the function replaces the found ';' character with 0 and returns the just created
-//zero-terminated substring.Also the function modifies aString argument to point right after the found
-//SQL string. If it is not SQL statement, the function will continue the searching.
-//
-//If there is no ';' inside aString argument, the function returns the same string as a return result and
-//modifies aString argument - sets it to TPtr(NULL, 0, 0).
-//
-//The function expects aString argument to be zero-terminated.
-TPtrC GetFirstSqlStmt(TPtr& aString)
-	{
-	const TChar KDelimitier(';');
-	TPtr str(const_cast <TUint16*> (aString.Ptr()), aString.Length(), aString.Length());
-	TInt afterDelimitierPos = 0;
-	TInt pos;
-	while((pos = str.Locate(KDelimitier) + 1) > 0 && pos < str.Length())
-		{
-		//There is a possibility that the string which terminates with the found ';' is SQL statement.
-		//Zero terminate the string placing a zero right after ';' character and test it using sqlite3_complete16()
-		//call. If it is not SQL string, restore the original character and continue searching.
-		afterDelimitierPos += pos;
-		TChar ch = aString[afterDelimitierPos];
-		aString[afterDelimitierPos] = 0;
-		TInt res = sqlite3_complete16(aString.Ptr());
-		aString[afterDelimitierPos] = ch;
-		if(res)
-			{
-			str.Set(const_cast <TUint16*> (aString.Ptr()), afterDelimitierPos, afterDelimitierPos);	
-			//Replace the found ';' character with 0.
-			str[afterDelimitierPos - 1] = 0;
-			aString.Set(const_cast <TUint16*> (aString.Ptr()) + afterDelimitierPos, aString.Length() - afterDelimitierPos, aString.Length() - afterDelimitierPos);
-			return str;
-			}
-		str.Set(const_cast <TUint16*> (str.Ptr()) + pos, str.Length() - pos, str.Length() - pos);	
-		}
-	//aString argument does not contain valid SQL statement or there is no ';' character inside aString.
-	//Set aString to TPtr(NULL, 0, 0) and return the original string.
-	aString.Set(NULL, 0, 0);
-	return str;
-	}
--- a/persistentstorage/sql/TEST/t_sqldefect.cpp	Wed Feb 03 12:02:34 2010 +0000
+++ b/persistentstorage/sql/TEST/t_sqldefect.cpp	Sat Feb 20 00:33: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	Wed Feb 03 12:02:34 2010 +0000
+++ b/persistentstorage/sqlite3api/GROUP/SQLite3_stub.pkg	Sat Feb 20 00:33: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	Wed Feb 03 12:02:34 2010 +0000
+++ b/persistentstorage/store/ROM/StoreTests.BAT	Sat Feb 20 00:33: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	Wed Feb 03 12:02:34 2010 +0000
+++ b/persistentstorage/store/TSTOR/t_stordict.cpp	Sat Feb 20 00:33: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/te_ostv2integsuite_functional/inc/te_ostv2tracetestwrapper.h	Wed Feb 03 12:02:34 2010 +0000
+++ b/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_functional/inc/te_ostv2tracetestwrapper.h	Sat Feb 20 00:33: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	Wed Feb 03 12:02:34 2010 +0000
+++ b/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_functional/src/te_ostv2tracetestwrapper.cpp	Sat Feb 20 00:33: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	Wed Feb 03 12:02:34 2010 +0000
+++ b/traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_functional/testdata/scripts/te_integ_tracecollectorclient.script	Sat Feb 20 00:33: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
 
 
 
--- a/traceservices/tracefw/integ_test/ost/TEF/traces/te_ostv2tracetestwrapperTraces.h	Wed Feb 03 12:02:34 2010 +0000
+++ b/traceservices/tracefw/integ_test/ost/TEF/traces/te_ostv2tracetestwrapperTraces.h	Sat Feb 20 00:33:55 2010 +0200
@@ -1,19 +1,27 @@
-// Created by TraceCompiler 1.3.1
+// Created by TraceCompiler 2.1.0
 // DO NOT EDIT, CHANGES WILL BE LOST
 
 #ifndef __TE_OSTV2TRACETESTWRAPPERTRACES_H__
 #define __TE_OSTV2TRACETESTWRAPPERTRACES_H__
 
-#define KOstTraceComponentID 0x1028722f
+#define KOstTraceComponentID 0x1028722e
 
 #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