# HG changeset patch # User hgs # Date 1285585196 -3600 # Node ID 7d4490026038c6652083535a2abd4e4fe15fa9d8 # Parent b8bdbc8f59c7bbbab44efb06fdc3b8ba46377a20 201037_06 diff -r b8bdbc8f59c7 -r 7d4490026038 featuremgmt/featuremgr/group/bld.inf --- a/featuremgmt/featuremgr/group/bld.inf Thu Aug 12 11:53:23 2010 +0100 +++ b/featuremgmt/featuremgr/group/bld.inf Mon Sep 27 11:59:56 2010 +0100 @@ -47,21 +47,6 @@ ./featmgrserver.mmp -PRJ_EXTENSIONS - -// Extension makefile to install the emulator default features.dat data -// file into the release/winscw/[urel|udeb]/z/private/10205054 folder for use -// in the emulator platform. features.dat file generated by the features tool -// in the TOOLS[2] builds by the cedar/tools/romkit component. FeatMgr has -// the responsibility of installing it for Symbian OS emulator platforms for -// Core OS (textshell) and TechView (GUI or textshell) product builds. -START EXTENSION syslibs/fm_copyfile_to_winscw_zdrive -option FILE_TO_COPY features.dat -option SRC_PATH $(EPOCROOT)epoc32/data/config -option DEST_PATH z/private/10205054 -END - - PRJ_TESTMMPFILES #include "../tools/group/bld.inf" diff -r b8bdbc8f59c7 -r 7d4490026038 featuremgmt/featuremgr/src/serverexe/featmgrfeatureregistry.cpp --- a/featuremgmt/featuremgr/src/serverexe/featmgrfeatureregistry.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/featuremgmt/featuremgr/src/serverexe/featmgrfeatureregistry.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -520,27 +520,27 @@ // ----------------------------------------------------------------------------- -TInt CFeatMgrFeatureRegistry::ResetFeatures() +void CFeatMgrFeatureRegistry::ResetFeaturesL() { FUNC_LOG // backup the feature list before it is destroyed iFeatureListBackup.Reset(); - TInt count = iFeatureList.Count(); - - for( TInt i=0; i < count; i++ ) - { - iFeatureListBackup.Append( iFeatureList[i] ); - } - + const TInt KCount = iFeatureList.Count(); + iFeatureListBackup.ReserveL(KCount); + for(TInt i(0); i < KCount; i++) + { + // The main error here would be KErrNoMemory which should not happen as + // we have already reserved the space. However, we should still check. + iFeatureListBackup.AppendL(iFeatureList[i]); + } + // destroy the feature list iFeatureList.Reset(); iFeatureList.Close(); iRangeList.Reset(); iRangeList.Close(); - - return( 0 ); } /** @@ -752,8 +752,7 @@ continue; } - tempFeatureArray.Insert( entry, i); - + tempFeatureArray.InsertL( entry, i); } // Reserve memory if list still empty @@ -771,7 +770,7 @@ if( index == KErrNotFound) { - User::LeaveIfError( iFeatureList.InsertInOrder( entry, FindByUid ) ); + iFeatureList.InsertInOrderL( entry, FindByUid ); } else { diff -r b8bdbc8f59c7 -r 7d4490026038 featuremgmt/featuremgr/src/serverexe/featmgrfeatureregistry.h --- a/featuremgmt/featuremgr/src/serverexe/featmgrfeatureregistry.h Thu Aug 12 11:53:23 2010 +0100 +++ b/featuremgmt/featuremgr/src/serverexe/featmgrfeatureregistry.h Mon Sep 27 11:59:56 2010 +0100 @@ -155,8 +155,11 @@ /** * Make a backup of the feature list into member iFeatureListBackup, then reset * the feature list iFeatureList. + * + * Leaves if there is an error during back up, with KErrNoMemory or any of the + * other system-wide error codes. */ - TInt ResetFeatures(); + void ResetFeaturesL(); /** * This function will handle the required notifications for new, deleted and changed features diff -r b8bdbc8f59c7 -r 7d4490026038 featuremgmt/featuremgr/src/serverexe/featmgrserver.cpp --- a/featuremgmt/featuremgr/src/serverexe/featmgrserver.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/featuremgmt/featuremgr/src/serverexe/featmgrserver.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -632,7 +632,6 @@ BURStatus CFeatMgrServer::Goto_ErrorState( BURStatus aCurrent ) { BURStatus aNewState = EFeatMgrBURState_None; // fail safe: all roads lead to normal state - TInt err( KErrNone ); switch( aCurrent ) { @@ -646,8 +645,8 @@ iPendingRequests = ETrue; iFeaturesReady = EFalse; // re-read the new features; - ClearFeatures(); - TRAP( err, LoadFeaturesL() ); + TRAP_IGNORE(ClearFeaturesL() ); + TRAP_IGNORE(LoadFeaturesL() ); // Stop queuing iPluginsReady = ETrue; // commit the pending change requests @@ -703,19 +702,18 @@ // re-read the new features // Only call the next function if the previous one was // successfully completed. - ClearFeatures(); - TRAP( err, LoadFeaturesL() ); - if( err == KErrNone ) + TRAP(err, ClearFeaturesL() ); + if (err == KErrNone) { - TRAP( err, HandleRestoredNotificationsL() ); + TRAP(err, LoadFeaturesL() ); } - if( err != KErrNone ) + if(err == KErrNone) { - // error condition - aNewState = EFeatMgrBURState_Error; + TRAP(err, HandleRestoredNotificationsL() ); } - else + + if(err == KErrNone) { // Stop queuing iPluginsReady = ETrue; @@ -726,6 +724,11 @@ // Change state machine aNewState = EFeatMgrBURState_RestoreEnded; } + else + { + // error condition + aNewState = EFeatMgrBURState_Error; + } return aNewState; } @@ -784,7 +787,7 @@ /** * This function will clear features from RAM */ -void CFeatMgrServer::ClearFeatures( void ) +void CFeatMgrServer::ClearFeaturesL( void ) { // Delete plugin handlers if ( !iPluginsDeleted ) @@ -807,7 +810,7 @@ if( NULL != iRegistry ) { - iRegistry->ResetFeatures(); + iRegistry->ResetFeaturesL(); } return; diff -r b8bdbc8f59c7 -r 7d4490026038 featuremgmt/featuremgr/src/serverexe/featmgrserver.h --- a/featuremgmt/featuremgr/src/serverexe/featmgrserver.h Thu Aug 12 11:53:23 2010 +0100 +++ b/featuremgmt/featuremgr/src/serverexe/featmgrserver.h Mon Sep 27 11:59:56 2010 +0100 @@ -226,7 +226,7 @@ private: /* Clears the feature array ready to re-populate it during a restore operation */ - void ClearFeatures( void ); + void ClearFeaturesL( void ); /* Reloads the feature array and merges features during a restore operation */ void LoadFeaturesL( void ); /* Handles any outstanding notifications after a restore operation */ diff -r b8bdbc8f59c7 -r 7d4490026038 featuremgmt/featuremgr/test/helper/test_plugins/group/bld.inf --- a/featuremgmt/featuremgr/test/helper/test_plugins/group/bld.inf Thu Aug 12 11:53:23 2010 +0100 +++ b/featuremgmt/featuremgr/test/helper/test_plugins/group/bld.inf Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2002-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" @@ -19,7 +19,9 @@ DEFAULT PRJ_TESTEXPORTS -test_plugins.iby /epoc32/rom/include/test_plugins.iby +test_plugins.iby /epoc32/rom/include/test_plugins.iby +featmgr_moveplugin.mk /epoc32/tools/makefile_templates/syslibs/test/featmgr_moveplugin.mk +featmgr_moveplugin.meta /epoc32/tools/makefile_templates/syslibs/test/featmgr_moveplugin.meta PRJ_TESTMMPFILES reconciliation_plugin.mmp support diff -r b8bdbc8f59c7 -r 7d4490026038 featuremgmt/featuremgr/test/helper/test_plugins/group/featmgr_moveplugin.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/featuremgmt/featuremgr/test/helper/test_plugins/group/featmgr_moveplugin.meta Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,20 @@ +# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# template.meta +# Meta information for template use +# + +platform win32 +makefile gnumake +techstream syslibs diff -r b8bdbc8f59c7 -r 7d4490026038 featuremgmt/featuremgr/test/helper/test_plugins/group/featmgr_moveplugin.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/featuremgmt/featuremgr/test/helper/test_plugins/group/featmgr_moveplugin.mk Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,162 @@ +# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TMPROOT:=$(subst \,/,$(EPOCROOT)) +EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/ + +include $(EPOCROOT)epoc32/tools/shell/$(notdir $(basename $(SHELL))).mk + +ifeq ($(findstring WINS,$(PLATFORM)),WINS) + EPOCDATADIR:=$(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH) +else + EPOCDATADIR:=$(EPOCROOT)epoc32/data +endif + +BINSOURCEDIR:=$(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH) +RESOURCESOURCEDIR:=$(EPOCDATADIR)/z/resource/plugins + +FILE1:=normal_plugin.dll +FILE2:=hanging_plugin.dll +FILE3:=corrupt_plugin.dll +FILE4:=reconciliation_plugin.dll +FILE5:=ab_normal_plugin.dll +FILE6:=bc_enhanced_plugin.dll +FILE7:=slowstart_plugin.dll +FILE8:=invalid_plugin.dll +FILE9:=normal_plugin.rsc +FILE10:=hanging_plugin.rsc +FILE11:=corrupt_plugin.rsc +FILE12:=reconciliation_plugin.rsc +FILE13:=ab_normal_plugin.rsc +FILE14:=bc_enhanced_plugin.rsc +FILE15:=slowstart_plugin.rsc +FILE16:=invalid_plugin.rsc + +TARGETDIR:=$(EPOCDATADIR)/z/test/efm/plugins +# we copy the normal plugin files to the resource folder on C: drive for the plugin ignoring test +PLUGINTARGETDIR:=$(EPOCROOT)epoc32/winscw/c/sys/bin +RESOURCETARGETDIR:=$(EPOCROOT)epoc32/winscw/c/resource/plugins + +$(TARGETDIR) : + $(call createdir,"$@") + +$(PLUGINTARGETDIR) : + $(call createdir,"$@") + +$(RESOURCETARGETDIR) : + $(call createdir,"$@") + +COPYFILES : $(TARGETDIR) $(PLUGINTARGETDIR) $(RESOURCETARGETDIR) + $(call forcecopy,$(BINSOURCEDIR)/$(FILE1),$(TARGETDIR)/$(FILE1)) + $(call forcecopy,$(BINSOURCEDIR)/$(FILE1),$(PLUGINTARGETDIR)/$(FILE1)) + $(call forcecopy,$(BINSOURCEDIR)/$(FILE2),$(TARGETDIR)/$(FILE2)) + $(call forcecopy,$(BINSOURCEDIR)/$(FILE3),$(TARGETDIR)/$(FILE3)) + $(call forcecopy,$(BINSOURCEDIR)/$(FILE4),$(TARGETDIR)/$(FILE4)) + $(call forcecopy,$(BINSOURCEDIR)/$(FILE5),$(TARGETDIR)/$(FILE5)) + $(call forcecopy,$(BINSOURCEDIR)/$(FILE6),$(TARGETDIR)/$(FILE6)) + $(call forcecopy,$(BINSOURCEDIR)/$(FILE7),$(TARGETDIR)/$(FILE7)) + $(call forcecopy,$(BINSOURCEDIR)/$(FILE8),$(TARGETDIR)/$(FILE8)) + $(call forcecopy,$(RESOURCESOURCEDIR)/$(FILE9),$(TARGETDIR)/$(FILE9)) + $(call forcecopy,$(RESOURCESOURCEDIR)/$(FILE9),$(RESOURCETARGETDIR)/$(FILE9)) + $(call forcecopy,$(RESOURCESOURCEDIR)/$(FILE10),$(TARGETDIR)/$(FILE10)) + $(call forcecopy,$(RESOURCESOURCEDIR)/$(FILE11),$(TARGETDIR)/$(FILE11)) + $(call forcecopy,$(RESOURCESOURCEDIR)/$(FILE12),$(TARGETDIR)/$(FILE12)) + $(call forcecopy,$(RESOURCESOURCEDIR)/$(FILE13),$(TARGETDIR)/$(FILE13)) + $(call forcecopy,$(RESOURCESOURCEDIR)/$(FILE14),$(TARGETDIR)/$(FILE14)) + $(call forcecopy,$(RESOURCESOURCEDIR)/$(FILE15),$(TARGETDIR)/$(FILE15)) + $(call forcecopy,$(RESOURCESOURCEDIR)/$(FILE16),$(TARGETDIR)/$(FILE16)) + +ERASEFILES : $(call slash2generic,$(foreach FILE, $(FILE1) $(FILE2) $(FILE3) $(FILE4) $(FILE5) $(FILE6) $(FILE7) $(FILE8), $(TARGETDIR)/$(FILE)) $(PLUGINTARGETDIR)/$(FILE1)) + $(call forceremove,$(BINSOURCEDIR)/$(FILE1)) + $(call forceremove,$(BINSOURCEDIR)/$(FILE2)) + $(call forceremove,$(BINSOURCEDIR)/$(FILE3)) + $(call forceremove,$(BINSOURCEDIR)/$(FILE4)) + $(call forceremove,$(BINSOURCEDIR)/$(FILE5)) + $(call forceremove,$(BINSOURCEDIR)/$(FILE6)) + $(call forceremove,$(BINSOURCEDIR)/$(FILE7)) + $(call forceremove,$(BINSOURCEDIR)/$(FILE8)) + +DO_NOTHING: + @echo do nothing + +# +# The targets invoked by bld... +# + +BLD : DO_NOTHING + +CLEAN : + $(call forceremove,$(TARGETDIR)/$(FILE1)) + $(call forceremove,$(PLUGINTARGETDIR)/$(FILE1)) + $(call forceremove,$(TARGETDIR)/$(FILE2)) + $(call forceremove,$(TARGETDIR)/$(FILE3)) + $(call forceremove,$(TARGETDIR)/$(FILE4)) + $(call forceremove,$(TARGETDIR)/$(FILE5)) + $(call forceremove,$(TARGETDIR)/$(FILE6)) + $(call forceremove,$(TARGETDIR)/$(FILE7)) + $(call forceremove,$(TARGETDIR)/$(FILE8)) + $(call forceremove,$(TARGETDIR)/$(FILE9)) + $(call forceremove,$(RESOURCETARGETDIR)/$(FILE9)) + $(call forceremove,$(TARGETDIR)/$(FILE10)) + $(call forceremove,$(TARGETDIR)/$(FILE11)) + $(call forceremove,$(TARGETDIR)/$(FILE12)) + $(call forceremove,$(TARGETDIR)/$(FILE13)) + $(call forceremove,$(TARGETDIR)/$(FILE14)) + $(call forceremove,$(TARGETDIR)/$(FILE15)) + $(call forceremove,$(TARGETDIR)/$(FILE16)) + $(call forceremove,$(RESOURCESOURCEDIR)/$(FILE9)) + $(call forceremove,$(RESOURCESOURCEDIR)/$(FILE10)) + $(call forceremove,$(RESOURCESOURCEDIR)/$(FILE11)) + $(call forceremove,$(RESOURCESOURCEDIR)/$(FILE12)) + $(call forceremove,$(RESOURCESOURCEDIR)/$(FILE13)) + $(call forceremove,$(RESOURCESOURCEDIR)/$(FILE14)) + $(call forceremove,$(RESOURCESOURCEDIR)/$(FILE15)) + $(call forceremove,$(RESOURCESOURCEDIR)/$(FILE16)) + +RELEASABLES : + @echo $(TARGETDIR)/$(FILE1) + @echo $(PLUGINTARGETDIR)/$(FILE1) + @echo $(TARGETDIR)/$(FILE2) + @echo $(TARGETDIR)/$(FILE3) + @echo $(TARGETDIR)/$(FILE4) + @echo $(TARGETDIR)/$(FILE5) + @echo $(TARGETDIR)/$(FILE6) + @echo $(TARGETDIR)/$(FILE7) + @echo $(TARGETDIR)/$(FILE8) + @echo $(TARGETDIR)/$(FILE9) + @echo $(RESOURCETARGETDIR)/$(FILE9) + @echo $(TARGETDIR)/$(FILE10) + @echo $(TARGETDIR)/$(FILE11) + @echo $(TARGETDIR)/$(FILE12) + @echo $(TARGETDIR)/$(FILE13) + @echo $(TARGETDIR)/$(FILE14) + @echo $(TARGETDIR)/$(FILE15) + @echo $(TARGETDIR)/$(FILE16) + +MAKMAKE : DO_NOTHING + +SAVESPACE : DO_NOTHING + +LIB : DO_NOTHING + +CLEANLIB : DO_NOTHING + +FREEZE : DO_NOTHING + +RESOURCE : DO_NOTHING + +FINAL : COPYFILES ERASEFILES + +ROMFILE : DO_NOTHING diff -r b8bdbc8f59c7 -r 7d4490026038 featuremgmt/featuremgr/test/tef/group/tef_featmgr.script --- a/featuremgmt/featuremgr/test/tef/group/tef_featmgr.script Thu Aug 12 11:53:23 2010 +0100 +++ b/featuremgmt/featuremgr/test/tef/group/tef_featmgr.script Mon Sep 27 11:59:56 2010 +0100 @@ -22,5 +22,8 @@ RUN_SCRIPT z:\test\efm\scripts\tef_efm_unit.script RUN_SCRIPT z:\test\efm\scripts\tef_efm_configured.script RUN_SCRIPT z:\test\efm\scripts\tef_efm_performance.script -RUN_SCRIPT z:\test\efm\scripts\tef_efm_bursuite.script +//The following script is temporally commented to make sure the result in ONB for all other scripts will be shown correctly. +//Instead, tef_efm_bursuite.script will be placed in build script as a separated test script. +//RUN_SCRIPT z:\test\efm\scripts\tef_efm_bursuite.script + diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/LogCli/inc/LOGCLI.H --- a/loggingservices/eventlogger/LogCli/inc/LOGCLI.H Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/LogCli/inc/LOGCLI.H Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2003-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" @@ -20,8 +20,6 @@ #include #include #include -// -//#include // Classes referenced class CLogClientObserver; diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/LogServ/LOGSERV.RSS --- a/loggingservices/eventlogger/LogServ/LOGSERV.RSS Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/LogServ/LOGSERV.RSS Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2002-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" @@ -25,14 +25,10 @@ WORD value; } -#ifdef SYSLIBS_TEST -//The phone digits match count must be at least 7 otherwise the Contacts server won't perform the match properly -RESOURCE INT16 r_log_contact_match_count { value = 8; } -#else -// Set number of digits to use for contacts matching -// Set to zero to disable contacts matching when adding events -RESOURCE INT16 r_log_contact_match_count { value = 0; } -#endif +//The default contact match count is 7 - the LogServ contact matching is emabled by default. +//The default value is kept here for compatibility reasons. The resource file is not used anymore. +//The related LogServ confml file is used for loading the default contact match count. +RESOURCE INT16 r_log_contact_match_count { value = 7; } // r_name_format_values enum values are used for for initializing // r_log_contact_name_format integer resource. @@ -53,5 +49,7 @@ // // By default r_log_contact_name_format value is set to r_western_format. // It has to be set to r_chinese_format for chinese builds. +// The default value is kept here for compatibility reasons. The resource file is not used anymore. +// The related LogServ confml file is used for loading the default contact name format. RESOURCE INT16 r_log_contact_name_format { value = r_western_format; } diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/LogServ/inc/LOGREPDEFS.H --- a/loggingservices/eventlogger/LogServ/inc/LOGREPDEFS.H Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/LogServ/inc/LOGREPDEFS.H Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,6 +18,8 @@ #ifndef __LOGREPDEFS_H__ #define __LOGREPDEFS_H__ +#include "logcntdef.h" + const TUid KUidLogengRepository = { 0x101f401d }; //The repository for Log engine const TInt KMaxLogSizeRepKey = 1; const TInt KMaxRecentLogSizeRepKey = 2; @@ -25,4 +27,18 @@ const TInt KContactMatchCountRepKey = 4; const TInt KContactNameFormatRepKey = 5; +/** +Default contact matching digits count. +If the LogEng repository cannot be open, this is the value which will be used by the LogEng server. +@internalAll +*/ +const TInt KLogContactMatchCount = 7; + +/** +Default contact name format. +If the LogEng repository cannot be open, this is the value which will be used by the LogEng server. +@internalAll +*/ +const TLogContactNameFormat KLogContactNameFormat = ELogWesternFormat; + #endif diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/LogServ/inc/LogServResourceInterpreter.h --- a/loggingservices/eventlogger/LogServ/inc/LogServResourceInterpreter.h Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/LogServ/inc/LogServResourceInterpreter.h Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2002-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,70 +21,43 @@ #include /** -Gives an access to the server resource file and maintains a cache of the retrieved resource entries. +Gives an access to the LogWrap resource file and maintains a cache of the retrieved resource entries. @internalComponent */ class CLogServResourceInterpreter : public CBase { public: - enum TResourceType - { - ELogWrap = 0, - ELogServer - }; - -public: - static CLogServResourceInterpreter* NewL(RFs& aFsSession); + static CLogServResourceInterpreter* NewL(RFs& aFs); ~CLogServResourceInterpreter(); - void CreateResourceReaderLC(TResourceReader& aReader, TInt aId, TResourceType aType) ;//Create a resource reader for a specific resource entry + void CreateResourceReaderLC(TResourceReader& aReader, TInt aId); private: /** - @internalComponent - */ - struct TResourceFileEntry - { - RResourceFile iFile; - TResourceType iType; - }; - - /** + Resource file item. + Holds one resource string identified by an id. @internalComponent */ - class CResourceStringCacheEntry : public CBase + struct TResourceString { - public: - static CResourceStringCacheEntry* NewL(TInt aResourceId, CLogServResourceInterpreter::TResourceType aResourceType, HBufC8* aResourceString); - ~CResourceStringCacheEntry(); - TUint ResourceId(void) ; - CLogServResourceInterpreter::TResourceType ResourceType(void) ; - HBufC8* ResourceString (void) ; - static TInt Offset(); - - private: - CResourceStringCacheEntry (TInt aResourceId, CLogServResourceInterpreter::TResourceType aType, HBufC8* aResourceString); - - private : - TSglQueLink iLink; - TUint iResourceId ; - CLogServResourceInterpreter::TResourceType iResourceType ; - HBufC8* iResourceString ; + inline TResourceString(TInt aResourceId, HBufC8* aResourceString) : + iId(aResourceId), + iString(aResourceString) + { + } + TInt iId; + HBufC8* iString; }; - CLogServResourceInterpreter(RFs& aFsSession); + CLogServResourceInterpreter(RFs& aFs); void ConstructL(); - void LoadResourceFileL(const TDesC& aName, TResourceType aType); - const RResourceFile& ResourceFileForType(TResourceType aType) const; - CResourceStringCacheEntry* FindCachedResourceString(const TInt aId, TResourceType aType) ; - HBufC8* GetResourceBufferL(TInt aId, TResourceType aType) ; + HBufC8* GetStringL(TInt aId); + static TInt Compare(const TResourceString& aLeft, const TResourceString& aRight); private: - RFs& iFsSession; - RArray iResourceFiles; - //Used to cache strings read from resource file - TSglQue iResourceStringCache; - TSglQueIter iResourceStringCacheIter; + RFs& iFs; + RResourceFile iFile; + RArray iStrings; }; #endif diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/LogServ/src/LOGADD.CPP --- a/loggingservices/eventlogger/LogServ/src/LOGADD.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/LogServ/src/LOGADD.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2004-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" @@ -25,7 +25,6 @@ #include "LogServResourceInterpreter.h" #include "LogServCacheConfig.h" #include "LogServDatabaseChangeInterface.h" -#include #include #include "LogServCacheStrings.h" #include "LogServCacheTypes.h" @@ -88,37 +87,27 @@ return val; } -//This function reads logeng resource file and returns the integer value of the given resource id. -static TInt LogGetResourceValueL(CLogServResourceInterpreter& aResourceInterpreter, TInt aResourceId) - { - TResourceReader reader; - aResourceInterpreter.CreateResourceReaderLC(reader, aResourceId, CLogServResourceInterpreter::ELogServer); - TInt val = reader.ReadInt16(); - CleanupStack::PopAndDestroy(); - return val; - } - -static void LogGetContactmatchCountAndNameFormatL(CLogServResourceInterpreter& aResourceInterpreter, TInt& aContactMatchCount, TLogContactNameFormat& aContactNameFormat) +static void LogGetContactmatchCountAndNameFormatL(TInt& aContactMatchCount, TLogContactNameFormat& aContactNameFormat) { CRepository* repository = NULL; TRAPD(err, repository = CRepository::NewL(KUidLogengRepository)); - if(err == KErrCorrupt) - { - __ASSERT_DEBUG(!repository, User::Invariant()); - User::Leave(err); - } - else if(err == KErrNone) + if(err == KErrNone) { CleanupStack::PushL(repository); aContactMatchCount = LogGetRepositoryValueL(*repository, KContactMatchCountRepKey); aContactNameFormat = static_cast (LogGetRepositoryValueL(*repository, KContactNameFormatRepKey)); CleanupStack::PopAndDestroy(repository); } + else if(err == KErrCorrupt) + { + __ASSERT_DEBUG(!repository, User::Invariant()); + User::Leave(err); + } else { __ASSERT_DEBUG(!repository, User::Invariant()); - aContactMatchCount = LogGetResourceValueL(aResourceInterpreter, R_LOG_CONTACT_MATCH_COUNT); - aContactNameFormat = static_cast (LogGetResourceValueL(aResourceInterpreter, R_LOG_CONTACT_NAME_FORMAT)); + aContactMatchCount = KLogContactMatchCount; + aContactNameFormat = KLogContactNameFormat; } #ifdef SYSLIBS_TEST LogStoreContactMatchCountAndNameFormatL(aContactMatchCount, aContactNameFormat); @@ -157,11 +146,11 @@ { iDuplicate = CLogDuplicate::NewL(iDatabase, Priority()); iDuplicateFilter = CLogFilter::NewL(); - ::LogGetContactmatchCountAndNameFormatL(iDatabase.DTIResourceInterface(), iContactMatchCount, iContactNameFormat); + ::LogGetContactmatchCountAndNameFormatL(iContactMatchCount, iContactNameFormat); } //This method will open contacts database (if not opened yet), only if the value of -//r_log_contact_match_count resource in logserv.rsg resource file is not 0. +//iContactMatchCount is not 0. //Se how iContactMatchCount data member is initialised. TBool CLogAddEvent::PerformContactMatchL() { diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/LogServ/src/LogServDatabaseMarshall.cpp --- a/loggingservices/eventlogger/LogServ/src/LogServDatabaseMarshall.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/LogServ/src/LogServDatabaseMarshall.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -22,7 +22,6 @@ #include "LogServBackupInterface.h" #include "LogServResourceInterpreter.h" #include "LogServDatabaseChangeInterface.h" -#include #include "LogServSqlStrings.h" #include "LOGREPDEFS.H" @@ -493,7 +492,7 @@ { // Get the array size TResourceReader reader; - iResourceInterface.CreateResourceReaderLC(reader, R_LOG_INITIAL_EVENTS, CLogServResourceInterpreter::ELogWrap); + iResourceInterface.CreateResourceReaderLC(reader, R_LOG_INITIAL_EVENTS); // Create them DTICacheTypes().CreateStandardTypesL(reader, aReadOnly); @@ -505,7 +504,7 @@ { // Get the array size TResourceReader reader; - iResourceInterface.CreateResourceReaderLC(reader, R_LOG_INDEXES, CLogServResourceInterpreter::ELogWrap); + iResourceInterface.CreateResourceReaderLC(reader, R_LOG_INDEXES); const TInt indexes = reader.ReadInt16(); @@ -591,7 +590,7 @@ void CLogServDatabaseMarshall::ReadResourceFileConfigurationL(TLogConfig& aConfig) const { TResourceReader reader; - iResourceInterface.CreateResourceReaderLC(reader, R_LOG_INITIAL_CONFIG, CLogServResourceInterpreter::ELogWrap); + iResourceInterface.CreateResourceReaderLC(reader, R_LOG_INITIAL_CONFIG); // aConfig.iMaxLogSize = static_cast(reader.ReadUint16()); aConfig.iMaxRecentLogSize = static_cast(reader.ReadUint8()); diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/LogServ/src/LogServRecentListManager.cpp --- a/loggingservices/eventlogger/LogServ/src/LogServRecentListManager.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/LogServ/src/LogServRecentListManager.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -31,7 +31,7 @@ void CLogServRecentListManager::ConstructL(CLogServResourceInterpreter& aResourceInterpreter, TInt aResourceId) { TResourceReader reader; - aResourceInterpreter.CreateResourceReaderLC(reader, aResourceId, CLogServResourceInterpreter::ELogWrap); + aResourceInterpreter.CreateResourceReaderLC(reader, aResourceId); const TInt count = reader.ReadInt16(); iLists.ReserveL(count); for(TInt i=0; i CLogServResourceInterpreter (source) -///////////////////////////////////////////////////////////////////////////////////////// -CLogServResourceInterpreter::CLogServResourceInterpreter(RFs& aFsSession) : - iFsSession(aFsSession), iResourceFiles(KLogResourceFileGranularity), - iResourceStringCache(CResourceStringCacheEntry::Offset()), - iResourceStringCacheIter(iResourceStringCache) - { - } +/** +Creates a CLogServResourceInterpreter instance. +The created CLogServResourceInterpreter instance will load into memory the content of the LogWrap +resource file. + +@param aFs Reference to a file session object, used later for reading the content of the resource file. -CLogServResourceInterpreter::~CLogServResourceInterpreter() +@leave KErrNoMemory, an out of memory condition has occurred; + Note that the function may leave with database specific errors and + other system-wide error codes. +*/ +CLogServResourceInterpreter* CLogServResourceInterpreter::NewL(RFs& aFs) { - const TInt count = iResourceFiles.Count(); - for(TInt i=0; iConstructL(); CleanupStack::Pop(self); return self; } -///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////// - -void CLogServResourceInterpreter::CreateResourceReaderLC(TResourceReader& aReader, TInt aId, TResourceType aType) +/** +Destroys CLogServResourceInterpreter object deallocating all previously allocated resources +(the resource file, the memory for the loaded resource strings) +*/ +CLogServResourceInterpreter::~CLogServResourceInterpreter() { - HBufC8* buf = GetResourceBufferL(aId, aType) ; - - // Resource reader needs to be created with a copy of the cache buffer as otherwise - // our cache buffer will be deleted when the resource reader is deleted! - aReader.SetBuffer(buf->AllocLC()); - } - -HBufC8* CLogServResourceInterpreter::GetResourceBufferL(TInt aId, TResourceType aType) - { - - // Attempt to find the requested resource in the cache - CResourceStringCacheEntry* cacheEntry = FindCachedResourceString(aId, aType) ; + iFile.Close(); + for(TInt i=iStrings.Count()-1;i>=0;--i) + { + delete iStrings[i].iString; + } + iStrings.Close(); + } - HBufC8* buf ; - if (!cacheEntry) - { - // Not found in cache, load from resource file and add to the - // linked list which forms the cache. - buf = ResourceFileForType(aType).AllocReadLC(aId); - cacheEntry = CResourceStringCacheEntry::NewL(aId, aType, buf) ; - iResourceStringCache.AddLast(*cacheEntry) ; - - // buf is now the responsibility of iResourceStringCache and - // will be tidied up by the destructor... - CleanupStack::Pop(buf); - } - else - { - buf = cacheEntry->ResourceString(); - } - return buf ; +/** +Creates a resource reader object for the resource identified by the aId parameter. + +@param aReader Output parameter. The resource reader object, created by this call. +@param aId Resource item identifier. + +@leave KErrNoMemory, an out of memory condition has occurred; + Note that the function may leave with database specific errors and + other system-wide error codes. +*/ +void CLogServResourceInterpreter::CreateResourceReaderLC(TResourceReader& aReader, TInt aId) + { + HBufC8* string = GetStringL(aId); + //Resource reader needs to be created with a copy of the string resource as otherwise + //our "HBufC8*" string will be deleted when the resource reader is deleted! + aReader.SetBuffer(string->AllocLC()); } -///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////// +/** +Initializes CLogServResourceInterpreter data members with their default values. +@param aFs Reference to a file session object, used later for reading the content of the resource file. +*/ +CLogServResourceInterpreter::CLogServResourceInterpreter(RFs& aFs) : + iFs(aFs), + iStrings(KStringsArrayGranularity) + { + } -void CLogServResourceInterpreter::LoadResourceFileL(const TDesC& aName, TResourceType aType) +/** +Loads the content of the LogWrap resource file. +*/ +void CLogServResourceInterpreter::ConstructL() { - LOGTEXT3("CLogServResourceInterpreter::LoadResourceFileL(%S, %d)", &aName, aType); - // Find the resource file - TFileName fileName; + TFileName fileName; fileName.Copy(RProcess().FileName()); - TParse parse; - parse.Set(aName, &fileName, NULL); + TParse parse; + parse.Set(KResourceFileWrapper, &fileName, NULL); fileName = parse.FullName(); // Get language of resource file - BaflUtils::NearestLanguageFile(iFsSession, fileName); + BaflUtils::NearestLanguageFile(iFs, fileName); // Check the entry exists on this drive (e.g. if we are running the log server // from RAM, then default to the ROM if no RSC on the current drive exists). TEntry fsEntry; - TInt err = iFsSession.Entry(fileName, fsEntry); - if ( err == KErrNotFound || err == KErrPathNotFound ) + TInt err = iFs.Entry(fileName, fsEntry); + if(err == KErrNotFound || err == KErrPathNotFound) { // Switch to ROM (we might already have been launching from the ROM, // in which case this will have no effect anyway). fileName[0] = 'Z'; } - - // Open resource file - TResourceFileEntry entry; - entry.iType = aType; - CleanupClosePushL(entry.iFile); - - LOGTEXT2("CLogServResourceInterpreter::LoadResourceFileL() - localized name is: %S", &fileName); - - entry.iFile.OpenL(iFsSession, fileName); - - LOGTEXT("CLogServResourceInterpreter::LoadResourceFileL() - resource file open"); - - // I'm leaving this in just in case somebody decides to try and add this code - // without realising the consequences... -#ifdef __CAN_BREAK_BC__ - // - // Can't use BAFL 'NAME' support in resource file, since this - // will break data compatibility with old software using the existing - // logwrap and logcli RSG header files :(( - entry.iFile.ConfirmSignatureL(); - __ASSERT_ALWAYS(entry.iFile.Offset() != 0, Panic(ELogNoResourceName)); -#endif - - User::LeaveIfError(iResourceFiles.Append(entry)); - CleanupStack::Pop(&entry.iFile); - - LOGTEXT("CLogServResourceInterpreter::LoadResourceFileL() - end"); - } - -const RResourceFile& CLogServResourceInterpreter::ResourceFileForType(TResourceType aType) const - { - const RResourceFile* ret = NULL; - // - const TInt count = iResourceFiles.Count(); - for(TInt i=0; i order(&CLogServResourceInterpreter::Compare); + //Try to find the requested resource in the cached strings + TInt idx = iStrings.FindInOrder(TResourceString(aId, NULL), order); + if(idx == KErrNotFound) { - if ((item->ResourceType() == aType) && (item->ResourceId() == aId)) - { - break ; - } - }; - return item ; - } - - -///////////////////////////////////////////////////////////////////////////////////////// -// -----> CLogServResourceInterpreter::CResourceStringCacheEntry (source) -///////////////////////////////////////////////////////////////////////////////////////// -CLogServResourceInterpreter::CResourceStringCacheEntry::CResourceStringCacheEntry(TInt aResourceId, CLogServResourceInterpreter::TResourceType aType, HBufC8* aResourceString) : iResourceId (aResourceId), iResourceType (aType), iResourceString(aResourceString) - { + //String not in the cache, load it from the resource file + iStrings.ReserveL(iStrings.Count() + 1); + HBufC8* buf = iFile.AllocReadL(aId); + TResourceString entry(aId, buf); + #ifdef _DEBUG + TInt err = + #endif + iStrings.InsertInOrder(entry, order); + __ASSERT_DEBUG(err == KErrNone, User::Invariant()); + return buf; + } + return iStrings[idx].iString; } - -CLogServResourceInterpreter::CResourceStringCacheEntry::~CResourceStringCacheEntry() - { - delete iResourceString ; - } - +/** +Compares two iStrings entries. +Used for sorting/finding entries in iStrings sorted array. -CLogServResourceInterpreter::CResourceStringCacheEntry* CLogServResourceInterpreter::CResourceStringCacheEntry::NewL(TInt aResourceId, CLogServResourceInterpreter::TResourceType aType, HBufC8* aResourceString) +@param aLeft Left entry to be compared +@param aRight Right entry to be compared +@return -1 aLeft is less than aRight, 0 entries are equal, 1 aLeft is bigger than aRight +*/ +TInt CLogServResourceInterpreter::Compare(const CLogServResourceInterpreter::TResourceString& aLeft, + const CLogServResourceInterpreter::TResourceString& aRight) { - return new(ELeave) CResourceStringCacheEntry(aResourceId, aType, aResourceString); - } - -TUint CLogServResourceInterpreter::CResourceStringCacheEntry::ResourceId(void) - { - return iResourceId ; + TInt64 res = (TInt64)aLeft.iId - (TInt64)aRight.iId; + return res > 0LL ? 1 : (res < 0LL ? -1 : 0); } - -CLogServResourceInterpreter::TResourceType CLogServResourceInterpreter::CResourceStringCacheEntry::ResourceType(void) - { - return iResourceType ; - } - -HBufC8* CLogServResourceInterpreter::CResourceStringCacheEntry::ResourceString (void) - { - return iResourceString ; - } - -TInt CLogServResourceInterpreter::CResourceStringCacheEntry::Offset() - { - return (_FOFF(CLogServResourceInterpreter::CResourceStringCacheEntry, iLink)); - } - diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/LogServ/src/logservsecurity.cpp --- a/loggingservices/eventlogger/LogServ/src/logservsecurity.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/LogServ/src/logservsecurity.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -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" @@ -321,7 +321,7 @@ TInt eventTypeCount = GetEventTypeCountL(); TResourceReader reader; - iResourceInterface.CreateResourceReaderLC(reader, R_LOG_SECURITY, CLogServResourceInterpreter::ELogWrap); + iResourceInterface.CreateResourceReaderLC(reader, R_LOG_SECURITY); TInt securityNodeCount = reader.ReadInt16(); @@ -357,7 +357,7 @@ TInt TSecurityInfoReader::GetEventTypeCountL() { TResourceReader reader; - iResourceInterface.CreateResourceReaderLC(reader, R_LOG_INITIAL_EVENTS, CLogServResourceInterpreter::ELogWrap); + iResourceInterface.CreateResourceReaderLC(reader, R_LOG_INITIAL_EVENTS); TInt count = reader.ReadInt16(); CleanupStack::PopAndDestroy(); return count; diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/Rom/logengtest.iby --- a/loggingservices/eventlogger/Rom/logengtest.iby Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/Rom/logengtest.iby Mon Sep 27 11:59:56 2010 +0100 @@ -23,7 +23,7 @@ #include //for t_logview2 -#include +#include ECOM_PLUGIN(t_logcntmatchplugin.dll,2000862e.rsc) diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/conf/eventlogger.confml Binary file loggingservices/eventlogger/conf/eventlogger.confml has changed diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/test/inc/t_logutil3.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/loggingservices/eventlogger/test/inc/t_logutil3.h Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,24 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +#ifndef t_logutil3_h +#define t_logutil3_h + +#include +#include "logcntdef.h" + +void LogGetContactmatchCountAndNameFormatL(TInt& aContactMatchCount, TLogContactNameFormat& aContactNameFormat); + + +#endif//t_logutil3_h diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/test/src/T_LogSecurity.cpp --- a/loggingservices/eventlogger/test/src/T_LogSecurity.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/test/src/T_LogSecurity.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -140,7 +140,7 @@ static void DoOOMTestL() { - CLogServResourceInterpreter* logServRsc = CLogServResourceInterpreter::NewL(TheFileSess); + CLogServResourceInterpreter* logServRsc = CLogServResourceInterpreter::NewL(TheFileSess); CleanupStack::PushL(logServRsc); CLogServSecurity* logServSecurity = CLogServSecurity::NewL(*logServRsc); @@ -159,7 +159,6 @@ { __UHEAP_FAILNEXT(count); __UHEAP_MARK; - TRAPD(err, ::DoOOMTestL()); if(err == KErrNoMemory) diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/test/src/t_logapi.cpp --- a/loggingservices/eventlogger/test/src/t_logapi.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/test/src/t_logapi.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -18,6 +18,7 @@ #include #include #include "t_logutil2.h" +#include "t_logutil3.h" #define UNUSED_VAR(a) a = a @@ -703,6 +704,7 @@ #ifdef SYSLIBS_TEST + /** @SYMTestCaseID SYSLIB-LOGENG-UT-4015 @SYMTestCaseDesc Test the behaviour implemented by PREQ2103 @@ -716,20 +718,25 @@ */ LOCAL_C void TestGetConfigSettingsFromRepositoryFileL(CLogClient& aClient) { - //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. TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-UT-4015 ")); - //Get the contact match count and contact name format.This should be from resource file. - TInt16 contactMatchCount; - TInt16 contactNameFormat; + + TInt contactMatchCount1; + TLogContactNameFormat contactNameFormat1; + LogGetContactmatchCountAndNameFormatL(contactMatchCount1, contactNameFormat1); + TheTest.Printf(_L("Contact match count = %d, contact name format = %d\r\n"), contactMatchCount1, (TInt)contactNameFormat1); + //contactMatchCount1 and contactNameFormat1 are loaded directly from the repository, if exists. + //Otherwise they are initialzied with their default values. + //The LogEng server should load these resource values in a similar way. + //They will be stored in contactMatchCount2 and contactNameFormat2. + TInt16 contactMatchCount2; + TInt16 contactNameFormat2; RFs fs; LEAVE_IF_ERROR(fs.Connect()); CleanupClosePushL(fs); //Creating a new CLogClient Object make the server getting the contact match settings. - //As the database is deleted it get them from the resource file. + //As the database is deleted it gets them from the LogEng repository. CLogClient* client2 = CLogClient::NewL(fs); CleanupStack::PushL(client2); CleanupStack::PopAndDestroy(client2); @@ -743,12 +750,12 @@ _LIT(KLogengTestFileNameFormat, "c:\\test\\test_logengconfig_format.ini"); LEAVE_IF_ERROR(resFileCount_reader.Open(fs, KLogengTestFileNameCount, EFileRead)); LEAVE_IF_ERROR(resFileFormat_reader.Open(fs, KLogengTestFileNameFormat, EFileRead)); - contactMatchCount = resFileCount_reader.ReadInt32L(); - contactNameFormat = resFileFormat_reader.ReadInt32L(); + contactMatchCount2 = resFileCount_reader.ReadInt32L(); + contactNameFormat2 = resFileFormat_reader.ReadInt32L(); //The settings should match the ones from resource file. - TEST(contactMatchCount == 8); - TEST(contactNameFormat == 0); + TEST2(contactMatchCount1, contactMatchCount2); + TEST2(contactNameFormat1, contactNameFormat2); CleanupStack::PopAndDestroy(&resFileFormat_reader); CleanupStack::PopAndDestroy(&resFileCount_reader); @@ -767,7 +774,7 @@ CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); - //The config settings should match the ones from the resource file. + //The config settings should match the ones from the repository. TEST(config.iMaxEventAge == 2592000); TEST(config.iMaxLogSize == 1000); TEST(config.iMaxRecentLogSize == 20); @@ -824,15 +831,15 @@ CleanupClosePushL(repFileFormat_reader); LEAVE_IF_ERROR(repFileCount_reader.Open(fs, KLogengTestFileNameCount, EFileRead)); LEAVE_IF_ERROR(repFileFormat_reader.Open(fs, KLogengTestFileNameFormat, EFileRead)); - contactMatchCount = repFileCount_reader.ReadInt32L(); - contactNameFormat = repFileFormat_reader.ReadInt32L(); + contactMatchCount2 = repFileCount_reader.ReadInt32L(); + contactNameFormat2 = repFileFormat_reader.ReadInt32L(); CleanupStack::PopAndDestroy(&repFileFormat_reader); CleanupStack::PopAndDestroy(&repFileCount_reader); CleanupStack::PopAndDestroy(&fs); //The values should match the ones from the repository file. - TEST(contactMatchCount == 6); - TEST(contactNameFormat == 1); + TEST(contactMatchCount2 == 6); + TEST(contactNameFormat2 == 1); //delete the repository file c:\\private\\10202be9\\101f401d.txt. _LIT(KCommandParameters2, "c:\\private\\10202be9\\101f401d.txt;private\\10202be9\101f401d.txt;2"); diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/test/src/t_logbadclient.cpp --- a/loggingservices/eventlogger/test/src/t_logbadclient.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/test/src/t_logbadclient.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -176,6 +176,7 @@ } } //Send arguments + //RDebug::Print(_L("##data.iFunction=%d\r\n"), data.iFunction); TRequestStatus stat; sess.Send(data.iFunction, args, stat); if(stat.Int() == KErrServerTerminated) @@ -186,6 +187,7 @@ { if(data.iFunction == ELogOperationInitiate) { + //RDebug::Print(_L("##ELogOperationGetResult\r\n")); err = sess.Send(ELogOperationGetResult, args); if(err == KErrServerTerminated) { @@ -197,10 +199,12 @@ //Give some time to the LogEng server to do something with that async request, then cancel it. //Otherwise, on a multi-core hardware, the LogEnd server will end up with a long queue of //pending requests, not cleared if the client side thread is panic'd. It will be a complete chaos. - User::After(20000); + //RDebug::Print(_L("##data.iFunction=%d, wait and cancel async request\r\n"), data.iFunction); + User::After(100000); TRequestStatus* s = &stat; User::RequestComplete(s, KErrCancel); } + //RDebug::Print(_L("##---err=%d\r\n"), err); } } @@ -330,8 +334,7 @@ // If the Server has crashed then we must fail if (serverStatus != KRequestPending) { - TheTest.Printf(_L("##Iteration=%d, Function=%d, Status1=%d, Status2=%d\r\n"), data.iIteration, data.iFunction, status.Int(), serverStatus.Int()); - break; + TheTest.Printf(_L("##Iteration=%d, Function=%d, Status=%d, Server Status=%d\r\n"), data.iIteration, data.iFunction, status.Int(), serverStatus.Int()); } TExitType exitType = thread.ExitType(); @@ -339,12 +342,16 @@ thread.Close(); User::SetJustInTime(ETrue); - if(exitType == EExitPanic) + if(exitType == EExitPanic || serverStatus != KRequestPending) { - if(exitReason == KPanicCode) + if(exitReason == KPanicCode || serverStatus != KRequestPending) { TheTest.Printf(_L("##Server terminated!\r\n")); - TheTest.Printf(_L("##Iteration=%d, Function=%d\r\n"), data.iIteration, data.iFunction); + TheTest.Printf(_L("##Iteration=%d, Function=%d, iOperationType=%d, iDataSlot1=%d, iDataSlot2=%d\r\n"), + data.iIteration, data.iFunction, + TheLogIpcData.iOperationType, + TheLogIpcData.iDataSlot1, + TheLogIpcData.iDataSlot2); for(TInt i=0;i -#include -#include +#include "LOGREPDEFS.H" #include "t_logutil2.h" +#include "t_logutil3.h" #include "t_logcntmatchplugin.h" RTest TheTest(_L("t_logcntmatch")); +#ifdef SYSLIBS_TEST + TBool TheMatchingIsEnabled = EFalse; //TheContactNameFmt variable must be initialized before tests. //It gives an information what is the contact name format in the logs. -TLogContactNameFormat TheContactNameFmt = ELogWesternFormat; +TLogContactNameFormat TheContactNameFmt = KLogContactNameFormat; ///////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -//The function opens the LogEng server resource file (logserv.rsc) and gets the value of -//R_LOG_CONTACT_NAME_FORMAT resource. This value will be retured as a result of the call. -//It gives an information what is the contact name format in the logs. -static TLogContactNameFormat GetContactNameFormatL() - { - // Get language of resource file - _LIT(KLogResourceFile,"z:\\private\\101f401d\\logserv.rsc"); - TFileName fileName(KLogResourceFile); - BaflUtils::NearestLanguageFile(theFs, fileName); - - // Open resource file - RResourceFile rscFile; - CleanupClosePushL(rscFile); - rscFile.OpenL(theFs, fileName); - HBufC8* buf = rscFile.AllocReadLC(R_LOG_CONTACT_NAME_FORMAT); - - TResourceReader reader; - reader.SetBuffer(buf); - - TLogContactNameFormat contactNameFmt = static_cast (reader.ReadInt16()); - CleanupStack::PopAndDestroy(2, &rscFile); - return contactNameFmt; - } - //This function checks the logged name is the same as the event name. //Contact name logging format is taken into account. static void CheckContactName(CLogEvent& aEvent, const TDesC& aGivenName, const TDesC& aFamilyName) @@ -329,7 +299,9 @@ return; } - TheContactNameFmt = ::GetContactNameFormatL(); + TInt contactMatchCount = 0; + LogGetContactmatchCountAndNameFormatL(contactMatchCount, TheContactNameFmt); + TheTest.Printf(_L("Contact match count = %d, TheContactNameFmt = %d\r\n"), contactMatchCount, (TInt)TheContactNameFmt); TestUtils::DeleteDatabaseL(); @@ -337,8 +309,7 @@ CleanupStack::PushL(client); //All tests bellow are likely to fail if: - // 1. 101f401d.txt file exists in CentralRepository private data cage and the contact mach count is set to 0 in that file. - // 2. SYSLIB_TEST macro is not defined. + // 101f401d.txt file exists in CentralRepository private data cage and the contact mach count is set to 0 in that file. TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1392: DEF068087: Chinese names don't display in Chinese name format")); ::DEF068087L(*client); TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1016: Contacts matching - test1")); @@ -350,3 +321,12 @@ CleanupStack::PopAndDestroy(client); } + +#else //SYSLIBS_TEST + +void doTestsL() + { + TheTest.Start(_L("This test can be run only when built with SYSLIBS_TEST macro defined!")); + } + +#endif //SYSLIBS_TEST diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/test/src/t_loghicaphelper.cpp --- a/loggingservices/eventlogger/test/src/t_loghicaphelper.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/test/src/t_loghicaphelper.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -17,14 +17,10 @@ // may be sub-contracted to this process as needed. // // - - #include #include -#include -#include -#include #include "t_logutil2.h" +#include "t_logutil3.h" const TUid KTestEventUid = {0x10005393}; _LIT(KTestEventDesc1, "Event Type Description"); @@ -505,28 +501,16 @@ //................................................................................................. //See TestUtils::MatchingEnabledL(). -//The function opens the LogEng server resource file (logserv.rsc) and gets the value of -//r_log_contact_match_count resource. This value will be retured as a result of the call. +//The function opens the LogEng repository (KUidLogengRepository) and gets the value of +//KContactMatchCountRepKey resource. //If the value is 0 - "contacts matching" part of the test will be skipped. static TBool MatchingEnabledL() { - // Get language of resource file - _LIT(KLogResourceFile,"z:\\private\\101f401d\\logserv.rsc"); - TFileName fileName(KLogResourceFile); - BaflUtils::NearestLanguageFile(theFs, fileName); - - // Open resource file - RResourceFile res; - res.OpenL(theFs, fileName); - HBufC8* buf = res.AllocReadLC(R_LOG_CONTACT_MATCH_COUNT); - res.Close(); - - TResourceReader reader; - reader.SetBuffer(buf); - - TBool enabled = reader.ReadInt16() > 0; - CleanupStack::PopAndDestroy(buf); - return enabled; + TInt contactMatchCount = 0; + TLogContactNameFormat contactNameFormat = ELogWesternFormat; + LogGetContactmatchCountAndNameFormatL(contactMatchCount, contactNameFormat); + RDebug::Print(_L("** contact match count = %d, contact name format = %d\r\n"), contactMatchCount, (TInt)contactNameFormat); + return contactMatchCount > 0; } //................................................................................................. diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/test/src/t_logservercrash.cpp --- a/loggingservices/eventlogger/test/src/t_logservercrash.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/test/src/t_logservercrash.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -14,13 +14,6 @@ // 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 #include #include "t_logutil2.h" diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/test/src/t_logutil3.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/loggingservices/eventlogger/test/src/t_logutil3.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,50 @@ +// 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 "t_logutil3.h" +#include +#include "LOGREPDEFS.H" + +//This function reads logeng repository file and returns the integer value of the given key. +static TInt LogGetRepositoryValueL(CRepository& aRepository, TInt aKey) + { + TInt val = -1; + User::LeaveIfError(aRepository.Get(aKey, val)); + return val; + } + +void LogGetContactmatchCountAndNameFormatL(TInt& aContactMatchCount, TLogContactNameFormat& aContactNameFormat) + { + CRepository* repository = NULL; + TRAPD(err, repository = CRepository::NewL(KUidLogengRepository)); + if(err == KErrNone) + { + CleanupStack::PushL(repository); + aContactMatchCount = LogGetRepositoryValueL(*repository, KContactMatchCountRepKey); + aContactNameFormat = static_cast (LogGetRepositoryValueL(*repository, KContactNameFormatRepKey)); + CleanupStack::PopAndDestroy(repository); + } + else if(err == KErrCorrupt) + { + __ASSERT_DEBUG(!repository, User::Invariant()); + User::Leave(err); + } + else + { + __ASSERT_DEBUG(!repository, User::Invariant()); + aContactMatchCount = KLogContactMatchCount; + aContactNameFormat = KLogContactNameFormat; + } + } + diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/test/src/t_logview1.cpp --- a/loggingservices/eventlogger/test/src/t_logview1.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/test/src/t_logview1.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -12,13 +12,6 @@ // // 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 #include #include @@ -2490,6 +2483,7 @@ TEST2(active->iStatus.Int(), KErrNone); TLogId testId = event->Id(); event->SetNumber(KNullDesC); + TheTest.Printf(_L(" Event flags: 0x%X\r\n"), event->Flags()); TInt count; for(count = 0; count < KTestEventNum; count++) @@ -2527,7 +2521,7 @@ CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); if( TheMatchingIsEnabled) - { + {//This check will fail if the first AddEvent() call in this function didn't perform contact matching TEST2(event->Flags(), KLogEventContactSearched); } else diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/test/t_logapi.mmp --- a/loggingservices/eventlogger/test/t_logapi.mmp Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/test/t_logapi.mmp Mon Sep 27 11:59:56 2010 +0100 @@ -22,12 +22,14 @@ USERINCLUDE ../test/inc USERINCLUDE ../Shared +USERINCLUDE ../LogServ/inc OS_LAYER_SYSTEMINCLUDE_SYMBIAN SOURCEPATH ../test/src SOURCE t_logapi.cpp SOURCE t_logutil.cpp SOURCE t_logutil2.cpp +SOURCE t_logutil3.cpp SOURCE t_logservsession.cpp LIBRARY euser.lib @@ -37,6 +39,7 @@ LIBRARY bafl.lib LIBRARY edbms.lib LIBRARY estor.lib +LIBRARY centralrepository.lib #ifdef MMPSWITCH_LOGGING_ENABLED LIBRARY flogger.lib diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/test/t_logcntmatch.mmp --- a/loggingservices/eventlogger/test/t_logcntmatch.mmp Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/test/t_logcntmatch.mmp Mon Sep 27 11:59:56 2010 +0100 @@ -20,12 +20,14 @@ USERINCLUDE ../test/inc USERINCLUDE ../Shared +USERINCLUDE ../LogServ/inc OS_LAYER_SYSTEMINCLUDE_SYMBIAN SOURCEPATH ../test/src SOURCE t_logcntmatch.cpp SOURCE t_logutil.cpp SOURCE t_logutil2.cpp +SOURCE t_logutil3.cpp SOURCE t_logservsession.cpp LIBRARY euser.lib @@ -33,6 +35,7 @@ LIBRARY bafl.lib LIBRARY logcli.lib LIBRARY logwrap.lib +LIBRARY centralrepository.lib VENDORID 0x70000001 diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/test/t_loghicaphelper.mmp --- a/loggingservices/eventlogger/test/t_loghicaphelper.mmp Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/test/t_loghicaphelper.mmp Mon Sep 27 11:59:56 2010 +0100 @@ -20,12 +20,14 @@ USERINCLUDE ../test/inc USERINCLUDE ../Shared +USERINCLUDE ../LogServ/inc OS_LAYER_SYSTEMINCLUDE_SYMBIAN SOURCEPATH ../test/src SOURCE t_loghicaphelper.cpp SOURCE t_logservsession.cpp SOURCE t_logutil.cpp +SOURCE t_logutil3.cpp LIBRARY euser.lib LIBRARY efsrv.lib @@ -33,6 +35,7 @@ LIBRARY logcli.lib LIBRARY bafl.lib LIBRARY edbms.lib +LIBRARY centralrepository.lib VENDORID 0x70000001 diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/test/tef/group/logengteftests.iby --- a/loggingservices/eventlogger/test/tef/group/logengteftests.iby Thu Aug 12 11:53:23 2010 +0100 +++ b/loggingservices/eventlogger/test/tef/group/logengteftests.iby Mon Sep 27 11:59:56 2010 +0100 @@ -22,9 +22,9 @@ file=ABI_DIR\BUILD_DIR\teflogengbur.exe sys\bin\teflogengbur.exe -data=EPOCROOT##epoc32\data\z\TEF_LogEng\logengteftests.script TEF_LogEng\logengteftests.script -data=EPOCROOT##epoc32\data\z\TEF_LogEng\teflogengbur.script TEF_LogEng\teflogengbur.script -data=EPOCROOT##epoc32\data\z\TEF_LogEng\bur_config.ini TEF_LogEng\bur_config.ini -data=EPOCROOT##epoc32\data\z\TEF_LogEng\testdata_config.ini TEF_LogEng\testdata_config.ini +data=EPOCROOT##epoc32\data\z\tef_logeng\logengteftests.script TEF_LogEng\logengteftests.script +data=EPOCROOT##epoc32\data\z\tef_logeng\teflogengbur.script TEF_LogEng\teflogengbur.script +data=EPOCROOT##epoc32\data\z\tef_logeng\bur_config.ini TEF_LogEng\bur_config.ini +data=EPOCROOT##epoc32\data\z\tef_logeng\testdata_config.ini TEF_LogEng\testdata_config.ini #endif // #ifndef LOGENGTEFTESTS_IBY diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/cenrepsrv/obsrvr_noc.cpp --- a/persistentstorage/centralrepository/cenrepsrv/obsrvr_noc.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/centralrepository/cenrepsrv/obsrvr_noc.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2004-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" @@ -720,7 +720,6 @@ err = KErrNone; } User::LeaveIfError(err); - CleanupStack::PushL(aRepository); // Now that we have enough memory for the object and constructed it properly // we try to load it. We trap all errors, either from leaving functions or error code @@ -742,6 +741,8 @@ #ifdef CACHE_OOM_TESTABILITY if (!iTrapOOMOnOpen) { + delete aRepository; + aRepository = NULL; User::Leave(KErrNoMemory); } #endif @@ -769,7 +770,13 @@ } } // If unhandled, leave + if(unifiedErrorCode != KErrNone) + { + delete aRepository; + aRepository = NULL; + } User::LeaveIfError(unifiedErrorCode); + CleanupStack::PushL(aRepository); // Otherwise, finalize calulations TInt lastSize = myHeap.Size(); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/cenrepsrv/srvsubsess.cpp --- a/persistentstorage/centralrepository/cenrepsrv/srvsubsess.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/centralrepository/cenrepsrv/srvsubsess.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -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" @@ -852,7 +852,7 @@ CleanupClosePushL(settingsToSend); //reserve memory for everything that needs to be added to the array - settingsToSend.Reserve(numInitial); + settingsToSend.ReserveL(numInitial + 1); // the plus one is for the numSettings value //first append the number of found settings settingsToSend.AppendL(numSettings); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/group/CentralRepositoryTests.iby --- a/persistentstorage/centralrepository/group/CentralRepositoryTests.iby Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/centralrepository/group/CentralRepositoryTests.iby Mon Sep 27 11:59:56 2010 +0100 @@ -19,7 +19,7 @@ REM Central Repository Tests #include // batch file that runs all automatic tests -data=ZSYSTEM\test\CentralRepositoryTests.bat test\CentralRepositoryTests.bat +data=ZSYSTEM\test\centralrepositorytests.bat test\centralrepositorytests.bat // centrep test dlls #include diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/group/centreptestdata.iby --- a/persistentstorage/centralrepository/group/centreptestdata.iby Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/centralrepository/group/centreptestdata.iby Mon Sep 27 11:59:56 2010 +0100 @@ -16,90 +16,90 @@ #ifndef __CENTREPTESTDATA_IBY__ #define __CENTREPTESTDATA_IBY__ -data=DATAZ_\PRIVATE\10202BE9\1020506B.txt PRIVATE\10202BE9\1020506B.txt -data=DATAZ_\PRIVATE\10202BE9\00000001.txt PRIVATE\10202BE9\00000001.txt -data=DATAZ_\PRIVATE\10202BE9\00000002.txt PRIVATE\10202BE9\00000002.txt -data=DATAZ_\PRIVATE\10202BE9\00000003.txt PRIVATE\10202BE9\00000003.txt -data=DATAZ_\PRIVATE\10202BE9\00000004.txt PRIVATE\10202BE9\00000004.txt -data=DATAZ_\PRIVATE\10202BE9\00000005.txa PRIVATE\10202BE9\00000005.txa -data=DATAZ_\PRIVATE\10202BE9\00000e0f.cre PRIVATE\10202BE9\00000e0f.cre -data=DATAZ_\PRIVATE\10202BE9\00000bad.cre PRIVATE\10202BE9\00000bad.cre -data=DATAZ_\PRIVATE\10202BE9\00000010.txt PRIVATE\10202BE9\00000010.txt -data=DATAZ_\PRIVATE\10202BE9\00000010.txc PRIVATE\10202BE9\00000010.txc -data=DATAZ_\PRIVATE\10202BE9\00000010.txi PRIVATE\10202BE9\00000010.txi -data=DATAZ_\PRIVATE\10202BE9\00000011.txt PRIVATE\10202BE9\00000011.txt -data=DATAZ_\PRIVATE\10202BE9\00000011.txi PRIVATE\10202BE9\00000011.txi -data=DATAZ_\PRIVATE\10202BE9\00000012.txi PRIVATE\10202BE9\00000012.txi -data=DATAZ_\PRIVATE\10202BE9\00000013.txc PRIVATE\10202BE9\00000013.txc -data=DATAZ_\PRIVATE\10202BE9\00000100.txt PRIVATE\10202BE9\00000100.txt -data=DATAZ_\PRIVATE\10202BE9\00000100.txa PRIVATE\10202BE9\00000100.txa -data=DATAZ_\PRIVATE\10202BE9\00000100.txb PRIVATE\10202BE9\00000100.txb -data=DATAZ_\PRIVATE\10202BE9\00000100.txu PRIVATE\10202BE9\00000100.txu -data=DATAZ_\PRIVATE\10202BE9\00000101.txt PRIVATE\10202BE9\00000101.txt -data=DATAZ_\PRIVATE\10202BE9\00000102.txt PRIVATE\10202BE9\00000102.txt -data=DATAZ_\PRIVATE\10202BE9\00000103.txt PRIVATE\10202BE9\00000103.txt -data=DATAZ_\PRIVATE\10202BE9\00000104.txt PRIVATE\10202BE9\00000104.txt -data=DATAZ_\PRIVATE\10202BE9\00000105.txt PRIVATE\10202BE9\00000105.txt -data=DATAZ_\PRIVATE\10202BE9\00000106.txt PRIVATE\10202BE9\00000106.txt -data=DATAZ_\PRIVATE\10202BE9\00000107.txt PRIVATE\10202BE9\00000107.txt -data=DATAZ_\PRIVATE\10202BE9\00000108.txt PRIVATE\10202BE9\00000108.txt -data=DATAZ_\PRIVATE\10202BE9\00000109.txt PRIVATE\10202BE9\00000109.txt -data=DATAZ_\PRIVATE\10202BE9\0000010A.txt PRIVATE\10202BE9\0000010A.txt -data=DATAZ_\PRIVATE\10202BE9\BADBADBA.txt PRIVATE\10202BE9\BADBADBA.txt -data=DATAZ_\PRIVATE\10202BE9\BADBADBB.txt PRIVATE\10202BE9\BADBADBB.txt -data=DATAZ_\PRIVATE\10202BE9\100058DB.txt PRIVATE\10202BE9\100058DB.txt -data=DATAZ_\PRIVATE\10202BE9\10054632.txt PRIVATE\10202BE9\10054632.txt -data=DATAZ_\PRIVATE\10202BE9\10054633.txt PRIVATE\10202BE9\10054633.txt -data=DATAZ_\PRIVATE\10202BE9\CCCCCC01.txt PRIVATE\10202BE9\CCCCCC01.txt -data=DATAZ_\PRIVATE\10202BE9\CCCCCC02.cre PRIVATE\10202BE9\CCCCCC02.cre -data=DATAZ_\PRIVATE\10202BE9\CCCCCC03.txt PRIVATE\10202BE9\CCCCCC03.txt -data=DATAZ_\PRIVATE\10202BE9\CCCCCC04.cre PRIVATE\10202BE9\CCCCCC04.cre -data=DATAZ_\PRIVATE\10202BE9\10055661.txt PRIVATE\10202BE9\10055661.txt -data=DATAZ_\PRIVATE\10202BE9\F0000001.txt PRIVATE\10202BE9\F0000001.txt +data=DATAZ_\private\10202be9\1020506B.txt PRIVATE\10202BE9\1020506b.txt +data=DATAZ_\private\10202be9\00000001.txt PRIVATE\10202BE9\00000001.txt +data=DATAZ_\private\10202be9\00000002.txt PRIVATE\10202BE9\00000002.txt +data=DATAZ_\private\10202be9\00000003.txt PRIVATE\10202BE9\00000003.txt +data=DATAZ_\private\10202be9\00000004.txt PRIVATE\10202BE9\00000004.txt +data=DATAZ_\private\10202be9\00000005.txa PRIVATE\10202BE9\00000005.txa +data=DATAZ_\private\10202be9\00000e0f.cre PRIVATE\10202BE9\00000e0f.cre +data=DATAZ_\private\10202be9\00000bad.cre PRIVATE\10202BE9\00000bad.cre +data=DATAZ_\private\10202be9\00000010.txt PRIVATE\10202BE9\00000010.txt +data=DATAZ_\private\10202be9\00000010.txc PRIVATE\10202BE9\00000010.txc +data=DATAZ_\private\10202be9\00000010.txi PRIVATE\10202BE9\00000010.txi +data=DATAZ_\private\10202be9\00000011.txt PRIVATE\10202BE9\00000011.txt +data=DATAZ_\private\10202be9\00000011.txi PRIVATE\10202BE9\00000011.txi +data=DATAZ_\private\10202be9\00000012.txi PRIVATE\10202BE9\00000012.txi +data=DATAZ_\private\10202be9\00000013.txc PRIVATE\10202BE9\00000013.txc +data=DATAZ_\private\10202be9\00000100.txt PRIVATE\10202BE9\00000100.txt +data=DATAZ_\private\10202be9\00000100.txa PRIVATE\10202BE9\00000100.txa +data=DATAZ_\private\10202be9\00000100.txb PRIVATE\10202BE9\00000100.txb +data=DATAZ_\private\10202be9\00000100.txu PRIVATE\10202BE9\00000100.txu +data=DATAZ_\private\10202be9\00000101.txt PRIVATE\10202BE9\00000101.txt +data=DATAZ_\private\10202be9\00000102.txt PRIVATE\10202BE9\00000102.txt +data=DATAZ_\private\10202be9\00000103.txt PRIVATE\10202BE9\00000103.txt +data=DATAZ_\private\10202be9\00000104.txt PRIVATE\10202BE9\00000104.txt +data=DATAZ_\private\10202be9\00000105.txt PRIVATE\10202BE9\00000105.txt +data=DATAZ_\private\10202be9\00000106.txt PRIVATE\10202BE9\00000106.txt +data=DATAZ_\private\10202be9\00000107.txt PRIVATE\10202BE9\00000107.txt +data=DATAZ_\private\10202be9\00000108.txt PRIVATE\10202BE9\00000108.txt +data=DATAZ_\private\10202be9\00000109.txt PRIVATE\10202BE9\00000109.txt +data=DATAZ_\private\10202be9\0000010a.txt PRIVATE\10202BE9\0000010A.txt +data=DATAZ_\private\10202be9\badbadba.txt PRIVATE\10202BE9\BADBADBA.txt +data=DATAZ_\private\10202be9\badbadbb.txt PRIVATE\10202BE9\BADBADBB.txt +data=DATAZ_\private\10202be9\100058db.txt PRIVATE\10202BE9\100058DB.txt +data=DATAZ_\private\10202be9\10054632.txt PRIVATE\10202BE9\10054632.txt +data=DATAZ_\private\10202be9\10054633.txt PRIVATE\10202BE9\10054633.txt +data=DATAZ_\private\10202be9\cccccc01.txt PRIVATE\10202BE9\CCCCCC01.txt +data=DATAZ_\private\10202be9\cccccc02.cre PRIVATE\10202BE9\CCCCCC02.cre +data=DATAZ_\private\10202be9\cccccc03.txt PRIVATE\10202BE9\CCCCCC03.txt +data=DATAZ_\private\10202be9\cccccc04.cre PRIVATE\10202BE9\CCCCCC04.cre +data=DATAZ_\private\10202be9\10055661.txt PRIVATE\10202BE9\10055661.txt +data=DATAZ_\private\10202be9\f0000001.txt PRIVATE\10202BE9\F0000001.txt #ifndef __TE_CENTREP_BUR_SUITE_IBY__ -data=DATAZ_\PRIVATE\10202BE9\BACBACBA.txt PRIVATE\10202BE9\BACBACBA.txt -data=DATAZ_\PRIVATE\10202BE9\BAC2BAC2.txt PRIVATE\10202BE9\BAC2BAC2.txt -data=DATAZ_\PRIVATE\10202BE9\BAEBAEBA.txt PRIVATE\10202BE9\BAEBAEBA.txt +data=DATAZ_\PRIVATE\10202BE9\bacbacba.txt PRIVATE\10202BE9\BACBACBA.txt +data=DATAZ_\PRIVATE\10202BE9\bac2bac2.txt PRIVATE\10202BE9\BAC2BAC2.txt +data=DATAZ_\PRIVATE\10202BE9\baebaeba.txt PRIVATE\10202BE9\BAEBAEBA.txt #endif // __TE_CENTREP_BUR_SUITE_IBY__ -data=DATAZ_\PRIVATE\10202BE9\101F8764.cre PRIVATE\10202BE9\101F8764.cre -data=DATAZ_\PRIVATE\10202BE9\101F8765.txt PRIVATE\10202BE9\101F8765.txt -data=DATAZ_\PRIVATE\10202BE9\11111111.txt PRIVATE\10202BE9\11111111.txt -data=DATAZ_\PRIVATE\10202BE9\11111111.txu PRIVATE\10202BE9\11111111.txu -data=DATAZ_\PRIVATE\10202BE9\11111112.txu PRIVATE\10202BE9\11111112.txu -data=DATAZ_\PRIVATE\10202BE9\11111110.cri PRIVATE\10202BE9\11111110.cri -data=DATAZ_\PRIVATE\10202BE9\11111110.cru PRIVATE\10202BE9\11111110.cru -data=DATAZ_\PRIVATE\10202BE9\00056194.txt PRIVATE\10202BE9\00056194.txt -data=DATAZ_\PRIVATE\10202BE9\10057145.txt PRIVATE\10202BE9\10057145.txt -data=DATAZ_\PRIVATE\10202BE9\00057778.txt PRIVATE\10202BE9\00057778.txt -data=DATAZ_\PRIVATE\10202BE9\10057522.txt PRIVATE\10202BE9\10057522.txt -data=DATAZ_\PRIVATE\10202BE9\10057470.txt PRIVATE\10202BE9\10057470.txt -data=DATAZ_\PRIVATE\10202BE9\10058900.txt PRIVATE\10202BE9\10058900.txt -data=DATAZ_\PRIVATE\10202BE9\10061087.txt PRIVATE\10202BE9\10061087.txt -data=DATAZ_\PRIVATE\10202BE9\10098500.txt PRIVATE\10202BE9\10098500.txt -data=DATAZ_\PRIVATE\10202BE9\22222221.cre PRIVATE\10202BE9\22222221.cre -data=DATAZ_\PRIVATE\10202BE9\fffffffa.txt PRIVATE\10202BE9\fffffffa.txt -data=DATAZ_\PRIVATE\10202BE9\ffffffff.txt PRIVATE\10202BE9\ffffffff.txt -data=DATAZ_\PRIVATE\10202BE9\ffffffff.txc PRIVATE\10202BE9\ffffffff.txc -data=DATAZ_\PRIVATE\10202BE9\centrepcache.ini0 PRIVATE\10202BE9\centrepcache.ini0 -data=DATAZ_\PRIVATE\10202BE9\centrepcache.ini1 PRIVATE\10202BE9\centrepcache.ini1 -data=DATAZ_\PRIVATE\10202BE9\centrepcache.ini2 PRIVATE\10202BE9\centrepcache.ini2 -data=DATAZ_\PRIVATE\10202BE9\centrepcache.ini3 PRIVATE\10202BE9\centrepcache.ini3 -data=DATAZ_\PRIVATE\10202BE9\centrepcache.ini4 PRIVATE\10202BE9\centrepcache.ini4 -data=DATAZ_\PRIVATE\10202BE9\centrepcache.ini5 PRIVATE\10202BE9\centrepcache.ini5 -data=DATAZ_\PRIVATE\10202BE9\centrepcache.ini6 PRIVATE\10202BE9\centrepcache.ini6 -data=DATAZ_\PRIVATE\10202BE9\centrepcache.ini7 PRIVATE\10202BE9\centrepcache.ini7 -data=DATAZ_\PRIVATE\10202BE9\centrepcache.ini8 PRIVATE\10202BE9\centrepcache.ini8 -data=DATAZ_\PRIVATE\10202BE9\centrepcache.ini9 PRIVATE\10202BE9\centrepcache.ini9 -data=DATAZ_\PRIVATE\10202BE9\Centrepcache.ini10 PRIVATE\10202BE9\centrepcache.ini10 -data=DATAZ_\PRIVATE\102081E4\00000003.txt PRIVATE\102081E4\00000003.txt -data=DATAZ_\PRIVATE\10202BE9\installdir_corrupt1.bin PRIVATE\10202BE9\installdir_corrupt1.bin -data=DATAZ_\PRIVATE\10202BE9\installdir_corrupt2.bin PRIVATE\10202BE9\installdir_corrupt2.bin -data=DATAZ_\PRIVATE\10202BE9\cache_corrupt.ini PRIVATE\10202BE9\cache_corrupt.ini -data=DATAZ_\PRIVATE\10202BE9\00112273.txt PRIVATE\10202BE9\00112273.txt -data=DATAZ_\PRIVATE\10202BE9\00000100.cra PRIVATE\10202BE9\00000100.cra -data=DATAZ_\PRIVATE\10202BE9\00000005.cra PRIVATE\10202BE9\00000005.cra -data=DATAZ_\PRIVATE\10202BE9\00000100.crb PRIVATE\10202BE9\00000100.crb -data=DATAZ_\PRIVATE\10202BE9\babababa.cre PRIVATE\10202BE9\babababa.cre +data=DATAZ_\private\10202be9\101f8764.cre PRIVATE\10202BE9\101F8764.cre +data=DATAZ_\private\10202be9\101f8765.txt PRIVATE\10202BE9\101F8765.txt +data=DATAZ_\private\10202be9\11111111.txt PRIVATE\10202BE9\11111111.txt +data=DATAZ_\private\10202be9\11111111.txu PRIVATE\10202BE9\11111111.txu +data=DATAZ_\private\10202be9\11111112.txu PRIVATE\10202BE9\11111112.txu +data=DATAZ_\private\10202be9\11111110.cri PRIVATE\10202BE9\11111110.cri +data=DATAZ_\private\10202be9\11111110.cru PRIVATE\10202BE9\11111110.cru +data=DATAZ_\private\10202be9\00056194.txt PRIVATE\10202BE9\00056194.txt +data=DATAZ_\private\10202be9\10057145.txt PRIVATE\10202BE9\10057145.txt +data=DATAZ_\private\10202be9\00057778.txt PRIVATE\10202BE9\00057778.txt +data=DATAZ_\private\10202be9\10057522.txt PRIVATE\10202BE9\10057522.txt +data=DATAZ_\private\10202be9\10057470.txt PRIVATE\10202BE9\10057470.txt +data=DATAZ_\private\10202be9\10058900.txt PRIVATE\10202BE9\10058900.txt +data=DATAZ_\private\10202be9\10061087.txt PRIVATE\10202BE9\10061087.txt +data=DATAZ_\private\10202be9\10098500.txt PRIVATE\10202BE9\10098500.txt +data=DATAZ_\private\10202be9\22222221.cre PRIVATE\10202BE9\22222221.cre +data=DATAZ_\private\10202be9\fffffffa.txt PRIVATE\10202BE9\fffffffa.txt +data=DATAZ_\private\10202be9\ffffffff.txt PRIVATE\10202BE9\ffffffff.txt +data=DATAZ_\private\10202be9\ffffffff.txc PRIVATE\10202BE9\ffffffff.txc +data=DATAZ_\private\10202be9\centrepcache.ini0 PRIVATE\10202BE9\centrepcache.ini0 +data=DATAZ_\private\10202be9\centrepcache.ini1 PRIVATE\10202BE9\centrepcache.ini1 +data=DATAZ_\private\10202be9\centrepcache.ini2 PRIVATE\10202BE9\centrepcache.ini2 +data=DATAZ_\private\10202be9\centrepcache.ini3 PRIVATE\10202BE9\centrepcache.ini3 +data=DATAZ_\private\10202be9\centrepcache.ini4 PRIVATE\10202BE9\centrepcache.ini4 +data=DATAZ_\private\10202be9\centrepcache.ini5 PRIVATE\10202BE9\centrepcache.ini5 +data=DATAZ_\private\10202be9\centrepcache.ini6 PRIVATE\10202BE9\centrepcache.ini6 +data=DATAZ_\private\10202be9\centrepcache.ini7 PRIVATE\10202BE9\centrepcache.ini7 +data=DATAZ_\private\10202be9\centrepcache.ini8 PRIVATE\10202BE9\centrepcache.ini8 +data=DATAZ_\private\10202be9\centrepcache.ini9 PRIVATE\10202BE9\centrepcache.ini9 +data=DATAZ_\private\10202be9\centrepcache.ini10 PRIVATE\10202BE9\centrepcache.ini10 +data=DATAZ_\private\102081e4\00000003.txt PRIVATE\102081e4\00000003.txt +data=DATAZ_\private\10202be9\installdir_corrupt1.bin PRIVATE\10202BE9\installdir_corrupt1.bin +data=DATAZ_\private\10202be9\installdir_corrupt2.bin PRIVATE\10202BE9\installdir_corrupt2.bin +data=DATAZ_\private\10202be9\cache_corrupt.ini PRIVATE\10202BE9\cache_corrupt.ini +data=DATAZ_\private\10202be9\00112273.txt PRIVATE\10202BE9\00112273.txt +data=DATAZ_\private\10202be9\00000100.cra PRIVATE\10202BE9\00000100.cra +data=DATAZ_\private\10202be9\00000005.cra PRIVATE\10202BE9\00000005.cra +data=DATAZ_\private\10202be9\00000100.crb PRIVATE\10202BE9\00000100.crb +data=DATAZ_\private\10202be9\babababa.cre PRIVATE\10202BE9\babababa.cre data=DATAZ_\PRIVATE\10202BE9\cccccc99.cre PRIVATE\10202BE9\cccccc99.cre #ifndef __CENTRALREPOSITORYTECHVIEWRTESTS_IBY__ @@ -112,19 +112,19 @@ #endif // SYMBIAN_CENTREP_SUPPORT_MULTIROFS #ifdef SYMBIAN_BAFL_SYSUTIL #include -data=DATAZ_\PRIVATE\10202BE9\10033333.txt PRIVATE\10202BE9\10033333.txt -data=DATAZ_\PRIVATE\10202BE9\10033333_modified2.cre PRIVATE\10202BE9\10033333_modified2.cre -data=DATAZ_\PRIVATE\10202BE9\10033333_modified3.cre PRIVATE\10202BE9\10033333_modified3.cre -data=DATAZ_\PRIVATE\10202BE9\10033340_reserved.cre PRIVATE\10202BE9\10033340_reserved.cre -data=DATAZ_\PRIVATE\10202BE9\10033341_reserved.cre PRIVATE\10202BE9\10033341_reserved.cre -data=DATAZ_\PRIVATE\10202BE9\10043336_persists.cre PRIVATE\10202BE9\10043336_persists.cre -data=DATAZ_\PRIVATE\10202BE9\10043337_persists.cre PRIVATE\10202BE9\10043337_persists.cre -data=DATAZ_\PRIVATE\10202BE9\10043338_persists.cre PRIVATE\10202BE9\10043338_persists.cre -data=DATAZ_\PRIVATE\10202BE9\10033341_orig.cre PRIVATE\10202BE9\10033341_orig.cre -data=DATAZ_\PRIVATE\10202BE9\10043336.txt PRIVATE\10202BE9\10043336.txt -data=DATAZ_\PRIVATE\10202BE9\10043337.txt PRIVATE\10202BE9\10043337.txt -data=DATAZ_\PRIVATE\10202BE9\10043338.txt PRIVATE\10202BE9\10043338.txt -data=DATAZ_\PRIVATE\10202BE9\10033333_modified.cre PRIVATE\10202BE9\10033333_modified.cre +data=DATAZ_\private\10202be9\10033333.txt PRIVATE\10202BE9\10033333.txt +data=DATAZ_\private\10202be9\10033333_modified2.cre PRIVATE\10202BE9\10033333_modified2.cre +data=DATAZ_\private\10202be9\10033333_modified3.cre PRIVATE\10202BE9\10033333_modified3.cre +data=DATAZ_\private\10202be9\10033340_reserved.cre PRIVATE\10202BE9\10033340_reserved.cre +data=DATAZ_\private\10202be9\10033341_reserved.cre PRIVATE\10202BE9\10033341_reserved.cre +data=DATAZ_\private\10202be9\10043336_persists.cre PRIVATE\10202BE9\10043336_persists.cre +data=DATAZ_\private\10202be9\10043337_persists.cre PRIVATE\10202BE9\10043337_persists.cre +data=DATAZ_\private\10202be9\10043338_persists.cre PRIVATE\10202BE9\10043338_persists.cre +data=DATAZ_\private\10202be9\10033341_orig.cre PRIVATE\10202BE9\10033341_orig.cre +data=DATAZ_\private\10202be9\10043336.txt PRIVATE\10202BE9\10043336.txt +data=DATAZ_\private\10202be9\10043337.txt PRIVATE\10202BE9\10043337.txt +data=DATAZ_\private\10202be9\10043338.txt PRIVATE\10202BE9\10043338.txt +data=DATAZ_\private\10202be9\10033333_modified.cre PRIVATE\10202BE9\10033333_modified.cre data=DATAZ_\private\10202be9\cabacaba.txt private\10202be9\cabacaba.txt data=DATAZ_\private\10202be9\cadacada.txt private\10202be9\cadacada.txt #ifdef SYMBIAN_CENTREP_SUPPORT_MULTIROFS @@ -137,12 +137,12 @@ #endif // PDS_TEST_MULTIROFS #endif // SYMBIAN_CENTREP_SUPPORT_MULTIROFS #ifndef __TE_SYSUTILTEFTESTS_IBY__ -data=DATAZ_\RESOURCE\versions\sw.txt RESOURCE\versions\sw.txt +data=DATAZ_\resource\versions\sw.txt RESOURCE\versions\sw.txt #endif // __TE_SYSUTILTEFTESTS_IBY__ -data=DATAZ_\PRIVATE\10202BE9\sw_modified.txt PRIVATE\10202BE9\sw_modified.txt -data=DATAZ_\PRIVATE\10202BE9\sw_modified1.txt PRIVATE\10202BE9\sw_modified1.txt -data=DATAZ_\PRIVATE\10202BE9\RF1.sis PRIVATE\10202BE9\RF1.sis -data=DATAZ_\PRIVATE\10202BE9\RF4.sis PRIVATE\10202BE9\RF4.sis +data=DATAZ_\private\10202be9\sw_modified.txt PRIVATE\10202BE9\sw_modified.txt +data=DATAZ_\private\10202be9\sw_modified1.txt PRIVATE\10202BE9\sw_modified1.txt +data=DATAZ_\private\10202be9\rf1.sis PRIVATE\10202BE9\RF1.sis +data=DATAZ_\private\10202be9\rf4.sis PRIVATE\10202BE9\RF4.sis #endif // SYMBIAN_BAFL_SYSUTIL #endif // __CENTRALREPOSITORYTECHVIEWRTESTS_IBY__ #endif //__CENTREPTESTDATA_IBY__ diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/pccenrep/group/bld.inf --- a/persistentstorage/centralrepository/pccenrep/group/bld.inf Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/centralrepository/pccenrep/group/bld.inf Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -22,8 +22,11 @@ PRJ_TESTEXPORTS -cenrepcstests.iby /epoc32/rom/include/cenrepcstests.iby - +cenrepcstests.iby /epoc32/rom/include/cenrepcstests.iby +centrep_copypctestfile.mk /epoc32/tools/makefile_templates/syslibs/test/centrep_copypctestfile.mk +centrep_copypctestfile.meta /epoc32/tools/makefile_templates/syslibs/test/centrep_copypctestfile.meta +centrep_copypctestfilev2.mk /epoc32/tools/makefile_templates/syslibs/test/centrep_copypctestfilev2.mk +centrep_copypctestfilev2.meta /epoc32/tools/makefile_templates/syslibs/test/centrep_copypctestfilev2.meta PRJ_EXTENSIONS #ifdef TOOLS2 diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/pccenrep/group/centrep_copypctestfile.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/centralrepository/pccenrep/group/centrep_copypctestfile.meta Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,19 @@ +# 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: +# Meta information for centrep_copypctestfile use +# + +platform win32 +makefile gnumake +techstream syslibs diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/pccenrep/group/centrep_copypctestfile.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/centralrepository/pccenrep/group/centrep_copypctestfile.mk Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,203 @@ +# 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: +# + +TMPROOT:=$(subst \,/,$(EPOCROOT)) +EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/ + +include $(EPOCROOT)epoc32/tools/shell/$(notdir $(basename $(SHELL))).mk + +ifeq ($(findstring WINS,$(PLATFORM)),WINS) + EPOCDATADIR = $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH) +else + EPOCDATADIR = $(EPOCROOT)epoc32/data +endif + +SECURETARGETDIR = $(EPOCDATADIR)/z/private/10202BE9 + +PCCENREPSOURCE = $(EXTENSION_ROOT)/../test +PCCENREPDATADIR = $(EPOCROOT)epoc32/winscw/c/private/00000000 +PCCENREPTESTDIR = $(EPOCROOT)epoc32/winscw/c +PCCENREPPCTESTDIR = $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH) + +$(SECURETARGETDIR) : + $(call createdir, "$@") + +$(PCCENREPDATADIR) : + $(call createdir, "$@") + +COPYFILES : +ifneq ($(findstring TOOLS2,$(PLATFORM)),TOOLS2) + + $(call forcecopy,$(PCCENREPSOURCE)/000001ff.txt,$(SECURETARGETDIR)/000001ff.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.cre,$(SECURETARGETDIR)/00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000002ff.cre,$(SECURETARGETDIR)/000002ff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/88888880.txt,$(SECURETARGETDIR)/88888880.txt) + $(call forcecopy,$(PCCENREPSOURCE)/88888881.cre,$(SECURETARGETDIR)/88888881.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.txt,$(SECURETARGETDIR)/00022222.txt) + +ifeq ($(findstring WINS,$(PLATFORM)),WINS) + $(call forcecopy,$(PCCENREPSOURCE)/000001ff.txt,$(PCCENREPDATADIR)/000001ff.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.cre,$(PCCENREPDATADIR)/00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000002ff.cre,$(PCCENREPDATADIR)/000002ff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/88888880.txt,$(PCCENREPDATADIR)/88888880.txt) + $(call forcecopy,$(PCCENREPSOURCE)/88888881.cre,$(PCCENREPDATADIR)/88888881.cre) + $(call forcecopy,$(PCCENREPSOURCE)/winscwcre.cre,$(PCCENREPDATADIR)/ref_winscwcre.cre) + $(call forcecopy,$(PCCENREPSOURCE)/winscwtxt.cre,$(PCCENREPDATADIR)/ref_winscwtxt.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000001ff.txt,$(PCCENREPDATADIR)/copy000001ff.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.cre,$(PCCENREPDATADIR)/copy00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000002ff.cre,$(PCCENREPDATADIR)/copy000002ff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.txt,$(PCCENREPDATADIR)/00022222.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.cre,$(PCCENREPDATADIR)/copy00022222.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000001ff.txt,$(PCCENREPTESTDIR)/000001ff.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.cre,$(PCCENREPTESTDIR)/00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.cre,$(PCCENREPTESTDIR)/copy00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.txt,$(PCCENREPTESTDIR)/00022222.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.cre,$(PCCENREPTESTDIR)/copy00022222.cre) +endif + +else + $(call forcecopy,$(PCCENREPSOURCE)/000001ff.txt,$(PCCENREPPCTESTDIR)/000001ff.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.cre,$(PCCENREPPCTESTDIR)/00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000001ff.txt,$(PCCENREPPCTESTDIR)/copy000001ff.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.cre,$(PCCENREPPCTESTDIR)/copy00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000002ff.cre,$(PCCENREPPCTESTDIR)/000002ff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000002ff.cre,$(PCCENREPPCTESTDIR)/copy000002ff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/winscwcre.cre,$(PCCENREPPCTESTDIR)/ref_winscwcre.cre) + $(call forcecopy,$(PCCENREPSOURCE)/winscwtxt.cre,$(PCCENREPPCTESTDIR)/ref_winscwtxt.cre) + $(call forcecopy,$(PCCENREPSOURCE)/88888880.txt,$(PCCENREPPCTESTDIR)/88888880.txt) + $(call forcecopy,$(PCCENREPSOURCE)/88888881.cre,$(PCCENREPPCTESTDIR)/88888881.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.txt,$(PCCENREPPCTESTDIR)/00022222.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.cre,$(PCCENREPPCTESTDIR)/copy00022222.cre) + +endif + +DO_NOTHING: + @echo do nothing + +# +# The targets invoked by bld... +# + +BLD : $(SECURETARGETDIR) $(PCCENREPDATADIR) $(PCCENREPTESTDIR) $(PCCENREPSOURCE) $(PCCENREPPCTESTDIR) COPYFILES + +CLEAN : + +ifneq ($(findstring TOOLS2,$(PLATFORM)),TOOLS2) + + $(call forceremove,$(SECURETARGETDIR)/000001ff.txt) + $(call forceremove,$(SECURETARGETDIR)/00001fff.cre) + $(call forceremove,$(SECURETARGETDIR)/000002ff.cre) + $(call forceremove,$(SECURETARGETDIR)/88888880.txt) + $(call forceremove,$(SECURETARGETDIR)/88888881.cre) + $(call forceremove,$(SECURETARGETDIR)/00022222.txt) + +ifeq ($(findstring WINS,$(PLATFORM)),WINS) + $(call forceremove,$(PCCENREPDATADIR)/000001ff.txt) + $(call forceremove,$(PCCENREPDATADIR)/00001fff.cre) + $(call forceremove,$(PCCENREPDATADIR)/000002ff.cre) + $(call forceremove,$(PCCENREPDATADIR)/88888880.txt) + $(call forceremove,$(PCCENREPDATADIR)/88888881.cre) + $(call forceremove,$(PCCENREPDATADIR)/ref_winscwcre.cre) + $(call forceremove,$(PCCENREPDATADIR)/ref_winscwtxt.cre) + $(call forceremove,$(PCCENREPDATADIR)/copy000001ff.txt) + $(call forceremove,$(PCCENREPDATADIR)/copy00001fff.cre) + $(call forceremove,$(PCCENREPDATADIR)/copy000002ff.cre) + $(call forceremove,$(PCCENREPDATADIR)/00022222.txt) + $(call forceremove,$(PCCENREPDATADIR)/copy00022222.cre) + $(call forceremove,$(PCCENREPTESTDIR)/000001ff.txt) + $(call forceremove,$(PCCENREPTESTDIR)/00001fff.cre) + $(call forceremove,$(PCCENREPTESTDIR)/copy00001fff.cre) + $(call forceremove,$(PCCENREPTESTDIR)/00022222.txt) + $(call forceremove,$(PCCENREPTESTDIR)/copy00022222.cre) + +endif + +else + $(call forceremove,$(PCCENREPPCTESTDIR)/000001ff.txt) + $(call forceremove,$(PCCENREPPCTESTDIR)/00001fff.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/copy000001ff.txt) + $(call forceremove,$(PCCENREPPCTESTDIR)/copy00001fff.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/000002ff.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/copy000002ff.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/ref_winscwcre.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/ref_winscwtxt.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/88888880.txt) + $(call forceremove,$(PCCENREPPCTESTDIR)/88888881.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/00022222.txt) + $(call forceremove,$(PCCENREPPCTESTDIR)/copy00022222.cre) + +endif + +RELEASABLES : +ifneq ($(findstring TOOLS2,$(PLATFORM)),TOOLS2) + + @echo $(SECURETARGETDIR)/000001ff.txt + @echo $(SECURETARGETDIR)/00001fff.cre + @echo $(SECURETARGETDIR)/000002ff.cre + @echo $(SECURETARGETDIR)/88888880.txt + @echo $(SECURETARGETDIR)/88888881.cre + @echo $(SECURETARGETDIR)/00022222.txt + +ifeq ($(findstring WINS,$(PLATFORM)),WINS) + @echo $(PCCENREPDATADIR)/000001ff.txt + @echo $(PCCENREPDATADIR)/00001fff.cre + @echo $(PCCENREPDATADIR)/000002ff.cre + @echo $(PCCENREPDATADIR)/88888880.txt + @echo $(PCCENREPDATADIR)/88888881.cre + @echo $(PCCENREPDATADIR)/ref_winscwcre.cre + @echo $(PCCENREPDATADIR)/ref_winscwtxt.cre + @echo $(PCCENREPDATADIR)/copy000001ff.txt + @echo $(PCCENREPDATADIR)/copy00001fff.cre + @echo $(PCCENREPDATADIR)/copy000002ff.cre + @echo $(PCCENREPDATADIR)/00022222.txt + @echo $(PCCENREPDATADIR)/copy00022222.cre + @echo $(PCCENREPTESTDIR)/000001ff.txt + @echo $(PCCENREPTESTDIR)/00001fff.cre + @echo $(PCCENREPTESTDIR)/copy00001fff.cre + @echo $(PCCENREPTESTDIR)/00022222.txt + @echo $(PCCENREPTESTDIR)/copy00022222.cre + +endif + +else + @echo $(PCCENREPPCTESTDIR)/000001ff.txt + @echo $(PCCENREPPCTESTDIR)/00001fff.cre + @echo $(PCCENREPPCTESTDIR)/copy000001ff.txt + @echo $(PCCENREPPCTESTDIR)/copy00001fff.cre + @echo $(PCCENREPPCTESTDIR)/000002ff.cre + @echo $(PCCENREPPCTESTDIR)/copy000002ff.cre + @echo $(PCCENREPPCTESTDIR)/ref_winscwcre.cre + @echo $(PCCENREPPCTESTDIR)/ref_winscwtxt.cre + @echo $(PCCENREPPCTESTDIR)/88888880.txt + @echo $(PCCENREPPCTESTDIR)/88888881.cre + @echo $(PCCENREPPCTESTDIR)/00022222.txt + @echo $(PCCENREPPCTESTDIR)/copy00022222.cre +endif + +MAKMAKE : DO_NOTHING + +RESOURCE : DO_NOTHING + +SAVESPACE : DO_NOTHING + +FREEZE : DO_NOTHING + +LIB : DO_NOTHING + +CLEANLIB : DO_NOTHING + +FINAL : DO_NOTHING + +ROMFILE : DO_NOTHING diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/pccenrep/group/centrep_copypctestfilev2.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/centralrepository/pccenrep/group/centrep_copypctestfilev2.meta Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,20 @@ +# 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: +# centrep_copypctestfile.meta +# Meta information for centrep_copypctestfile use +# + +platform win32 +makefile gnumake +techstream syslibs diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/pccenrep/group/centrep_copypctestfilev2.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/centralrepository/pccenrep/group/centrep_copypctestfilev2.mk Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,238 @@ +# 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: +# centrep_copypctestfile.mk +# +# + +TMPROOT:=$(subst \,/,$(EPOCROOT)) +EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/ + +include $(EPOCROOT)epoc32/tools/shell/$(notdir $(basename $(SHELL))).mk + +ifeq ($(findstring WINS,$(PLATFORM)),WINS) + EPOCDATADIR = $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH) +else + EPOCDATADIR = $(EPOCROOT)epoc32/data +endif + +SECURETARGETDIR = $(EPOCDATADIR)/z/private/10202BE9 + +PCCENREPSOURCE = $(EXTENSION_ROOT)/../test +PCCENREPDATADIR = $(EPOCROOT)epoc32/winscw/c/private/00000000 +PCCENREPTESTDIR = $(EPOCROOT)epoc32/winscw/c +PCCENREPPCTESTDIR = $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH) + +$(SECURETARGETDIR) : + $(call createdir, "$@") + +$(PCCENREPDATADIR) : + $(call createdir, "$@") + +COPYFILES : +ifneq ($(findstring TOOLS2,$(PLATFORM)),TOOLS2) + $(call forcecopy,$(PCCENREPSOURCE)/000001ff.txt,$(SECURETARGETDIR)/000001ff.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.crev2,$(SECURETARGETDIR)/00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000002ff.crev2,$(SECURETARGETDIR)/000002ff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/88888880.txt,$(SECURETARGETDIR)/88888880.txt) + $(call forcecopy,$(PCCENREPSOURCE)/88888881.cre,$(SECURETARGETDIR)/88888881.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00004fff.cre,$(SECURETARGETDIR)/00004fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.txt,$(SECURETARGETDIR)/00022222.txt) + +ifeq ($(findstring WINS,$(PLATFORM)),WINS) + $(call forcecopy,$(PCCENREPSOURCE)/000001ff.txt,$(PCCENREPDATADIR)/000001ff.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.crev2,$(PCCENREPDATADIR)/00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000002ff.crev2,$(PCCENREPDATADIR)/000002ff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/88888880.txt,$(PCCENREPDATADIR)/88888880.txt) + $(call forcecopy,$(PCCENREPSOURCE)/88888881.cre,$(PCCENREPDATADIR)/88888881.cre) + $(call forcecopy,$(PCCENREPSOURCE)/winscwcre.crev2,$(PCCENREPDATADIR)/ref_winscwcre.cre) + $(call forcecopy,$(PCCENREPSOURCE)/winscwtxt.crev2,$(PCCENREPDATADIR)/ref_winscwtxt.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000001ff.txt,$(PCCENREPDATADIR)/copy000001ff.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.crev2,$(PCCENREPDATADIR)/copy00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000002ff.crev2,$(PCCENREPDATADIR)/copy000002ff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00004fff.cre,$(PCCENREPDATADIR)/00004fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00004fff.cre,$(PCCENREPDATADIR)/copy00004fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.txt,$(PCCENREPDATADIR)/00022222.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.crev2,$(PCCENREPDATADIR)/copy00022222.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000001ff.txt,$(PCCENREPTESTDIR)/000001ff.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.crev2,$(PCCENREPTESTDIR)/00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.crev2,$(PCCENREPTESTDIR)/copy00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00004fff.cre,$(PCCENREPTESTDIR)/00004fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00004fff.cre,$(PCCENREPTESTDIR)/copy00004fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.txt,$(PCCENREPTESTDIR)/00022222.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.crev2,$(PCCENREPTESTDIR)/copy00022222.cre) +# Shared files between the t_cenreppc (WINSCW) and testsymcenrep (TOOLS2) tests. + $(call forcecopy,$(PCCENREPSOURCE)/common_crc.txt,$(PCCENREPTESTDIR)/common_crc.txt) + $(call forcecopy,$(PCCENREPSOURCE)/common_ref_00022222.cre,$(PCCENREPDATADIR)/common_ref_00022222.cre) +endif + +# TOOLS2 +else + $(call forcecopy,$(PCCENREPSOURCE)/000001ff.txt,$(PCCENREPPCTESTDIR)/000001ff.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.crev2,$(PCCENREPPCTESTDIR)/00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00004fff.cre,$(PCCENREPPCTESTDIR)/00004fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000001ff.txt,$(PCCENREPPCTESTDIR)/copy000001ff.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00001fff.crev2,$(PCCENREPPCTESTDIR)/copy00001fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00004fff.cre,$(PCCENREPPCTESTDIR)/copy00004fff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000002ff.crev2,$(PCCENREPPCTESTDIR)/000002ff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/000002ff.crev2,$(PCCENREPPCTESTDIR)/copy000002ff.cre) + $(call forcecopy,$(PCCENREPSOURCE)/winscwcre.crev2,$(PCCENREPPCTESTDIR)/ref_winscwcre.cre) + $(call forcecopy,$(PCCENREPSOURCE)/winscwtxt.crev2,$(PCCENREPPCTESTDIR)/ref_winscwtxt.cre) + $(call forcecopy,$(PCCENREPSOURCE)/88888880.txt,$(PCCENREPPCTESTDIR)/88888880.txt) + $(call forcecopy,$(PCCENREPSOURCE)/88888881.cre,$(PCCENREPPCTESTDIR)/88888881.cre) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.txt,$(PCCENREPPCTESTDIR)/00022222.txt) + $(call forcecopy,$(PCCENREPSOURCE)/00022222.crev2,$(PCCENREPPCTESTDIR)/copy00022222.cre) +# Shared files between the t_cenreppc (WINSCW) and testsymcenrep (TOOLS2) tests. + $(call forcecopy,$(PCCENREPSOURCE)/common_crc.txt,$(PCCENREPTESTDIR)/common_crc.txt) + $(call forcecopy,$(PCCENREPSOURCE)/common_ref_00022222.cre,$(PCCENREPDATADIR)/common_ref_00022222.cre) +endif + +DO_NOTHING: + @echo do nothing + +# +# The targets invoked by bld... +# + +BLD : $(SECURETARGETDIR) $(PCCENREPDATADIR) $(PCCENREPTESTDIR) $(PCCENREPSOURCE) $(PCCENREPPCTESTDIR) COPYFILES + +CLEAN : + +ifneq ($(findstring TOOLS2,$(PLATFORM)),TOOLS2) + $(call forceremove,$(SECURETARGETDIR)/000001ff.txt) + $(call forceremove,$(SECURETARGETDIR)/00001fff.cre) + $(call forceremove,$(SECURETARGETDIR)/000002ff.cre) + $(call forceremove,$(SECURETARGETDIR)/88888880.txt) + $(call forceremove,$(SECURETARGETDIR)/88888881.cre) + $(call forceremove,$(SECURETARGETDIR)/00004fff.cre) + $(call forceremove,$(SECURETARGETDIR)/00022222.txt) + +ifeq ($(findstring WINS,$(PLATFORM)),WINS) + $(call forceremove,$(PCCENREPDATADIR)/000001ff.txt) + $(call forceremove,$(PCCENREPDATADIR)/00001fff.cre) + $(call forceremove,$(PCCENREPDATADIR)/000002ff.cre) + $(call forceremove,$(PCCENREPDATADIR)/88888880.txt) + $(call forceremove,$(PCCENREPDATADIR)/88888881.cre) + $(call forceremove,$(PCCENREPDATADIR)/ref_winscwcre.cre) + $(call forceremove,$(PCCENREPDATADIR)/ref_winscwtxt.cre) + $(call forceremove,$(PCCENREPDATADIR)/copy000001ff.txt) + $(call forceremove,$(PCCENREPDATADIR)/copy00001fff.cre) + $(call forceremove,$(PCCENREPDATADIR)/copy000002ff.cre) + $(call forceremove,$(PCCENREPDATADIR)/00004fff.cre) + $(call forceremove,$(PCCENREPDATADIR)/copy00004fff.cre) + $(call forceremove,$(PCCENREPDATADIR)/00022222.txt) + $(call forceremove,$(PCCENREPDATADIR)/copy00022222.cre) + $(call forceremove,$(PCCENREPTESTDIR)/000001ff.txt) + $(call forceremove,$(PCCENREPTESTDIR)/00001fff.cre) + $(call forceremove,$(PCCENREPTESTDIR)/copy00001fff.cre) + $(call forceremove,$(PCCENREPTESTDIR)/00004fff.cre) + $(call forceremove,$(PCCENREPTESTDIR)/copy00004fff.cre) + $(call forceremove,$(PCCENREPTESTDIR)/00022222.txt) + $(call forceremove,$(PCCENREPTESTDIR)/copy00022222.cre) + $(call forceremove,$(PCCENREPTESTDIR)/common_crc.txt) + $(call forceremove,$(PCCENREPDATADIR)/common_ref_00022222.cre) +endif + + +# TOOLS2 +else + $(call forceremove,$(PCCENREPPCTESTDIR)/000001ff.txt) + $(call forceremove,$(PCCENREPPCTESTDIR)/00001fff.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/00004fff.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/copy000001ff.txt) + $(call forceremove,$(PCCENREPPCTESTDIR)/copy00001fff.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/000002ff.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/copy000002ff.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/ref_winscwcre.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/ref_winscwtxt.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/88888880.txt) + $(call forceremove,$(PCCENREPPCTESTDIR)/88888881.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/00022222.txt) + $(call forceremove,$(PCCENREPPCTESTDIR)/copy00022222.cre) + $(call forceremove,$(PCCENREPPCTESTDIR)/copy00004fff.cre) + $(call forceremove,$(PCCENREPTESTDIR)/common_crc.txt) + $(call forceremove,$(PCCENREPDATADIR)/common_ref_00022222.cre) + +endif + +RELEASABLES : +ifneq ($(findstring TOOLS2,$(PLATFORM)),TOOLS2) + @echo $(SECURETARGETDIR)/000001ff.txt + @echo $(SECURETARGETDIR)/00001fff.cre + @echo $(SECURETARGETDIR)/000002ff.cre + @echo $(SECURETARGETDIR)/88888880.txt + @echo $(SECURETARGETDIR)/88888881.cre + @echo $(SECURETARGETDIR)/00004fff.cre + @echo $(SECURETARGETDIR)/00022222.txt + +ifeq ($(findstring WINS,$(PLATFORM)),WINS) + @echo $(PCCENREPDATADIR)/000001ff.txt + @echo $(PCCENREPDATADIR)/00001fff.cre + @echo $(PCCENREPDATADIR)/000002ff.cre + @echo $(PCCENREPDATADIR)/88888880.txt + @echo $(PCCENREPDATADIR)/88888881.cre + @echo $(PCCENREPDATADIR)/ref_winscwcre.cre + @echo $(PCCENREPDATADIR)/ref_winscwtxt.cre + @echo $(PCCENREPDATADIR)/copy000001ff.txt + @echo $(PCCENREPDATADIR)/copy00001fff.cre + @echo $(PCCENREPDATADIR)/copy000002ff.cre + @echo $(PCCENREPDATADIR)/00004fff.cre + @echo $(PCCENREPDATADIR)/copy00004fff.cre + @echo $(PCCENREPDATADIR)/00022222.txt + @echo $(PCCENREPDATADIR)/copy00022222.cre + @echo $(PCCENREPTESTDIR)/000001ff.txt + @echo $(PCCENREPTESTDIR)/00001fff.cre + @echo $(PCCENREPTESTDIR)/copy00001fff.cre + @echo $(PCCENREPTESTDIR)/00004fff.cre + @echo $(PCCENREPTESTDIR)/copy00004fff.cre + @echo $(PCCENREPTESTDIR)/00022222.txt + @echo $(PCCENREPTESTDIR)/copy00022222.cre + @echo $(PCCENREPTESTDIR)/common_crc.txt + @echo $(PCCENREPDATADIR)/common_ref_00022222.cre +endif + +# TOOLS2 +else + @echo $(PCCENREPPCTESTDIR)/000001ff.txt + @echo $(PCCENREPPCTESTDIR)/00001fff.cre + @echo $(PCCENREPPCTESTDIR)/copy000001ff.txt + @echo $(PCCENREPPCTESTDIR)/copy00001fff.cre + @echo $(PCCENREPPCTESTDIR)/000002ff.cre + @echo $(PCCENREPPCTESTDIR)/copy000002ff.cre + @echo $(PCCENREPPCTESTDIR)/ref_winscwcre.cre + @echo $(PCCENREPPCTESTDIR)/ref_winscwtxt.cre + @echo $(PCCENREPPCTESTDIR)/88888880.txt + @echo $(PCCENREPPCTESTDIR)/88888881.cre + @echo $(PCCENREPPCTESTDIR)/00022222.txt + @echo $(PCCENREPPCTESTDIR)/copy00022222.cre + @echo $(PCCENREPPCTESTDIR)/copy00004fff.cre + @echo $(PCCENREPTESTDIR)/common_crc.txt + @echo $(PCCENREPDATADIR)/common_ref_00022222.cre + +endif + +MAKMAKE : DO_NOTHING + +RESOURCE : DO_NOTHING + +SAVESPACE : DO_NOTHING + +FREEZE : DO_NOTHING + +LIB : DO_NOTHING + +CLEANLIB : DO_NOTHING + +FINAL : DO_NOTHING + +ROMFILE : DO_NOTHING diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/test/testexecute/BUR/group/te_centrep_BURsuite.iby --- a/persistentstorage/centralrepository/test/testexecute/BUR/group/te_centrep_BURsuite.iby Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/centralrepository/test/testexecute/BUR/group/te_centrep_BURsuite.iby Mon Sep 27 11:59:56 2010 +0100 @@ -20,21 +20,21 @@ #include #include -file=ABI_DIR\BUILD_DIR\te_centrep_BURSuite.exe System\bin\te_centrep_BURSuite.exe +file=ABI_DIR\BUILD_DIR\te_centrep_bursuite.exe System\bin\te_centrep_BURSuite.exe file=ABI_DIR\BUILD_DIR\te_centrep_burobserversuite.exe System\bin\te_centrep_burobserversuite.exe -data=DATAZ_\TEF_CentralRepository\te_centrep_BURSuite.script TEF_CentralRepository\te_centrep_BURSuite.Script -data=DATAZ_\TEF_CentralRepository\BUR.ini TEF_CentralRepository\BUR.ini -data=DATAZ_\TEF_CentralRepository\backup_registration.xml TEF_CentralRepository\backup_registration.xml +data=DATAZ_\tef_centralrepository\te_centrep_BURSuite.script TEF_CentralRepository\te_centrep_BURSuite.Script +data=DATAZ_\tef_centralrepository\bur.ini TEF_CentralRepository\BUR.ini +data=DATAZ_\tef_centralrepository\backup_registration.xml TEF_CentralRepository\backup_registration.xml #ifndef __CENTREPTESTDATA_IBY__ -data=DATAZ_\PRIVATE\10202BE9\BACBACBA.txt PRIVATE\10202BE9\BACBACBA.txt -data=DATAZ_\PRIVATE\10202BE9\BAC2BAC2.txt PRIVATE\10202BE9\BAC2BAC2.txt -data=DATAZ_\PRIVATE\10202BE9\BAEBAEBA.txt PRIVATE\10202BE9\BAEBAEBA.txt +data=DATAZ_\private\10202be9\bacbacba.txt PRIVATE\10202BE9\BACBACBA.txt +data=DATAZ_\private\10202be9\bac2bac2.txt PRIVATE\10202BE9\BAC2BAC2.txt +data=DATAZ_\private\10202be9\baebaeba.txt PRIVATE\10202BE9\BAEBAEBA.txt #ifdef PDS_TEST_MULTIROFS -data=DATAZ_\PRIVATE\10202BE9\BACBACBA.txt PRIVATE\10202BE9\BACBACBA.txt[01-00] -data=DATAZ_\PRIVATE\10202BE9\BAC2BAC2.txt PRIVATE\10202BE9\BAC2BAC2.txt[01-00] -data=DATAZ_\PRIVATE\10202BE9\BAEBAEBA.txt PRIVATE\10202BE9\BAEBAEBA.txt[01-00] +data=DATAZ_\private\10202be9\bacbacba.txt PRIVATE\10202BE9\BACBACBA.txt[01-00] +data=DATAZ_\private\10202be9\bac2bac2.txt PRIVATE\10202BE9\BAC2BAC2.txt[01-00] +data=DATAZ_\private\10202be9\baebaeba.txt PRIVATE\10202BE9\BAEBAEBA.txt[01-00] #endif #endif // __CENTREPTESTDATA_IBY__ #endif // __TE_CENTREP_BUR_SUITE_IBY__ diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/test/testexecute/SWI/group/bld.inf --- a/persistentstorage/centralrepository/test/testexecute/SWI/group/bld.inf Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/centralrepository/test/testexecute/SWI/group/bld.inf Mon Sep 27 11:59:56 2010 +0100 @@ -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" @@ -16,12 +16,14 @@ // To create test app and related files for SWI-BUR tests #include "../data/testapp/bld.inf" -PRJ_EXPORTS - -PRJ_MMPFILES PRJ_TESTEXPORTS -//CentralRepository TestExecute Main scripts +// Test Extension Makefiles +centrep_copyincentrepsrv.mk /epoc32/tools/makefile_templates/syslibs/test/centrep_copyincentrepsrv.mk +centrep_copyincentrepsrv.meta /epoc32/tools/makefile_templates/syslibs/test/centrep_copyincentrepsrv.meta +centrep_copydatfile.mk /epoc32/tools/makefile_templates/syslibs/test/centrep_copydatfile.mk +centrep_copydatfile.meta /epoc32/tools/makefile_templates/syslibs/test/centrep_copydatfile.meta + //CentralRepository TestExecute Sub scripts ../scripts/te_centrep_SWIsuite.script z:/tef_centralrepository/te_centrep_swisuite.script diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/test/testexecute/SWI/group/centrep_copydatfile.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/centralrepository/test/testexecute/SWI/group/centrep_copydatfile.meta Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,19 @@ +# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Meta information for centrep_copydatfile use +# + +platform win32 +makefile gnumake +techstream syslibs diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/test/testexecute/SWI/group/centrep_copydatfile.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/centralrepository/test/testexecute/SWI/group/centrep_copydatfile.mk Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,70 @@ +# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TMPROOT:=$(subst \,/,$(EPOCROOT)) +EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/ + +include $(EPOCROOT)epoc32/tools/shell/$(notdir $(basename $(SHELL))).mk + +ifeq ($(findstring WINS,$(PLATFORM)),WINS) + EPOCDATADIR=$(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH) +else + EPOCDATADIR=$(EPOCROOT)epoc32/data +endif + +TARGETDIR = $(EPOCDATADIR)/z/resource +SOURCEDIR = $(EXTENSION_ROOT)/../data/certstore + +FILE = swicertstore.dat + +$(TARGETDIR) : + $(call createdir, "$@") + +COPYFILES : $(FILE) + + $(call forcecopy,$(SOURCEDIR)/$^,$(TARGETDIR)/$^) + +$(FILE) : + +DO_NOTHING: + @echo do nothing + +# +# The targets invoked by bld... +# + +BLD : $(TARGETDIR) COPYFILES + +CLEAN : + $(call forceremove,$(TARGETDIR)/swicertstore.dat) + +RELEASABLES : + @echo $(TARGETDIR)/swicertstore.dat + +MAKMAKE : DO_NOTHING + +SAVESPACE : DO_NOTHING + +LIB : DO_NOTHING + +CLEANLIB : DO_NOTHING + +FREEZE : DO_NOTHING + +RESOURCE : DO_NOTHING + +FINAL : DO_NOTHING + +ROMFILE : DO_NOTHING diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/test/testexecute/SWI/group/centrep_copyincentrepsrv.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/centralrepository/test/testexecute/SWI/group/centrep_copyincentrepsrv.meta Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,19 @@ +# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Meta information for centrep_copyincentrepsrv use +# + +platform win32 +makefile gnumake +techstream syslibs diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/test/testexecute/SWI/group/centrep_copyincentrepsrv.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/centralrepository/test/testexecute/SWI/group/centrep_copyincentrepsrv.mk Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,74 @@ +# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TMPROOT:=$(subst \,/,$(EPOCROOT)) +EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/ + +include $(EPOCROOT)epoc32/tools/shell/$(notdir $(basename $(SHELL))).mk + +ifeq ($(findstring WINS,$(PLATFORM)),WINS) +CENTREPSRVSRCDIR = $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH) +CENTREPSRVTGTDIR = $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/z/sys/bin + +FILE = centralrepositorysrv.exe + +$(CENTREPSRVTGTDIR) : + $(call createdir, "$(CENTREPSRVTGTDIR)") + +COPYFILE : $(FILE) + $(call forcecopy,$(CENTREPSRVSRCDIR)/$^,$(CENTREPSRVTGTDIR)) + +$(FILE): +endif + +DO_NOTHING : + @echo do nothing + +# +# The targets invoked by bld... +# + +ifeq ($(findstring WINS,$(PLATFORM)),WINS) +BLD : $(CENTREPSRVTGTDIR) $(CENTREPSRVSRCDIR) COPYFILE + +CLEAN : $(FILE) + $(call forceremove,$(CENTREPSRVTGTDIR)/$^) + +RELEASABLES : $(FILE) + @echo $(CENTREPSRVTGTDIR)/$^ + +else +BLD : DO_NOTHING + +CLEAN : DO_NOTHING + +RELEASABLES : DO_NOTHING +endif + +MAKMAKE : DO_NOTHING + +SAVESPACE : DO_NOTHING + +LIB : DO_NOTHING + +CLEANLIB : DO_NOTHING + +FREEZE : DO_NOTHING + +RESOURCE : DO_NOTHING + +FINAL : DO_NOTHING + +ROMFILE : DO_NOTHING diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/test/testexecute/SWI/group/swicertstoredat.iby --- a/persistentstorage/centralrepository/test/testexecute/SWI/group/swicertstoredat.iby Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/centralrepository/test/testexecute/SWI/group/swicertstoredat.iby Mon Sep 27 11:59:56 2010 +0100 @@ -20,7 +20,7 @@ #define __SWICERTSTORE_DAT_IBY__ //CertStore -data=EPOCROOT##Epoc32\data\z\Resource\swicertstore.dat Resource\swicertstore.dat +data=EPOCROOT##epoc32\data\z\resource\swicertstore.dat Resource\swicertstore.dat #endif //__SWICERTSTORE_DAT_IBY__ diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/test/testexecute/SWI/group/te_centrep_SWIsuite.iby --- a/persistentstorage/centralrepository/test/testexecute/SWI/group/te_centrep_SWIsuite.iby Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/centralrepository/test/testexecute/SWI/group/te_centrep_SWIsuite.iby Mon Sep 27 11:59:56 2010 +0100 @@ -26,89 +26,89 @@ #include -file=ABI_DIR\BUILD_DIR\te_centrep_SWISuite.exe System\bin\te_centrep_SWISuite.exe +file=ABI_DIR\BUILD_DIR\te_centrep_swisuite.exe System\bin\te_centrep_SWISuite.exe file=ABI_DIR\BUILD_DIR\t_deletedirallfiles.exe System\bin\t_deletedirallfiles.exe file=ABI_DIR\BUILD_DIR\t_deletefileallfiles.exe System\bin\t_deletefileallfiles.exe file=ABI_DIR\BUILD_DIR\t_killprocess.exe System\bin\t_killprocess.exe -data=DATAZ_\PRIVATE\10202BE9\51551552.cre PRIVATE\10202BE9\51551552.cre -data=DATAZ_\PRIVATE\10202BE9\51551554.cre PRIVATE\10202BE9\51551554.cre -data=DATAZ_\PRIVATE\10202BE9\5155155F.cre PRIVATE\10202BE9\5155155F.cre -data=DATAZ_\PRIVATE\10202BE9\51551652.cre PRIVATE\10202BE9\51551652.cre +data=DATAZ_\private\10202be9\51551552.cre PRIVATE\10202BE9\51551552.cre +data=DATAZ_\private\10202be9\51551554.cre PRIVATE\10202BE9\51551554.cre +data=DATAZ_\private\10202be9\5155155f.cre PRIVATE\10202BE9\5155155F.cre +data=DATAZ_\private\10202be9\51551652.cre PRIVATE\10202BE9\51551652.cre #ifdef PDS_TEST_MULTIROFS -data=DATAZ_\PRIVATE\10202BE9\51551552.cre PRIVATE\10202BE9\51551552.cre[01-00] -data=DATAZ_\PRIVATE\10202BE9\51551554.cre PRIVATE\10202BE9\51551554.cre[01-00] -data=DATAZ_\PRIVATE\10202BE9\5155155F.cre PRIVATE\10202BE9\5155155F.cre[01-00] -data=DATAZ_\PRIVATE\10202BE9\51551652.cre PRIVATE\10202BE9\51551652.cre[01-00] +data=DATAZ_\private\10202be9\51551552.cre PRIVATE\10202BE9\51551552.cre[01-00] +data=DATAZ_\private\10202be9\51551554.cre PRIVATE\10202BE9\51551554.cre[01-00] +data=DATAZ_\private\10202be9\5155155F.cre PRIVATE\10202BE9\5155155F.cre[01-00] +data=DATAZ_\private\10202be9\51551652.cre PRIVATE\10202BE9\51551652.cre[01-00] #endif -data=DATAZ_\TEF_CentralRepository\te_centrep_SWISuite.script TEF_CentralRepository\te_centrep_SWISuite.script -data=DATAZ_\TEF_CentralRepository\te_centrep_swisuite_sp_upgrade.script TEF_CentralRepository\te_centrep_swisuite_sp_upgrade.Script -data=DATAZ_\TEF_CentralRepository\te_centrep_SWISuite_pu_upgrade.script TEF_CentralRepository\te_centrep_swisuite_pu_upgrade.Script -data=DATAZ_\TEF_CentralRepository\te_centrep_SWISuite-pu-metadata.script TEF_CentralRepository\te_centrep_SWISuite-pu-metadata.Script -data=DATAZ_\TEF_CentralRepository\te_centrep_SWISuite-sp-metadata.script TEF_CentralRepository\te_centrep_SWISuite-sp-metadata.Script -data=DATAZ_\TEF_CentralRepository\te_centrep_SWISuite-PUnotify.script TEF_CentralRepository\te_centrep_SWISuite-PUnotify.Script -data=DATAZ_\TEF_CentralRepository\te_centrep_SWISuite-SPnotify.script TEF_CentralRepository\te_centrep_SWISuite-SPnotify.Script -data=DATAZ_\TEF_CentralRepository\te_centrep_swisuite_pu_cap.script TEF_CentralRepository\te_centrep_swisuite_pu_cap.Script -data=DATAZ_\TEF_CentralRepository\te_centrep_swisuite_sp_cap.script TEF_CentralRepository\te_centrep_swisuite_sp_cap.Script -data=DATAZ_\TEF_CentralRepository\te_centrep_SWI_BUR.script TEF_CentralRepository\te_centrep_SWI_BUR.script -data=DATAZ_\TEF_CentralRepository\te_centrep_SWIdefect.script TEF_CentralRepository\te_centrep_SWIdefect.script -data=DATAZ_\TEF_CentralRepository\te_centrep_swisuite-app-sp.script TEF_CentralRepository\te_centrep_swisuite-app-sp.Script +data=DATAZ_\tef_centralrepository\te_centrep_swisuite.script TEF_CentralRepository\te_centrep_SWISuite.script +data=DATAZ_\tef_centralrepository\te_centrep_swisuite_sp_upgrade.script TEF_CentralRepository\te_centrep_swisuite_sp_upgrade.Script +data=DATAZ_\tef_centralrepository\te_centrep_swisuite_pu_upgrade.script TEF_CentralRepository\te_centrep_swisuite_pu_upgrade.Script +data=DATAZ_\tef_centralrepository\te_centrep_swisuite-pu-metadata.script TEF_CentralRepository\te_centrep_SWISuite-pu-metadata.Script +data=DATAZ_\tef_centralrepository\te_centrep_swisuite-sp-metadata.script TEF_CentralRepository\te_centrep_SWISuite-sp-metadata.Script +data=DATAZ_\tef_centralrepository\te_centrep_swisuite-punotify.script TEF_CentralRepository\te_centrep_SWISuite-PUnotify.Script +data=DATAZ_\tef_centralrepository\te_centrep_swisuite-spnotify.script TEF_CentralRepository\te_centrep_SWISuite-SPnotify.Script +data=DATAZ_\tef_centralrepository\te_centrep_swisuite_pu_cap.script TEF_CentralRepository\te_centrep_swisuite_pu_cap.Script +data=DATAZ_\tef_centralrepository\te_centrep_swisuite_sp_cap.script TEF_CentralRepository\te_centrep_swisuite_sp_cap.Script +data=DATAZ_\tef_centralrepository\te_centrep_swi_bur.script TEF_CentralRepository\te_centrep_SWI_BUR.script +data=DATAZ_\tef_centralrepository\te_centrep_swidefect.script TEF_CentralRepository\te_centrep_SWIdefect.script +data=DATAZ_\tef_centralrepository\te_centrep_swisuite-app-sp.script TEF_CentralRepository\te_centrep_swisuite-app-sp.Script -data=DATAZ_\TEF_CentralRepository\SWI-PU-K1.ini TEF_CentralRepository\SWI-PU-K1.ini -data=DATAZ_\TEF_CentralRepository\SWI-PU-K2.ini TEF_CentralRepository\SWI-PU-K2.ini -data=DATAZ_\TEF_CentralRepository\SWI-PU-K3.ini TEF_CentralRepository\SWI-PU-K3.ini -data=DATAZ_\TEF_CentralRepository\SWI-PU-notify.ini TEF_CentralRepository\SWI-PU-notify.ini -data=DATAZ_\TEF_CentralRepository\SWI-SP-notify.ini TEF_CentralRepository\SWI-SP-notify.ini -data=DATAZ_\TEF_CentralRepository\SWI-SP-K1.ini TEF_CentralRepository\SWI-SP-K1.ini -data=DATAZ_\TEF_CentralRepository\SWI-SP-K2.ini TEF_CentralRepository\SWI-SP-K2.ini -data=DATAZ_\TEF_CentralRepository\SWI-SP-K3.ini TEF_CentralRepository\SWI-SP-K3.ini -data=DATAZ_\TEF_CentralRepository\SWI-SP-K6.ini TEF_CentralRepository\SWI-SP-K6.ini -data=DATAZ_\TEF_CentralRepository\SWI-PU-CAP-K4.ini TEF_CentralRepository\SWI-PU-CAP-K4.ini -data=DATAZ_\TEF_CentralRepository\SWI-SP-CAP-K4.ini TEF_CentralRepository\SWI-SP-CAP-K4.ini -data=DATAZ_\TEF_CentralRepository\SWI-CAP-K5.ini TEF_CentralRepository\SWI-CAP-K5.ini -data=DATAZ_\TEF_CentralRepository\SWI-PU-K6.ini TEF_CentralRepository\SWI-PU-K6.ini -data=DATAZ_\TEF_CentralRepository\SWI-BUR-KSX.ini TEF_CentralRepository\SWI-BUR-KSX.ini -data=DATAZ_\TEF_CentralRepository\SWI-KSD.ini TEF_CentralRepository\SWI-KSD.ini -data=DATAZ_\TEF_CentralRepository\SWI-APP-SP.ini TEF_CentralRepository\SWI-APP-SP.ini +data=DATAZ_\tef_centralrepository\swi-pu-k1.ini TEF_CentralRepository\SWI-PU-K1.ini +data=DATAZ_\tef_centralrepository\swi-pu-k2.ini TEF_CentralRepository\SWI-PU-K2.ini +data=DATAZ_\tef_centralrepository\swi-pu-k3.ini TEF_CentralRepository\SWI-PU-K3.ini +data=DATAZ_\tef_centralrepository\swi-pu-notify.ini TEF_CentralRepository\SWI-PU-notify.ini +data=DATAZ_\tef_centralrepository\swi-sp-notify.ini TEF_CentralRepository\SWI-SP-notify.ini +data=DATAZ_\tef_centralrepository\swi-sp-K1.ini TEF_CentralRepository\SWI-SP-K1.ini +data=DATAZ_\tef_centralrepository\swi-sp-K2.ini TEF_CentralRepository\SWI-SP-K2.ini +data=DATAZ_\tef_centralrepository\swi-sp-K3.ini TEF_CentralRepository\SWI-SP-K3.ini +data=DATAZ_\tef_centralrepository\swi-sp-K6.ini TEF_CentralRepository\SWI-SP-K6.ini +data=DATAZ_\tef_centralrepository\swi-pu-CAP-K4.ini TEF_CentralRepository\SWI-PU-CAP-K4.ini +data=DATAZ_\tef_centralrepository\swi-sp-CAP-K4.ini TEF_CentralRepository\SWI-SP-CAP-K4.ini +data=DATAZ_\tef_centralrepository\swi-cap-k5.ini TEF_CentralRepository\SWI-CAP-K5.ini +data=DATAZ_\tef_centralrepository\swi-pu-k6.ini TEF_CentralRepository\SWI-PU-K6.ini +data=DATAZ_\tef_centralrepository\swi-bur-ksx.ini TEF_CentralRepository\SWI-BUR-KSX.ini +data=DATAZ_\tef_centralrepository\swi-ksd.ini TEF_CentralRepository\SWI-KSD.ini +data=DATAZ_\tef_centralrepository\swi-app-sp.ini TEF_CentralRepository\SWI-APP-SP.ini -data=DATAZ_\TEF_CentralRepository\KP12s.sis TEF_CentralRepository\KP12s.sis -data=DATAZ_\TEF_CentralRepository\KP14s.sis TEF_CentralRepository\KP14s.sis -data=DATAZ_\TEF_CentralRepository\KPS14s.sis TEF_CentralRepository\KPS14s.sis -data=DATAZ_\TEF_CentralRepository\KP2s.sis TEF_CentralRepository\KP2s.sis -data=DATAZ_\TEF_CentralRepository\KP22s.sis TEF_CentralRepository\KP22s.sis -data=DATAZ_\TEF_CentralRepository\KP23s.sis TEF_CentralRepository\KP23s.sis -data=DATAZ_\TEF_CentralRepository\KP3s.sis TEF_CentralRepository\KP3s.sis -data=DATAZ_\TEF_CentralRepository\KP4s.sis TEF_CentralRepository\KP4s.sis -data=DATAZ_\TEF_CentralRepository\KP41s.sis TEF_CentralRepository\KP41s.sis -data=DATAZ_\TEF_CentralRepository\KPS4s.sis TEF_CentralRepository\KPS4s.sis -data=DATAZ_\TEF_CentralRepository\KP62s.sis TEF_CentralRepository\KP62s.sis -data=DATAZ_\TEF_CentralRepository\KPS64s.sis TEF_CentralRepository\KPS64s.sis +data=DATAZ_\tef_centralrepository\kp12s.sis TEF_CentralRepository\KP12s.sis +data=DATAZ_\tef_centralrepository\kp14s.sis TEF_CentralRepository\KP14s.sis +data=DATAZ_\tef_centralrepository\kps14s.sis TEF_CentralRepository\KPS14s.sis +data=DATAZ_\tef_centralrepository\kp2s.sis TEF_CentralRepository\KP2s.sis +data=DATAZ_\tef_centralrepository\kp22s.sis TEF_CentralRepository\KP22s.sis +data=DATAZ_\tef_centralrepository\kp23s.sis TEF_CentralRepository\KP23s.sis +data=DATAZ_\tef_centralrepository\kp3s.sis TEF_CentralRepository\KP3s.sis +data=DATAZ_\tef_centralrepository\kp4s.sis TEF_CentralRepository\KP4s.sis +data=DATAZ_\tef_centralrepository\kp41s.sis TEF_CentralRepository\KP41s.sis +data=DATAZ_\tef_centralrepository\kpS4s.sis TEF_CentralRepository\KPS4s.sis +data=DATAZ_\tef_centralrepository\kp62s.sis TEF_CentralRepository\KP62s.sis +data=DATAZ_\tef_centralrepository\kpS64s.sis TEF_CentralRepository\KPS64s.sis -data=DATAZ_\TEF_CentralRepository\KS12s.sis TEF_CentralRepository\KS12s.sis -data=DATAZ_\TEF_CentralRepository\KS14s.sis TEF_CentralRepository\KS14s.sis -data=DATAZ_\TEF_CentralRepository\KS2s.sis TEF_CentralRepository\KS2s.sis -data=DATAZ_\TEF_CentralRepository\KS22s.sis TEF_CentralRepository\KS22s.sis -data=DATAZ_\TEF_CentralRepository\KS3s.sis TEF_CentralRepository\KS3s.sis -data=DATAZ_\TEF_CentralRepository\KS4s.sis TEF_CentralRepository\KS4s.sis -data=DATAZ_\TEF_CentralRepository\KS41s.sis TEF_CentralRepository\KS41s.sis -data=DATAZ_\TEF_CentralRepository\KS51s.sis TEF_CentralRepository\KS51s.sis -data=DATAZ_\TEF_CentralRepository\KS62s.sis TEF_CentralRepository\KS62s.sis -data=DATAZ_\TEF_CentralRepository\APPXs.sis TEF_CentralRepository\APPXs.sis -data=DATAZ_\TEF_CentralRepository\KSDs.sis TEF_CentralRepository\KSDs.sis +data=DATAZ_\tef_centralrepository\ks12s.sis TEF_CentralRepository\KS12s.sis +data=DATAZ_\tef_centralrepository\ks14s.sis TEF_CentralRepository\KS14s.sis +data=DATAZ_\tef_centralrepository\ks2s.sis TEF_CentralRepository\KS2s.sis +data=DATAZ_\tef_centralrepository\ks22s.sis TEF_CentralRepository\KS22s.sis +data=DATAZ_\tef_centralrepository\ks3s.sis TEF_CentralRepository\KS3s.sis +data=DATAZ_\tef_centralrepository\ks4s.sis TEF_CentralRepository\KS4s.sis +data=DATAZ_\tef_centralrepository\ks41s.sis TEF_CentralRepository\KS41s.sis +data=DATAZ_\tef_centralrepository\ks51s.sis TEF_CentralRepository\KS51s.sis +data=DATAZ_\tef_centralrepository\ks62s.sis TEF_CentralRepository\KS62s.sis +data=DATAZ_\tef_centralrepository\appxs.sis TEF_CentralRepository\APPXs.sis +data=DATAZ_\tef_centralrepository\ksds.sis TEF_CentralRepository\KSDs.sis -data=DATAZ_\TEF_CentralRepository\APPYs.sis TEF_CentralRepository\APPYs.sis -data=DATAZ_\TEF_CentralRepository\KSYs.sis TEF_CentralRepository\KSYs.sis +data=DATAZ_\tef_centralrepository\appys.sis TEF_CentralRepository\APPYs.sis +data=DATAZ_\tef_centralrepository\ksys.sis TEF_CentralRepository\KSYs.sis -data=DATAZ_\TEF_CentralRepository\APPY1s.sis TEF_CentralRepository\APPY1s.sis -data=DATAZ_\TEF_CentralRepository\KSY1s.sis TEF_CentralRepository\KSY1s.sis +data=DATAZ_\tef_centralrepository\appy1s.sis TEF_CentralRepository\APPY1s.sis +data=DATAZ_\tef_centralrepository\ksy1s.sis TEF_CentralRepository\KSY1s.sis -data=DATAZ_\TEF_CentralRepository\APPY2s.sis TEF_CentralRepository\APPY2s.sis -data=DATAZ_\TEF_CentralRepository\KSY2s.sis TEF_CentralRepository\KSY2s.sis +data=DATAZ_\tef_centralrepository\appy2s.sis TEF_CentralRepository\APPY2s.sis +data=DATAZ_\tef_centralrepository\ksy2s.sis TEF_CentralRepository\KSY2s.sis diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/centralrepository/test/testexecute/group/TEF_CentralRepository.iby --- a/persistentstorage/centralrepository/test/testexecute/group/TEF_CentralRepository.iby Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/centralrepository/test/testexecute/group/TEF_CentralRepository.iby Mon Sep 27 11:59:56 2010 +0100 @@ -24,8 +24,8 @@ // Note also that all these tests are techview tests. #ifdef CENTREP_MW_TESTS - #include - #include + #include + #include #endif // CENTREP_MW_TESTS #endif // __TEF_CentralRepository_IBY__ diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/dbms/group/DBMSTests.iby --- a/persistentstorage/dbms/group/DBMSTests.iby Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/dbms/group/DBMSTests.iby Mon Sep 27 11:59:56 2010 +0100 @@ -42,44 +42,44 @@ data=ZPRIVATE\100012a5\dbs_11335578_b.db \private\100012a5\dbs_11335578_b.dB data=ZPRIVATE\100012a5\dbs_11335578_z.db \private\100012a5\dbs_11335578_z.db data=ZPRIVATE\100012a5\dbs_11335579_testdb.db \private\100012a5\dbs_11335579_testdb.db -data=ZPRIVATE\100012a5\dbs_12344321_1234567890123456789012345678901234567890123456789012345678901234567890.DB \PRIVATE\100012A5\dbs_12344321_1234567890123456789012345678901234567890123456789012345678901234567890.db +data=ZPRIVATE\100012a5\dbs_12344321_1234567890123456789012345678901234567890123456789012345678901234567890.db \PRIVATE\100012A5\dbs_12344321_1234567890123456789012345678901234567890123456789012345678901234567890.db data=ZPRIVATE\100012a5\dbs_1133557a_zzz.db \private\100012a5\dbs_1133557a_zzz.db -file=ABI_DIR\BUILD_DIR\T_DBENVCREATE.EXE \test\t_dbenvcreate.exe -file=ABI_DIR\BUILD_DIR\T_DBALTER.EXE \test\t_dbalter.exe -file=ABI_DIR\BUILD_DIR\T_DBBENCH.EXE \test\t_dbbench.exe -file=ABI_DIR\BUILD_DIR\T_DBBIG.EXE \test\t_dbbig.exe -file=ABI_DIR\BUILD_DIR\T_DBBUG.EXE \test\t_dbbug.exe -file=ABI_DIR\BUILD_DIR\T_DBCLIENT.EXE \test\t_dbclient.exe -file=ABI_DIR\BUILD_DIR\T_DBCOMP.EXE \test\t_dbcomp.exe -file=ABI_DIR\BUILD_DIR\T_DBAPI.EXE \test\t_dbapi.exe -file=ABI_DIR\BUILD_DIR\T_DBSRV.EXE \test\t_dbsrv.exe -file=ABI_DIR\BUILD_DIR\T_DBFAIL.EXE \test\t_dbfail.exe -file=ABI_DIR\BUILD_DIR\T_DBINDEX.EXE \test\t_dbindex.exe -file=ABI_DIR\BUILD_DIR\T_DBLIMIT.EXE \test\t_dblimit.exe -file=ABI_DIR\BUILD_DIR\T_DBSCRIPT.EXE \test\t_dbscript.exe -file=ABI_DIR\BUILD_DIR\T_DBSQL.EXE \test\t_dbsql.exe -file=ABI_DIR\BUILD_DIR\T_DBSTRESS.EXE \test\t_dbstress.exe -file=ABI_DIR\BUILD_DIR\T_DBTRANS.EXE \test\t_dbtrans.exe -file=ABI_DIR\BUILD_DIR\T_DBWINDOW.EXE \test\t_dbwindow.exe -file=ABI_DIR\BUILD_DIR\T_DBPANIC.EXE \test\t_dbpanic.exe -file=ABI_DIR\BUILD_DIR\T_DBDEFECT.EXE \test\t_dbdefect.exe -file=ABI_DIR\BUILD_DIR\T_DBLONGCOL.EXE \test\t_dblongcol.exe -file=ABI_DIR\BUILD_DIR\T_DBPLATSEC.EXE \test\t_dbplatsec.exe -file=ABI_DIR\BUILD_DIR\T_DBPLATSEC1.EXE \test\t_dbplatsec1.exe -file=ABI_DIR\BUILD_DIR\T_DBPLATSEC2.EXE \test\t_dbplatsec2.exe -file=ABI_DIR\BUILD_DIR\T_DBPLATSEC3.EXE \test\t_dbplatsec3.exe -file=ABI_DIR\BUILD_DIR\T_DBPLATSEC4.EXE \test\t_dbplatsec4.exe -file=ABI_DIR\BUILD_DIR\T_DBPLATSEC5.EXE \test\t_dbplatsec5.exe -file=ABI_DIR\BUILD_DIR\T_DBNEWCAP1.EXE \test\t_dbnewcap1.exe -file=ABI_DIR\BUILD_DIR\T_DBPLATSECPERF.EXE \test\t_dbplatsecperf.eXE -file=ABI_DIR\BUILD_DIR\T_DBBACKUPSID.EXE \test\t_dbbackupsid.exe -file=ABI_DIR\BUILD_DIR\T_DBOOD.EXE \test\t_dbood.exe -file=ABI_DIR\BUILD_DIR\T_DBSTRCMP.EXE \test\t_dbstrcmp.exe -file=ABI_DIR\BUILD_DIR\T_DBPERF1.EXE \test\t_dbperf1.exe -file=ABI_DIR\BUILD_DIR\T_DBPERF2.EXE \test\t_dbperf2.exe -file=ABI_DIR\BUILD_DIR\T_DBPERF3.EXE \test\t_dbperf3.exe -file=ABI_DIR\BUILD_DIR\T_DBENVDESTROY.EXE \test\t_dbenvdestroy.exE +file=ABI_DIR\BUILD_DIR\t_dbenvcreate.exe \test\t_dbenvcreate.exe +file=ABI_DIR\BUILD_DIR\t_dbalter.exe \test\t_dbalter.exe +file=ABI_DIR\BUILD_DIR\t_dbbench.exe \test\t_dbbench.exe +file=ABI_DIR\BUILD_DIR\t_dbbig.exe \test\t_dbbig.exe +file=ABI_DIR\BUILD_DIR\t_dbbug.exe \test\t_dbbug.exe +file=ABI_DIR\BUILD_DIR\t_dbclient.exe \test\t_dbclient.exe +file=ABI_DIR\BUILD_DIR\t_dbcomp.exe \test\t_dbcomp.exe +file=ABI_DIR\BUILD_DIR\t_dbapi.exe \test\t_dbapi.exe +file=ABI_DIR\BUILD_DIR\t_dbsrv.exe \test\t_dbsrv.exe +file=ABI_DIR\BUILD_DIR\t_dbfail.exe \test\t_dbfail.exe +file=ABI_DIR\BUILD_DIR\t_dbindex.exe \test\t_dbindex.exe +file=ABI_DIR\BUILD_DIR\t_dblimit.exe \test\t_dblimit.exe +file=ABI_DIR\BUILD_DIR\t_dbscript.exe \test\t_dbscript.exe +file=ABI_DIR\BUILD_DIR\t_dbsql.exe \test\t_dbsql.exe +file=ABI_DIR\BUILD_DIR\t_dbstress.exe \test\t_dbstress.exe +file=ABI_DIR\BUILD_DIR\t_dbtrans.exe \test\t_dbtrans.exe +file=ABI_DIR\BUILD_DIR\t_dbwindow.exe \test\t_dbwindow.exe +file=ABI_DIR\BUILD_DIR\t_dbpanic.exe \test\t_dbpanic.exe +file=ABI_DIR\BUILD_DIR\t_dbdefect.exe \test\t_dbdefect.exe +file=ABI_DIR\BUILD_DIR\t_dblongcol.exe \test\t_dblongcol.exe +file=ABI_DIR\BUILD_DIR\t_dbplatsec.exe \test\t_dbplatsec.exe +file=ABI_DIR\BUILD_DIR\t_dbplatsec1.exe \test\t_dbplatsec1.exe +file=ABI_DIR\BUILD_DIR\t_dbplatsec2.exe \test\t_dbplatsec2.exe +file=ABI_DIR\BUILD_DIR\t_dbplatsec3.exe \test\t_dbplatsec3.exe +file=ABI_DIR\BUILD_DIR\t_dbplatsec4.exe \test\t_dbplatsec4.exe +file=ABI_DIR\BUILD_DIR\t_dbplatsec5.exe \test\t_dbplatsec5.exe +file=ABI_DIR\BUILD_DIR\t_dbnewcap1.exe \test\t_dbnewcap1.exe +file=ABI_DIR\BUILD_DIR\t_dbplatsecperf.exe \test\t_dbplatsecperf.exe +file=ABI_DIR\BUILD_DIR\t_dbbackupsid.exe \test\t_dbbackupsid.exe +file=ABI_DIR\BUILD_DIR\t_dbood.exe \test\t_dbood.exe +file=ABI_DIR\BUILD_DIR\t_dbstrcmp.exe \test\t_dbstrcmp.exe +file=ABI_DIR\BUILD_DIR\t_dbperf1.exe \test\t_dbperf1.exe +file=ABI_DIR\BUILD_DIR\t_dbperf2.exe \test\t_dbperf2.exe +file=ABI_DIR\BUILD_DIR\t_dbperf3.exe \test\t_dbperf3.exe +file=ABI_DIR\BUILD_DIR\t_dbenvdestroy.exe \test\t_dbenvdestroy.exe #endif diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/dbms/tdbms/t_dbenvcreate.cpp --- a/persistentstorage/dbms/tdbms/t_dbenvcreate.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/dbms/tdbms/t_dbenvcreate.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -23,6 +23,7 @@ static RDbs TheDbs; const TUid KSecureDbUid = {0x11335578}; const TUid KSecureDbUid2 = {0x11335579}; +const TUid KSecureDbUid3 = {0x1133557A}; _LIT(KProtDbZName, "z:z.db"); _LIT(KProtDbCName, "C:z.Db"); _LIT(KProtDbZName2, "z:TEstDB.dB"); @@ -71,21 +72,28 @@ static void DoRun() { TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0023 Copy protected databases from Z: to C: ")); + TheDbs.DeleteDatabase(KProtDbCName, KSecureDbUid); TInt err = TheDbs.CopyDatabase(KProtDbZName, KProtDbCName, KSecureDbUid); + TheTest.Printf(_L("copy file file from z:z.db to C:z.Db uid = 0x11335578 err = %d"),err); TEST2(err, KErrNone); + TheDbs.DeleteDatabase(KProtDbCName2, KSecureDbUid2); err = TheDbs.CopyDatabase(KProtDbZName2, KProtDbCName2, KSecureDbUid2); + TheTest.Printf(_L("copy file file from z:TEstDB.dB to c:teSTDB.db uid = 0x11335579 err = %d"),err); TEST2(err, KErrNone); + TheDbs.DeleteDatabase(KProtDbCName3, KSecureDbUid3); TheTest.Next(_L("Create protected database on C:")); RDbNamedDatabase db; err = db.Create(TheDbs, KProtDbCName3, KProtDbFormat3); TEST2(err, KErrNone); db.Close(); + TheDbs.DeleteDatabase(KProtDbCName4, KSecureDbUid3); err = db.Create(TheDbs, KProtDbCName4, KProtDbFormat3); TEST2(err, KErrNone); db.Close(); + TheDbs.DeleteDatabase(KProtDbCName5, KSecureDbUid3); err = db.Create(TheDbs, KProtDbCName5, KProtDbFormat3); TEST2(err, KErrNone); db.Close(); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/dbms/tdbms/t_dbsql.cpp --- a/persistentstorage/dbms/tdbms/t_dbsql.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/dbms/tdbms/t_dbsql.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -162,8 +162,8 @@ { protected: static void Create(const TText* aType); - static void Test(const TSelectTest* aTest,TInt aCount,TInt aRows); - static void TestViewL(const TSelectTest* aTest,TInt aCount,TInt aRows); + static void Test(const TSelectTest* aTest,TInt aCount,TInt aRows, TBool aLog); + static void TestViewL(const TSelectTest* aTest,TInt aCount,TInt aRows, TBool aLog=EFalse); }; // Create the table for the predicate tests @@ -179,54 +179,93 @@ } // Test the predicate on the table, then on the indexed table -void TestPredicateBase::Test(const TSelectTest* aTest,TInt aCount,TInt aRows) +void TestPredicateBase::Test(const TSelectTest* aTest,TInt aCount,TInt aRows, TBool aLog) { + if(aLog) + { + TheTest.Printf(_L("TestPredicateBase::Test\r\n")); + } TheTable.Close(); TInt r=TheDatabase.Commit(); + if(aLog) + { + TheTest.Printf(_L("Commit %d\r\n"), r); + } TEST2(r, KErrNone); - TRAPD(errCode, TestViewL(aTest,aCount,aRows)); + TRAPD(errCode, TestViewL(aTest,aCount,aRows, aLog)); + if(aLog) + { + TheTest.Printf(_L("TestViewL %d"), errCode); + } + TEST2(errCode, KErrNone); r=TheDatabase.Execute(_L("CREATE INDEX Key ON Compare (Test)")); + if(aLog) + { + TheTest.Printf(_L("Execute %d"), r); + } + TEST2(r, KErrNone); - TRAP(errCode,TestViewL(aTest,aCount,aRows)); + TRAP(errCode,TestViewL(aTest,aCount,aRows, aLog)); + if(aLog) + { + TheTest.Printf(_L("TestViewL %d"), errCode); + } + TEST2(errCode, KErrNone); r=TheDatabase.Execute(_L("DROP TABLE Compare")); + if(aLog) + { + TheTest.Printf(_L("Execute %d"), r); + } + TEST2(r, KErrNone); } // Test the predicate on the table -void TestPredicateBase::TestViewL(const TSelectTest* aTest,TInt aCount,TInt aRows) +void TestPredicateBase::TestViewL(const TSelectTest* aTest,TInt aCount,TInt aRows, TBool /*aLog*/) { TUint rowMask=(2u<=0;++aTest) { TheSql.Format(_L("SELECT Id FROM Compare WHERE Test %s"),aTest->iSearchCondition); TInt r=TheView.Prepare(TheDatabase,TheSql,TheView.EReadOnly); - - TBool ignoreRow0=TheView.Unevaluated(); + if(r!=KErrNone) + { + TheTest.Printf(_L("Prepare r= %d aCount= %d statement %S\r\n"), r, aCount, &TheSql); + } TEST2(r, KErrNone); + TBool ignoreRow0=TheView.Unevaluated(); r=TheView.EvaluateAll(); - TEST2(r, KErrNone); + TEST2(r, KErrNone); TUint rows=0; while (TheView.NextL()) { - TheView.GetL(); + TheView.GetL(); rows|=1u<iResultSet&rowMask&~ROW(0))); + { + TEST((rows&~ROW(0))==(aTest->iResultSet&rowMask&~ROW(0))); + } else - TEST(rows==(aTest->iResultSet&rowMask)); + { + TEST(rows==(aTest->iResultSet&rowMask)); + } TheView.Close(); } } typedef void (*FSetColL)(TDbColNo aCol,const TAny* aVal); -void WriteRowsL(const TAny* aValues,TInt aRows,TInt aSize,FSetColL aSetColL) +void WriteRowsL(const TAny* aValues,TInt aRows,TInt aSize,FSetColL aSetColL, TBool aLog) { for (TInt row=0;row<=aRows;++row) { + if(aLog) + { + TheTest.Printf(_L("row = %d"), row); + } TheTable.InsertL(); TEST(TheTable.ColUint(1)==TUint(row)); if (row>0) @@ -248,9 +287,9 @@ }; template -inline void WriteRowsL(const T* aValues,TUint aRows) +inline void WriteRowsL(const T* aValues,TUint aRows, TBool aLog) { - WriteRowsL(aValues,aRows,sizeof(T),&SetCol::SetColL); + WriteRowsL(aValues,aRows,sizeof(T),&SetCol::SetColL, aLog); } template @@ -265,8 +304,13 @@ void TestPredicate::RunL() { Create(T::KType); - WriteRowsL(T::KValues,elementsof(T::KValues)); - Test(T::KTests,elementsof(T::KTests),elementsof(T::KValues)); + TBool log = EFalse; + if((TPtrC(T::KType)).CompareF(_L("TIME"))==0) + { + log = ETrue; + } + WriteRowsL(T::KValues,elementsof(T::KValues), log); + Test(T::KTests,elementsof(T::KTests),elementsof(T::KValues),log); } struct TypeBit @@ -744,13 +788,15 @@ static void ReadDesc(TDes& aDes, const TDesC& aFilename, RFs& aFs) { - RDebug::Print(_L("---ReadDesc(), aFilename=%S\r\n"), &aFilename); + TheTest.Printf(_L("---ReadDesc(), aFilename=%S\r\n"), &aFilename); RFile file; TInt err = file.Open(aFs, aFilename, EFileRead); + TheTest.Printf(_L("Open file aFilename=%S err = %d\r\n"), &aFilename, err); TEST2(err, KErrNone); TPtr8 ptr(reinterpret_cast(const_cast(aDes.Ptr())), aDes.MaxSize()); err = file.Read(ptr); + TheTest.Printf(_L("Read file aFilename=%S err = %d\r\n"), &aFilename, err); TEST2(err, KErrNone); aDes.SetLength(ptr.Length() / sizeof(TText)); file.Close(); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/GROUP/bld.inf --- a/persistentstorage/sql/GROUP/bld.inf Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/GROUP/bld.inf Mon Sep 27 11:59:56 2010 +0100 @@ -119,6 +119,7 @@ t_sqlprivcage.mmp t_sqlbadclient.mmp t_sqlbur.mmp +t_sqlbur2.mmp t_sqlscalarfullselect.mmp t_sqlfserr.mmp t_sqlconfig.mmp diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/GROUP/sqltests.bat --- a/persistentstorage/sql/GROUP/sqltests.bat Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/GROUP/sqltests.bat Mon Sep 27 11:59:56 2010 +0100 @@ -50,6 +50,7 @@ t_sqlprivcage.exe t_sqlbadclient.exe t_sqlbur.exe +t_sqlbur2.exe t_sqlscalarfullselect.exe t_sqlfserr.exe t_sqlconfig.exe diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/GROUP/sqltests.iby --- a/persistentstorage/sql/GROUP/sqltests.iby Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/GROUP/sqltests.iby Mon Sep 27 11:59:56 2010 +0100 @@ -23,8 +23,7 @@ #include #include -data=DATAZ_\test\sqlTests.bat \test\sqltests.bat - +data=DATAZ_\test\sqltests.bat \test\sqltests.bat data=DATAZ_\test\contacts_schema_to_vendors.sql \test\contacts_schema_to_vendors.sql data=DATAZ_\test\add_simple_contacts.sql \test\add_simple_contacts.sql data=DATAZ_\test\contacts_startup_time.sql \test\contacts_startup_time.sql @@ -87,6 +86,7 @@ file=ABI_DIR\BUILD_DIR\t_sqlprivcage.exe \test\t_sqlprivcage.exe file=ABI_DIR\BUILD_DIR\t_sqlbadclient.exe \test\t_sqlbadclient.exe file=ABI_DIR\BUILD_DIR\t_sqlbur.exe \test\t_sqlbur.exe +file=ABI_DIR\BUILD_DIR\t_sqlbur2.exe \test\t_sqlbur2.exe file=ABI_DIR\BUILD_DIR\t_sqlscalarfullselect.exe \test\t_sqlscalarfullselect.exe file=ABI_DIR\BUILD_DIR\t_sqlfserr.exe \test\t_sqlfserr.exe file=ABI_DIR\BUILD_DIR\t_sqlconfig.exe \test\t_sqlconfig.exe diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/GROUP/t_sqlbur2.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/sql/GROUP/t_sqlbur2.mmp Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,51 @@ +// 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_sqlbur2.exe +TARGETTYPE EXE +CAPABILITY All -Tcb + +MACRO SQL_BUR_PROPERTY_MONITOR_TEST + +USERINCLUDE . +USERINCLUDE ../SRC/Server +USERINCLUDE ../SRC/Common +USERINCLUDE ../traces_SqlSrv +#ifdef SYMBIAN_USE_SQLITE_VERSION_3_6_4 +USERINCLUDE ../SQLite364 +#else +USERINCLUDE ../SQLite +#endif +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_ESTLIB_SYSTEMINCLUDE + +SOURCEPATH ../TEST +SOURCE t_sqlbur2.cpp t_dummyabclient.cpp + +SOURCEPATH ../SRC/Server +SOURCE SqlBur.cpp + +SOURCEPATH ../SRC/Common +SOURCE SqlUtil.cpp + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY estor.lib + +UID 0 0x10281e17 +VENDORID 0x70000001 + +SMPSAFE diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/GROUP/t_sqlcorrupt.mmp --- a/persistentstorage/sql/GROUP/t_sqlcorrupt.mmp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/GROUP/t_sqlcorrupt.mmp Mon Sep 27 11:59:56 2010 +0100 @@ -18,8 +18,14 @@ TARGETTYPE EXE CAPABILITY ProtServ AllFiles +//SQLITE warnings suppressed +OPTION ARMCC --diag_suppress 368 + USERINCLUDE . +USERINCLUDE ../OsLayer OS_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_ESTLIB_SYSTEMINCLUDE +USERINCLUDE ../SQLite SOURCEPATH ../TEST SOURCE t_sqlcorrupt.cpp @@ -29,6 +35,8 @@ LIBRARY sqldb.lib LIBRARY bafl.lib LIBRARY estor.lib +LIBRARY estlib.lib +STATICLIBRARY sqlite.lib UID 0 0x08770000 VENDORID 0x70000001 diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/GROUP/t_sqlload.mmp --- a/persistentstorage/sql/GROUP/t_sqlload.mmp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/GROUP/t_sqlload.mmp Mon Sep 27 11:59:56 2010 +0100 @@ -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" @@ -15,6 +15,7 @@ TARGET t_sqlload.exe TARGETTYPE EXE +UID 0 0x1AF1C1CC CAPABILITY None USERINCLUDE . diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/OsLayer/os_symbian.cpp --- a/persistentstorage/sql/OsLayer/os_symbian.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/OsLayer/os_symbian.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -971,22 +971,19 @@ { SQLITE_TRACE_OS(OstTrace0(TRACE_INTERNALS, COSLAYERDATA_CREATE_ENTRY, "OS-Entry;0;COsLayerData::Create")); __ASSERT_DEBUG(!COsLayerData::iOsLayerData, __SQLITEPANIC2(ESqliteOsPanicOsLayerDataExists)); + COsLayerData::iOsLayerData = new COsLayerData; if(!COsLayerData::iOsLayerData) { - COsLayerData::iOsLayerData = new COsLayerData; - if(!COsLayerData::iOsLayerData) - { - SQLITE_TRACE_OS(OstTrace0(TRACE_INTERNALS, COSLAYERDATA_CREATE_EXIT1, "OS-Exit;0;COsLayerData::Create;err=KErrNoMemory")); - return KErrNoMemory; - } - TInt err = COsLayerData::iOsLayerData->DoCreate(); - if(err != KErrNone) - { - delete COsLayerData::iOsLayerData; - COsLayerData::iOsLayerData = NULL; - SQLITE_TRACE_OS(OstTrace1(TRACE_INTERNALS, COSLAYERDATA_CREATE_EXIT2, "OS-Exit;0;COsLayerData::Create;err=%d", err)); - return err; - } + SQLITE_TRACE_OS(OstTrace0(TRACE_INTERNALS, COSLAYERDATA_CREATE_EXIT1, "OS-Exit;0;COsLayerData::Create;err=KErrNoMemory")); + return KErrNoMemory; + } + TInt err = COsLayerData::iOsLayerData->DoCreate(); + if(err != KErrNone) + { + delete COsLayerData::iOsLayerData; + COsLayerData::iOsLayerData = NULL; + SQLITE_TRACE_OS(OstTrace1(TRACE_INTERNALS, COSLAYERDATA_CREATE_EXIT2, "OS-Exit;0;COsLayerData::Create;err=%d", err)); + return err; } SQLITE_TRACE_OS(OstTrace0(TRACE_INTERNALS, COSLAYERDATA_CREATE_EXIT3, "OS-Exit;0;COsLayerData::Create;err=KErrNone")); return KErrNone; @@ -1983,11 +1980,7 @@ __OS_CALL(EOsFileSectorSize, 0, 0); __OSTIME_COUNTER(TheOsCallTicks[EOsFileSectorSize], ::OsCallProfile(dbFile.iIsJournal, EOsFileSectorSize), 0, 0, aDbFile, 0); __ASSERT_DEBUG(dbFile.iSectorSize > 0, __SQLITEPANIC2(ESqliteOsPanicInternalError)); - if(dbFile.iSectorSize > 0) - { - return dbFile.iSectorSize; - } - return SQLITE_DEFAULT_SECTOR_SIZE; + return dbFile.iSectorSize; } /** @@ -2013,11 +2006,7 @@ __OS_CALL(EOsFileDeviceCharacteristics, 0, 0); __OSTIME_COUNTER(TheOsCallTicks[EOsFileDeviceCharacteristics], ::OsCallProfile(dbFile.iIsJournal, EOsFileDeviceCharacteristics), 0, 0, aDbFile, 0); __ASSERT_DEBUG(dbFile.iDeviceCharacteristics >= 0, __SQLITEPANIC2(ESqliteOsPanicInternalError)); - if(dbFile.iDeviceCharacteristics >= 0) - { - return dbFile.iDeviceCharacteristics; - } - return 0; + return dbFile.iDeviceCharacteristics; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -2074,6 +2063,28 @@ return err; } +//Maps disk sector sizes to SQLITE_IOCAP_ATOMIC constants + +struct TSqliteSectorSizeMap + { + TInt iSectorSize; + TInt iSqliteSectorSizeConstant; + }; + +//Used in TVfs::DoGetDeviceCharacteristics() to find which SQLITE_IOCAP_ATOMIC constant should be used +//for the specified sector size +const TSqliteSectorSizeMap KSqliteSectorSizeMap[] = + { + { 512, SQLITE_IOCAP_ATOMIC512}, + { 1024, SQLITE_IOCAP_ATOMIC1K}, + { 2048, SQLITE_IOCAP_ATOMIC2K}, + { 4096, SQLITE_IOCAP_ATOMIC4K}, + { 8192, SQLITE_IOCAP_ATOMIC8K}, + {16384, SQLITE_IOCAP_ATOMIC16K}, + {32768, SQLITE_IOCAP_ATOMIC32K}, + {65536, SQLITE_IOCAP_ATOMIC64K} + }; + /** Retrieves and returns in a bit set the device characteristics. @@ -2097,35 +2108,13 @@ { deviceCharacteristics |= SQLITE_IOCAP_ATOMIC; } - switch(aVolumeInfo.iBlockSize) + for(TInt i=0;i<(sizeof(KSqliteSectorSizeMap)/sizeof(KSqliteSectorSizeMap[0]));++i) { - case 512: - deviceCharacteristics |= SQLITE_IOCAP_ATOMIC512; - break; - case 1024: - deviceCharacteristics |= SQLITE_IOCAP_ATOMIC1K; - break; - case 2048: - deviceCharacteristics |= SQLITE_IOCAP_ATOMIC2K; - break; - case 4096: - deviceCharacteristics |= SQLITE_IOCAP_ATOMIC4K; + if(KSqliteSectorSizeMap[i].iSectorSize == aVolumeInfo.iBlockSize) + { + deviceCharacteristics |= KSqliteSectorSizeMap[i].iSqliteSectorSizeConstant; break; - case 8192: - deviceCharacteristics |= SQLITE_IOCAP_ATOMIC8K; - break; - case 16384: - deviceCharacteristics |= SQLITE_IOCAP_ATOMIC16K; - break; - case 32768: - deviceCharacteristics |= SQLITE_IOCAP_ATOMIC32K; - break; - case 65536: - deviceCharacteristics |= SQLITE_IOCAP_ATOMIC64K; - break; - default: - //Do nothing. deviceCharacteristics was initialized with 0 at the beginning of the function body. - break; + } } return deviceCharacteristics; } diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/SRC/Server/Compact/SqlCompactEntry.cpp --- a/persistentstorage/sql/SRC/Server/Compact/SqlCompactEntry.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/SRC/Server/Compact/SqlCompactEntry.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -224,6 +224,10 @@ if(err == KErrNone) { iPageCount -= processedPageCount; + if(processedPageCount == 0) + { + iPageCount = 0; + } __ASSERT_DEBUG(iPageCount >= 0, __SQLPANIC(ESqlPanicInternalError)); } TBool stopCompaction = err == KSqlErrCorrupt || err == KSqlErrNotDb || err == KErrCorrupt || err == KErrDisMounted; diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/SRC/Server/SqlBur.cpp --- a/persistentstorage/sql/SRC/Server/SqlBur.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/SRC/Server/SqlBur.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -23,6 +23,12 @@ #define UNUSED_ARG(arg) arg = arg +_LIT(KSqlBurBackupExt, ".bak"); +_LIT(KSqlBurRestoreDir, "temprestore"); +_LIT(KSqlBurAllFiles, "*"); + +const TUint K8to16bitShift = 1; + //Extracts and returns 32-bit integer from aNumBuf buffer. static TUint32 GetNumUint32L(const TDesC& aNumBuf) { @@ -44,223 +50,358 @@ } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -// string consts -_LIT(KRestoreFilter,"*.rst"); // the filter for restore files -_LIT(KBackupFilter,"*.bak");// the filter for backup files -_LIT(KRestoreSuffix,".bak.rst"); // the suffix for restore files (a shortcut by using double suffix :) - -const TUint K8to16bitShift = 1; +/////////////////////////////// CSqlBurEventMonitor ////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/** Standard two phase construction - @return an instance of the backup client - @param a pointer to the SQL server which must have implemented the - TSqlSrvBurInterface interface - @leave if no memory +/** +Standard two phase construction. Creates a CSqlBurEventMonitor instance. +@param aInterface A reference to an interface that is used for retrieving list of databases to be sent for backup. +@return An instance of the backup notifier +@leave KErrNoMemory, an out of memory condition has occurred; + Note that the function may also leave with some other system-wide error codes. */ -CSqlBackupClient* CSqlBackupClient::NewLC(MSqlSrvBurInterface *aInterface) +CSqlBurEventMonitor* CSqlBurEventMonitor::NewL(MSqlSrvBurInterface& aInterface) { - CSqlBackupClient *self=(CSqlBackupClient *)new(ELeave) CSqlBackupClient(aInterface); + CSqlBurEventMonitor* self = new (ELeave) CSqlBurEventMonitor(aInterface); CleanupStack::PushL(self); self->ConstructL(); - SQL_TRACE_BUR(OstTrace1(TRACE_INTERNALS, CSQLBACKUPCLIENT_NEWLC, "0x%X;CSqlBackupClient::NewLC", (TUint)self)); - return self; - } - -/** Standard two phase construction - @return an instance of the backup client - @param a pointer to the SQL server which must have implemented the - TSqlSrvBurInterface interface - @leave if no memory -*/ -CSqlBackupClient* CSqlBackupClient::NewL(MSqlSrvBurInterface *aInterface) - { - CSqlBackupClient *self=(CSqlBackupClient *) NewLC(aInterface); - CleanupStack::Pop(); + CleanupStack::Pop(self); + SQL_TRACE_BUR(OstTrace1(TRACE_INTERNALS, CSQLBACKUPNOTIFIER_NEWL, "0x%X;CSqlBurEventMonitor::NewL", (TUint)self)); return self; } -/** Standard two phase construction - @param a pointer to the SQL server which must have implemented the - TSqlSrvBurInterface interface +/** +Releases the allocated resources. +*/ +CSqlBurEventMonitor::~CSqlBurEventMonitor() + { + SQL_TRACE_BUR(OstTrace1(TRACE_INTERNALS, CSQLBACKUPNOTIFIER_CSQLBACKUPNOTIFIER2, "0x%X;CSqlBurEventMonitor::~CSqlBurEventMonitor", (TUint)this)); + Cancel(); + iBurProperty.Close(); + DestroyContent(); + } + +/** +Initializes data members with their default values. +@param aInterface A reference to an interface that is used for retrieving list of databases to be sent for backup. */ -CSqlBackupClient::CSqlBackupClient(MSqlSrvBurInterface *aInterface) -: CActive(EPriorityStandard), iInterface(aInterface) +CSqlBurEventMonitor::CSqlBurEventMonitor(MSqlSrvBurInterface& aInterface) : + CActive(EPriorityStandard), + iBurInterface(aInterface) { } -/** Usual tidy up -*/ -CSqlBackupClient::~CSqlBackupClient() +/** +Initializes the created CSqlBurEventMonitor object. +@leave KErrNoMemory, an out of memory condition has occurred; + Note that the function may also leave with some other system-wide error codes. +*/ +void CSqlBurEventMonitor::ConstructL() { - SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_CSQLBACKUPCLIENT2, "0x%X;CSqlBackupClient::~CSqlBackupClient;iFile.SubSessionHandle()=0x%X", (TUint)this, (TUint)iFile.SubSessionHandle())); - - // cancel outstanding requests - Cancel(); - - // release the pub/sub property - iBurProperty.Close(); - - // the file list array - iFileList.Close(); - - // close the file - iFile.Close(); - - // nuke the active backup client - delete iActiveBackupClient; - } - -/** Standard two phase construction - @leave if non memory or StartL leaves -*/ -void CSqlBackupClient::ConstructL() - { - // attach to backup/restore publish/subscribe property - __SQLLEAVE_IF_ERROR(iBurProperty.Attach(KUidSystemCategory,KUidBackupRestoreKey)); - - // add us to the scheduler + __SQLLEAVE_IF_ERROR(iBurProperty.Attach(KSqlBurPropertyCategoryUid, KSqlBurBackupRestoreKey)); CActiveScheduler::Add(this); - - // set active and request notification of changes to backup - // and restore publish/subscribe property - StartL(); + iBurProperty.Subscribe(iStatus); + SetActive(); } /** -Cancel the outstanding B&R request +RunL() is called when the value of the {KUidSystemCategory, KUidBackupRestoreKey} gets changed. +That indicates: a backup or a restore is about to begin. + +How the function works: + - When a backup or restore notification is received, the function will subscribe again for notifications from + the backup and restore property and will read the property status; + - If the property status is conn::EBURUnset or conn::EBURNormal, the function will destroy iSqlBurCallback + and iActiveBackupClient interfaces. No more callbacks will be reseived from the backup and restore server. + This is the end of the backup or restore processing; + - If the property status is conn::EBURBackupFull, conn::EBURBackupPartial, conn::EBURRestoreFull or + conn::EBURRestorePartial, the function will create iSqlBurCallback and iActiveBackupClient interface + (iActiveBackupClient's NewL() receives iSqlBurCallback as an input parameter, registering this way the callback + in the backup and restore server to be called later, when sending or retrieving data to/from the server). + If the property read and the interface creation operations have been successful, the function will call + ConfirmReadyForBURL(KErrNone) to notify the backup and restore server that the SQL server is ready to send/retrieve + backup/restore data. + If the current notification is that a backup is about to begin, after the confirmation the backup and restore server will + call CSqlBurCallback::InitialiseGetProxyBackupDataL() once per {client secure id, drive} + followed by CSqlBurCallback::GetBackupDataSectionL() calls to retrieve the backup data. + If the current notification is that a restore is about to begin, after the confirmation the backup and restore server will + call CSqlBurCallback::InitialiseRestoreProxyBaseDataL() once per {client secure id, drive} + followed by CSqlBurCallback::RestoreBaseDataSectionL() calls to send the restore data. + +The current implementation has one design flaw. If a backup or restore notification is received, there are at lest 3 +places before the ConfirmReadyForBURL() call, where the code may leave: + - the "property get" operation; + - the iSqlBurCallback creation; + - the iActiveBackupClient creation; +If a leave occurs at some of the mentioned places, that leave will be trapped by the current CActiveScheduler object +and CSqlBurEventMonitor::RunError() will be called with the leaved error code. +Problem #1: CSqlBurEventMonitor::RunError() won't do anything with the error (apart from printing a trace in the OST builds). + The error is silently suppressed. The backup or restore won't start. But the client won't see any notification + for that problem. +Problem #2: ConfirmReadyForBURL() won't be called. According to the backup and restore documentation, if + ConfirmReadyForBURL() is called with KErrNone parameter, that's a confirmation for the backup and restore + server to start the processing. If ConfirmReadyForBURL() is called with an error different than KErrNone, + that's a confirmation for the backup and restore server that the client is not ready. No backup or restore + will be started. The remote backup client will be notified about the problem. +After an investigation it was found that the same problems do exist in all active backup clients, none of them has +solved the problems. Then, the code here will be kept as it is, it might be too dangerous to do a change right now. + +@see CSqlBurEventMonitor::RunError() +@see CSqlBurCallback +@see CActiveBackupClient +@see CSqlBurCallback::InitialiseGetProxyBackupDataL() +@see CSqlBurCallback::GetBackupDataSectionL() +@see CSqlBurCallback::InitialiseRestoreProxyBaseDataL() +@see CSqlBurCallback::RestoreBaseDataSectionL() + +@leave KErrNoMemory, an out of memory condition has occurred; + Note that the function may also leave with some other system-wide error codes. */ -void CSqlBackupClient::DoCancel() +void CSqlBurEventMonitor::RunL() + { + SQL_TRACE_BUR(OstTrace1(TRACE_INTERNALS, CSQLBACKUPNOTIFIER_RUNL_ENTRY, "Entry;0x%X;CSqlBurEventMonitor::RunL", (TUint)this)); + iBurProperty.Subscribe(iStatus); + SetActive(); + TInt status; + __SQLLEAVE_IF_ERROR(iBurProperty.Get(status)); + status &= conn::KBURPartTypeMask; +#ifdef _SQL_RDEBUG_PRINT + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPNOTIFIER_RUNL1, "0x%X;CSqlBurEventMonitor::RunL;status=%d", (TUint)this, status)); +#else + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPNOTIFIER_RUNL2, "0x%X;CSqlBurEventMonitor::RunL;status=%{TBURPartType}", (TUint)this, status)); +#endif + switch(status) + { + case conn::EBURBackupFull: + case conn::EBURBackupPartial: + case conn::EBURRestoreFull: + case conn::EBURRestorePartial: + { + // we only do full backups and full restores + if(!(iSqlBurCallback && iActiveBackupClient)) + { + DestroyContent(); + TRAPD(err, CreateContentL()); + if(err != KErrNone) + { + DestroyContent(); + __SQLLEAVE(err); + } + } + iActiveBackupClient->ConfirmReadyForBURL(KErrNone); + } + break; + //case conn::EBURUnset: + //case conn::EBURNormal: + default: + DestroyContent(); + break; + } + SQL_TRACE_BUR(OstTrace1(TRACE_INTERNALS, CSQLBACKUPNOTIFIER_EXIT, "Exit;0x%X;CSqlBurEventMonitor::RunL", (TUint)this)); + SQL_BUR_TEST_STOP(); + } + +/** +Cancels the subscribtion for {KUidSystemCategory, KUidBackupRestoreKey} property changes. +*/ +void CSqlBurEventMonitor::DoCancel() { iBurProperty.Cancel(); } -/** Not implemented - @return a flag indicating whether we actioned the error - @param the error unused +/** +No-op. The method does nothing with the reported from CSqlBurEventMonitor::RunL() error +(apart from logging a trace in OST builds). +Actually, the right action is to return KErrNone (as it is implemented), otherwise the default implementation of +CActiveScheduler::Error() will panic the current thread. + +@see CActiveScheduler::Error() +@see CSqlBurEventMonitor::RunL() + +@return The RunL() error, if the RunL() call leaves. +@param The RunL() error */ -TInt CSqlBackupClient::RunError(TInt aError) +TInt CSqlBurEventMonitor::RunError(TInt aError) { UNUSED_ARG(aError); - SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RUNERROR, "0x%X;CSqlBackupClient::RunError;aError=%d", (TUint)this, aError)); - // just satisfy it that we did something! + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RUNERROR, "0x%X;CSqlBurEventMonitor::RunError;aError=%d", (TUint)this, aError)); + SQL_BUR_TEST_SET_ERROR(aError); + SQL_BUR_TEST_STOP(); return KErrNone; } -/** Kick off the BUR client - @leave if TestBurStatusL leaves +/** +Creates iActiveBackupClient and iSqlBurCallback objects. */ -void CSqlBackupClient::StartL() +void CSqlBurEventMonitor::CreateContentL() { - TestBurStatusL(); - NotifyChange(); + iSqlBurCallback = CSqlBurCallback::NewL(iBurInterface); + iActiveBackupClient = conn::CActiveBackupClient::NewL(iSqlBurCallback); + } + +/** +Destroys iActiveBackupClient and iSqlBurCallback objects. +*/ +void CSqlBurEventMonitor::DestroyContent() + { + delete iActiveBackupClient; + iActiveBackupClient = NULL; + delete iSqlBurCallback; + iSqlBurCallback = NULL; } -/** Resubscribe and wait for events -*/ -void CSqlBackupClient::NotifyChange() +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////// CSqlBackupClient ///////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + +/** +Creates new CSqlBurCallback instance. +The CSqlBurEventMonitor object monitors the state of the {KUidSystemCategory, KUidBackupRestoreKey} +property. When a backup or a restore is about to begin, the CSqlBurEventMonitor object creates a +CSqlBurCallback instance, establishes a connection with the B&R server and passes a pointer to +the CSqlBurCallback callback to the BYR conenction. +The CSqlBurCallback methods will be called during the backup/restore for sending/retrieving data. + +@param aInterface A reference to an interface that is used for retrieving list of databases to be sent for backup. +@return A pointer to the created CSqlBurCallback instance +@leave KErrNoMemory, an out of memory condition has occurred; + Note that the function may also leave with some other system-wide error codes. +*/ +CSqlBurCallback* CSqlBurCallback::NewL(MSqlSrvBurInterface& aInterface) { - SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_NOTIFYCHANGE, "0x%X;CSqlBackupClient::NotifyChange;iBurProperty.Handle()=0x%X", (TUint)this, (TUint)iBurProperty.Handle())); - iBurProperty.Subscribe(iStatus); - SetActive(); + CSqlBurCallback* self = new (ELeave) CSqlBurCallback(aInterface); + SQL_TRACE_BUR(OstTrace1(TRACE_INTERNALS, CSQLBACKUPCLIENT_NEWLC, "0x%X;CSqlBurCallback::NewL", (TUint)self)); + return self; + } + +/** +Initializes CSqlBurCallback data members with their default values. +@param aInterface A reference to an interface that is used for retrieving list of databases to be sent for backup. +*/ +CSqlBurCallback::CSqlBurCallback(MSqlSrvBurInterface& aInterface) : + iInterface(aInterface) + { } -/** Something happened. Find out what. - Create an instance of BUR client if required - Delete it if no longer required - This is for performance reasons - @leave if ConfirmReadyForBURL leaves +/** +Releases the allocated resources. */ -void CSqlBackupClient::TestBurStatusL() +CSqlBurCallback::~CSqlBurCallback() { - SQL_TRACE_BUR(OstTrace1(TRACE_INTERNALS, CSQLBACKUPCLIENT_TESTBURSTATUSL_ENTRY, "Entry;0x%X;CSqlBackupClient::TestBurStatusL", (TUint)this)); - TInt status; - __SQLTRACE_BURVAR(TInt err = KErrNone); - if((__SQLTRACE_BUREXPR(err =) iBurProperty.Get(status)) != KErrNotFound) - { - status&=KBURPartTypeMask; -#ifdef _SQL_RDEBUG_PRINT - SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_TESTBURSTATUSL1, "0x%X;CSqlBackupClient::TestBurStatusL;status=%d", (TUint)this, status)); -#else - SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_TESTBURSTATUSL2, "0x%X;CSqlBackupClient::TestBurStatusL;status=%{TBURPartType}", (TUint)this, status)); -#endif - switch(status) - { - case EBURUnset: // same as EBURNormal - case EBURNormal: - delete iActiveBackupClient; - iActiveBackupClient=NULL; - break; - case EBURBackupFull: - case EBURBackupPartial: - case EBURRestoreFull: - case EBURRestorePartial: - // we only do full backups and full restores - if(!iActiveBackupClient) - { - iActiveBackupClient=CActiveBackupClient::NewL(this); - } - iActiveBackupClient->ConfirmReadyForBURL(KErrNone); - break; - default: - break; - } - } - SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_TESTBURSTATUSL_EXIT, "Exit;0x%X;CSqlBackupClient::TestBurStatusL;iProperty.Get() err=%d", (TUint)this, err)); + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_CSQLBACKUPCLIENT2, "0x%X;CSqlBurCallback::~CSqlBurCallback;iFile.SubSessionHandle()=0x%X", (TUint)this, (TUint)iFile.SubSessionHandle())); + BackupCleanup(); + (void)RestoreCleanup(); } -/** Called when BUE notifies a BUR event - @leave if TestBurStatusL leaves +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////// Full backup ////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** +This is called to let us know that the given SID is to be backed up. +We ask the SQL server (using iInterface, see MSqlSrvBurInterface for more details) +for a list of databases that want to be backed up. + +The backup is initiated by a notification received in CSqlBurEventMonitor::RunL() method. +InitialiseGetProxyBackupDataL() is called once per {client secure id, drive} and each +InitialiseGetProxyBackupDataL() call is followed after that by a set of CSqlBurCallback::GetBackupDataSectionL() calls, +made from the backup and restore client dll. + +During GetBackupDataSectionL() calls the CSqlBurCallback object will read the content of the databases from the list, +retrieved from the MSqlSrvBurInterface::GetBackUpListL() call and send the content to the backup and restore server. + +@see MSqlSrvBurInterface +@see CSqlBurEventMonitor::RunL() +@see CSqlBurCallback::GetBackupDataSectionL() +@see CSqlServer::GetBackUpListL() + +@param aSid the UID of the application to backup +@param aDrive the drive to be backed up +@leave KErrNoMemory, an out of memory condition has occurred; + Note that the function may also leave with some other system-wide error codes. */ -void CSqlBackupClient::RunL() +void CSqlBurCallback::InitialiseGetProxyBackupDataL(TSecureId aSid, TDriveNumber aDrive) { - NotifyChange(); - TestBurStatusL(); + SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_INITIALIZEGETPROXYBACKUPDATAL, "0x%X;CSqlBurCallback::InitialiseGetProxyBackupDataL;aSid=0x%X;aDrive=%d", (TUint)this, (TUint)aSid.iId, (TInt)aDrive)); + BackupCleanup(); + iInterface.GetBackUpListL(aSid, aDrive, iFileList); + iFileIndex = 0; + iState = EBackupNoFileOpen; + iBackupError = KErrNone; } -/** This is supposed to allow the BUE to know in advance how much - data is coming - but unfortunately there is no way to know this - at this stage since we don't even know yet what SID is being processed - So we just answer some number to make the BUE happy. It doesn't - actually rely on this number so there is no risk - the aFinishedFlag - indicates the end of data, not the value returned here. It is - supposed to allow the BUE to optimise its behaviour by know up front - the data volume. - @return an arbitrary number - @param TDrive unused +/** +This is supposed to allow the B&R framework to know in advance how much +data is coming - but unfortunately there is no way to know this +at this stage since we don't even know yet what SID is being processed +So we just answer some number to make the BUE happy. It doesn't +actually rely on this number so there is no risk - the aFinishedFlag +indicates the end of data, not the value returned here. It is +supposed to allow the BUE to optimise its behaviour by know up front +the data volume. + +@see CSqlBurEventMonitor::RunL() +@see CSqlBurCallback::InitialiseGetProxyBackupDataL() + +@param aDrive Unused parameter (the drive number is logged in OST builds). +@return an arbitrary number (1024 at the moment) */ -TUint CSqlBackupClient::GetExpectedDataSize(TDriveNumber aDrive) +TUint CSqlBurCallback::GetExpectedDataSize(TDriveNumber aDrive) { UNUSED_ARG(aDrive); // we have no idea at this point - we even don't know who is to be backed up yet const TUint KArbitraryNumber = 1024; - SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETEXPECTEDDATASIZE, "0x%X;CSqlBackupClient::GetExpectedDataSize;aDrive=%d;rc=%u", (TUint)this, (TInt)aDrive, KArbitraryNumber)); + SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETEXPECTEDDATASIZE, "0x%X;CSqlBurCallback::GetExpectedDataSize;aDrive=%d;rc=%u", (TUint)this, (TInt)aDrive, KArbitraryNumber)); return KArbitraryNumber; } -/** This is the backup state machine - Because the data has to be sent back in sections and the various - components of the dataflow may straddle chunks, we have to keep - track of where we are between each transfer - a state machine is - the simplest and most understandable implementation - @param TPtr this is where the data will be put to be passed back - @param TBool set to true when all data has been submitted for backup - @leave +/** +This is the backup state machine +Because the data has to be sent back in sections and the various +components of the dataflow may straddle chunks, we have to keep +track of where we are between each transfer - a state machine is +the simplest and most understandable implementation. + +Please note how the function processes the errors occuring during the backup. +If an error occurs, the error is not propagated back to the B&R server immediatelly. +The error is stored in iBurError data member and is reported at the end of the backup process. +The reason for such unusual error reporting poicy is: the SQL server performs full backup of possibly more +than one database file. If an error occurs during the backup of the first file for example, the backup +process should not stop at that point. All files will be processed and then at the end, the error will be reproted. + +In details, the function runs a state machine, where: + - every file in the list retrieved in InitialiseGetProxyBackupDataL() is opened; + - the file is read and 32-bit checksum over the file data - calculated; + - a file backup header is prepared, including there the file size, file name, file name length, protocol verison number + and the checksum. The header is sent to the backup restore server; + - the file data is read and sent to the backup and restore server; + - during the described above sequence no leave ever occurs. The error that occurs during the file processing, + is stored into a data member of CSqlBurCallback class. At the end, after the last file in the list is processed, + the backup and restore server will get a notification (via a User::Leave() call) regarding the error; + The used error reporting policy allows all files to be process without interrupting the backup process. + For example, if there are 5 files to be sent to the backup and restore server, an error that occurs during the + processing of file #3, won't prevent files #4 and #5 from being sent for backup. + +@see CSqlBurEventMonitor::RunL() +@see CSqlBurCallback::InitialiseGetProxyBackupDataL() + +@param aBuffer Output parameter, the buffer where the data will be put to be passed back +@param aFinishedFlag Set to true when all data has been submitted for backup +@leave KErrNoMemory, an out of memory condition has occurred; + Note that the function may also leave with some other system-wide error codes. */ -void CSqlBackupClient::GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinishedFlag) +void CSqlBurCallback::GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinishedFlag) { - SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL0, "0x%X;CSqlBackupClient::GetBackupDataSectionL;iState=%d;iFileIndex=%d", (TUint)this, (TInt)iState, iFileIndex)); // don't assume they set it to false aFinishedFlag=EFalse; // any files to backup if(iFileList.Count()==0) { - SQL_TRACE_BUR(OstTrace1(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL1, "0x%X;CSqlBackupClient::GetBackupDataSectionL;file count is 0", (TUint)this)); - // nothing to backup - just return the finished flag - aFinishedFlag=ETrue; - // clear down the list - iFileList.Reset(); - // iFileList closed in dtor + // nothing to backup + SQL_TRACE_BUR(OstTrace1(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL1, "0x%X;CSqlBurCallback::GetBackupDataSectionL;file count is 0", (TUint)this)); + aFinishedFlag = ETrue; + BackupCleanup(); return; } @@ -272,21 +413,21 @@ case EBackupNoFileOpen: // open a file for processing { if(iFileIndex>=iFileList.Count()) - { - SQL_TRACE_BUR(OstTrace1(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL2, "0x%X;CSqlBackupClient::GetBackupDataSectionL;all files processed", (TUint)this)); - // all files have been processed - send the finished flag - aFinishedFlag=ETrue; - // clear down the filelist - iFileList.Reset(); + {// all files have been processed - send the finished flag + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL2, "0x%X;CSqlBurCallback::GetBackupDataSectionL;all files processed;iBackupError=%d", (TUint)this, iBackupError)); + aFinishedFlag = ETrue; + BackupCleanup(); + __SQLLEAVE_IF_ERROR(iBackupError); return; } // open the database file to send - TInt rc=iFile.Open( iInterface->Fs(), iFileList[iFileIndex].FullName(), EFileRead | EFileShareExclusive); - __SQLTRACE_BUREXPR(TPtrC fname = iFileList[iFileIndex].FullName()); - SQL_TRACE_BUR(OstTraceExt5(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL3, "0x%X;CSqlBackupClient::GetBackupDataSectionL;BEGIN;fname=%S;iFileIndex=%d;iFile.SubSessionHandle()=0x%X;rc=%d", (TUint)this, __SQLPRNSTR(fname), iFileIndex, (TUint)iFile.SubSessionHandle(), rc)); - if(KErrNone!=rc) + TPtrC fname = iFileList[iFileIndex]->Des(); + TInt err = iFile.Open(iInterface.Fs(), fname, EFileRead | EFileShareExclusive); + SQL_TRACE_BUR(OstTraceExt5(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL3, "0x%X;CSqlBurCallback::GetBackupDataSectionL;BEGIN;fname=%S;iFileIndex=%d;iFile.SubSessionHandle()=0x%X;err=%d", (TUint)this, __SQLPRNSTR(fname), iFileIndex, (TUint)iFile.SubSessionHandle(), err)); + if(KErrNone != err) { // there's nothing we can do if we can't open the file so we just skip it + SetBackupError(err); ++iFileIndex; break; } @@ -296,28 +437,38 @@ case EBackupOpenNothingSent: // nothing sent (so far) for this file - send the header info { TInt64 fileSize; - if(KErrNone!=iFile.Size(fileSize) || fileSize==0) // short circuit eval + TInt err = iFile.Size(fileSize); + if(KErrNone != err) { - // empty or unreadable - skip this file - iState=EBackupEndOfFile; + SetBackupError(err); + iState = EBackupEndOfFile; break; } - // get the checksum - only grab last 4 bytes - enough to be satisfied that - // the backup and restore worked ok - TUint32 checksum = CheckSumL(iFile) & KMaxTUint32; + TUint64 checksum64 = 0; + err = CheckSum(iFile, checksum64); + SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL4, "0x%X;CSqlBurCallback::GetBackupDataSectionL;CheckSum();iFileIndex=%d;err=%d", (TUint)this, iFileIndex, err)); + if(err != KErrNone) + { + //An error occured while reading the file (or there was not enough memory for the read buffer) + SetBackupError(err); + iState = EBackupEndOfFile; + break; + } + // Only grab last 4 bytes of the checksum - enough to be satisfied that the backup and restore worked ok + TUint32 checksum32 = checksum64 & KMaxTUint32; // build the header - this is an instance member because it // has to persist over multiple calls to this method - const TDesC& fileName = iFileList[iFileIndex].FullName(); + TPtrC fname = iFileList[iFileIndex]->Des(); iBuffer.Format(_L("%8x%8x%4x%16lx%8x%S"), - checksum, // %8x - KMagicNum, // %8x - KBackupHeaderVersion, // %4x + checksum32, // %8x + KSqlBurMagicNum, // %8x + KSqlBurHeaderVersion, // %4x fileSize, // %16lx - fileName.Length(), // %8x - &fileName); // %S - SQL_TRACE_BUR(OstTraceExt4(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL5, "0x%X;CSqlBackupClient::GetBackupDataSectionL;fileName=%S;hdrPtr=|%S|;fileSize=%lld", (TUint)this, __SQLPRNSTR(fileName), __SQLPRNSTR(iBuffer), fileSize)); + fname.Length(), // %8x + &fname); // %S + SQL_TRACE_BUR(OstTraceExt4(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL5, "0x%X;CSqlBackupClient::GetBackupDataSectionL;fileName=%S;hdrPtr=|%S|;fileSize=%lld", (TUint)this, __SQLPRNSTR(fname), __SQLPRNSTR(iBuffer), fileSize)); // we need it to look like an 8bit buffer TPtr8 hdrPtr8((TUint8*)iBuffer.Ptr(), iBuffer.Size(), iBuffer.Size()); @@ -372,7 +523,15 @@ case EBackupOpenAllHeaderSent: // need to send some data { TPtr8 ptr((TUint8*)aBuffer.Ptr() + aBuffer.Size(), 0, bufFreeSpace); - __SQLLEAVE_IF_ERROR(iFile.Read(ptr)); + TInt err = iFile.Read(ptr); + if(err != KErrNone) + { + //An error occured while reading the file + SetBackupError(err); + iState = EBackupEndOfFile; + SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL6, "0x%X;CSqlBurCallback::GetBackupDataSectionL;File read;iFileIndex=%d;err=%d", (TUint)this, iFileIndex, err)); + break; + } TInt bytesRead = ptr.Size(); aBuffer.SetLength(aBuffer.Size() + bytesRead); // EOF @@ -385,83 +544,119 @@ } case EBackupEndOfFile: { - SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL4, "0x%X;CSqlBackupClient::GetBackupDataSectionL;END;iFile.SubSessionHandle()=0x%X;iFileIndex=%d", (TUint)this, (TUint)iFile.SubSessionHandle(), iFileIndex)); + SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL7, "0x%X;CSqlBurCallback::GetBackupDataSectionL;END;iFile.SubSessionHandle()=0x%X;iFileIndex=%d", (TUint)this, (TUint)iFile.SubSessionHandle(), iFileIndex)); iFile.Close(); ++iFileIndex; // move on to next file iState = EBackupNoFileOpen; // go round again break; } default: - { + __ASSERT_DEBUG(EFalse, __SQLPANIC(ESqlPanicInternalError)); break; - } }//end of the "switch" statement }//end of the "for" statement } -/** This is called by BUE when the restore has completed - Nothing to do here except tell the server - @param TDrive the drive that is being restored (unused) +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////// Full restore ///////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** +Called when the BUE wants to start sending data to us. +Creates the folder (if the folder does not exist) where the temporary files will be created during the restore process. +Deletes all files from the restore folder. + +The restore is initiated by a notification received in CSqlBurEventMonitor::RunL() method. +InitialiseRestoreProxyBaseDataL() is called once per {client secure id, drive} and each +InitialiseRestoreProxyBaseDataLL() call is followed after that by a set of CSqlBurCallback::RestoreBaseDataSectionL() +calls, made from the backup and restore client dll. + +During RestoreBaseDataSectionLL() calls the CSqlBurCallback object will receive data from the backup and resore server. + +@see CSqlBurEventMonitor::RunL() +@see CSqlBurCallback::RestoreBaseDataSectionL() + +@param aSid the UID of the application that is to be restored. Not used (only logged in OST builds). +@param aDrive the drive to restore. +@leave KErrNoMemory, an out of memory condition has occurred; + Note that the function may also leave with some other system-wide error codes. */ -void CSqlBackupClient::RestoreComplete(TDriveNumber aDrive) +void CSqlBurCallback::InitialiseRestoreProxyBaseDataL(TSecureId aSid, TDriveNumber aDrive) { + UNUSED_ARG(aSid); UNUSED_ARG(aDrive); - SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTORECOMPLETE, "0x%X;CSqlBackupClient::RestoreComplete;aDrive=%d", (TUint)this, (TInt)aDrive)); + SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_INITIALIZERESTOREPROXYBASEDATAL, "0x%X;CSqlBurCallback::InitialiseRestoreProxyBaseDataL;aSid=0x%X;aDrive=%d", (TUint)this, (TUint)aSid.iId, (TInt)aDrive)); + iBuffer.Zero(); + iState = ERestoreExpectChecksum; + iRestoreDrive = aDrive; + iRestoreId = aSid; + //Create the directory for the temporary files created during the restore process. + TFileName privatePath; + __SQLLEAVE_IF_ERROR(iInterface.Fs().PrivatePath(privatePath)); + TDriveUnit driveUnit(iRestoreDrive); + TDriveName driveName = driveUnit.Name(); + privatePath.Insert(0, driveName); + __SQLLEAVE_IF_ERROR(iParse.Set(KSqlBurRestoreDir, &privatePath, 0)); + iRestoreDir.Copy(iParse.FullName()); + iRestoreDir.Append(KPathDelimiter); + TInt err = iInterface.Fs().MkDirAll(iRestoreDir); + if(err != KErrAlreadyExists) + { + __SQLLEAVE_IF_ERROR(err); + } + //Cleanup the restore directory + err = RestoreCleanup(); + if(err != KErrNotFound) + { + __SQLLEAVE_IF_ERROR(err); + } } -/** This is called to let us know that the given SID is to be backed up - We ask the SQL server for a list of databases that want to be backed - up - this is because the backup flag is an internal metadata object - in the database, and to decouple we don't want to have to know how - this data is stored. - @param TSecureSid the UID of the application to backup - @param TDriveNumber the drive to be backed up (unused) - @leave +/** +This is called by BUE when the restore has completed. + +@see CSqlBurEventMonitor::RunL() +@see CSqlBurCallback::InitialiseRestoreProxyBaseDataL() + +@param aDrive the drive that is being restored. Not used (only logged in OST builds). */ -void CSqlBackupClient::InitialiseGetProxyBackupDataL(TSecureId aSid, TDriveNumber aDrive) +void CSqlBurCallback::RestoreComplete(TDriveNumber aDrive) { UNUSED_ARG(aDrive); - SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_INITIALIZEGETPROXYBACKUPDATAL, "0x%X;CSqlBackupClient::InitialiseGetProxyBackupDataL;aSid=0x%X;aDrive=%d", (TUint)this, (TUint)aSid.iId, (TInt)aDrive)); - // get the list of database files to back up - this is provided by the SQL server - GetBackupListL(aSid); - // this is the index of the file being processed - point to the beginning - iFileIndex=0; - // the first state of the backup state machine - iState=EBackupNoFileOpen; - // save the sid for notifying the server when the backup is complete - iSid=aSid; + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTORECOMPLETE, "0x%X;CSqlBurCallback::RestoreComplete;aDrive=%d", (TUint)this, (TInt)aDrive)); + iRestoreDrive = TDriveNumber(-1); + iRestoreId = TSecureId(KNullUid); } -/** Called when the BUE wants to start sending data to us - @param TSecureId the UID of the application that is to be restored - @param TDriveNumber the drive to restore (unused) - @leave +/** +This is repeatedly called by the BUE to send us chunks of restore data (for the current SID) +Becuase the data is spread over chunks we need to manage the state across mutiple calls +to this method so we use a state machine. + +The function runs the state machine and for each file block detected in the coming data, the function does: + - creates a temporary file in the restore directory (created by InitialiseRestoreProxyBaseDataL()); + - stores the file data in the created temporary file; + - During the 2 steps descirbed above, if an error occurs, that erro will be reproted to the backup and restore + server (via a User::Leave() call); + - When all data is received and stored in temporary files in the restore directory, + for each received file the function will: + = move the original database file to the restore directory with a ".bak" extension added to the file name; + = move the temporary file, which has the same name as the original database file, to the location of the + original database file - the SQL server private data cage; + = delete the file with the ".bak" extension; + The three steps described above are implemented as "all or none" operation - if an error occurs during step (2), + the content of the original database file will be restored from the file with the ".bak" extension. + +@see CSqlBurEventMonitor::RunL() +@see CSqlBurCallback::InitialiseRestoreProxyBaseDataL() + +@param aInBuffer Buffer with data to be restored +@param aFinishedFlag Set when there is not more data to restore +@leave KErrNoMemory, an out of memory condition has occurred; + Note that the function may also leave with some other system-wide error codes. */ -void CSqlBackupClient::InitialiseRestoreProxyBaseDataL(TSecureId aSid, TDriveNumber aDrive) +void CSqlBurCallback::RestoreBaseDataSectionL(TDesC8& aInBuffer, TBool aFinishedFlag) { - UNUSED_ARG(aDrive); - SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_INITIALIZERESTOREPROXYBASEDATAL, "0x%X;CSqlBackupClient::InitialiseRestoreProxyBaseDataL;aSid=0x%X;aDrive=%d", (TUint)this, (TUint)aSid.iId, (TInt)aDrive)); - iBuffer.Zero(); - // this is the first state of the restore state machine - iState=ERestoreExpectChecksum; - iAnyData=EFalse; // to keep track in the state machine whether any data was actually sent - // save the sid for notifying the server when the restore is done - iSid=aSid; - } - -/** This is repeatedly called by the BUE to send us chunks of restore data (for the current SID) - Becuase the data is spread over chunks we need to manage the state across mutiple calls - to this method so we use a state machine - @leave KErrCorrupt if the data is incomplete or the checksum fails - @param TDesc8 the data to be restored - @param TBool set when there is not more data to restore - -Attention!!! This function won't work properly if aInBuffer parameter contains odd number of bytes!!! -(a legacy problem, if it is a problem at all, because the B&R engine probably sends the data in chunks with even size) -*/ -void CSqlBackupClient::RestoreBaseDataSectionL(TDesC8& aInBuffer, TBool aFinishedFlag) - { - SQL_TRACE_BUR(OstTraceExt4(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL0, "0x%X;CSqlBackupClient::RestoreBaseDataSectionL;iState=%d;aInBuffer.Length()=%d;aFinishedFlag=%d", (TUint)this, (TInt)iState, aInBuffer.Length(), (TInt)aFinishedFlag)); // used to walk the buffer // got a new buffer - because each time this method is called, we have a // fresh chunk of data @@ -471,16 +666,14 @@ TBool done = EFalse; // check whether this is an empty restore - if(aFinishedFlag && !iAnyData) + if(aFinishedFlag && aInBuffer.Size() == 0) { - // we have to do this and not rely on aFinishedFlag alone, becuase - // if aFinished is used, we'll process the last state of the machine - // which does tidyup, except that if there was no data, no tidyup should - // be done return; } - - // run the machine + + TInt iterations = 0; + + // run the state machine do { // how many bytes are there available in the buffer for processing? @@ -493,18 +686,6 @@ // so we return and wait for more data to arrive return; } - if(aFinishedFlag && iState != ERestoreComplete && iState != ERestoreExpectData) - { - // ran out of data early - // will be ERestoreComplete if data not aligned on 128 - // will be ERestoreExpectData if data aligned on 128 - __SQLLEAVE(KErrCorrupt); - } - // yep there was some data in the chunk if we got here - if(bytesAvailable > 0) - { - iAnyData = ETrue; - } switch(iState) { case ERestoreExpectChecksum: // 16 bytes (the header is UTF16 encoded, 8 unicode characters for the checksum) @@ -526,7 +707,7 @@ if(iBuffer.Length() == KOldFileSizeStrLen) { TUint32 oldFileSize = ::GetNumUint32L(iBuffer); - if(oldFileSize == KMagicNum) + if(oldFileSize == KSqlBurMagicNum) { iState = ERestoreExpectVersion; } @@ -562,7 +743,7 @@ iState = ERestoreExpectFileNameSize; iBuffer.Zero(); } - SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL1, "0x%X;CSqlBackupClient::RestoreBaseDataSectionL;iFileSize=%lld", (TUint)this, iFileSize)); + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL1, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;iFileSize=%lld", (TUint)this, iFileSize)); break; } case ERestoreExpectFileNameSize: // the size of the file name to restore @@ -580,17 +761,17 @@ case ERestoreExpectFileName: // the name of the file to restore { CopyBufData(aInBuffer, inBufferPos, iBuffer, iFileNameSize); - SQL_TRACE_BUR(OstTraceExt4(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL2, "0x%X;CSqlBackupClient::RestoreBaseDataSectionL;BEGIN;iBuffer=%S;iBuffer.Length()=%d;iFileNameSize=%d", (TUint)this, __SQLPRNSTR(iBuffer), iBuffer.Length(), iFileNameSize)); + SQL_TRACE_BUR(OstTraceExt4(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL2, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;BEGIN;iBuffer=%S;iBuffer.Length()=%d;iFileNameSize=%d", (TUint)this, __SQLPRNSTR(iBuffer), iBuffer.Length(), iFileNameSize)); if(iBuffer.Length() == iFileNameSize) { iState = ERestoreExpectData; - iBuffer.Append(KRestoreSuffix); - // now we start writing the data to the target file - // write to a temp - double disk space potentially - // once all the temp files are created, then they are renamed to the - // real file names in one fell swoop - __SQLLEAVE_IF_ERROR(iFile.Replace(iInterface->Fs(), iBuffer, EFileWrite | EFileShareExclusive)); - SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL3, "0x%X;CSqlBackupClient::RestoreBaseDataSectionL;iFile.SubSessionHandle()=0x%X", (TUint)this, (TUint)iFile.SubSessionHandle())); + TParse parse; + __SQLLEAVE_IF_ERROR(parse.Set(iBuffer, 0, 0)); + __SQLLEAVE_IF_ERROR(iParse.Set(parse.NameAndExt(), &iRestoreDir, 0)); + TPtrC fname(iParse.FullName()); + //The database is restored first to a temporary file, in the restore folder, on the same drive. + __SQLLEAVE_IF_ERROR(iFile.Replace(iInterface.Fs(), fname, EFileWrite | EFileShareExclusive)); + SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL3, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;fname=%S;iFile.SubSessionHandle()=0x%X", (TUint)this, __SQLPRNSTR(fname), (TUint)iFile.SubSessionHandle())); iBuffer.Zero(); } break; @@ -598,7 +779,12 @@ case ERestoreExpectData: // now for the data { TInt len = Min((aInBuffer.Size() - inBufferPos), iFileSize); - __SQLLEAVE_IF_ERROR(iFile.Write(aInBuffer.Mid(inBufferPos, len))); + TInt err = iFile.Write(aInBuffer.Mid(inBufferPos, len)); + if(err != KErrNone) + { + (void)RestoreCleanup(); + __SQLLEAVE(err); + } inBufferPos += len; iFileSize -= len; if(iFileSize == 0) @@ -609,286 +795,285 @@ } case ERestoreComplete: // file completely restored { - // calculate the checksum - TUint32 cksum = CheckSumL(iFile) & KMaxTUint32; - - // done with the file now - has to follow checksum cos it - // expects ann open file - SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL4, "0x%X;CSqlBackupClient::RestoreBaseDataSectionL;END;iFile.SubSessionHandle()=0x%X", (TUint)this, (TUint)iFile.SubSessionHandle())); - __SQLLEAVE_IF_ERROR(iFile.Flush()); + TUint64 checkSum64 = 0; + TInt restoreErr = iFile.Flush(); + if(restoreErr == KErrNone) + { + // calculate the checksum + restoreErr = CheckSum(iFile, checkSum64); + } iFile.Close(); - - // validate that the checksum matches - if(cksum!=iChecksum) + if(restoreErr != KErrNone) + { + (void)RestoreCleanup(); + __SQLLEAVE(restoreErr); + } + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL4, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;END;iFile.SubSessionHandle()=0x%X", (TUint)this, (TUint)iFile.SubSessionHandle())); + TUint32 checkSum32 = checkSum64 & KMaxTUint32; + if(checkSum32 != iChecksum) { + (void)RestoreCleanup(); __SQLLEAVE(KErrCorrupt); } - - // end of data - or another file to be restored? - if(aFinishedFlag) + if((aInBuffer.Size() - inBufferPos) > 0) + {//There are bytes to be consumed in the input buffer + iState = ERestoreExpectChecksum; + break; + } + SQL_TRACE_BUR(OstTrace1(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL5, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;aFinishedFlag=ETrue", (TUint)this)); + //End of data. We have all data restored in the restore folder. + //The final step of the "restoring files" process consists of the following sub-steps: + // - Rename the database file to be restored to a file with ".bak" extension + // - Rename the file with the restored data to the database file + // - Delete the file with ".bak" extension + //Do not leave during the restore process! Restore as much files as possible. + //The only excpetion is TParse::Set() - if it fails it is a fatal error, the + //restored file path cannot be constructed. + __ASSERT_DEBUG(iRestoreDrive != TDriveNumber(-1), __SQLPANIC(ESqlPanicInternalError)); + __ASSERT_DEBUG(iRestoreId != TSecureId(KNullUid), __SQLPANIC(ESqlPanicInternalError)); + //Include the aUid and the "*" mask + TUidName uidName = (static_cast (iRestoreId)).Name(); + TBuf fileNameMask(uidName); + fileNameMask.Append(KSqlBurAllFiles); + __SQLLEAVE_IF_ERROR(iParse.Set(fileNameMask, &iRestoreDir, 0)); + CDir* dir = NULL; + TPtrC searchPattern(iParse.FullName()); + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL55, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;search pattern=%S", (TUint)this, __SQLPRNSTR(searchPattern))); + restoreErr = iInterface.Fs().GetDir(searchPattern, KEntryAttNormal, ESortNone, dir); + if(restoreErr == KErrNone) { - // we need to rename all the - // temp rst files to the real database names - CDir *dir=NULL; - __SQLLEAVE_IF_ERROR(iInterface->Fs().GetDir(KRestoreFilter,KEntryAttNormal,ESortNone,dir)); - CleanupStack::PushL(dir); - TInt err2 = KErrNone; - for(TInt a=0;aCount();++a) + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL6, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;restored files=%d", (TUint)this, dir->Count())); + for(TInt i=0;iCount();++i) { - TEntry entry=(*dir)[a]; - TPtrC rst=entry.iName.Des(); - TInt len=rst.Length(); - // format .db.bak.rst - // just a convenience! - TPtrC bak(rst.Left(len - 4));//".rst" part excluded - TPtrC db(rst.Left(len - 8));//".bak.rst" part excluded - - // first, rename the orig .db as .bak just in case - // ok if not found - might have been deleted. - //the ".bak" file, if exists, will be deleted first. - (void)iInterface->Fs().Delete(bak); - TInt err=iInterface->Fs().Rename(db,bak); - SQL_TRACE_BUR(OstTraceExt4(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL5, "0x%X;CSqlBackupClient::RestoreBaseDataSectionL;END;bak=%S;db=%S;err=%d", (TUint)this, __SQLPRNSTR(bak), __SQLPRNSTR(db), err)); + const TEntry& entry = (*dir)[i]; + __SQLLEAVE_IF_ERROR(iParse.Set(entry.iName, &iRestoreDir, 0)); + TFileName dbName(iParse.FullName()); + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL7, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;restored file=%S", (TUint)this, __SQLPRNSTR(dbName))); + TInt pos = dbName.Find(KSqlBurRestoreDir); + __ASSERT_DEBUG(pos >= 0, __SQLPANIC(ESqlPanicInternalError)); + dbName.Delete(pos, KSqlBurRestoreDir().Length() + 1);//"+1" for the path delimitier + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL8, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;database=%S", (TUint)this, __SQLPRNSTR(dbName))); + TFileName bakDbName(iParse.FullName()); + bakDbName.Append(KSqlBurBackupExt); + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL9, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;backup file=%S", (TUint)this, __SQLPRNSTR(dbName))); + //Now, dbName contains the original database (full path), iParse - the restored file, + //bakDbName - backup file name + TInt err = iInterface.Fs().Rename(dbName, bakDbName); if(err == KErrNone || err == KErrNotFound) { - // now, rename the .rst as .db - err = iInterface->Fs().Rename(rst,db); - } - if(err != KErrNone && err2 == KErrNone) - { - //The idea here is to not report the error immediatelly by calling LeaveIfError(). - //If we leave here, the next database restore may also fail, for example, if the current database is still open by - //its owner. Then "TInt err=iInterface->Fs().Rename(db,bak);" will fail again. - err2 = err; + err = iInterface.Fs().Rename(iParse.FullName(), dbName); + if(err == KErrNone) + {//commit: delete the backup database file + SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL10, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;Commit;file=%S", (TUint)this, __SQLPRNSTR(dbName))); + (void)iInterface.Fs().Delete(bakDbName); + } + else + {//rollback: restore the original database file + err = iInterface.Fs().Rename(bakDbName, dbName); + SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL11, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;Rollback;file=%S;err=%d", (TUint)this, __SQLPRNSTR(dbName), err)); + } } - // if we got here, we have a backup of the original database in .db.bak - // and the new database in .db - }//end of for(...) - __SQLLEAVE_IF_ERROR(err2); - - // clean up dir - //delete dir; - CleanupStack::PopAndDestroy(dir); - dir=NULL; - - // now delete all the .bak files - // we do this here and not part of the earlier loop - // because we want to make sure that we have a coherent set of database - // files that belong together and not bits of old and new - __SQLLEAVE_IF_ERROR(iInterface->Fs().GetDir(KBackupFilter,KEntryAttNormal,ESortNone,dir)); - CleanupStack::PushL(dir); - SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL6, "0x%X;CSqlBackupClient::RestoreBaseDataSectionL;bak files count=%d", (TUint)this, dir->Count())); - for(TInt a1=0;a1Count();++a1) - { - TEntry entry=(*dir)[a1]; - TPtrC bak=entry.iName.Des(); - __SQLLEAVE_IF_ERROR(iInterface->Fs().Delete(bak)); - } - - // clean up dir - //delete dir; - CleanupStack::PopAndDestroy(dir); - dir=NULL; - done=ETrue; + if(err != KErrNone && err != KErrNotFound) + { + if(restoreErr == KErrNone) + { + restoreErr = err; + } + } + }//for(...) + delete dir; + }//iInterface.Fs().GetDir(...) + done = ETrue; + (void)RestoreCleanup(); + if(restoreErr != KErrNone) + { + __SQLLEAVE(restoreErr); } - else - { - iState=ERestoreExpectChecksum; - } - break; } default: + __ASSERT_DEBUG(EFalse, __SQLPANIC(ESqlPanicInternalError)); break; + }//switch(...) + if((aInBuffer.Size() - inBufferPos) == bytesAvailable) + {//No bytes have been consumed from the buffer. + if(++iterations > 1 && !done) + {//This is the second iteration in the loop where no bytes have been consumed from the input buffer. + //But the "done" flag is still false. Corrupted archive. + __SQLLEAVE(KErrCorrupt); + } } } while(!done); } -/** The operation was terminated - we should tidyup here (as best we can) - Nothing needs to be done for a backup. Restore is more - complicated in the case of an interruption. - What we need to do here is move all the backup files - back to being db files.... +/** +The operation was terminated - we should tidyup here (as best we can) +Backup: close the file, free the allocated memory for the file names. +Restore: since the final restore step is a non-leaving one, nothing special needs to be done here - +RestoreCleanup() is called to close the file and delete if there are any temporary files left. */ -void CSqlBackupClient::TerminateMultiStageOperation() +void CSqlBurCallback::TerminateMultiStageOperation() { - // backup/restore terminated, try to tidy up! Can't leave, can't Panic!!!!! - // rename all the .bak files to .db - CDir *dir=NULL; - TInt rc=iInterface->Fs().GetDir(KBackupFilter,KEntryAttNormal,ESortNone,dir); - SQL_TRACE_BUR(OstTraceExt3(TRACE_INTERNALS, CSQLBACKUPCLIENT_TERMINATEMULTISTAGEOPERATION1, "0x%X;CSqlBackupClient::TerminateMultiStageOperation;Fs().GetDir() err=%d;file count=%d", (TUint)this, rc, rc == KErrNone ? dir->Count() : 0)); - if(KErrNone!=rc) - { - // can't get a file list - can't do anything - return; - } - for(TInt a=0;aCount();++a) - { - TEntry entry=(*dir)[a]; - TPtrC bak=entry.iName.Des(); - TInt len=bak.Length(); - TPtrC db(bak.Left(len-4));//".bak" part excluded - rc=iInterface->Fs().Delete(db); // rename does not overwrite - if(KErrNone == rc) - { - rc = iInterface->Fs().Rename(bak,db); - } - //The function cannot leave or return an error. The only thing which could be done here is to print out something - //and continue with the next file. - if(KErrNone != rc) - { - SQL_TRACE_BUR(OstTraceExt4(TRACE_INTERNALS, CSQLBACKUPCLIENT_TERMINATEMULTISTAGEOPERATION2, "0x%X;CSqlBackupClient::TerminateMultiStageOperation;Fs().Rename() err=%d;bak=%S;db=%S", (TUint)this, rc, __SQLPRNSTR(bak), __SQLPRNSTR(db))); - } - // backup restored ok - } - // cleanup dir - delete dir; + BackupCleanup(); + (void)RestoreCleanup(); } -/** We do our own checksumming so we don't need this - @return the checksum - @param TDriveNumber the drive affected (unused) +/** +We do our own checksumming so we don't need this +@return the checksum +@param aDrive the drive affected (unused) */ -TUint CSqlBackupClient::GetDataChecksum(TDriveNumber /* aDrive */) +TUint CSqlBurCallback::GetDataChecksum(TDriveNumber /* aDrive */) { // not required - not implemented const TUint KArbitraryNumber = 1024; return KArbitraryNumber; } -/** We don't support incremental backup +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////// Incremental backup/restore //////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** +We don't support incremental backup */ -void CSqlBackupClient::GetSnapshotDataL(TDriveNumber /* aDrive */, TPtr8& /* aBuffer */, - TBool& /* aFinishedFlag */) +void CSqlBurCallback::GetSnapshotDataL(TDriveNumber /* aDrive */, TPtr8& /* aBuffer */, TBool& /* aFinishedFlag */) { - // incremental backup not supported __SQLLEAVE(KErrNotSupported); } -/** We don't support incremental backup +/** +We don't support incremental backup */ -void CSqlBackupClient::InitialiseGetBackupDataL(TDriveNumber /* aDrive */) +void CSqlBurCallback::InitialiseGetBackupDataL(TDriveNumber /* aDrive */) { - // incremental backup not supported __SQLLEAVE(KErrNotSupported); } -/** We don't support incremental backup +/** +We don't support incremental backup */ -void CSqlBackupClient::InitialiseRestoreBaseDataL(TDriveNumber /* aDrive */) +void CSqlBurCallback::InitialiseRestoreBaseDataL(TDriveNumber /* aDrive */) { - // incremental backup not supported __SQLLEAVE(KErrNotSupported); } -/** We don't support incremental backup +/** +We don't support incremental backup */ -void CSqlBackupClient::InitialiseRestoreIncrementDataL(TDriveNumber /* aDrive */) +void CSqlBurCallback::InitialiseRestoreIncrementDataL(TDriveNumber /* aDrive */) { - // incremental backup not supported __SQLLEAVE(KErrNotSupported); } -/** We don't support incremental backup +/** +We don't support incremental backup */ -void CSqlBackupClient::RestoreIncrementDataSectionL(TDesC8& /* aBuffer */, TBool /* aFinishedFlag */) +void CSqlBurCallback::RestoreIncrementDataSectionL(TDesC8& /* aBuffer */, TBool /* aFinishedFlag */) { - // incremental backup not supported __SQLLEAVE(KErrNotSupported); } -/** We don't support incremental backup +/** +We don't support incremental backup */ -void CSqlBackupClient::AllSnapshotsSuppliedL() +void CSqlBurCallback::AllSnapshotsSuppliedL() { - // incremental backup not supported - // cannot leave or panic! } -/** We don't support incremental backup +/** +We don't support incremental backup */ -void CSqlBackupClient::ReceiveSnapshotDataL(TDriveNumber /* aDrive */, TDesC8& /* aBuffer */, - TBool /* aFinishedFlag */) +void CSqlBurCallback::ReceiveSnapshotDataL(TDriveNumber /* aDrive */, TDesC8& /* aBuffer */, TBool /* aFinishedFlag */) { - // incremental backup not supported __SQLLEAVE(KErrNotSupported); } -/** - Get a list of database files that need to be backed up - This is decided by the SQL server on the basis of the UID provided - and whether the metadata in the database indicates that this data - should be backed up or not. The list of database files is populated - into the iFileList array. - @leave - @param TSecureSid the UID of the data owner +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////// Helper functions ////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** +A simple checksumming algorithm to allow a degree +of trust that the backup and restore worked. +Note the file pointer will be back at the start when the function call completes successfully. +In case of an error, the position of the file pointer is undetermined. + +@param aOpenFile Already opened database file on which the checksum is calculated. +@param aCheckSum Output parameter. The checksum is returned in this parameter. +@return KErrNoMemory, an out of memory condition has occurred; + Note that the function may also return some other system-wide error codes. */ -void CSqlBackupClient::GetBackupListL(TSecureId aSid) - { - SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPLISTL, "0x%X;CSqlBackupClient::GetBackupListL;aSid=0x%X", (TUint)this, (TUint)aSid.iId)); - // we own the array - the SQL server just populates it - iInterface->GetBackUpListL(aSid,iFileList); - } - -/** A simple checksumming algorithm to allow a degree - of trust that the backup and restore worked - This is visble externally because the test harness - needs to use it - NOTE the file pointer will be back at the - start when this function ends. - @leave - @param RFile64 an OPEN file to checksum -*/ -TUint64 CSqlBackupClient::CheckSumL(const RFile64& aOpenFile) const +TInt CSqlBurCallback::CheckSum(const RFile64& aOpenFile, TUint64& aCheckSum) const { // scoot through the database file building the checksum - TInt64 seekPos=0; // rewind first - __SQLLEAVE_IF_ERROR(aOpenFile.Seek(ESeekStart,seekPos)); - TUint64 total=0; + aCheckSum = 0; + TInt64 seekPos = 0; // rewind first + TInt err = aOpenFile.Seek(ESeekStart, seekPos); + if(err != KErrNone) + { + return err; + } const TUint KCheckSumBlockSize = 4 * 1024; - HBufC8* block=HBufC8::NewLC(KCheckSumBlockSize); - TPtr8 ptr=block->Des(); + HBufC8* buf = HBufC8::New(KCheckSumBlockSize); + if(!buf) + { + return KErrNoMemory; + } + TPtr8 ptr = buf->Des(); for(;;) { - __SQLLEAVE_IF_ERROR(aOpenFile.Read(ptr)); - TInt len=ptr.Length(); - if(len==0) + err = aOpenFile.Read(ptr); + if(err != KErrNone) + { + delete buf; + return err; + } + TInt len = ptr.Length(); + if(len == 0) { break; } // calculate the checksum for(TInt i=0;i> 63); - total += ptr[i]; + aCheckSum = (aCheckSum << 1) | (aCheckSum >> 63); + aCheckSum += ptr[i]; } }; - CleanupStack::PopAndDestroy(block); + delete buf; // restore file position - seekPos=0; - __SQLLEAVE_IF_ERROR(aOpenFile.Seek(ESeekStart,seekPos)); - return total; + seekPos = 0; + err = aOpenFile.Seek(ESeekStart,seekPos); + return err; } -//Reads the content of aInBuf from position aInBufReadPos and stores the data into aOutBuf. -//aDataLen is the length of the data. If the input buffer does not contain all the data, then only the -//available data will be copied to the output buffer. -// -//Attention!!! This function won't work properly if aInBuf parameter contains odd number of bytes!!! -//(a legacy problem, if it is a problem at all, because the B&R engine probably sends the data in chunks with even size) -// -//How the function works. It is called during the restore process and aInBuf parameter contains a block of raw -//data sent by the B&R server. The calling function, RestoreBaseDataSectionL(), uses a state -//machine to processes the incoming data. At particular moment RestoreBaseDataSectionL() will process the data header -//and will have to read "aDataLen" 16-bit characters at position "aInBufReadPos". If there are "aDataLen" characters -//at position "aInBufReadPos" and enough free space in "aOutBuf", CopyBufData() will copy all of them, -//otherwise CopyBufData() will copy as much characters as possible (in which case RestoreBaseDataSectionL() will -//stay in the same state, waiting for more data from the B&R server). -// -void CSqlBackupClient::CopyBufData(const TDesC8& aInBuf, TInt& aInBufReadPos, TDes& aOutBuf, TInt aDataLen) +/** +Reads the content of aInBuf from position aInBufReadPos and stores the data into aOutBuf. +aDataLen is the length of the data. If the input buffer does not contain all the data, then only the +available data will be copied to the output buffer. + +How the function works. It is called during the restore process and aInBuf parameter contains a block of raw +data sent by the B&R server. The calling function, RestoreBaseDataSectionL(), uses a state +machine to processes the incoming data. At particular moment RestoreBaseDataSectionL() will process the data header +and will have to read "aDataLen" 16-bit characters at position "aInBufReadPos". If there are "aDataLen" characters +at position "aInBufReadPos" and enough free space in "aOutBuf", CopyBufData() will copy all of them, +otherwise CopyBufData() will copy as much characters as possible (in which case RestoreBaseDataSectionL() will +stay in the same state, waiting for more data from the B&R server). + +@param aInBuf 8-bit buffer with input data +@param aInBufReadPos The position in the buffer from which the read operation starts. + When the "buffer read" operatio completes, aInBufReadPos is updated with the + number of bytes read from the input buffer. +@param aOutBuf 16-bit output buffer. The data read from the input buffer is stored in the output buffer. +@param aDataLen How much bytes to be read from the input buffer. Note that if there is not enough + data in the input buffer, the function will read as much as possible from the input buffer. + The aInBufReadPos in/out parameter will be updated with the actual number of bytes read. +*/ +void CSqlBurCallback::CopyBufData(const TDesC8& aInBuf, TInt& aInBufReadPos, TDes& aOutBuf, TInt aDataLen) { __ASSERT_DEBUG(aInBufReadPos >= 0, __SQLPANIC(ESqlPanicBadArgument)); __ASSERT_DEBUG(aDataLen > 0, __SQLPANIC(ESqlPanicBadArgument)); - __ASSERT_DEBUG(!(aInBuf.Length() & 0x01), __SQLPANIC(ESqlPanicInternalError)); TInt needed = (aDataLen - aOutBuf.Length()) << K8to16bitShift; TInt available = aInBuf.Size() - aInBufReadPos; @@ -899,3 +1084,59 @@ len >>= K8to16bitShift; aOutBuf.Append((const TUint16*)ptr8.Ptr(), len); } + +/** +Cleans up the allocated during the backup resources - file handles, buffers allocated for the file names. +*/ +void CSqlBurCallback::BackupCleanup() + { + for(TInt i=0;iDelete(allFiles); + delete fm; + } + return err; + } + +/** +Stores the error occured during backup for furhter processing. +Please note that the function asserts if the aError parameter is KErrNone. +Call the function only with a real error. + +@param aError The backup error to be stored +*/ +void CSqlBurCallback::SetBackupError(TInt aError) + { + __ASSERT_DEBUG(aError != KErrNone, __SQLPANIC(ESqlPanicBadArgument)); + if(aError != KErrNotFound && aError != KErrPathNotFound) + { + if(iBackupError == KErrNone || aError == KErrDiskFull || aError == KErrCorrupt) + { + iBackupError = aError; + } + } + } diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/SRC/Server/SqlBur.h --- a/persistentstorage/sql/SRC/Server/SqlBur.h Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/SRC/Server/SqlBur.h Mon Sep 27 11:59:56 2010 +0100 @@ -23,7 +23,48 @@ #include // MactiveBackupDataClient #include "SqlSrvBurInterface.h" -using namespace conn; +//Forward declarations +class CSqlBurCallback; + +#ifdef SQL_BUR_PROPERTY_MONITOR_TEST + +const TInt32 KSqlBurPropertyCategory = 0x10281e17;//the SQL server secure id (the bur tests have the same id, + //in order to be able to operate with the property) +const TUint KSqlBurBackupRestoreKeyValue = 0x1234DDD1; + +extern TInt TestModeSqlBurError; +#define SQL_BUR_TEST_SET_ERROR(err) TestModeSqlBurError = err +//This macro is called at the end of CSqlBurEventMonitor::RunL()and CSqlBurEventMonitor::RunError() +//CActiveScheduler::Stop() is called here to return the execution control back to the test code. +#define SQL_BUR_TEST_STOP() CActiveScheduler::Stop() + +#else + +const TInt32 KSqlBurPropertyCategory = KUidSystemCategoryValue; +const TUint KSqlBurBackupRestoreKeyValue = conn::KUidBackupRestoreKey; + +#define SQL_BUR_TEST_SET_ERROR(err) (void)0 +#define SQL_BUR_TEST_STOP() (void)0 + +#endif + +/** +The system category of the backup and restore property, that is used for notifying active backup clients +regarding beginning or the end of backup or restore process. +Different value is used in SQL tests, because only the secure backup server can set or get the value of +the {KUidSystemCategoryValue, conn::KUidBackupRestoreKey} property. +@internalComponent +*/ +const TUid KSqlBurPropertyCategoryUid = {KSqlBurPropertyCategory}; + +/** +The backup and restore property key, that is used for notifying active backup clients +regarding beginning or the end of backup or restore process. +Different value is used in SQL tests, because only the secure backup server can set or get the value of +the {KUidSystemCategoryValue, conn::KUidBackupRestoreKey} property. +@internalComponent +*/ +const TUint KSqlBurBackupRestoreKey = KSqlBurBackupRestoreKeyValue; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////// Backup database file header format /////////////////// @@ -37,124 +78,151 @@ // 8 chars 8 chars 4 chars 16 chars 8 chars up to 256 characters (512 bytes) // <32-bit checksum><64-bit filesize><32-bit filenamelen> -const TInt KBackupHeaderVersion = 2; //Current backup database file header version +const TInt KSqlBurHeaderVersion = 2; //Current backup database file header version -const TUint32 KMagicNum = 0xFFFFAA55; //Magic number. If the "old database file size" field in the header - //has this value, then the header version is 2+ -const TInt KMaxHeaderSize = 256 + KMaxFileName; //The size of the buffer used for the operations on the header +const TUint32 KSqlBurMagicNum = 0xFFFFAA55; //Magic number. If the "old database file size" field in the header + //has this value, then the header version is 2+ +const TInt KSqlBurMaxHeaderSize = 256 + KMaxFileName; //The size of the buffer used for the operations on the header /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** +An object of this class is created to monitor the backup & restore property +{KUidSystemCategory, KUidBackupRestoreKey}. +If the property gets set, the CSqlBurEventMonitor object will create a CSqlBurClient +instance to handle the backup or restore. -//----------------------------------------- -// CSqlBackupClient -//----------------------------------------- +@internalComponent +*/ +class CSqlBurEventMonitor : public CActive + { +public: + static CSqlBurEventMonitor* NewL(MSqlSrvBurInterface& aBufInterface); + virtual ~CSqlBurEventMonitor(); +#ifdef SQL_BUR_PROPERTY_MONITOR_TEST + inline conn::CActiveBackupClient* ActiveBackupClient(); + inline CSqlBurCallback* SqlBurCallback(); +#endif + +private: + CSqlBurEventMonitor(MSqlSrvBurInterface& aInterface); + void ConstructL(); + virtual void RunL(); + virtual void DoCancel(); + virtual TInt RunError(TInt aError); + void CreateContentL(); + void DestroyContent(); + +private: + RProperty iBurProperty;//B&R property published by the B&R server. SQL server subscribes for notifications + MSqlSrvBurInterface& iBurInterface;//Provided by the SQL server + conn::CActiveBackupClient* iActiveBackupClient;//The connection with the B&R server + CSqlBurCallback* iSqlBurCallback;//A "Database file list" interface provided by the SQL server + + }; + +#ifdef SQL_BUR_PROPERTY_MONITOR_TEST + +inline conn::CActiveBackupClient* CSqlBurEventMonitor::ActiveBackupClient() + { + return iActiveBackupClient; + } + +inline CSqlBurCallback* CSqlBurEventMonitor::SqlBurCallback() + { + return iSqlBurCallback; + } + +#endif /** - This class is called by the Backup and Restore Framework - when a backup or restore is requested by the user - It implements the active proxy backup and restore as - defined in the MActiveBackupDataClient interface. - - @internalComponent +This class is called by the Backup and Restore Framework +when a backup or restore is requested by the user +It implements the active proxy backup and restore as +defined in the MActiveBackupDataClient interface. + +@internalComponent */ - -// derives from the framework mixin MActiveBackupClient -class CSqlBackupClient : public CActive, public MActiveBackupDataClient +class CSqlBurCallback : public CBase, public conn::MActiveBackupDataClient { - public: - static CSqlBackupClient *NewLC(MSqlSrvBurInterface *aBurInterface); - static CSqlBackupClient *NewL(MSqlSrvBurInterface *aBufInterface); - - ~CSqlBackupClient(); - - // AO implementations - void StartL(); - void NotifyChange(); - - // impl of virtuals from MActiveBackupDataClient - void AllSnapshotsSuppliedL(); - void ReceiveSnapshotDataL(TDriveNumber aDrive, TDesC8& aBuffer, TBool aLastSection); - TUint GetExpectedDataSize(TDriveNumber aDrive); - void GetSnapshotDataL(TDriveNumber aDrive, TPtr8& aBuffer, TBool& aFinished); - void InitialiseGetBackupDataL(TDriveNumber aDrive); - void GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished); - void InitialiseRestoreBaseDataL(TDriveNumber aDrive); - void RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished); - void InitialiseRestoreIncrementDataL(TDriveNumber aDrive); - void RestoreIncrementDataSectionL(TDesC8& aBuffer, TBool aFinished); - void RestoreComplete(TDriveNumber aDrive); - void InitialiseGetProxyBackupDataL(TSecureId aSid, TDriveNumber aDrive); - void InitialiseRestoreProxyBaseDataL(TSecureId aSid, TDriveNumber aDrive); - void TerminateMultiStageOperation(); - TUint GetDataChecksum(TDriveNumber aDrive); - - // to validate successful BUR - TUint64 CheckSumL(const RFile64 &aOpenFile) const; - - // for debug - //void SetConsole(CConsoleBase *aConsole); - private: - CSqlBackupClient(MSqlSrvBurInterface *aInterface); - void ConstructL(); - - // active object methods - void RunL(); - void DoCancel(); - TInt RunError(TInt aError); +public: + static CSqlBurCallback* NewL(MSqlSrvBurInterface& aBufInterface); + virtual ~CSqlBurCallback(); + + //Implementations of virtuals from MActiveBackupDataClient - full backup + virtual void InitialiseGetProxyBackupDataL(TSecureId aSid, TDriveNumber aDrive); + virtual TUint GetExpectedDataSize(TDriveNumber aDrive); + virtual void GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished); + + //Implementations of virtuals from MActiveBackupDataClient - full restore + virtual void InitialiseRestoreProxyBaseDataL(TSecureId aSid, TDriveNumber aDrive); + virtual void RestoreComplete(TDriveNumber aDrive); + virtual void RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished); + + virtual void TerminateMultiStageOperation(); + virtual TUint GetDataChecksum(TDriveNumber aDrive); + + //Implementations of virtuals from MActiveBackupDataClient - incremental backup & restore - not supported + virtual void AllSnapshotsSuppliedL(); + virtual void ReceiveSnapshotDataL(TDriveNumber aDrive, TDesC8& aBuffer, TBool aLastSection); + virtual void GetSnapshotDataL(TDriveNumber aDrive, TPtr8& aBuffer, TBool& aFinished); + virtual void InitialiseGetBackupDataL(TDriveNumber aDrive); + virtual void InitialiseRestoreBaseDataL(TDriveNumber aDrive); + virtual void InitialiseRestoreIncrementDataL(TDriveNumber aDrive); + virtual void RestoreIncrementDataSectionL(TDesC8& aBuffer, TBool aFinished); + + // to validate successful BUR + TInt CheckSum(const RFile64 &aOpenFile, TUint64& aCheckSum) const; + +private: + CSqlBurCallback(MSqlSrvBurInterface& aInterface); + void CopyBufData(const TDesC8& aInBuf, TInt& aInBufReadPos, TDes& aOutBuf, TInt aDataLen); + void BackupCleanup(); + TInt RestoreCleanup(); + void SetBackupError(TInt aError); + +private: + + // state machine for backup + enum + { + EBackupNoFileOpen=0, // not currently processing a file + EBackupOpenNothingSent, // file open and ready, but nothing sent yet + EBackupOpenPartHeaderSent, // part of the header is sent, but more remains + EBackupOpenAllHeaderSent, // all of the header is sent, ready to send the data + EBackupEndOfFile // all done, tidy up after backup + }; + + // state machine for restore + // this is more complicated because we are driven by the backup engine + // and have incomplete information most of the time + enum + { + ERestoreExpectChecksum=0, // checksum marks the start of the next file + ERestoreExpectOldFileSize, // the size of the file - backup file header version 0 + ERestoreExpectVersion, // backup header version + ERestoreExpectFileSize, // the size of the file, backup file header version 2+ + ERestoreExpectFileNameSize, // the size of the file name + ERestoreExpectFileName, // the name of the file to restore + ERestoreExpectData, // now for the data + ERestoreComplete // tidy up after restore + }; - // used to determine what the BUR status is and to respond as required - void TestBurStatusL(); - - // this is used to ask the SQL server for a list of databases to backup - // we ask the database server because the decision to backup is not - // only based on the UID but also the database backup flag stored in - // the database metadata - and we don't want to have to know how that - // is implemented - void GetBackupListL(TSecureId aSid); - void CopyBufData(const TDesC8& aInBuf, TInt& aInBufReadPos, TDes& aOutBuf, TInt aDataLen); - - private: - - // state machine for backup - enum - { - EBackupNoFileOpen=0, // not currently processing a file - EBackupOpenNothingSent, // file open and ready, but nothing sent yet - EBackupOpenPartHeaderSent, // part of the header is sent, but more remains - EBackupOpenAllHeaderSent, // all of the header is sent, ready to send the data - EBackupEndOfFile // all done, tidy up after backup - }; - - // state machine for restore - // this is more complicated because we are driven by the backup engine - // and have incomplete information most of the time - enum - { - ERestoreExpectChecksum=0, // checksum marks the start of the next file - ERestoreExpectOldFileSize, // the size of the file - backup file header version 0 - ERestoreExpectVersion, // backup header version - ERestoreExpectFileSize, // the size of the file, backup file header version 2+ - ERestoreExpectFileNameSize, // the size of the file name - ERestoreExpectFileName, // the name of the file to restore - ERestoreExpectData, // now for the data - ERestoreComplete // tidy up after restore - }; - - CActiveBackupClient *iActiveBackupClient; - RProperty iBurProperty;//B&R property published by the B&R server. SQL server subscribes for notifications. - MSqlSrvBurInterface *iInterface; // the SQL server - RArray iFileList; // which is populated by the SQL server - RFile64 iFile; - TInt iFileIndex; - TUint iState; - TBuf iBuffer; // used for the header data - TInt iHeaderSent; // how many header bytes sent so far - TUint32 iChecksum; // used by restore - TInt64 iFileSize; // used by restore - TUint32 iFileNameSize; // used by restore - TBool iAnyData; // set to true if the restore actually sends any data to us - TSecureId iSid; // the sid being backed up/restored + MSqlSrvBurInterface& iInterface; //A "Database file list" interface provided by the SQL server + RArray iFileList; //An array with database file names for backup, provided by the SQL server + RFile64 iFile; //A handle to file being backup/restored. + TInt iFileIndex; //The index of the file name in iFileList being processed at the moment + TUint iState; //Backup or restore state machine - current state + TBuf iBuffer; //Used for the header data + TInt iHeaderSent; //How many header bytes sent so far + TUint32 iChecksum; //Database archive checksum - used by the restore. + TInt64 iFileSize; //Restored database file size - used by the restore. + TUint32 iFileNameSize; //Restored database file name size - used by the restore. + TDriveNumber iRestoreDrive; //The drive where the data is currently restored to. + TSecureId iRestoreId; //The secure id of the client which data is being restored at the moment + TInt iBackupError; //An error occured during the backup processing + TFileName iRestoreDir; //The directory where temporary files will be created during restore. + TParse iParse; }; diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/SRC/Server/SqlSrvBurInterface.h --- a/persistentstorage/sql/SRC/Server/SqlSrvBurInterface.h Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/SRC/Server/SqlSrvBurInterface.h Mon Sep 27 11:59:56 2010 +0100 @@ -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" @@ -20,6 +20,11 @@ /** MSqlSrvBurInterface is needed for performing "Backup&Restore" actions on secure SQL databases. +It is used for retrieving from the SQL server a list with database names, located on a specific drive and +owned by a client with specific TSecureId id. +The returned list contains the full database names, including the path. + +@see CSqlServer::GetBackUpListL() @internalComponent */ @@ -27,7 +32,7 @@ { public: virtual RFs& Fs() = 0; - virtual void GetBackUpListL(TSecureId aUid, RArray& aFileList) = 0; + virtual void GetBackUpListL(TSecureId aUid, TDriveNumber aDrive, RArray& aFileNameList) = 0; }; #endif//__SQLSRVBURINTERFACE_H__ diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/SRC/Server/SqlSrvDatabase.cpp --- a/persistentstorage/sql/SRC/Server/SqlSrvDatabase.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/SRC/Server/SqlSrvDatabase.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -1218,7 +1218,12 @@ TSqlCompactionMode compactionMode = currVacuumMode == ESqliteVacuumOff ? ESqlCompactionManual : ESqlCompactionNotSet; TSqlDbSysSettings dbSettings(iDbHandle); dbSettings.LoadSettingsL(aDbName, storedCollationDllName, storedDbConfigFileVer, compactionMode); - __ASSERT_DEBUG(currVacuumMode == ESqliteVacuumOff ? compactionMode == ESqlCompactionManual : 1, __SQLPANIC(ESqlPanicInternalError)); + if(currVacuumMode == ESqliteVacuumOff && compactionMode != ESqlCompactionManual) + {//The database has been opened and the vacuum mode is "off". Then this is a database, not created by SQL + //server or it is a corrupted database. The compaction mode read from the system table does not match the + //database vacuum mode. Conclusion: this is a corrupted database. + __SQLLEAVE(KErrCorrupt); + } if(aFileData.ContainHandles() && aFileData.IsCreated()) { compactionMode = aFileData.ConfigParams().iCompactionMode; diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/SRC/Server/SqlSrvMain.cpp --- a/persistentstorage/sql/SRC/Server/SqlSrvMain.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/SRC/Server/SqlSrvMain.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -39,6 +39,12 @@ #endif CSqlServer* TheServer = NULL;//The single CSqlServer instance +#ifdef _DEBUG +#define __SQLDEBUG_EXPR(expr) expr +#else +#define __SQLDEBUG_EXPR(expr) +#endif + _LIT(KMatchAllDbFiles, "*"); _LIT(KDefaultICollationDllName, ""); @@ -114,7 +120,7 @@ { SQL_TRACE_INTERNALS(OstTrace1(TRACE_INTERNALS, CSQLSERVER_CSQLSERVER2_ENTRY, "Entry;0x%x;CSqlServer::~CSqlServer", (TUint)this)); delete iCompactor; - delete iBackupClient; + delete iBurEventMonitor; iDriveSpaceCol.ResetAndDestroy(); sqlite3_soft_heap_limit(0);//Set to 0 the soft heap limit iSecurityMap.Close(); @@ -345,7 +351,7 @@ //Create an empty "drive space" collection iDriveSpaceCol.Create(fs); // Create the BUR instance - iBackupClient=CSqlBackupClient::NewL(this); + iBurEventMonitor = CSqlBurEventMonitor::NewL(*this); //Compactor iCompactor = CSqlCompactor::NewL(&SqlCreateCompactConnL, KSqlCompactStepIntervalMs); #ifdef _DEBUG @@ -414,7 +420,9 @@ TParse fileName; TInt err = extdlocale.GetLocaleDllName(ELocaleCollateSetting, fname); if(err!= KErrNone) - iCollationDllName = KDefaultICollationDllName; + { + iCollationDllName = KDefaultICollationDllName; + } else { //only get the file name + extension @@ -435,19 +443,21 @@ TFileName configFilePath(parseDbConfig.FullName()); // get 'drive:\private path\cfg*' search string CDir* entryList = 0; // memory will be allocated for this in GetDir() TInt err = aFs.GetDir(configFilePath, KEntryAttNormal, ESortByName, entryList); - CleanupStack::PushL(entryList); - if(!err) + if(err == KErrNone) { - if(entryList && (entryList->Count() > 0)) + __ASSERT_DEBUG(entryList != NULL, __SQLPANIC(ESqlPanicInternalError)); + CleanupStack::PushL(entryList); + if(entryList->Count() > 0) { iDbConfigFiles = CDbConfigFiles::NewL(*entryList); } + CleanupStack::PopAndDestroy(entryList); } else { SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, CSQLSERVER_CACHEDDBCONFIGFILENAMESL, "0x%X;CSqlServer::CacheDbConfigFileNamesL;GetDir() failed with error code %d", (TUint)this, err)); + __ASSERT_DEBUG(!entryList, __SQLPANIC(ESqlPanicInternalError)); } - CleanupStack::PopAndDestroy(); // entryList } ////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -486,74 +496,74 @@ /** Implements MSqlSrvBurInterface::GetBackupListL(). -Retrieves in aFileList parameter a list of secure database names (full database paths actually) +Retrieves in aFileNameList parameter a list of secure database names (full database names, including path) which security UID matches aUid parameter. -Database files on ROM drive(s) won't be put in aFileList. +No databases will be included into the list, if the drive is read-only. @param aUid Database security UID. -@param aFileList An output parameter. If the function completes successfully, then aFileList will be filled - with all secure database file names which security UID matches aUid parameter. - Database files on ROM drive(s) won't be put in aFileList. +@param aDrive The drive where the database search will be performed, in the SQL server private data cage. +@param aFileNameList An output parameter. + Each array entry represents the full name of a database in SQL server private data cage + on the specified drive (aDrive), which uid matches the aUid parameter. @leave KErrNoMemory, an out of memory condition has occured; Note that the function may leave also with some other database specific or OS specific error codes. */ -void CSqlServer::GetBackUpListL(TSecureId aUid, RArray& aFileList) +void CSqlServer::GetBackUpListL(TSecureId aUid, TDriveNumber aDrive, RArray& aFileNameList) { - SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, CSQLSERVER_GETBACKUPLISTL_ENTRY, "Entry;0x%x;CSqlServer::GetBackUpListL;aUid=0x%X", (TUint)this, (TUint)aUid.iId)); - aFileList.Reset(); - TFindFile findFile(iFileData.Fs()); - CDir* fileNameCol = NULL; + SQL_TRACE_INTERNALS(OstTraceExt3(TRACE_INTERNALS, CSQLSERVER_GETBACKUPLISTL_ENTRY, "Entry;0x%x;CSqlServer::GetBackUpListL;aDrive=%d;aUid=0x%X", (TUint)this, (TInt)aDrive, (TUint)aUid.iId)); + __ASSERT_DEBUG(aFileNameList.Count() == 0, __SQLPANIC(ESqlPanicBadArgument)); + RFs& fs = iFileData.Fs(); + //No files in the list if aDrive is a read-only drive + TDriveInfo driveInfo; + __SQLLEAVE_IF_ERROR(fs.Drive(driveInfo, aDrive)); + if(driveInfo.iDriveAtt & KDriveAttRom) + { + return; + } + //Compose the search path + TDriveUnit driveUnit(aDrive); + TDriveName driveName = driveUnit.Name(); + TFileName path; + path.Copy(driveName); + path.Append(iFileData.PrivatePath()); + //Include the aUid and the "*" mask TUidName uidName = (static_cast (aUid)).Name(); TBuf fileNameMask(uidName); fileNameMask.Append(KMatchAllDbFiles); - //Find all files which name is matching "[aUid]*" pattern. - TInt err = findFile.FindWildByDir(fileNameMask, iFileData.PrivatePath(), fileNameCol); - if(err == KErrNone) + TParse parse; + __SQLLEAVE_IF_ERROR(parse.Set(path, &fileNameMask, NULL)); + //Do the search + TPtrC fullPath(parse.FullName()); + SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, CSQLSERVER_GETBACKUPLISTL_FULLPATH, "Exit;0x%x;CSqlServer::GetBackUpListL;fullPath=%S", (TUint)this, __SQLPRNSTR(fullPath))); + CDir* fileNameCol = NULL; + TInt err = fs.GetDir(fullPath, KEntryAttNormal, ESortNone, fileNameCol); + if(err == KErrNotFound) { - //The first set of files, which name is matching "[aUid]*" pattern, is ready. - do - { - __ASSERT_DEBUG(fileNameCol != NULL, __SQLPANIC(ESqlPanicInternalError)); - CleanupStack::PushL(fileNameCol); - const TDesC& file = findFile.File();//"file" variable contains the drive and the path. the file name in "file" is invalid in this case. - //Check that the drive, where the database files are, is not ROM drive - TParse parse; - (void)parse.Set(file, NULL, NULL);//this call can't file, the file name comes from findFile call. - TPtrC driveName = parse.Drive(); - __ASSERT_DEBUG(driveName.Length() > 0, __SQLPANIC(ESqlPanicInternalError)); - TInt driveNumber = -1; - __SQLLEAVE_IF_ERROR(RFs::CharToDrive(driveName[0], driveNumber)); - TDriveInfo driveInfo; - __SQLLEAVE_IF_ERROR(iFileData.Fs().Drive(driveInfo, static_cast (driveNumber))); - //If current drive is not ROM drive then process the files - if(!(driveInfo.iDriveAtt & KDriveAttRom)) - { - TInt cnt = fileNameCol->Count(); - //For each found database file, which name is matching "[aUid]*" pattern, do: - for(TInt i=0;iCount(); + __SQLLEAVE_IF_ERROR(aFileNameList.Reserve(fileCount)); + //Append the full database file paths to the file names list. + for(TInt i=0;i& aFileList); + virtual void GetBackUpListL(TSecureId aUid, TDriveNumber aDrive, RArray& aFileNameList); private: CSqlServer(); @@ -96,7 +96,7 @@ TSqlSrvFileData iFileData; //Used as a temporary storage for file data (file name, drive, path, secure uid) RSqlSecurityMap iSecurityMap; //Collection of database security policies RSqlDriveSpaceCol iDriveSpaceCol; //Collection of "drive space" objects (reserved drive space management) - CSqlBackupClient* iBackupClient; // the backup and restore instance + CSqlBurEventMonitor* iBurEventMonitor;//Monitors B&R events TFileName iCollationDllName;//Default collation - dll name - uniquely identifies the collation method RSqlBufFlat iFlatBuf; //general purpose flat buffer. do not keep a state in it between calls! TUint8* iBuf; //general purpose buffer. do not keep a state in it between calls! diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/SRC/Server/SqlSrvStatement.cpp --- a/persistentstorage/sql/SRC/Server/SqlSrvStatement.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/SRC/Server/SqlSrvStatement.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -67,7 +67,8 @@ */ void HSqlSrvStmtParamBuf::DoSynchL() { - if(iSynchDone || !iAlive || iStatementFinalized || iBufType != HSqlSrvStmtParamBuf::EBufIpcStream) + TBool dontSynch = iSynchDone || !iAlive || iStatementFinalized || iBufType != HSqlSrvStmtParamBuf::EBufIpcStream; + if(dontSynch) { return; } diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/SRC/Server/SqlSrvStatement.inl --- a/persistentstorage/sql/SRC/Server/SqlSrvStatement.inl Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/SRC/Server/SqlSrvStatement.inl Mon Sep 27 11:59:56 2010 +0100 @@ -88,7 +88,12 @@ iBuf->ResizeL(aData.Length()); iBuf->Write(0, aData); //If the size is 0, then return KNullDesC8, where an empty string is hold, not a null one ("" instead of NULL) - return iBuf->Size() == 0 ? KNullDesC8() : iBuf->Ptr(0); + // was return iBuf->Size() == 0 ? KNullDesC8() : iBuf->Ptr(0); + if (iBuf->Size() == 0) + { + return KNullDesC8(); + } + return iBuf->Ptr(0); } /** @@ -102,7 +107,12 @@ { __ASSERT_DEBUG(iBuf != NULL, __SQLPANIC(ESqlPanicInvalidObj)); //If the size is 0, then return KNullDesC8, where an empty string is hold, not a null one ("" instead of NULL) - return iBuf->Size() == 0 ? KNullDesC8() : iBuf->Ptr(0); + // was return iBuf->Size() == 0 ? KNullDesC8() : iBuf->Ptr(0); + if (iBuf->Size() == 0) + { + return KNullDesC8(); + } + return iBuf->Ptr(0); } /** diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/SRC/Server/SqlSrvStatementUtil.cpp --- a/persistentstorage/sql/SRC/Server/SqlSrvStatementUtil.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/SRC/Server/SqlSrvStatementUtil.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -270,10 +270,7 @@ TInt err = sqlite3_exec(aDbHandle, reinterpret_cast (aSqlStmt.Ptr()), NULL, NULL, NULL); err = ::Sql2OsErrCode(err, sqlite3SymbianLastOsError()); - if(err == KSqlAtEnd) - { - err = KErrNone; - } + __ASSERT_DEBUG(err != KSqlAtEnd, __SQLPANIC2(ESqlPanicInternalError)); SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, DBEXECSTMT8_EXIT, "Exit;0x%X;DbExecStmt8;err=%d", (TUint)aDbHandle, err)); return err; } @@ -876,20 +873,22 @@ { startTicks = User::FastCounter(); } + while((err = sqlite3_step(stmtHandle)) == SQLITE_ROW) - { - ++aProcessedPageCount; - if(aMaxTime > 0 && IsCompactTimeLimitReached(startTicks, User::FastCounter(), aMaxTime)) - { - err = SQLITE_DONE;//The statement execution did not complete because of the time limit - break; - } - } - if(err == SQLITE_ERROR) //It may be "out of memory" problem - { - err = sqlite3_reset(stmtHandle); - __ASSERT_DEBUG(err != SQLITE_OK, __SQLPANIC2(ESqlPanicInternalError)); - } + { + ++aProcessedPageCount; + if(aMaxTime > 0 && IsCompactTimeLimitReached(startTicks, User::FastCounter(), aMaxTime)) + { + err = SQLITE_DONE;//The statement execution did not complete because of the time limit + break; + } + } + + if(err == SQLITE_ERROR) //It may be "out of memory" problem + { + err = sqlite3_reset(stmtHandle); + __ASSERT_DEBUG(err != SQLITE_OK, __SQLPANIC2(ESqlPanicInternalError)); + } } (void)sqlite3_finalize(stmtHandle);//sqlite3_finalize() fails only if an invalid statement handle is passed. } diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/t_dummyabclient.cpp --- a/persistentstorage/sql/TEST/t_dummyabclient.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/t_dummyabclient.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -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" @@ -17,6 +17,10 @@ #include "connect/abclient.h" +//The CActiveBackupClient implementation here is used by t_sqlbur and t_sqlbur2 tests. +//These 2 tests don't link agains the real secure backup client dll, so they use the +//CActiveBackupClient implementation here. + namespace conn { diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/t_sqlbur.cpp --- a/persistentstorage/sql/TEST/t_sqlbur.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/t_sqlbur.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -25,45 +25,93 @@ RTest TheTest(_L("SQL Backup and Restore Test")); -_LIT(KPrivateDir, "C:\\private\\10281e17\\"); +_LIT(KPrivateDir, "\\private\\10281e17\\"); -const TUid KClientUid = {0x21212122}; // the data owner's UID +//Don't forget to update DeleteBackupFiles() implementation if a new uid is added +const TSecureId KClientUid = 0x21212122; // the data owner's UID +const TSecureId KZeroFileSizeUid = 0xFFFF4321; +const TSecureId KTestClientUid1 = 0xFFFF4322; +const TSecureId KTestClientUid2 = 0xFFFF4323; +const TSecureId KTestClientUid3 = 0xFFFF4324; _LIT(KBackupDir, "C:\\TEST\\"); -_LIT(KBackupFile, "C:\\TEST\\Backup.bak"); +_LIT(KBackupFileTemplate, "C:\\TEST\\Backup.bak"); +_LIT(KBackupCopy, "C:\\TEST\\Backup2.bak"); _LIT(KBackupFile2Z, "Z:\\TEST\\t_sqlbur_backup_ver0.bak"); _LIT(KBackupFile2, "C:\\TEST\\t_sqlbur_backup_ver0.bak"); +_LIT(KZeroSizeFile, "C:\\private\\10281e17\\[FFFF4321]t_sqlbur_zero.db"); +_LIT(KTestFile1, "C:\\private\\10281e17\\[FFFF4322]t_sqlbur_test1.db"); +_LIT(KTestFile1NameOnly, "[FFFF4322]t_sqlbur_test1.db"); +_LIT(KTestFile1Bak, "C:\\private\\10281e17\\bak[FFFF4322]t_sqlbur_test1.db.bak"); +_LIT(KTestDeleteMask1, "C:\\private\\10281e17\\[FFFF4322]*"); +_LIT(KTestDeleteMask2, "*bur_test1.db"); +_LIT(KTestFile2, "\\private\\10281e17\\[FFFF4323]t_sqlbur_test2.db"); +_LIT(KTestFile3, "c:\\private\\10281e17\\[FFFF4324]t_sqlbur_test3.db"); +_LIT(KTestFile4, "c:\\private\\10281e17\\[FFFF4324]t_sqlbur_test4.db"); + +const TDriveNumber KTestDrive = EDriveC; + const TUint KBufferSize = 2048; // used for reading backup files for validation static CActiveScheduler* TheScheduler = NULL; -static CSqlBurTestHarness* TheTestHarness = NULL; +static CSqlSrvTestBurInterface* TheSqlSrvTestBurInterface = NULL; ///////////////////////////////////// -const TInt KMaxDbFileSize = 10 * 1024;//The max test db file size -const TInt KTestDbFileCnt = 2; - //Test db files -_LIT(KTestFileName1,"[21212122]AADB2.db");//Created outside this test app -_LIT(KTestFileName2,"[21212122]BBDB2.db");//Created outside this test app _LIT(KTestDbFileName1,"C:[21212122]AADB2.db"); _LIT(KTestDbFileName2,"C:[21212122]BBDB2.db"); -const TPtrC KTestFileNames[KTestDbFileCnt] = {KTestFileName1(), KTestFileName2()}; - -static TInt TheDbFileSizes[KTestDbFileCnt];//An array where the real db file size will be stored -static TUint8 TheDbFileData[KTestDbFileCnt][KMaxDbFileSize];//An array where the original db file content will be stored +//Temp buffers for storing files content, to be compared with what is received after the restore operation. 10 files max. +TInt TheFileCount = 0; +const TInt KMaxDbFileSize = 10 * 1024;//The max test db file size - 10 Kb max. +static TUint8 TheDbFileData[10][KMaxDbFileSize];//An array where the original db file content will be stored +static TInt TheDbFileSizes[10];//An array where the real db file size will be stored static TUint8 TheBuf[KMaxDbFileSize]; ///////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////// +void DeleteBackupFiles() + { + TFileName fname; + + fname.Copy(KBackupFileTemplate); + fname.Append((static_cast (KClientUid)).Name()); + (void)TheSqlSrvTestBurInterface->Fs().Delete(fname); + + fname.Copy(KBackupFileTemplate); + fname.Append((static_cast (KZeroFileSizeUid)).Name()); + (void)TheSqlSrvTestBurInterface->Fs().Delete(fname); + + fname.Copy(KBackupFileTemplate); + fname.Append((static_cast (KTestClientUid1)).Name()); + (void)TheSqlSrvTestBurInterface->Fs().Delete(fname); + + fname.Copy(KBackupFileTemplate); + fname.Append((static_cast (KTestClientUid2)).Name()); + (void)TheSqlSrvTestBurInterface->Fs().Delete(fname); + + fname.Copy(KBackupFileTemplate); + fname.Append((static_cast (KTestClientUid3)).Name()); + (void)TheSqlSrvTestBurInterface->Fs().Delete(fname); + } + void TestEnvDestroy() { - delete TheTestHarness; - TheTestHarness = NULL; + (void)TheSqlSrvTestBurInterface->Fs().Delete(KBackupCopy); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1Bak); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile3); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile4); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KZeroSizeFile); + + DeleteBackupFiles(); + + delete TheSqlSrvTestBurInterface; + TheSqlSrvTestBurInterface = NULL; delete TheScheduler; TheScheduler = NULL; @@ -96,32 +144,40 @@ /////////////////////////////////////////////////////////////////////////////////////// -//CSqlBurTestHarness - test implementation of the MSqlSrvBurInterface, implemented in the production code by the SQL server. -CSqlBurTestHarness *CSqlBurTestHarness::New() +static void DestroyFileList(RArray& aFileList) { - CSqlBurTestHarness* self = new CSqlBurTestHarness; + for(TInt i=0;iConstruct(); return self; } -CSqlBurTestHarness::CSqlBurTestHarness() +CSqlSrvTestBurInterface::CSqlSrvTestBurInterface() { } -void CSqlBurTestHarness::Construct() +void CSqlSrvTestBurInterface::Construct() { TInt err = iFs.Connect(); TEST2(err, KErrNone); err = iFs.MkDir(KBackupDir); TEST(err == KErrNone || err == KErrAlreadyExists); - err = iFs.CreatePrivatePath(EDriveC); + err = iFs.CreatePrivatePath(KTestDrive); TEST2(err, KErrNone); } -CSqlBurTestHarness::~CSqlBurTestHarness() +CSqlSrvTestBurInterface::~CSqlSrvTestBurInterface() { - (void)iFs.Delete(KBackupFile); iFs.Close(); } @@ -129,51 +185,57 @@ //The array is owned by the caller //The SQL server would have the job to get a list of databases owned by //the given SID and to determine whether the backup flag is set -//All databases that satisfy this requirement will be added to the array -void CSqlBurTestHarness::GetBackUpListL(TSecureId aUid, RArray& aFileList) +//All databases that satisfy this requirement will be added to the array. +void CSqlSrvTestBurInterface::GetBackUpListL(TSecureId aUid, TDriveNumber aDrive, RArray& aFileList) { if(aUid.iId == 0) {//Simulates that there are no databases for backup - aFileList.Reset(); + DestroyFileList(aFileList); return; } - //TheTest.Printf(_L("Getting backup file list for SID=%x\r\n"),aUid); - for(TInt i=0;i (aUid)).Name(); + _LIT(KMatchAllDbFiles, "*"); + TBuf fileNameMask(uidName); + fileNameMask.Append(KMatchAllDbFiles); + TParse parse; + TInt err = parse.Set(path, &fileNameMask, NULL); + User::LeaveIfError(err); + //Do the search + TPtrC fullPath(parse.FullName()); + CDir* fileNameCol = NULL; + err = TheSqlSrvTestBurInterface->Fs().GetDir(fullPath, KEntryAttNormal, ESortNone, fileNameCol); + if(err == KErrNotFound) { - TParse parse; - parse.Set(KTestFileNames[i], &KPrivateDir, NULL); - aFileList.AppendL(parse); + return; } - } - -//Notification that a backup is starting -TBool CSqlBurTestHarness::StartBackupL(const RArray& /*aFileList*/) - { - //TheTest.Printf(_L("Start \"backup\". %d files in the list.\r\n"), aFileList.Count()); - return ETrue; + User::LeaveIfError(err); + CleanupStack::PushL(fileNameCol); + TInt fileCount = fileNameCol->Count(); + err = aFileList.Reserve(fileCount); + User::LeaveIfError(err); + //Append the full database file paths to the file names list. + for(TInt i=0;i& /*aFileList*/) - { - //TheTest.Printf(_L("End \"backup\". %d files in the list.\r\n"), aFileList.Count()); - } - -//Notification that a restore is starting -TBool CSqlBurTestHarness::StartRestoreL(TSecureId /*aUid*/) - { - //TheTest.Printf(_L("Start \"restore\" for UID=%X\r\n"), aUid); - return ETrue; - } - -//Notification that a restore has ended -void CSqlBurTestHarness::EndRestore(TSecureId /*aUid*/) - { - //TheTest.Printf(_L("End \"restore\" for UID=%X\r\n"), aUid); - } - //Returns the file system resource handle to the caller. -RFs& CSqlBurTestHarness::Fs() +RFs& CSqlSrvTestBurInterface::Fs() { return iFs; } @@ -195,18 +257,54 @@ CActiveScheduler::Install(TheScheduler); - TheTestHarness = CSqlBurTestHarness::New(); - TEST(TheTestHarness != NULL); + TheSqlSrvTestBurInterface = CSqlSrvTestBurInterface::New(); + TEST(TheSqlSrvTestBurInterface != NULL); + } + +void PrepareSearchPath(TDriveNumber aDrive, TDes& aPath) + { + TDriveUnit driveUnit(aDrive); + TDriveName driveName = driveUnit.Name(); + aPath.Copy(driveName); + aPath.Append(KPrivateDir); + } + +void PrepareSearchPattern(const TDesC& aPath, TSecureId aUid, TParse& aParse) + { + TUidName uidName = (static_cast (aUid)).Name(); + _LIT(KMatchAllDbFiles, "*"); + TBuf fileNameMask(uidName); + fileNameMask.Append(KMatchAllDbFiles); + TInt err = aParse.Set(aPath, &fileNameMask, NULL); + TEST2(err, KErrNone); } //Reads the content of the db files and stores the content to a global memory buffer. //That buffer content will be used later for verification of the restore process. -void StoreDbContentToBuf(RFs& aFs) +void StoreDbContentToBuf(RFs& aFs, TDriveNumber aDrive, TSecureId aUid) { - for(TInt i=0;iCount(); + for(TInt i=0;iCount()); + for(TInt i=0;i 0); + const ::TEntry& entry = (*dir)[i]; + err = parse.Set(path, &entry.iName, NULL); + TEST2(err, KErrNone); + TPtrC fname(parse.FullName()); + RFile dbFile; - TInt err = dbFile.Open(aFs, KTestFileNames[i], EFileRead); + TInt err = dbFile.Open(aFs, fname, EFileRead); TEST2(err, KErrNone); TInt fileSize = 0; err = dbFile.Size(fileSize); TEST2(err, KErrNone); TEST(fileSize > 0); - TEST(TheDbFileSizes[i] == fileSize); + TEST2(TheDbFileSizes[i], fileSize); TPtr8 bufptr(TheBuf, 0, KMaxDbFileSize); err = dbFile.Read(bufptr, fileSize); TEST2(err, KErrNone); - TEST(fileSize == bufptr.Length()); + TEST2(fileSize, bufptr.Length()); err = Mem::Compare(TheBuf, fileSize, TheDbFileData[i], TheDbFileSizes[i]); TEST2(err, 0); dbFile.Close(); } + delete dir; } //////////////////////////////////////////////////////////////////////////////////////// @@ -261,13 +375,17 @@ //The backup client will return a series of data chunks representing //one of more databases for the uid of the data owner. //This data is stored in a file on the C drive for the purposes of the test -TInt TestBackupL(CSqlBackupClient &aBackupClient, RFs& aFs, TInt aDataChunkSize = KBufferSize) +TInt TestBackupL(CSqlBurCallback &aBackupClient, RFs& aFs, TSecureId aUid, TDriveNumber aDrive, TInt aDataChunkSize = KBufferSize) { + TFileName backupFileName; + backupFileName.Copy(KBackupFileTemplate); + backupFileName.Append((static_cast (aUid)).Name()); + RFile file; CleanupClosePushL(file); - TInt err = file.Replace(aFs, KBackupFile, EFileWrite | EFileStream | EFileShareExclusive); + TInt err = file.Replace(aFs, backupFileName, EFileWrite | EFileStream | EFileShareExclusive); User::LeaveIfError(err); - aBackupClient.InitialiseGetProxyBackupDataL(KClientUid, EDriveC); + aBackupClient.InitialiseGetProxyBackupDataL(aUid, aDrive); TBuf8 buf; TPtr8 ptr((TUint8*)buf.Ptr(), aDataChunkSize); @@ -290,7 +408,7 @@ { User::Leave(KErrEof); } - if(!FileExists(aFs, KBackupFile)) + if(!FileExists(aFs, backupFileName)) { User::Leave(KErrNotFound); } @@ -300,13 +418,17 @@ //This sends the data in chunks form back to the BUR client //for nupacking and restoration of the original databases files -TInt TestRestoreL(CSqlBackupClient &aRestoreClient, RFs& aFs, TInt aDataChunkSize = KBufferSize) +TInt TestRestoreL(CSqlBurCallback &aRestoreClient, RFs& aFs, TSecureId aUid, TDriveNumber aDrive, TInt aDataChunkSize = KBufferSize) { + TFileName backupFileName; + backupFileName.Copy(KBackupFileTemplate); + backupFileName.Append((static_cast (aUid)).Name()); + RFile file; CleanupClosePushL(file); - TInt err = file.Open(aFs, KBackupFile, EFileRead | EFileShareExclusive); + TInt err = file.Open(aFs, backupFileName, EFileRead | EFileShareExclusive); User::LeaveIfError(err); - aRestoreClient.InitialiseRestoreProxyBaseDataL(KClientUid, EDriveC); + aRestoreClient.InitialiseRestoreProxyBaseDataL(aUid, aDrive); TBuf8 buf; TPtr8 ptr((TUint8*)buf.Ptr(), aDataChunkSize); @@ -330,31 +452,28 @@ CleanupStack::PopAndDestroy(&file); - aRestoreClient.RestoreComplete(EDriveC); + aRestoreClient.RestoreComplete(aDrive); if(!finishedFlag) { User::Leave(KErrEof); } - for(TInt i=0;i (aUid)).Name()); - TInt err = bkpFile.Open(aFs, KBackupFile, EFileRead | EFileShareExclusive); + TInt err = bkpFile.Open(aFs, backupFileName, EFileRead | EFileShareExclusive); User::LeaveIfError(err); TBuf8 buf; @@ -473,9 +592,11 @@ bkpFileSize -= fileSize; // checksum the file - TUint32 dbChecksum = aBackupClient.CheckSumL(dbFile) & 0xFFFFFFFF; + TUint64 checkSum64 = 0; + User::LeaveIfError(aBackupClient.CheckSum(dbFile, checkSum64)); + TUint32 checksum32 = checkSum64 & 0xFFFFFFFF; - if(checksum != dbChecksum) + if(checksum != checksum32) { User::Leave(KErrCorrupt); } @@ -503,34 +624,30 @@ */ void FunctionalTest() { - TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4002 Backup: functional test ")); - - CSqlBackupClient* backupClient = NULL; - TRAPD(err, backupClient = CSqlBackupClient::NewL(TheTestHarness)); + CSqlBurCallback* backupClient = NULL; + TRAPD(err, backupClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface)); TEST(backupClient != NULL); //////////////////////////////////////// - - const TDriveNumber KDrive = EDriveC; //Virtual functions - with default implementation - (void)backupClient->GetExpectedDataSize(KDrive); + (void)backupClient->GetExpectedDataSize(KTestDrive); - (void)backupClient->GetDataChecksum(KDrive); + (void)backupClient->GetDataChecksum(KTestDrive); TBool finished = EFalse; TPtr8 ptr(0, 0, 0); - TRAP(err, backupClient->GetSnapshotDataL(KDrive, ptr, finished)); + TRAP(err, backupClient->GetSnapshotDataL(KTestDrive, ptr, finished)); TEST2(err, KErrNotSupported); - TRAP(err, backupClient->InitialiseGetBackupDataL(KDrive)); + TRAP(err, backupClient->InitialiseGetBackupDataL(KTestDrive)); TEST2(err, KErrNotSupported); - TRAP(err, backupClient->InitialiseRestoreBaseDataL(KDrive)); + TRAP(err, backupClient->InitialiseRestoreBaseDataL(KTestDrive)); TEST2(err, KErrNotSupported); - TRAP(err, backupClient->InitialiseRestoreIncrementDataL(KDrive)); + TRAP(err, backupClient->InitialiseRestoreIncrementDataL(KTestDrive)); TEST2(err, KErrNotSupported); TPtrC8 ptr2(KNullDesC8); @@ -540,7 +657,7 @@ TRAP(err, backupClient->AllSnapshotsSuppliedL()); TEST2(err, KErrNone); - TRAP(err, backupClient->ReceiveSnapshotDataL(KDrive, ptr2, finished)); + TRAP(err, backupClient->ReceiveSnapshotDataL(KTestDrive, ptr2, finished)); TEST2(err, KErrNotSupported); backupClient->TerminateMultiStageOperation(); @@ -548,45 +665,47 @@ //////////////////////////////////////// TInt bytesStored = 0; - TRAP(err, bytesStored = TestBackupL(*backupClient, TheTestHarness->Fs())); + TRAP(err, bytesStored = TestBackupL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KClientUid, KTestDrive)); TEST2(err, KErrNone); TheTest.Next(_L("Archive integrity test")); - TRAP(err, TestArchiveIntegrityL(*backupClient, TheTestHarness->Fs())); + TRAP(err, TestArchiveIntegrityL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KClientUid)); TEST2(err, KErrNone); delete backupClient; TheTest.Next(_L("Restore: functional test")); - CSqlBackupClient* restoreClient = NULL; - TRAP(err, restoreClient = CSqlBackupClient::NewL(TheTestHarness)); + CSqlBurCallback* restoreClient = NULL; + TRAP(err, restoreClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface)); TEST(restoreClient != NULL); TInt bytesRestored = 0; - TRAP(err, bytesRestored = TestRestoreL(*restoreClient, TheTestHarness->Fs())); + TRAP(err, bytesRestored = TestRestoreL(*restoreClient, TheSqlSrvTestBurInterface->Fs(), KClientUid, KTestDrive)); TEST2(err, KErrNone); TEST(bytesRestored == bytesStored); delete restoreClient; - CompareDbContentWithBuf(TheTestHarness->Fs()); + CompareDbContentWithBuf(TheSqlSrvTestBurInterface->Fs(), KTestDrive, KClientUid); } -TInt DoBackupL() +TInt DoBackupL(TDriveNumber aDrive, TSecureId aUid) { - CSqlBackupClient* backupClient = CSqlBackupClient::NewLC(TheTestHarness); - TInt bytesStored = TestBackupL(*backupClient, TheTestHarness->Fs()); + CSqlBurCallback* backupClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface); + CleanupStack::PushL(backupClient); + TInt bytesStored = TestBackupL(*backupClient, TheSqlSrvTestBurInterface->Fs(), aUid, aDrive); CleanupStack::PopAndDestroy(backupClient); return bytesStored; } -TInt DoRestoreL() +TInt DoRestoreL(TDriveNumber aDrive, TSecureId aUid) { - CSqlBackupClient* restoreClient = CSqlBackupClient::NewLC(TheTestHarness); - TInt bytesRestored = TestRestoreL(*restoreClient, TheTestHarness->Fs()); + CSqlBurCallback* restoreClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface); + CleanupStack::PushL(restoreClient); + TInt bytesRestored = TestRestoreL(*restoreClient, TheSqlSrvTestBurInterface->Fs(), aUid, aDrive); CleanupStack::PopAndDestroy(restoreClient); return bytesRestored; } @@ -606,7 +725,6 @@ void OomTest() { /////////////////////////////////////////////////////////////////////////////// - TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4003 Backup: OOM test ")); TInt err = KErrNoMemory; TInt bytesStored = 0; TInt count = 0; @@ -619,7 +737,7 @@ User::__DbgMarkStart(RHeap::EUser); User::__DbgSetAllocFail(RHeap::EUser,RHeap::EFailNext, count); - TRAP(err, bytesStored = DoBackupL()); + TRAP(err, bytesStored = DoBackupL(KTestDrive, KClientUid)); User::__DbgMarkEnd(RHeap::EUser, 0); TInt endProcessHandleCount; @@ -645,7 +763,7 @@ User::__DbgMarkStart(RHeap::EUser); User::__DbgSetAllocFail(RHeap::EUser,RHeap::EFailNext, count); - TRAP(err, bytesRestored = DoRestoreL()); + TRAP(err, bytesRestored = DoRestoreL(KTestDrive, KClientUid)); User::__DbgMarkEnd(RHeap::EUser, 0); TInt endProcessHandleCount; @@ -659,9 +777,9 @@ User::__DbgSetAllocFail(RHeap::EUser, RAllocator::ENone, 0); TheTest.Printf(_L("OOM restore test succeeded at heap failure rate of %d\r\n"), count); - TEST(bytesStored == bytesRestored); + TEST2(bytesStored, bytesRestored); - CompareDbContentWithBuf(TheTestHarness->Fs()); + CompareDbContentWithBuf(TheSqlSrvTestBurInterface->Fs(), KTestDrive, KClientUid); } /** @@ -678,8 +796,6 @@ */ void FunctionalTest2() { - TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4143 Backup&Restore: functional test 2")); - TTime now; now.UniversalTime(); TInt64 seed = now.Int64(); @@ -700,32 +816,32 @@ for(TInt i=0;iFs(), dataChunks[i])); + TRAP(err, bytesStored = TestBackupL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KClientUid, KTestDrive, dataChunks[i])); TEST2(err, KErrNone); - TRAP(err, TestArchiveIntegrityL(*backupClient, TheTestHarness->Fs())); + TRAP(err, TestArchiveIntegrityL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KClientUid)); TEST2(err, KErrNone); delete backupClient; - CSqlBackupClient* restoreClient = NULL; - TRAP(err, restoreClient = CSqlBackupClient::NewL(TheTestHarness)); + CSqlBurCallback* restoreClient = NULL; + TRAP(err, restoreClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface)); TEST(restoreClient != NULL); TInt bytesRestored = 0; - TRAP(err, bytesRestored = TestRestoreL(*restoreClient, TheTestHarness->Fs(), dataChunks[i])); + TRAP(err, bytesRestored = TestRestoreL(*restoreClient, TheSqlSrvTestBurInterface->Fs(), KClientUid, KTestDrive, dataChunks[i])); TEST2(err, KErrNone); TEST(bytesRestored == bytesStored); delete restoreClient; - CompareDbContentWithBuf(TheTestHarness->Fs()); + CompareDbContentWithBuf(TheSqlSrvTestBurInterface->Fs(), KTestDrive, KClientUid); } } @@ -743,24 +859,22 @@ */ void LegacyFileFormatTest() { - TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4144 Backup&Restore: legacy file format test")); - //KBackupFile2 is a database backup file with header version 0. - (void)TheTestHarness->Fs().Delete(KBackupFile2); - TInt rc = BaflUtils::CopyFile(TheTestHarness->Fs(), KBackupFile2Z, KBackupFile2); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KBackupFile2); + TInt rc = BaflUtils::CopyFile(TheSqlSrvTestBurInterface->Fs(), KBackupFile2Z, KBackupFile2); TEST2(rc, KErrNone); - (void)TheTestHarness->Fs().SetAtt(KBackupFile2, 0, KEntryAttReadOnly); + (void)TheSqlSrvTestBurInterface->Fs().SetAtt(KBackupFile2, 0, KEntryAttReadOnly); //Restore the databases from KBackupFile2. - CSqlBackupClient* restoreClient = NULL; - TRAP(rc, restoreClient = CSqlBackupClient::NewL(TheTestHarness)); + CSqlBurCallback* restoreClient = NULL; + TRAP(rc, restoreClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface)); TEST(restoreClient != NULL); RFile file; - rc = file.Open(TheTestHarness->Fs(), KBackupFile2, EFileRead | EFileShareExclusive); + rc = file.Open(TheSqlSrvTestBurInterface->Fs(), KBackupFile2, EFileRead | EFileShareExclusive); TEST2(rc, KErrNone); - TRAP(rc, restoreClient->InitialiseRestoreProxyBaseDataL(KClientUid, EDriveC)); + TRAP(rc, restoreClient->InitialiseRestoreProxyBaseDataL(KClientUid, KTestDrive)); TEST2(rc, KErrNone); TBuf8 buf; @@ -784,7 +898,7 @@ file.Close(); - restoreClient->RestoreComplete(EDriveC); + restoreClient->RestoreComplete(KTestDrive); TEST(finishedFlag); @@ -825,7 +939,7 @@ TEST2(rc, KSqlAtEnd); db.Close(); - (void)TheTestHarness->Fs().Delete(KBackupFile2); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KBackupFile2); } /** @@ -840,13 +954,11 @@ */ void EmptyBackupFileListTest() { - TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4192 Backup&Restore: empty backup file list")); - - CSqlBackupClient* backupClient = NULL; - TRAPD(err, backupClient = CSqlBackupClient::NewL(TheTestHarness)); + CSqlBurCallback* backupClient = NULL; + TRAPD(err, backupClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface)); TEST(backupClient != NULL); - TRAP(err, backupClient->InitialiseGetProxyBackupDataL(KNullUid, EDriveC)); + TRAP(err, backupClient->InitialiseGetProxyBackupDataL(KNullUid, KTestDrive)); TEST2(err, KErrNone); TBuf8<100> buf; @@ -872,11 +984,9 @@ */ void BackupRestoreFileIoErrTest() { - TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4193 Backup: File I/O error simulation test")); - //Make sure that the database content, just before the backup, will be copied to the test biffers. //The buffers will be used during the restore testing for verification of the database content. - StoreDbContentToBuf(TheTestHarness->Fs()); + StoreDbContentToBuf(TheSqlSrvTestBurInterface->Fs(), KTestDrive, KClientUid); for(TInt fsError=KErrNotFound;fsError>=KErrBadName;--fsError) { @@ -888,9 +998,9 @@ for(;errFs().SetErrorCondition(fsError, it_cnt1); - TRAP(err, bytesStored = DoBackupL()); - (void)TheTestHarness->Fs().SetErrorCondition(KErrNone); + (void)TheSqlSrvTestBurInterface->Fs().SetErrorCondition(fsError, it_cnt1); + TRAP(err, bytesStored = DoBackupL(KTestDrive, KClientUid)); + (void)TheSqlSrvTestBurInterface->Fs().SetErrorCondition(KErrNone); __UHEAP_MARKEND; } TEST2(err, KErrNone); @@ -901,40 +1011,878 @@ for(;errFs().SetErrorCondition(fsError, it_cnt2); - TRAP(err, bytesRestored = DoRestoreL()); - (void)TheTestHarness->Fs().SetErrorCondition(KErrNone); + (void)TheSqlSrvTestBurInterface->Fs().SetErrorCondition(fsError, it_cnt2); + TRAP(err, bytesRestored = DoRestoreL(KTestDrive, KClientUid)); + (void)TheSqlSrvTestBurInterface->Fs().SetErrorCondition(KErrNone); __UHEAP_MARKEND; } TEST2(err, KErrNone); TEST2(bytesStored, bytesRestored); - CompareDbContentWithBuf(TheTestHarness->Fs()); + CompareDbContentWithBuf(TheSqlSrvTestBurInterface->Fs(), KTestDrive, KClientUid); TheTest.Printf(_L("Backup&Restore file I/O error simulation test succeeded at backup iteration %d and restore itreration %d\r\n"), it_cnt1 - 1, it_cnt2 - 1); } } +/** +@SYMTestCaseID PDS-SQL-UT-4225 +@SYMTestCaseDesc SQL Backup - zero size file backup. + The test executes a backup on a file with zero size. +@SYMTestActions SQL Backup - zero size file backup. +@SYMTestExpectedResults Test must not fail +@SYMTestPriority High +*/ +void BackupZeroSizeFileTest() + { + CSqlBurCallback* backupClient = NULL; + TRAPD(err, backupClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface)); + TEST2(err, KErrNone); + TEST(backupClient != NULL); + // + (void)TheSqlSrvTestBurInterface->Fs().Delete(KZeroSizeFile); + RFile file; + err = file.Replace(TheSqlSrvTestBurInterface->Fs(), KZeroSizeFile, EFileRead | EFileWrite); + TEST2(err, KErrNone); + file.Close(); + // + TRAP(err, TestBackupL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KZeroFileSizeUid, KTestDrive)); + TEST2(err, KErrNone); + //Write something to the file + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KZeroSizeFile, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData, "123456787989"); + err = file.Write(KData); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Do the restore. After the restore the file size should be 0. + TRAP(err, TestRestoreL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KZeroFileSizeUid, KTestDrive)); + TEST2(err, KErrNone); + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KZeroSizeFile, EFileRead | EFileWrite); + TEST2(err, KErrNone); + TInt size; + err = file.Size(size); + TEST2(err, KErrNone); + file.Close(); + TEST2(size, 0); + //Write something to the file + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KZeroSizeFile, EFileRead | EFileWrite); + TEST2(err, KErrNone); + err = file.Write(KData); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Call RestoreBaseDataSectionL() with 0 data in the input buffer and finished flag: false. + TRAP(err, backupClient->InitialiseRestoreProxyBaseDataL(KZeroFileSizeUid, KTestDrive)); + TEST2(err, KErrNone); + TPtrC8 zeroBuf; + TRAP(err, backupClient->RestoreBaseDataSectionL(zeroBuf, EFalse)); + TEST2(err, KErrNone); + //No restore in this case, + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KZeroSizeFile, EFileRead | EFileWrite); + TEST2(err, KErrNone); + err = file.Size(size); + TEST2(err, KErrNone); + file.Close(); + TEST(size > 0); + //Call RestoreBaseDataSectionL() with 0 data in the input buffer and finished flag: true. + TRAP(err, backupClient->InitialiseRestoreProxyBaseDataL(KZeroFileSizeUid, KTestDrive)); + TEST2(err, KErrNone); + TRAP(err, backupClient->RestoreBaseDataSectionL(zeroBuf, ETrue)); + TEST2(err, KErrNone); + //No restore in this case, + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KZeroSizeFile, EFileRead | EFileWrite); + TEST2(err, KErrNone); + err = file.Size(size); + TEST2(err, KErrNone); + file.Close(); + TEST(size > 0); + // + (void)TheSqlSrvTestBurInterface->Fs().Delete(KZeroSizeFile); + delete backupClient; + } + +/** +@SYMTestCaseID PDS-SQL-UT-4226 +@SYMTestCaseDesc SQL Restore - corrupted archive 1. + The test does a backup of a file with a non-zero size. + The the test modifies the archive, simulating a corruption. + The the test performs a restore from the archive. The corruption + should be detected and reported by SQL B&R code. +@SYMTestActions SQL Restore - corrupted archive 1. +@SYMTestExpectedResults Test must not fail +@SYMTestPriority High +*/ +void CorruptedArchiveTest1() + { + CSqlBurCallback* backupClient = NULL; + TRAPD(err, backupClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface)); + TEST2(err, KErrNone); + TEST(backupClient != NULL); + //Create the test file that will be sent for backup + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1); + RFile file; + err = file.Replace(TheSqlSrvTestBurInterface->Fs(), KTestFile1, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData1, "123456787989"); + err = file.Write(KData1); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Backup the file + TRAP(err, TestBackupL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid1, KTestDrive)); + TEST2(err, KErrNone); + //Modify the file, which was sent for backup + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KTestFile1, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData2, "ABCDEFGH"); + err = file.Write(KData2); + TEST2(err, KErrNone); + err = file.SetSize(KData2().Length()); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Corrupt the archive + TFileName backupFileName; + backupFileName.Copy(KBackupFileTemplate); + backupFileName.Append((static_cast (KTestClientUid1)).Name()); + err = file.Open(TheSqlSrvTestBurInterface->Fs(), backupFileName, EFileRead | EFileWrite); + TEST2(err, KErrNone); + TInt pos = -3; + err = file.Seek(ESeekEnd, pos); + TEST2(err, KErrNone); + _LIT8(KData3, "ERR"); + err = file.Write(KData3); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Try to restore the archive + TRAP(err, TestRestoreL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid1, KTestDrive)); + TEST2(err, KErrCorrupt); + //Check that the file really has not been restored + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KTestFile1, EFileRead | EFileWrite); + TEST2(err, KErrNone); + TBuf8<50> data; + err = file.Read(data); + TEST2(err, KErrNone); + file.Close(); + TEST(data == KData2); + // + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1); + delete backupClient; + } + +/** +@SYMTestCaseID PDS-SQL-UT-4227 +@SYMTestCaseDesc SQL Restore - corrupted archive 2. + The test does a backup of a file with a non-zero size. + Then the test modifies the archive, byte after byte each step, + simulating a corruption. + The the test performs a restore from the archive. The corruption + should be detected and reported by SQL B&R code. +@SYMTestActions SQL Restore - corrupted archive 2. +@SYMTestExpectedResults Test must not fail +@SYMTestPriority High +*/ +void CorruptedArchiveTest2() + { + CSqlBurCallback* backupClient = NULL; + TRAPD(err, backupClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface)); + TEST2(err, KErrNone); + TEST(backupClient != NULL); + //Create the test file that will be sent for backup + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1); + RFile file; + err = file.Replace(TheSqlSrvTestBurInterface->Fs(), KTestFile1, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData1, "123456787989"); + err = file.Write(KData1); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Backup the file + TRAP(err, TestBackupL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid1, KTestDrive)); + TEST2(err, KErrNone); + //Modify the file, which was sent for backup + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KTestFile1, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData2, "ABCDEFGH"); + err = file.Write(KData2); + TEST2(err, KErrNone); + err = file.SetSize(KData2().Length()); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Make a copy of the modified file + CFileMan* fm = NULL; + TRAP(err, fm = CFileMan::NewL(TheSqlSrvTestBurInterface->Fs())); + TEST2(err, KErrNone); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1Bak); + err = fm->Copy(KTestFile1, KTestFile1Bak); + TEST2(err, KErrNone); + //Get the archive size + TFileName backupFileName; + backupFileName.Copy(KBackupFileTemplate); + backupFileName.Append((static_cast (KTestClientUid1)).Name()); + err = file.Open(TheSqlSrvTestBurInterface->Fs(), backupFileName, EFileRead | EFileWrite); + TEST2(err, KErrNone); + TInt size = 0; + err = file.Size(size); + TEST2(err, KErrNone); + file.Close(); + //Save a copy of the archive + (void)TheSqlSrvTestBurInterface->Fs().Delete(KBackupCopy); + err = fm->Copy(backupFileName, KBackupCopy); + TEST2(err, KErrNone); + //On each iteration step: corrupt the archive and try to do a restore from it. + for(TInt i=0;iFs(), backupFileName, EFileRead | EFileWrite); + TEST2(err, KErrNone); + TInt pos = i; + err = file.Seek(ESeekStart, pos); + TEST2(err, KErrNone); + TBuf8<1> byte; + err = file.Read(byte); + TEST2(err, KErrNone); + ++byte[0]; + err = file.Seek(ESeekStart, pos); + TEST2(err, KErrNone); + err = file.Write(byte); + TEST2(err, KErrNone); + if(i == (size - 1) && (size & 0x01) == 0) + {//Make the file size an odd number, just to test.... + err = file.Write(byte); + TEST2(err, KErrNone); + } + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Restore + TRAP(err, TestRestoreL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid1, KTestDrive)); + TheTest.Printf(_L("Iteration %d, err=%d\r\n"), i, err); + if(err == KErrNone) + { + //Delete the restored file. The reason that the restore didn't fail is because only the file data is + //protected with checksum. The restore file header - not. The restore completed, the data was restored + //to a file with different name. Or even to a file with the same name. Delete created file(s). + (void)fm->Delete(KTestDeleteMask1); + (void)fm->Delete(KTestDeleteMask2); + } + else + { + //The restore completed with an error. The file content is preserved. + //Check that the file content is the same. + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KTestFile1, EFileRead | EFileWrite); + TEST2(err, KErrNone); + TBuf8<50> data; + err = file.Read(data); + TEST2(err, KErrNone); + file.Close(); + TEST(data == KData2); + } + //Restore the file from the backup copy + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1); + err = fm->Copy(KTestFile1Bak, KTestFile1); + TEST2(err, KErrNone); + //Restore the archive from the good copy. + (void)TheSqlSrvTestBurInterface->Fs().Delete(backupFileName); + err = fm->Copy(KBackupCopy, backupFileName); + TEST2(err, KErrNone); + } + // + delete fm; + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1Bak); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KBackupCopy); + delete backupClient; + } + +/** +@SYMTestCaseID PDS-SQL-UT-4228 +@SYMTestCaseDesc SQL Backup&Restore on a drive different than KTestDrive (C: by default). + The test creates one database on KTestDrive and another database + with the same name on a drive different than KTestDrive. + Then the test backups the "not KTestDrive" drive and restores + the data after that. The test verifies that the backup&restore + really impacts only the other drive, not KTestDrive. +@SYMTestActions SQL Backup&Restore on a drive different than KTestDrive (C: by default). +@SYMTestExpectedResults Test must not fail +@SYMTestPriority High +*/ +void DbDriveTest() + { + CSqlBurCallback* backupClient = NULL; + TRAPD(err, backupClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface)); + TEST2(err, KErrNone); + TEST(backupClient != NULL); + // + TDriveUnit driveUnitDefault(KTestDrive); + TDriveName driveNameDefault = driveUnitDefault.Name(); + //Find a r/w drive, different than KTestDrive + TInt drive = EDriveA; + for(;drive<=EDriveZ;++drive) + { + if(drive == KTestDrive) + { + continue; + } + TDriveInfo driveInfo; + err = TheSqlSrvTestBurInterface->Fs().Drive(driveInfo, drive); + if(err != KErrNone) + { + continue; + } + if(driveInfo.iDriveAtt & KDriveAttRom) + { + continue; + } + // + TDriveUnit driveUnit(drive); + TDriveName driveName = driveUnit.Name(); + // + TVolumeInfo vinfo; + err = TheSqlSrvTestBurInterface->Fs().Volume(vinfo, drive); + if(err != KErrNone) + { + TheTest.Printf(_L("Drive %S, RFs::Volume() err=%d\r\n"), &driveName, err); + continue; + } + //R/W drive found. + TheTest.Printf(_L("Test drive: %S\r\n"), &driveName); + TParse parse; + err = parse.Set(KTestFile2, &driveName, 0); + TEST2(err, KErrNone); + //Create the test file that will be sent for backup + TPtrC fname1(parse.FullName()); + TheTest.Printf(_L("Test file 1: %S\r\n"), &fname1); + err = TheSqlSrvTestBurInterface->Fs().MkDirAll(parse.FullName()); + TEST(err == KErrNone || err == KErrAlreadyExists); + (void)TheSqlSrvTestBurInterface->Fs().Delete(parse.FullName()); + RFile file; + err = file.Replace(TheSqlSrvTestBurInterface->Fs(), parse.FullName(), EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData1, "123456787989"); + err = file.Write(KData1); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Create a test file with the same name on drive KTestDrive + err = parse.Set(KTestFile2, &driveNameDefault, 0); + TEST2(err, KErrNone); + TPtrC fname2(parse.FullName()); + TheTest.Printf(_L("Test file 2: %S\r\n"), &fname2); + (void)TheSqlSrvTestBurInterface->Fs().Delete(parse.FullName()); + err = file.Replace(TheSqlSrvTestBurInterface->Fs(), parse.FullName(), EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData2, "ABCDEFG"); + err = file.Write(KData2); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Do the backup on "drive" + TRAP(err, TestBackupL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid2, (TDriveNumber)drive)); + TEST2(err, KErrNone); + //Modify the file that was sent for backup + err = parse.Set(KTestFile2, &driveName, 0); + TEST2(err, KErrNone); + err = file.Open(TheSqlSrvTestBurInterface->Fs(), parse.FullName(), EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData3, "ABCDEFGHYYYYYY"); + err = file.Write(KData3); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Do the restore on "drive" + TRAP(err, TestRestoreL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid2, (TDriveNumber)drive)); + TEST2(err, KErrNone); + //Verify the content of the restored file + err = parse.Set(KTestFile2, &driveName, 0); + TEST2(err, KErrNone); + err = file.Open(TheSqlSrvTestBurInterface->Fs(), parse.FullName(), EFileRead | EFileWrite); + TEST2(err, KErrNone); + TBuf8<50> data; + err = file.Read(data); + TEST2(err, KErrNone); + file.Close(); + TEST(data == KData1); + //Verify the content of the file on drive KTestDrive. It should be the same as before the backup&restore. + err = parse.Set(KTestFile2, &driveNameDefault, 0); + TEST2(err, KErrNone); + err = file.Open(TheSqlSrvTestBurInterface->Fs(), parse.FullName(), EFileRead | EFileWrite); + TEST2(err, KErrNone); + err = file.Read(data); + TEST2(err, KErrNone); + file.Close(); + TEST(data == KData2); + //Cleanup + err = parse.Set(KTestFile2, &driveNameDefault, 0); + TEST2(err, KErrNone); + (void)TheSqlSrvTestBurInterface->Fs().Delete(parse.FullName()); + err = parse.Set(KTestFile2, &driveName, 0); + TEST2(err, KErrNone); + (void)TheSqlSrvTestBurInterface->Fs().Delete(parse.FullName()); + break; + } + delete backupClient; + if(drive > EDriveZ) + { + TheTest.Printf(_L("No R/W drive has been found, different than %S\r\n"), &driveNameDefault); + } + } + +/** +@SYMTestCaseID PDS-SQL-UT-4229 +@SYMTestCaseDesc SQL Backup&Restore with locked file. + The test creates two test files on the same drive and with the same uid. + Then the test backups the databases. After the backup the test simulates that + the first file is "in use". Then the test performs a restore. + The expected result: the locked file is not restored but the other file is restored. +@SYMTestActions SQL Backup&Restore with locked file. +@SYMTestExpectedResults Test must not fail +@SYMTestPriority High +*/ +void LockFileTest() + { + CSqlBurCallback* backupClient = NULL; + TRAPD(err, backupClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface)); + TEST2(err, KErrNone); + TEST(backupClient != NULL); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile3); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile4); + //Create the files. File 1. + RFile file; + err = file.Replace(TheSqlSrvTestBurInterface->Fs(), KTestFile3, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData1, "123456787989"); + err = file.Write(KData1); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //...file 2 + err = file.Replace(TheSqlSrvTestBurInterface->Fs(), KTestFile4, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData2, "ABCDEF"); + err = file.Write(KData2); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Backup + TRAP(err, TestBackupL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid3, KTestDrive)); + TEST2(err, KErrNone); + //Modify the files. Keep the first file opened. + RFile file1; + err = file1.Open(TheSqlSrvTestBurInterface->Fs(), KTestFile3, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData3, "YYYYYQQQQQQQQQQQ"); + err = file1.Write(KData3); + TEST2(err, KErrNone); + err = file1.Flush(); + TEST2(err, KErrNone); + //...file 2 + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KTestFile4, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData4, "5545495444j32322332234223432"); + err = file.Write(KData4); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Restore. The reported error should be KErrInUse. + TRAP(err, TestRestoreL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid3, KTestDrive)); + TEST2(err, KErrInUse); + //Close file 1 and check the content. It should be the same as after the backup + file1.Close(); + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KTestFile3, EFileRead | EFileWrite); + TEST2(err, KErrNone); + TBuf8<50> data; + err = file.Read(data); + TEST2(err, KErrNone); + file.Close(); + TEST(data == KData3); + //File2: check the content. It should be the same as before the backup + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KTestFile4, EFileRead | EFileWrite); + TEST2(err, KErrNone); + err = file.Read(data); + TEST2(err, KErrNone); + file.Close(); + TEST(data == KData2); + // + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile4); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile3); + delete backupClient; + } + +/** +@SYMTestCaseID PDS-SQL-UT-4230 +@SYMTestCaseDesc SQL Backup&Restore with locked file - test 2. + The test creates two test files on the same drive and with different uids. + Then the test backups the databases. After the backup the test simulates that + the first file is "in use". Then the test performs a restore. + The expected result: the locked file is not restored but the other file is restored. +@SYMTestActions SQL Backup&Restore with locked file - test 2. +@SYMTestExpectedResults Test must not fail +@SYMTestPriority High +*/ +void LockFileTest2() + { + CSqlBurCallback* backupClient = NULL; + TRAPD(err, backupClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface)); + TEST2(err, KErrNone); + TEST(backupClient != NULL); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1);//KTestClientUid1 used + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile4);//KTestClientUid3 used + //Create the files. File 1. + RFile file; + err = file.Replace(TheSqlSrvTestBurInterface->Fs(), KTestFile1, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData1, "123456787989"); + err = file.Write(KData1); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //...file 2 + err = file.Replace(TheSqlSrvTestBurInterface->Fs(), KTestFile4, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData2, "ABCDEF"); + err = file.Write(KData2); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Backup + TRAP(err, TestBackupL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid1, KTestDrive)); + TEST2(err, KErrNone); + TRAP(err, TestBackupL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid3, KTestDrive)); + TEST2(err, KErrNone); + //Modify the files. Keep the first file opened. + RFile file1; + err = file1.Open(TheSqlSrvTestBurInterface->Fs(), KTestFile1, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData3, "YYYYYQQQQQQQQQQQ"); + err = file1.Write(KData3); + TEST2(err, KErrNone); + err = file1.Flush(); + TEST2(err, KErrNone); + //...file 2 + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KTestFile4, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData4, "5545495444j32322332234223432"); + err = file.Write(KData4); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Restore the first file. The reported error should be KErrInUse. + TRAP(err, TestRestoreL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid1, KTestDrive)); + TEST2(err, KErrInUse); + //Restore the second file. The reported error should be KErrNone. + TRAP(err, TestRestoreL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid3, KTestDrive)); + TEST2(err, KErrNone); + //Close file 1 and check the content. It should be the same as after the backup + file1.Close(); + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KTestFile1, EFileRead | EFileWrite); + TEST2(err, KErrNone); + TBuf8<50> data; + err = file.Read(data); + TEST2(err, KErrNone); + file.Close(); + TEST(data == KData3); + //File2: check the content. It should be the same as before the backup + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KTestFile4, EFileRead | EFileWrite); + TEST2(err, KErrNone); + err = file.Read(data); + TEST2(err, KErrNone); + file.Close(); + TEST(data == KData2); + // + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile4); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1); + delete backupClient; + } + +CDir* GetPrivateDirContent(TDriveNumber aDrive) + { + TDriveUnit driveUnit(aDrive); + TDriveName driveName = driveUnit.Name(); + TFileName path; + path.Copy(driveName); + path.Append(KPrivateDir); + _LIT(KMatchAllDbFiles, "*"); + path.Append(KMatchAllDbFiles); + //Do the search + CDir* fileNameCol = NULL; + TInt err = TheSqlSrvTestBurInterface->Fs().GetDir(path, KEntryAttNormal, ESortByName, fileNameCol); + TEST2(err, KErrNone); + return fileNameCol; + } + +/** +@SYMTestCaseID PDS-SQL-UT-4231 +@SYMTestCaseDesc SQL Backup&Restore - directory content test. + The test stores into an array information regarding all files in + SQL private datacage. Then the test backups one of the files and modifies + the file after that. Then the test does a restore. Expected result - the only + modifed file should be the file which was sent for backup. +@SYMTestActions SQL Backup&Restore - directory content test. +@SYMTestExpectedResults Test must not fail +@SYMTestPriority High +*/ +void DirectoryContentTest() + { + CSqlBurCallback* backupClient = NULL; + TRAPD(err, backupClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface)); + TEST2(err, KErrNone); + TEST(backupClient != NULL); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1);//KTestClientUid1 used + //Create the file + RFile file; + err = file.Replace(TheSqlSrvTestBurInterface->Fs(), KTestFile1, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData1, "123456787989"); + err = file.Write(KData1); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Store file entries into an array + CDir* dirBeforeBackup = GetPrivateDirContent(KTestDrive); + //Backup + TRAP(err, TestBackupL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid1, KTestDrive)); + TEST2(err, KErrNone); + //Check dir content + CDir* dirAfterBackup = GetPrivateDirContent(KTestDrive); + TEST2(dirBeforeBackup->Count(), dirAfterBackup->Count()); + for(TInt i=0;iCount();++i) + { + const TEntry& entry1 = (*dirBeforeBackup)[i]; + const TEntry& entry2 = (*dirAfterBackup)[i]; + TheTest.Printf(_L("Entry1=%S, Entry2=%S\r\n"), &entry1.iName, &entry2.iName); + TBool rc = entry1.iAtt == entry2.iAtt; + TEST(rc); + rc = entry1.iSize == entry2.iSize; + TEST(rc); + rc = entry1.iModified == entry2.iModified; + TEST(rc); + rc = entry1.iType == entry2.iType; + TEST(rc); + rc = entry1.iName == entry2.iName; + TEST(rc); + } + delete dirAfterBackup; + //Modify the file + err = file.Replace(TheSqlSrvTestBurInterface->Fs(), KTestFile1, EFileRead | EFileWrite); + TEST2(err, KErrNone); + _LIT8(KData2, "ABCDEF"); + err = file.Write(KData2); + TEST2(err, KErrNone); + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Restore + User::After(2000000);//To force a change in the file time stamp (the restored file time stamp). + TRAP(err, TestRestoreL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid1, KTestDrive)); + TEST2(err, KErrNone); + //Check dir content + CDir* dirAfterRestore = GetPrivateDirContent(KTestDrive); + TEST2(dirBeforeBackup->Count(), dirAfterRestore->Count()); + for(TInt i=0;iCount();++i) + { + const TEntry& entry1 = (*dirBeforeBackup)[i]; + const TEntry& entry2 = (*dirAfterRestore)[i]; + TheTest.Printf(_L("Entry1=%S, Entry2=%S\r\n"), &entry1.iName, &entry2.iName); + TBool rc = entry1.iAtt == entry2.iAtt; + TEST(rc); + rc = entry1.iSize == entry2.iSize; + TEST(rc); + if(entry1.iName.FindF(KTestFile1NameOnly) >= 0) + { + rc = entry1.iModified != entry2.iModified; + } + else + { + rc = entry1.iModified == entry2.iModified; + } + TEST(rc); + rc = entry1.iType == entry2.iType; + TEST(rc); + rc = entry1.iName == entry2.iName; + TEST(rc); + } + delete dirAfterRestore; + // + delete dirBeforeBackup; + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1); + delete backupClient; + } + +/** +@SYMTestCaseID PDS-SQL-UT-4232 +@SYMTestCaseDesc SQL Backup&Restore - large file test. + Backup and restore with a file with size bigger than 1 Mb. +@SYMTestActions SQL Backup&Restore - large file test. +@SYMTestExpectedResults Test must not fail +@SYMTestPriority High +*/ +void LargeFileTest() + { + CSqlBurCallback* backupClient = NULL; + TRAPD(err, backupClient = CSqlBurCallback::NewL(*TheSqlSrvTestBurInterface)); + TEST2(err, KErrNone); + TEST(backupClient != NULL); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1);//KTestClientUid1 used + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile2);//KTestClientUid2 used + //Allocate buffer for the data + const TInt KDataBufSize = 100000; + HBufC8* dataBuf = HBufC8::New(KDataBufSize); + TEST(dataBuf != NULL); + TPtr8 dataPtr = dataBuf->Des(); + //Create file 1 + const TInt KFileSize1 = 1201345; + RFile file; + err = file.Replace(TheSqlSrvTestBurInterface->Fs(), KTestFile1, EFileRead | EFileWrite); + TEST2(err, KErrNone); + dataPtr.SetLength(dataPtr.MaxLength()); + const TChar KChar1(0x5A); + dataPtr.Fill(KChar1); + TInt len = KFileSize1; + while(len > 0) + { + TInt blockSize = Min(len, dataPtr.MaxLength()); + err = file.Write(dataPtr, blockSize); + TEST2(err, KErrNone); + len -= blockSize; + } + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Create file 2 + const TInt KFileSize2 = 1387651; + err = file.Replace(TheSqlSrvTestBurInterface->Fs(), KTestFile2, EFileRead | EFileWrite); + TEST2(err, KErrNone); + dataPtr.SetLength(dataPtr.MaxLength()); + const TChar KChar2(0xD5); + dataPtr.Fill(KChar2); + len = KFileSize2; + while(len > 0) + { + TInt blockSize = Min(len, dataPtr.MaxLength()); + err = file.Write(dataPtr, blockSize); + TEST2(err, KErrNone); + len -= blockSize; + } + err = file.Flush(); + TEST2(err, KErrNone); + file.Close(); + //Backup + TRAP(err, TestBackupL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid1, KTestDrive)); + TEST2(err, KErrNone); + TRAP(err, TestBackupL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid2, KTestDrive)); + TEST2(err, KErrNone); + //Delete the files + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile2); + //Restore + TRAP(err, TestRestoreL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid1, KTestDrive)); + TEST2(err, KErrNone); + TRAP(err, TestRestoreL(*backupClient, TheSqlSrvTestBurInterface->Fs(), KTestClientUid2, KTestDrive)); + TEST2(err, KErrNone); + //Check restored files content + const TPtrC KFileNames[] = {KTestFile1(), KTestFile2()}; + const TInt KFileSizes[] = {KFileSize1, KFileSize2}; + const TChar KSymbols[] = {KChar1, KChar2}; + for(TInt i=0;i<(sizeof(KFileNames)/sizeof(KFileNames[i]));++i) + { + err = file.Open(TheSqlSrvTestBurInterface->Fs(), KFileNames[i], EFileRead); + TEST2(err, KErrNone); + len = 0; + err = file.Size(len); + TEST2(err, KErrNone); + TEST2(len, KFileSizes[i]); + while(len > 0) + { + TInt blockSize = Min(len, dataPtr.MaxLength()); + err = file.Read(dataPtr, blockSize); + TEST2(err, KErrNone); + len -= blockSize; + for(TInt j=0;jFs().Delete(KTestFile2); + (void)TheSqlSrvTestBurInterface->Fs().Delete(KTestFile1); + delete backupClient; + } void DoMain() { TestEnvCreate(); TheTest.Start(_L("Store db content to memory buffer")); - StoreDbContentToBuf(TheTestHarness->Fs()); + StoreDbContentToBuf(TheSqlSrvTestBurInterface->Fs(), KTestDrive, KClientUid); + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4002 Backup: functional test ")); FunctionalTest(); + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4003 Backup: OOM test ")); OomTest(); + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4143 Backup&Restore: functional test 2")); FunctionalTest2(); + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4144 Backup&Restore: legacy file format test")); LegacyFileFormatTest(); + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4192 Backup&Restore: empty backup file list")); EmptyBackupFileListTest(); + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4193 Backup: File I/O error simulation test")); BackupRestoreFileIoErrTest(); + + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4225 Zero size file - backup test")); + BackupZeroSizeFileTest(); + + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4226 Restore test - corrupted archive 1")); + CorruptedArchiveTest1(); + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4227 Restore test - corrupted archive 2")); + CorruptedArchiveTest2(); + + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4228 Backup&Restore test on a drive different than KTestDrive (C: by default)")); + DbDriveTest(); + + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4229 Backup&Restore test with locked file")); + LockFileTest(); + + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4230 Backup&Restore test with locked file 2")); + LockFileTest2(); + + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4231 Backup&Restore - directory content test")); + DirectoryContentTest(); + + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4232 Backup&Restore - large file test")); + LargeFileTest(); + TestEnvDestroy(); } @@ -943,7 +1891,7 @@ TheTest.Title(); CTrapCleanup* tc = CTrapCleanup::New(); - TEST(tc != NULL); + TheTest(tc != NULL); __UHEAP_MARK; diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/t_sqlbur.h --- a/persistentstorage/sql/TEST/t_sqlbur.h Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/t_sqlbur.h Mon Sep 27 11:59:56 2010 +0100 @@ -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" @@ -21,20 +21,16 @@ #include "SqlSrvBurInterface.h" -class CSqlBurTestHarness : public CBase, public MSqlSrvBurInterface +class CSqlSrvTestBurInterface : public CBase, public MSqlSrvBurInterface { public: - static CSqlBurTestHarness* New(); - virtual ~CSqlBurTestHarness(); - virtual void GetBackUpListL(TSecureId aUid, RArray& aFileList); - virtual TBool StartBackupL(const RArray&aFileList); - virtual void EndBackup(const RArray&aFileList); - virtual TBool StartRestoreL(TSecureId aUid); - virtual void EndRestore(TSecureId aUid); + static CSqlSrvTestBurInterface* New(); + virtual ~CSqlSrvTestBurInterface(); virtual RFs& Fs(); + virtual void GetBackUpListL(TSecureId aUid, TDriveNumber aDrive, RArray& aFileList); private: - CSqlBurTestHarness(); + CSqlSrvTestBurInterface(); void Construct(); private: diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/t_sqlbur2.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/sql/TEST/t_sqlbur2.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,365 @@ +// 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 +#include +#include +#include +#include "SqlBur.h" + +//CSqlSrvTestBurInterface - test implementation of the MSqlSrvBurInterface, implemented in the production code by the SQL server. +class CSqlSrvTestBurInterface : public CBase, public MSqlSrvBurInterface + { + public: + static CSqlSrvTestBurInterface* New(); + virtual ~CSqlSrvTestBurInterface(); + virtual RFs& Fs(); + virtual void GetBackUpListL(TSecureId aUid, TDriveNumber aDrive, RArray& aFileList); + + private: + void Construct(); + + private: + RFs iFs; + + }; + +/////////////////////////////////////////////////////////////////////////////////////// + +RTest TheTest(_L("t_sqlbur2")); + +#ifdef _DEBUG +static const TInt KBurstRate = 100; +#endif + +TDriveNumber KTestDrive = EDriveC; +_LIT(KTestDir, "c:\\test\\"); +CActiveScheduler* TheScheduler = NULL; +CSqlSrvTestBurInterface* TheSqlSrvTestBurInterface = NULL; +TInt TestModeSqlBurError = KErrNone;//The CSqlBurEventMonitor code will set the error here + +/////////////////////////////////////////////////////////////////////////////////////// + +void DestroyTestEnv() + { + delete TheSqlSrvTestBurInterface; + TheSqlSrvTestBurInterface = NULL; + + delete TheScheduler; + TheScheduler = NULL; + + (void)RProperty::Delete(KSqlBurPropertyCategoryUid, KSqlBurBackupRestoreKey); + } + +/////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////// +//Test macros and functions +void Check(TInt aValue, TInt aLine) + { + if(!aValue) + { + DestroyTestEnv(); + RDebug::Print(_L("*** Boolean expression evaluated to false.\r\n")); + TheTest(EFalse, aLine); + } + } +void Check(TInt aValue, TInt aExpected, TInt aLine) + { + if(aValue != aExpected) + { + DestroyTestEnv(); + RDebug::Print(_L("*** Expected error: %d, got: %d.\r\n"), aExpected, aValue); + TheTest(EFalse, aLine); + } + } +#define TEST(arg) ::Check((arg), __LINE__) +#define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) + +/////////////////////////////////////////////////////////////////////////////////////// + +CSqlSrvTestBurInterface* CSqlSrvTestBurInterface::New() + { + CSqlSrvTestBurInterface* self = new CSqlSrvTestBurInterface; + TEST(self != NULL); + self->Construct(); + return self; + } + +void CSqlSrvTestBurInterface::Construct() + { + TInt err = iFs.Connect(); + TEST2(err, KErrNone); + + err = iFs.MkDir(KTestDir); + TEST(err == KErrNone || err == KErrAlreadyExists); + + err = iFs.CreatePrivatePath(KTestDrive); + TEST(err == KErrNone || err == KErrAlreadyExists); + } + +CSqlSrvTestBurInterface::~CSqlSrvTestBurInterface() + { + iFs.Close(); + } + +RFs& CSqlSrvTestBurInterface::Fs() + { + return iFs; + } + +//No-op. Not needed in this test app. +void CSqlSrvTestBurInterface::GetBackUpListL(TSecureId, TDriveNumber, RArray&) + { + TEST(EFalse); + } + +/////////////////////////////////////////////////////////////////////////////////////// + +void CreateTestEnv() + { + TheScheduler = new CActiveScheduler; + TEST(TheScheduler != NULL); + CActiveScheduler::Install(TheScheduler); + + TheSqlSrvTestBurInterface = CSqlSrvTestBurInterface::New(); + TEST(TheSqlSrvTestBurInterface != NULL); + + TInt err = RProperty::Define(KSqlBurPropertyCategoryUid, KSqlBurBackupRestoreKey, 0); + TEST(err == KErrNone || err == KErrAlreadyExists); + } + +/////////////////////////////////////////////////////////////////////////////////////// + +/** +@SYMTestCaseID PDS-SQL-UT-4233 +@SYMTestCaseDesc CSqlBurEventMonitor object creation - OOM test + The test runs CSqlBurEventMonitor::NewL() in an OOM loop. +@SYMTestActions CSqlBurEventMonitor object creation - OOM test +@SYMTestExpectedResults Test must not fail +@SYMTestPriority High +*/ +void SqlBurEventMonitorOomTest() + { + TInt err = KErrNoMemory; + TInt failingAllocationNo = 0; + TheTest.Printf(_L("Iteration:\r\n")); + while(err == KErrNoMemory) + { + TheTest.Printf(_L(" %d"), ++failingAllocationNo); + + TInt startProcessHandleCount; + TInt startThreadHandleCount; + RThread().HandleCount(startProcessHandleCount, startThreadHandleCount); + __UHEAP_MARK; + __UHEAP_SETBURSTFAIL(RAllocator::EBurstFailNext, failingAllocationNo, KBurstRate); + + CSqlBurEventMonitor* monitor = NULL; + TRAP(err, monitor = CSqlBurEventMonitor::NewL(*TheSqlSrvTestBurInterface)); + delete monitor; + + __UHEAP_RESET; + __UHEAP_MARKEND; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + RThread().HandleCount(endProcessHandleCount, endThreadHandleCount); + + TEST2(startProcessHandleCount, endProcessHandleCount); + TEST2(startThreadHandleCount, endThreadHandleCount); + } + TEST2(err, KErrNone); + TheTest.Printf(_L("\r\n=== OOM Test succeeded at heap failure rate of %d ===\r\n"), failingAllocationNo); + } + +/** +@SYMTestCaseID PDS-SQL-UT-4234 +@SYMTestCaseDesc CSqlBurEventMonitor functional test + The test sets the backup & restore property status and then checks + how the backup & restore property monitor (CSqlBurEventMonitor) reacts to the event. +@SYMTestActions CSqlBurEventMonitor functional test +@SYMTestExpectedResults Test must not fail +@SYMTestPriority High +*/ +void SqlBurEventMonitorFunctionalTest() + { + CSqlBurEventMonitor* monitor = NULL; + TRAPD(err, monitor = CSqlBurEventMonitor::NewL(*TheSqlSrvTestBurInterface)); + TEST2(err, KErrNone); + TEST(!monitor->ActiveBackupClient()); + TEST(!monitor->SqlBurCallback()); + //Set the property to conn::EBURBackupFull, conn::EBURBackupPartial, conn::EBURRestoreFull, conn::EBURRestorePartial, + //then start the scheduler. CSqlBurEventMonitor::RunL() gets called and + //CSqlBurCallback and CActiveBackupClient interfaces get created (if the interfaces do exist, they are destroyed first). + TInt burPropertyStatus[] = {conn::EBURBackupFull, conn::EBURBackupPartial, conn::EBURRestoreFull, conn::EBURRestorePartial}; + for(TInt i=0;i<(sizeof(burPropertyStatus)/sizeof(burPropertyStatus[0]));++i) + { + err = RProperty::Set(KSqlBurPropertyCategoryUid, KSqlBurBackupRestoreKey, burPropertyStatus[i]); + TEST2(err, KErrNone); + TestModeSqlBurError = KErrNone; + if(i > 0) + { + __UHEAP_MARK; + } + CActiveScheduler::Start(); + if(i > 0) + { + __UHEAP_MARKEND; + } + TEST2(TestModeSqlBurError, KErrNone); + TEST(monitor->ActiveBackupClient() != NULL); + TEST(monitor->SqlBurCallback() != NULL); + } + //Set the property to conn::EBURUnset, start the scheduler. CSqlBurEventMonitor::RunL() gets called + //and CSqlBurCallback interface gets destroyed. + err = RProperty::Set(KSqlBurPropertyCategoryUid, KSqlBurBackupRestoreKey, conn::EBURUnset); + TEST2(err, KErrNone); + TestModeSqlBurError = KErrNone; + CActiveScheduler::Start(); + TEST2(TestModeSqlBurError, KErrNone); + TEST(!monitor->ActiveBackupClient()); + TEST(!monitor->SqlBurCallback()); + //Set the property to conn::EBURNormal, start the scheduler. CSqlBurEventMonitor::RunL() gets called. + //CSqlBurCallback interface has been destroyed alread. No memory deallocations should be made during this call. + err = RProperty::Set(KSqlBurPropertyCategoryUid, KSqlBurBackupRestoreKey, conn::EBURNormal); + TEST2(err, KErrNone); + __UHEAP_MARK; + TestModeSqlBurError = KErrNone; + CActiveScheduler::Start(); + TEST2(TestModeSqlBurError, KErrNone); + TEST(!monitor->ActiveBackupClient()); + TEST(!monitor->SqlBurCallback()); + __UHEAP_MARKEND; + //Set the property, then delete it. CSqlBurEventMonitor::RunL() should get called, but the call should + //fail because the property does not exist. + err = RProperty::Set(KSqlBurPropertyCategoryUid, KSqlBurBackupRestoreKey, conn::EBURBackupFull); + TEST2(err, KErrNone); + err = RProperty::Delete(KSqlBurPropertyCategoryUid, KSqlBurBackupRestoreKey); + TEST2(err, KErrNone); + __UHEAP_MARK; + TestModeSqlBurError = KErrNone; + CActiveScheduler::Start(); + TEST2(TestModeSqlBurError, KErrNotFound); + TEST(!monitor->ActiveBackupClient()); + TEST(!monitor->SqlBurCallback()); + __UHEAP_MARKEND; + //Restore the property + err = RProperty::Define(KSqlBurPropertyCategoryUid, KSqlBurBackupRestoreKey, 0); + TEST2(err, KErrNone); + // + delete monitor; + } + +/** +@SYMTestCaseID PDS-SQL-UT-4235 +@SYMTestCaseDesc CSqlBurEventMonitor::RunL() - OOM test + The test sets the backup & restore property status and then checks + how the backup & restore property monitor (CSqlBurEventMonitor) reacts to the event. + The test is performed in an OOM loop. +@SYMTestActions CSqlBurEventMonitor::RunL() - OOM test +@SYMTestExpectedResults Test must not fail +@SYMTestPriority High +*/ +void SqlBurEventMonitorRunOomTest() + { + CSqlBurEventMonitor* monitor = NULL; + TRAPD(err, monitor = CSqlBurEventMonitor::NewL(*TheSqlSrvTestBurInterface)); + + err = KErrNoMemory; + TInt failingAllocationNo = 0; + TheTest.Printf(_L("Iteration:\r\n")); + while(err == KErrNoMemory) + { + TheTest.Printf(_L(" %d"), ++failingAllocationNo); + + TInt startProcessHandleCount; + TInt startThreadHandleCount; + RThread().HandleCount(startProcessHandleCount, startThreadHandleCount); + __UHEAP_MARK; + __UHEAP_SETBURSTFAIL(RAllocator::EBurstFailNext, failingAllocationNo, KBurstRate); + + TEST(!monitor->ActiveBackupClient()); + TEST(!monitor->SqlBurCallback()); + //Set the property, start the scheduler. CSqlBurEventMonitor::RunL() gets called and CSqlBurCallback + //interface gets created. + err = RProperty::Set(KSqlBurPropertyCategoryUid, KSqlBurBackupRestoreKey, conn::EBURBackupFull); + if(err == KErrNone) + { + TestModeSqlBurError = KErrNone; + CActiveScheduler::Start(); + err = TestModeSqlBurError; + if(err == KErrNone) + { + TEST(monitor->ActiveBackupClient() != NULL); + TEST(monitor->SqlBurCallback() != NULL); + //Destroy the SQL backup & restore callback + err = RProperty::Set(KSqlBurPropertyCategoryUid, KSqlBurBackupRestoreKey, conn::EBURNormal); + TestModeSqlBurError = KErrNone; + CActiveScheduler::Start(); + err = TestModeSqlBurError; + if(err == KErrNone) + { + TEST(!monitor->ActiveBackupClient()); + TEST(!monitor->SqlBurCallback()); + } + } + } + + __UHEAP_RESET; + __UHEAP_MARKEND; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + RThread().HandleCount(endProcessHandleCount, endThreadHandleCount); + + TEST2(startProcessHandleCount, endProcessHandleCount); + TEST2(startThreadHandleCount, endThreadHandleCount); + } + TEST2(err, KErrNone); + TheTest.Printf(_L("\r\n=== OOM Test succeeded at heap failure rate of %d ===\r\n"), failingAllocationNo); + delete monitor; + } + +void DoTestsL() + { + TheTest.Start(_L(" @SYMTestCaseID:PDS-SQL-UT-4233 CSqlBurEventMonitor object creation - OOM test")); + SqlBurEventMonitorOomTest(); + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4234 CSqlBurEventMonitor functional test")); + SqlBurEventMonitorFunctionalTest(); + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4235 CSqlBurEventMonitor::RunL() - OOM test")); + SqlBurEventMonitorRunOomTest(); + } + +TInt E32Main() + { + TheTest.Title(); + + CTrapCleanup* tc = CTrapCleanup::New(); + TheTest(tc != NULL); + + __UHEAP_MARK; + + CreateTestEnv(); + TRAPD(err, DoTestsL()); + DestroyTestEnv(); + TEST2(err, KErrNone); + + __UHEAP_MARKEND; + + TheTest.End(); + TheTest.Close(); + + delete tc; + + User::Heap().Check(); + return KErrNone; + } diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/t_sqlcompact2.cpp --- a/persistentstorage/sql/TEST/t_sqlcompact2.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/t_sqlcompact2.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -25,6 +25,7 @@ #include "SqlCompact.h" #include "SqlCompactConn.h" #include "SqlCompactEntry.h" +#include "SqlUtil.h" const TInt KOperationCount = 20; const TInt KFreePageThresholdKb = 5; @@ -220,6 +221,7 @@ void OomTest(); void FileIoErrTest(); void PerformanceTest(); + void FreePageUpdateTest(); protected: virtual void DoCancel(); @@ -232,6 +234,8 @@ void Schedule(TCommand aNextCommand, TTimeIntervalMicroSeconds32 aInterval); void CreateTestDatabase(); + void CreateTestDatabase2(); + void PrepareDb(TBool aNewDb); void InsertTestRecords(TInt aOpCount = KOperationCount); void UpdateTestRecords(TInt aOpCount = KOperationCount); void DeleteTestRecords(TInt aOpCount = KOperationCount); @@ -244,7 +248,6 @@ void DeleteTestEnd(); void SingleOpCompactTestBegin(); void SingleOpCompactTestEnd(); - void DoOomTest1(); void DoOomTest2(); void DoOomTest3(); @@ -391,6 +394,51 @@ } } +//Creates a test database (with KDbName name). +void CSqlCompactTestActive::CreateTestDatabase2() + { + //Create the database + const TInt KPageSize = 1024; + _LIT8(KConfigStr, "page_size="); + TBuf8<100> config; + config.Copy(KConfigStr); + config.AppendNum(KPageSize); + TInt err = KErrNone; + err = ::CreateDbHandle8(::FileNameZ8(TheDbName), TheDbHandle); + TEST2(err, KErrNone); + _LIT8(KCreateTableSql, "CREATE TABLE A(I INTEGER, T TEXT)\x0"); + err = ::DbExecStmt8(TheDbHandle, KCreateTableSql); + TEST2(err, KErrNone); + } + +//Insert 1000 records. The record size is such that there is only two records per page. +void CSqlCompactTestActive::PrepareDb(TBool aDeleteRecords) + { + //Insert records + const TInt KRecordCount = 1000; + const TInt KTextLen = 400; + TBuf TheText; + TBuf TheSqlBuf; + TheText.SetLength(TheText.MaxLength()); + TheText.Fill(TChar('A')); + for(TInt i=0;iAddEntryL(TheDbName, TheCompactionSettings)); + TEST2(err, KErrNone); + + PrepareDb(ETrue); + TInt freePageCount = ::FreePageCount(); + TEST(freePageCount > KSqlCompactFreePageThresholdKb); + TheTest.Printf(_L(" Free pages count = %d\r\n"), freePageCount); + + //Refill the database + PrepareDb(EFalse); + + CSqlCompactEntry* impl = compactor->iEntries[0]; + impl->iPageCount = freePageCount; + err = impl->Compact(); + TEST2(err, KErrNone); + TEST2(impl->iPageCount, 0); + + compactor->ReleaseEntry(TheDbName); + delete compactor; + ::CloseDbHandle(TheDbHandle); + TheDbHandle = NULL; + (void)TheFs.Delete(TheDbName); + } + ////////////////////////////////////////////////////////////////////////////////////////////////// void DoTests() @@ -939,6 +1031,9 @@ TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4052 Compaction - performance test")); TheTestActive->PerformanceTest(); + + TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-CT-4239 Free page update test")); + TheTestActive->FreePageUpdateTest(); CActiveScheduler::Start(); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/t_sqlcorrupt.cpp --- a/persistentstorage/sql/TEST/t_sqlcorrupt.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/t_sqlcorrupt.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -16,6 +16,9 @@ #include #include #include +#include +#include "sqlite3.h" +#include "SqliteSymbian.h" /////////////////////////////////////////////////////////////////////////////////////// @@ -67,6 +70,27 @@ /////////////////////////////////////////////////////////////////////////////////////// +RSqlSecurityPolicy CreateTestSecurityPolicy() + { + RSqlSecurityPolicy policy; + TInt err = policy.Create(TSecurityPolicy::EAlwaysPass); + TEST2(err, KErrNone); + + err = policy.SetDbPolicy(RSqlSecurityPolicy::ESchemaPolicy, TSecurityPolicy::EAlwaysPass); + TEST2(err, KErrNone); + err = policy.SetDbPolicy(RSqlSecurityPolicy::EWritePolicy, TSecurityPolicy::EAlwaysPass); + TEST2(err, KErrNone); + err = policy.SetDbPolicy(RSqlSecurityPolicy::EReadPolicy, TSecurityPolicy::EAlwaysPass); + TEST2(err, KErrNone); + + err = policy.SetPolicy(RSqlSecurityPolicy::ETable, _L("A"), RSqlSecurityPolicy::EWritePolicy, TSecurityPolicy::EAlwaysPass); + TEST2(err, KErrNone); + err = policy.SetPolicy(RSqlSecurityPolicy::ETable, _L("A"), RSqlSecurityPolicy::EReadPolicy, TSecurityPolicy::EAlwaysPass); + TEST2(err, KErrNone); + + return policy; + } + enum TDbEncoding { EDbEncUtf16, @@ -77,22 +101,8 @@ { (void)RSqlDatabase::Delete(KDbName); - RSqlSecurityPolicy policy; - TInt err = policy.Create(TSecurityPolicy::EAlwaysPass); - TEST2(err, KErrNone); - - err = policy.SetDbPolicy(RSqlSecurityPolicy::ESchemaPolicy, TSecurityPolicy::EAlwaysPass); - TEST2(err, KErrNone); - err = policy.SetDbPolicy(RSqlSecurityPolicy::EWritePolicy, TSecurityPolicy::EAlwaysPass); - TEST2(err, KErrNone); - err = policy.SetDbPolicy(RSqlSecurityPolicy::EReadPolicy, TSecurityPolicy::EAlwaysPass); - TEST2(err, KErrNone); - - err = policy.SetPolicy(RSqlSecurityPolicy::ETable, _L("A"), RSqlSecurityPolicy::EWritePolicy, TSecurityPolicy::EAlwaysPass); - TEST2(err, KErrNone); - err = policy.SetPolicy(RSqlSecurityPolicy::ETable, _L("A"), RSqlSecurityPolicy::EReadPolicy, TSecurityPolicy::EAlwaysPass); - TEST2(err, KErrNone); - + RSqlSecurityPolicy policy = CreateTestSecurityPolicy(); + TInt err = KErrNone; if(aEncoding == EDbEncUtf16) { err = TheDb.Create(KDbName, policy); @@ -124,58 +134,63 @@ // TBuf8 invalidData; invalidData.SetLength(KCorruptBlockLen); - invalidData.Fill(TChar(0xCC)); - // - for(TInt i=0;iCopy(KFullDbName2, KFullDbName); - TEST2(err, KErrNone); - RFile file; - err = file.Open(TheFs, KFullDbName, EFileRead | EFileWrite); - TEST2(err, KErrNone); - err = file.Write(i * KCorruptBlockLen, invalidData); - TEST2(err, KErrNone); - file.Close(); - //Try to open the database and read the record - TBool testPassed = EFalse; - err = TheDb.Open(KDbName); - if(err == KErrNone) + invalidData.Fill(invalidChar[j]); + TheTest.Printf(_L("Invalid char: %X\r\n"), (TUint)(invalidChar[j])); + for(TInt i=0;iCopy(KFullDbName2, KFullDbName); + TEST2(err, KErrNone); + RFile file; + err = file.Open(TheFs, KFullDbName, EFileRead | EFileWrite); + TEST2(err, KErrNone); + TInt fpos = i * KCorruptBlockLen; + err = file.Write(fpos, invalidData); + TEST2(err, KErrNone); + file.Close(); + //Try to open the database and read the record + TBool testPassed = EFalse; + err = TheDb.Open(KDbName); if(err == KErrNone) { - err = stmt.Next(); - if(err == KSqlAtRow) + RSqlStatement stmt; + err = stmt.Prepare(TheDb, _L("SELECT I FROM A")); + if(err == KErrNone) { - TInt val = stmt.ColumnInt(0); - if(val == 10) + err = stmt.Next(); + if(err == KSqlAtRow) { - testPassed = ETrue; - err = KErrNone; + TInt val = stmt.ColumnInt(0); + if(val == 10) + { + testPassed = ETrue; + err = KErrNone; + } + else + { + err = KErrGeneral; + } } - else - { - err = KErrGeneral; - } + stmt.Close(); } - stmt.Close(); } - } - TheDb.Close(); - (void)RSqlDatabase::Delete(KDbName); - TheTest.Printf(_L("Iteration % 4d, err=%d\r\n"), i + 1, err); - if(!testPassed) - { - TEST(err != KErrNone); - } - }//end of - for(TInt i=0;iDelete(KFullDbName2); delete fm; - TheTest.Printf(_L("\r\n")); } /** @@ -208,6 +223,198 @@ DoCorruptedSecureDbTest(EDbEncUtf8); } +const TInt KDbPolicyTypeTooSmall = 1; +const TInt KDbPolicyTypeTooBig = 2; +const TInt KDefaultPolicyWithObjName = 3; +const TInt KDbPolicyWithObjName = 4; +const TInt KInvObjPolicyWithObjName = 5; +const TInt KDefaultPolicyMoved = 6; +const TInt KDuplicatedDbPolicy = 7; +const TInt KTablePolicyTypeTooSmall = 8; +const TInt KTablePolicyTypeTooBig = 9; +const TInt KTablePolicyNameInvalid = 10; +const TInt KTwoDefaultPolicies = 11; + +void CorruptDbPolicy(TInt aType) + { + TBuf8<200> dbName; + dbName.Copy(KFullDbName()); + sqlite3* dbHandle = NULL; + TInt err = sqlite3_open((const char*)(dbName.PtrZ()), &dbHandle); + TEST2(err, SQLITE_OK); + switch(aType) + { + case KDbPolicyTypeTooSmall: //Invalid database poicy type - less than the schema policy type + err = sqlite3_exec(dbHandle, "UPDATE symbian_security SET PolicyType=-10 WHERE ObjectType=-1 AND PolicyType=0", NULL, 0, NULL); + TEST2(err, SQLITE_OK); + break; + case KDbPolicyTypeTooBig: //Invalid database poicy type - bigger than the write policy type + err = sqlite3_exec(dbHandle, "UPDATE symbian_security SET PolicyType=10 WHERE ObjectType=-1 AND PolicyType=0", NULL, 0, NULL); + TEST2(err, SQLITE_OK); + break; + case KDefaultPolicyWithObjName: //Default database policy with valid object name + err = sqlite3_exec(dbHandle, "UPDATE symbian_security SET ObjectName='aaaa' WHERE ObjectType=-2", NULL, 0, NULL); + TEST2(err, SQLITE_OK); + break; + case KDbPolicyWithObjName: //Database policy with valid object name + err = sqlite3_exec(dbHandle, "UPDATE symbian_security SET ObjectName='aaaa' WHERE ObjectType=-1", NULL, 0, NULL); + TEST2(err, SQLITE_OK); + break; + case KInvObjPolicyWithObjName: //Invalid object type is with valid object name + err = sqlite3_exec(dbHandle, "UPDATE symbian_security SET ObjectType=5, ObjectName='aaaa' WHERE ObjectType=0", NULL, 0, NULL); + TEST2(err, SQLITE_OK); + break; + case KDefaultPolicyMoved: //The default security policy is the last in the table + err = sqlite3_exec(dbHandle, "DELETE FROM symbian_security WHERE ObjectType=-2", NULL, 0, NULL); + TEST2(err, SQLITE_OK); + err = sqlite3_exec(dbHandle, "INSERT INTO symbian_security VALUES(20,-2,'',0, x'1122334455667788')", NULL, 0, NULL); + TEST2(err, SQLITE_OK); + break; + case KDuplicatedDbPolicy: //Two database policies of the same type + err = sqlite3_exec(dbHandle, "INSERT INTO symbian_security VALUES(9,-1,'',1, x'1122334455667788')", NULL, 0, NULL); + TEST2(err, SQLITE_OK); + break; + case KTablePolicyTypeTooSmall: //Invalid table poicy type - less than the read policy type + err = sqlite3_exec(dbHandle, "UPDATE symbian_security SET PolicyType=-10 WHERE ObjectType=0 AND PolicyType=1", NULL, 0, NULL); + TEST2(err, SQLITE_OK); + break; + case KTablePolicyTypeTooBig: //Invalid table poicy type - less than the write policy type + err = sqlite3_exec(dbHandle, "UPDATE symbian_security SET PolicyType=10 WHERE ObjectType=0 AND PolicyType=2", NULL, 0, NULL); + TEST2(err, SQLITE_OK); + break; + case KTablePolicyNameInvalid: + err = sqlite3_exec(dbHandle, "UPDATE symbian_security SET ObjectName='' WHERE ObjectType=0 AND PolicyType=2", NULL, 0, NULL); + TEST2(err, SQLITE_OK); + break; + case KTwoDefaultPolicies: + err = sqlite3_exec(dbHandle, "INSERT INTO symbian_security VALUES(9,-2,'',1, x'1122334455667788')", NULL, 0, NULL); + TEST2(err, SQLITE_OK); + break; + default: + TEST(0); + break; + } + sqlite3_close(dbHandle); + } + +/** +@SYMTestCaseID PDS-SQL-CT-4240 +@SYMTestCaseDesc Invalid settings in symbian_security table. +@SYMTestPriority High +@SYMTestActions The test creates a secure test database. Then the test runs a set of test + iterations. On each itertaion the test makes onle of the stored security + policies invalied (symbian_security table). Then the test attempts to open + the database and checks the behaviour of the SQL server - whether an error + will be reproted back or not. +@SYMTestExpectedResults Test must not fail +*/ +void BadDbPolicyTest() + { + sqlite3SymbianLibInit(); + + RSqlSecurityPolicy policy = CreateTestSecurityPolicy(); + // + (void)RSqlDatabase::Delete(KDbName); + TInt err = TheDb.Create(KDbName, policy); + TEST2(err, KErrNone); + err = TheDb.Exec(_L("CREATE TABLE A(I INTEGER); INSERT INTO A VALUES(10)")); + TEST(err >= 0); + TheDb.Close(); + policy.Close(); + // + CFileMan* fm = NULL; + TRAP(err, fm = CFileMan::NewL(TheFs)); + TEST2(err, KErrNone); + //Make a copy of the database + err = fm->Copy(KFullDbName, KFullDbName2); + TEST2(err, KErrNone); + //Invalid database policy - policy type value less than the schema policy type value + CorruptDbPolicy(KDbPolicyTypeTooSmall); + err = TheDb.Open(KDbName); + TheDb.Close(); + TEST2(err, KErrGeneral); + err = fm->Copy(KFullDbName2, KFullDbName); + TEST2(err, KErrNone); + //Invalid database policy - policy type value bigger than the write policy type value + CorruptDbPolicy(KDbPolicyTypeTooBig); + err = TheDb.Open(KDbName); + TheDb.Close(); + TEST2(err, KErrGeneral); + err = fm->Copy(KFullDbName2, KFullDbName); + TEST2(err, KErrNone); + //Invalid database policy - the default database policy is with valid object name + CorruptDbPolicy(KDefaultPolicyWithObjName); + err = TheDb.Open(KDbName); + TheDb.Close(); + TEST2(err, KErrNone); + err = fm->Copy(KFullDbName2, KFullDbName); + TEST2(err, KErrNone); + //Invalid database policy - database policy is with valid object name + CorruptDbPolicy(KDbPolicyWithObjName); + err = TheDb.Open(KDbName); + TheDb.Close(); + TEST2(err, KErrNone); + err = fm->Copy(KFullDbName2, KFullDbName); + TEST2(err, KErrNone); + //Invalid database policy - invalid object type is with valid object name + CorruptDbPolicy(KInvObjPolicyWithObjName); + err = TheDb.Open(KDbName); + TheDb.Close(); + TEST2(err, KErrGeneral); + err = fm->Copy(KFullDbName2, KFullDbName); + TEST2(err, KErrNone); + //Invalid database policy - the default security policy is the last in the table + CorruptDbPolicy(KDefaultPolicyMoved); + err = TheDb.Open(KDbName); + TheDb.Close(); + TEST2(err, KErrNone); + err = fm->Copy(KFullDbName2, KFullDbName); + TEST2(err, KErrNone); + //Invalid database policy - duplicated database policy + CorruptDbPolicy(KDuplicatedDbPolicy); + err = TheDb.Open(KDbName); + TheDb.Close(); + TEST2(err, KErrGeneral); + err = fm->Copy(KFullDbName2, KFullDbName); + TEST2(err, KErrNone); + //Invalid table policy - policy type value less than the read policy type value + CorruptDbPolicy(KTablePolicyTypeTooSmall); + err = TheDb.Open(KDbName); + TheDb.Close(); + TEST2(err, KErrGeneral); + err = fm->Copy(KFullDbName2, KFullDbName); + TEST2(err, KErrNone); + //Invalid table policy - policy type value bigger than the write policy type value + CorruptDbPolicy(KTablePolicyTypeTooBig); + err = TheDb.Open(KDbName); + TheDb.Close(); + TEST2(err, KErrGeneral); + err = fm->Copy(KFullDbName2, KFullDbName); + TEST2(err, KErrNone); + //Invalid table policy - emtpy string as a table name + CorruptDbPolicy(KTablePolicyNameInvalid); + err = TheDb.Open(KDbName); + TheDb.Close(); + TEST2(err, KErrGeneral); + err = fm->Copy(KFullDbName2, KFullDbName); + TEST2(err, KErrNone); + //Two default policies + CorruptDbPolicy(KTwoDefaultPolicies); + err = TheDb.Open(KDbName); + TheDb.Close(); + TEST2(err, KErrGeneral); + err = fm->Copy(KFullDbName2, KFullDbName); + TEST2(err, KErrNone); + // + (void)RSqlDatabase::Delete(KDbName); + (void)fm->Delete(KFullDbName2); + delete fm; + + sqlite3SymbianLibFinalize(); + CloseSTDLIB(); + } + + void CreateTestEnv() { TInt err = TheFs.Connect(); @@ -227,6 +434,9 @@ TheTest.Next(_L("@SYMTestCaseID:PDS-SQL-CT-4203 Corrupted UTF8 encoded secure database test")); CorruptedSecureDbTest8(); + + TheTest.Next(_L("@SYMTestCaseID:PDS-SQL-CT-4240 Secure database with bad policy test")); + BadDbPolicyTest(); } TInt E32Main() diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/t_sqlfilebuf64.cpp --- a/persistentstorage/sql/TEST/t_sqlfilebuf64.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/t_sqlfilebuf64.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -1337,6 +1337,225 @@ (void)TheFs.Delete(KTestFile); } +/////////////////////////////////////////////////////////////////////////////////////// + +#ifdef _DEBUG + +//Panic thread function. +//It will cast aData parameter to a TFunctor pointer and call it. +//The expectation is that the called function will panic and kill the panic thread. +TInt ThreadFunc(void* aData) + { + CTrapCleanup* tc = CTrapCleanup::New(); + TEST(tc != NULL); + + User::SetJustInTime(EFalse); // disable debugger panic handling + + TFunctor* obj = reinterpret_cast (aData); + TEST(obj != NULL); + (*obj)();//call the panic function + + delete tc; + + return KErrNone; + } + +//Panic test. +//PanicTest function will create a new thread - panic thread, giving it a pointer to the function which has to +//be executed and the expectation is that the function will panic and kill the panic thread. +//PanicTest function will check the panic thread exit code, exit category and the panic code. +void PanicTest(TFunctor& aFunctor, TExitType aExpectedExitType, const TDesC& aExpectedCategory, TInt aExpectedPanicCode) + { + RThread thread; + _LIT(KThreadName,"SqlFileBufPanicThread"); + TEST2(thread.Create(KThreadName, &ThreadFunc, 0x2000, 0x1000, 0x10000, (void*)&aFunctor, EOwnerThread), KErrNone); + + TRequestStatus status; + thread.Logon(status); + TEST2(status.Int(), KRequestPending); + thread.Resume(); + User::WaitForRequest(status); + User::SetJustInTime(ETrue); // enable debugger panic handling + + TEST2(thread.ExitType(), aExpectedExitType); + TEST(thread.ExitCategory() == aExpectedCategory); + TEST2(thread.ExitReason(), aExpectedPanicCode); + + CLOSE_AND_WAIT(thread); + } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////// Panic test functions ///////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +//Panic when calling RFileBuf64::RFileBuf64() with an invalid buffer capacity value. +class TSqlFileBuf_InvalidCapacity : public TFunctor + { +private: + virtual void operator()() + { + RFileBuf64 fbuf(-8192);//panic here - "-8192" - negative buffer capacity + } + }; +static TSqlFileBuf_InvalidCapacity TheSqlFileBuf_InvalidCapacity; + +//Panic when calling RFileBuf64::Create() with an invalid file handle. +class TSqlFileBuf_InvalidFileHandle1 : public TFunctor + { +private: + virtual void operator()() + { + RFileBuf64 fbuf(8192); + RFs fs; + fbuf.Create(fs, _L("aaa.db"), EFileRead);//panic here - invalid file handle + } + }; +static TSqlFileBuf_InvalidFileHandle1 TheSqlFileBuf_InvalidFileHandle1; + +//Panic when calling RFileBuf64::Create() with an invalid file name. +class TSqlFileBuf_InvalidFileName1 : public TFunctor + { +private: + virtual void operator()() + { + RFileBuf64 fbuf(8192); + RFs fs; + TInt err = fs.Connect(); + TEST2(err, KErrNone); + fbuf.Create(fs, KNullDesC, EFileRead);//panic here - invalid file name + fs.Close(); + } + }; +static TSqlFileBuf_InvalidFileName1 TheSqlFileBuf_InvalidFileName1; + +//Panic when calling RFileBuf64::Open() with an invalid file handle. +class TSqlFileBuf_InvalidFileHandle2 : public TFunctor + { +private: + virtual void operator()() + { + RFileBuf64 fbuf(8192); + RFs fs; + fbuf.Open(fs, _L("aaa.db"), EFileRead);//panic here - invalid file handle + } + }; +static TSqlFileBuf_InvalidFileHandle2 TheSqlFileBuf_InvalidFileHandle2; + +//Panic when calling RFileBuf64::Open() with an invalid file name. +class TSqlFileBuf_InvalidFileName2 : public TFunctor + { +private: + virtual void operator()() + { + RFileBuf64 fbuf(8192); + RFs fs; + TInt err = fs.Connect(); + TEST2(err, KErrNone); + fbuf.Open(fs, KNullDesC, EFileRead);//panic here - invalid file name + fs.Close(); + } + }; +static TSqlFileBuf_InvalidFileName2 TheSqlFileBuf_InvalidFileName2; + +//Panic when calling RFileBuf64::Temp() with an invalid file handle. +class TSqlFileBuf_InvalidFileHandle3 : public TFunctor + { +private: + virtual void operator()() + { + RFileBuf64 fbuf(8192); + RFs fs; + TFileName fname; + fbuf.Temp(fs, _L("c:\\test"), fname, EFileRead);//panic here - invalid file handle + } + }; +static TSqlFileBuf_InvalidFileHandle3 TheSqlFileBuf_InvalidFileHandle3; + +//Panic when calling RFileBuf64::AdoptFromClient() with an invalid message handle. +class TSqlFileBuf_InvalidMessageHandle : public TFunctor + { +private: + virtual void operator()() + { + RFileBuf64 fbuf(8192); + RMessage2 msg; + fbuf.AdoptFromClient(msg, 0, 1);//panic here - invalid message handle + } + }; +static TSqlFileBuf_InvalidMessageHandle TheSqlFileBuf_InvalidMessageHandle; + +//Panic when calling RFileBuf64::Read() with an invalid file position. +class TSqlFileBuf_InvalidReadPos : public TFunctor + { +private: + virtual void operator()() + { + RFileBuf64 fbuf(8192); + TBuf8<50> buf; + fbuf.Read(-1024, buf);//panic here - invalid file position + } + }; +static TSqlFileBuf_InvalidReadPos TheSqlFileBuf_InvalidReadPos; + +//Panic when calling RFileBuf64::Write() with an invalid file position. +class TSqlFileBuf_InvalidWritePos : public TFunctor + { +private: + virtual void operator()() + { + RFileBuf64 fbuf(8192); + TBuf8<50> buf; + fbuf.Write(-1024, buf);//panic here - invalid file position + } + }; +static TSqlFileBuf_InvalidWritePos TheSqlFileBuf_InvalidWritePos; + +//Panic when calling RFileBuf64::SetSize() with an invalid file size. +class TSqlFileBuf_InvalidSize : public TFunctor + { +private: + virtual void operator()() + { + RFileBuf64 fbuf(8192); + TBuf8<50> buf; + fbuf.SetSize(-1024);//panic here - invalid file size + } + }; +static TSqlFileBuf_InvalidSize TheSqlFileBuf_InvalidSize; + +#endif //_DEBUG + +/** +@SYMTestCaseID PDS-SQL-UT-4236 +@SYMTestCaseDesc RFileBuf64 panic test. + The test runs a thread. The thread will create a RFileBuf64 object + and put the object in a situation where the file buffer cannot perform + its duties anymore and will raise a panic. The test verifies that the file + buffer implementation properly detects anomalities such as bad parameters, + null handles, etc... +@SYMTestActions RFileBuf64 panic test. +@SYMTestExpectedResults Test must not fail +@SYMTestPriority High +*/ +void FileBufPanicTest() + { +#ifdef _DEBUG + _LIT(KPanicCategory, "FBuf64"); + PanicTest(TheSqlFileBuf_InvalidCapacity, EExitPanic, KPanicCategory, 1); + PanicTest(TheSqlFileBuf_InvalidFileHandle1, EExitPanic, KPanicCategory, 7); + PanicTest(TheSqlFileBuf_InvalidFileName1, EExitPanic, KPanicCategory, 10); + PanicTest(TheSqlFileBuf_InvalidFileHandle2, EExitPanic, KPanicCategory, 7); + PanicTest(TheSqlFileBuf_InvalidFileName2, EExitPanic, KPanicCategory, 10); + PanicTest(TheSqlFileBuf_InvalidFileHandle3, EExitPanic, KPanicCategory, 7); + PanicTest(TheSqlFileBuf_InvalidMessageHandle, EExitPanic, KPanicCategory, 8); + PanicTest(TheSqlFileBuf_InvalidReadPos, EExitPanic, KPanicCategory, 4); + PanicTest(TheSqlFileBuf_InvalidWritePos, EExitPanic, KPanicCategory, 4); + PanicTest(TheSqlFileBuf_InvalidSize, EExitPanic, KPanicCategory, 5); +#else //_DEBUG + TheTest.Printf(_L("This test can be run in _DEBUG mode only!")); +#endif//_DEBUG + } + void DoTests() { TheTest.Start(_L(" @SYMTestCaseID:PDS-SQL-UT-4132 RFileBuf64 write test 1")); @@ -1384,6 +1603,9 @@ OpenFileIoErrTest(); TheTest.Next( _L(" @SYMTestCaseID:PDS-SQL-CT-4212 RFileBuf64::Write() test")); TestSetSizeCounter(); + + TheTest.Next( _L(" @SYMTestCaseID:PDS-SQL-UT-4236 RFileBuf64 panic test")); + FileBufPanicTest(); } TInt E32Main() diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/t_sqlfilesrvcrash1.cpp --- a/persistentstorage/sql/TEST/t_sqlfilesrvcrash1.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/t_sqlfilesrvcrash1.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -25,7 +25,7 @@ #include #include -#include +#include RTest TheTest(_L("t_sqlfilesrvcrash1 test")); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/t_sqlfilesrvcrash2.cpp --- a/persistentstorage/sql/TEST/t_sqlfilesrvcrash2.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/t_sqlfilesrvcrash2.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -25,7 +25,7 @@ #include #include -#include +#include RTest TheTest(_L("t_sqlfilesrvcrash2 test")); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/t_sqlload.cpp --- a/persistentstorage/sql/TEST/t_sqlload.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/t_sqlload.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -25,10 +25,14 @@ RTest TheTest(_L("t_sqlload test")); +TDriveNumber KTestDrive = EDriveC; + _LIT(KTestDir, "c:\\test\\"); _LIT(KTestDbName1, "c:\\test\\t_sqlload_1.db"); _LIT(KTestDbName2, "c:\\test\\t_sqlload_2.db"); _LIT(KTestDbName3, "c:\\test\\t_sqlload_3.db"); +_LIT(KTestDbName4, "c:\\test\\t_sqlload_4.db"); +_LIT(KTestDbName5, "c:\\test\\t_sqlload_5.db"); //Test thread count const TInt KTestThreadCnt = 4; @@ -67,6 +71,8 @@ void DeleteTestFiles() { + RSqlDatabase::Delete(KTestDbName5); + RSqlDatabase::Delete(KTestDbName4); RSqlDatabase::Delete(KTestDbName3); RSqlDatabase::Delete(KTestDbName2); RSqlDatabase::Delete(KTestDbName1); @@ -127,25 +133,14 @@ /////////////////////////////////////////////////////////////////////////////////////// //StatementMaxNumberTest() timeouts in WDP builds. -//This function is used return the seconds passed from the start of the test case. -TTimeIntervalSeconds ExecutionTimeSeconds() +//This function is used to return the seconds passed from the start of the test case. +TTimeIntervalSeconds ExecutionTimeSeconds(TTime& aStartTime) { - struct TStartTime - { - TStartTime() - { - iTime.HomeTime(); - } - TTime iTime; - }; - - static TStartTime startTime; - TTime currTime; currTime.HomeTime(); TTimeIntervalSeconds s; - TInt err = currTime.SecondsFrom(startTime.iTime, s); + TInt err = currTime.SecondsFrom(aStartTime, s); TEST2(err, KErrNone); return s; } @@ -159,6 +154,9 @@ err = fs.MkDir(KTestDir); TEST(err == KErrNone || err == KErrAlreadyExists); + err = fs.CreatePrivatePath(KTestDrive); + TEST(err == KErrNone || err == KErrAlreadyExists); + fs.Close(); } @@ -577,7 +575,7 @@ the max number of statements to be created is reached (100000). Then the test deletes 1/2 of the created statements objects and after that attempts to execute Next() on the rest of them. - Note that the test has a time limit of 500 seconds. Otherwise on some platforms + Note that the test has a time limit of 120 seconds. Otherwise on some platforms with WDP feature switched on the test may timeout. @SYMTestExpectedResults Test must not fail @SYMDEF DEF145236 @@ -603,6 +601,9 @@ RSqlStatement* stmt = new RSqlStatement[KMaxStmtCount]; TEST(stmt != NULL); + TTime startTime; + startTime.HomeTime(); + //Create as many statement objects as possible TInt idx = 0; err = KErrNone; @@ -613,17 +614,18 @@ { break; } + TTimeIntervalSeconds s = ExecutionTimeSeconds(startTime); if((idx % 100) == 0) { GetHomeTimeAsString(time); - TTimeIntervalSeconds s = ExecutionTimeSeconds(); TheTest.Printf(_L("=== %S: Create % 5d statements. %d seconds.\r\n"), &time, idx + 1, s.Int()); - if(s.Int() > KTestTimeLimit) - { - TheTest.Printf(_L("=== %S: The time limit reached.\r\n"), &time); - ++idx;//The idx-th statement is valid, the statement count is idx + 1. - break; - } + } + if(s.Int() > KTestTimeLimit) + { + GetHomeTimeAsString(time); + TheTest.Printf(_L("=== %S: The time limit reached.\r\n"), &time); + ++idx;//The idx-th statement is valid, the statement count is idx + 1. + break; } } @@ -653,7 +655,7 @@ err = stmt[idx].Next(); TEST2(err, KSqlAtEnd); GetHomeTimeAsString(time); - TTimeIntervalSeconds s = ExecutionTimeSeconds(); + TTimeIntervalSeconds s = ExecutionTimeSeconds(startTime); if((j % 100) == 0) { TheTest.Printf(_L("=== %S: % 5d statements processed. %d seconds.\r\n"), &time, j + 1, s.Int()); @@ -682,12 +684,280 @@ TheTest.Printf(_L("=== %S: Test case end\r\n"), &time); } +TInt CreateFileSessions(TInt& aIdx, RFs aFs[], TInt aMaxFsSessCount) + { + TBuf<30> time; + TTime startTime; + startTime.HomeTime(); + //Create as many file session objects as possible + TInt err = KErrNone; + for(;aIdx KTestTimeLimit) + { + GetHomeTimeAsString(time); + TheTest.Printf(_L("=== %S: The time limit reached.\r\n"), &time); + ++aIdx;//The idx-th file session object is valid, the file session count is idx + 1. + break; + } + } + return err; + } + +/** +@SYMTestCaseID PDS-SQL-CT-4237 +@SYMTestCaseDesc Max file session number test. +@SYMTestPriority High +@SYMTestActions The test creates as many as possible file session objects. The expected result is + that either the file session creation process will fail with KErrNoMemory or + the max number of file sessions to be created is reached (100000). + Then the test attempts to create a database. If there is no memory, the test + closes some of the file session objects. The test also attempts to copy + the created database and to delete it after that, both operations performed + with all file session objects still open. The expectation is that the test + will not crash the SQL server or the client side SQL dll. + Note that the test has a time limit of 120 seconds. Otherwise on some platforms + with WDP feature switched on the test may timeout. +@SYMTestExpectedResults Test must not fail +*/ +void FileSessionMaxNumberTest() + { + TBuf<30> time; + GetHomeTimeAsString(time); + TheTest.Printf(_L("=== %S: Create file sessions\r\n"), &time); + + const TInt KMaxFsCount = 100000; + RFs* fs = new RFs[KMaxFsCount]; + TEST(fs != NULL); + + //Create as many file session objects as possible + TInt idx = 0; + TInt err = CreateFileSessions(idx, fs, KMaxFsCount); + TheTest.Printf(_L("%d created file session objects. Last error: %d.\r\n"), idx, err); + TEST(err == KErrNone || err == KErrNoMemory); + + TBool dbCreated = EFalse; + RSqlDatabase db; + + //An attempt to create a database + while(idx > 0 && err == KErrNoMemory) + { + (void)RSqlDatabase::Delete(KTestDbName1); + err = db.Create(KTestDbName1); + if(err == KErrNone) + { + err = db.Exec(_L("CREATE TABLE A(I INTEGER); INSERT INTO A(I) VALUES(1); INSERT INTO A(I) VALUES(2);")); + } + TheTest.Printf(_L("Database creation. Last error: %d.\r\n"), err); + TEST(err == KErrNoMemory || err >= 0); + if(err == KErrNoMemory) + { + fs[--idx].Close(); + } + else + { + dbCreated = ETrue; + } + db.Close(); + } + + if(dbCreated) + { + //Create again file session objects - as many as possible + err = CreateFileSessions(idx, fs, KMaxFsCount); + TEST(err == KErrNone || err == KErrNoMemory); + //Try to copy the database + err = RSqlDatabase::Copy(KTestDbName1, KTestDbName4); + TheTest.Printf(_L("Copy database. Last error: %d.\r\n"), err); + TEST(err == KErrNone || err == KErrNoMemory); + //Try to delete the databases + if(err == KErrNone) + { + err = RSqlDatabase::Delete(KTestDbName4); + TheTest.Printf(_L("Delete database copy. Last error: %d.\r\n"), err); + TEST(err == KErrNone || err == KErrNoMemory); + } + err = RSqlDatabase::Delete(KTestDbName1); + TheTest.Printf(_L("Delete database. Last error: %d.\r\n"), err); + TEST(err == KErrNone || err == KErrNoMemory); + } + + //Cleanup + for(TInt i=0;i time; + TTime startTime; + startTime.HomeTime(); + //Create as many file session objects as possible + TInt err = KErrNone; + for(;aIdx KTestTimeLimit) + { + GetHomeTimeAsString(time); + TheTest.Printf(_L("=== %S: The time limit reached.\r\n"), &time); + ++aIdx;//The idx-th sql connection is valid, the sql connection count is idx + 1. + break; + } + } + return err; + } + +/** +@SYMTestCaseID PDS-SQL-CT-4238 +@SYMTestCaseDesc Max sql connection number test. +@SYMTestPriority High +@SYMTestActions The test creates as many as possible sql connection objects. The expected result is + that either the sql connection creation process will fail with KErrNoMemory or + the max number of sql connection to be created is reached (100000). + Then the test attempts to create a database. If there is no memory, the test + closes some of the sql connection objects. The test also attempts to copy + the created database and to delete it after that, both operations performed + with all sql connection objects still open. The expectation is that the test + will not crash the SQL server or the client side SQL dll. + Note that the test has a time limit of 120 seconds. Otherwise on some platforms + with WDP feature switched on the test may timeout. +@SYMTestExpectedResults Test must not fail +*/ +void SqlConnectionMaxNumberTest() + { + TBuf<30> time; + GetHomeTimeAsString(time); + TheTest.Printf(_L("=== %S: Create sql connections\r\n"), &time); + + (void)RSqlDatabase::Delete(KTestDbName1); + RSqlDatabase db1; + TInt err = db1.Create(KTestDbName1);//CreateSqlConnections() opens the already existing KTestDbName1 database + TEST2(err, KErrNone); + + const TInt KMaxConnCount = 100000; + RSqlDatabase* db = new RSqlDatabase[KMaxConnCount]; + TEST(db != NULL); + + //Create as many sql connection objects as possible + TInt idx = 0; + err = CreateSqlConnections(idx, db, KMaxConnCount); + TheTest.Printf(_L("%d created sql connection objects. Last error: %d.\r\n"), idx, err); + TEST(err == KErrNone || err == KErrNoMemory); + + TBool dbCreated = EFalse; + RSqlDatabase db2; + + //An attempt to create a database + while(idx > 0 && err == KErrNoMemory) + { + (void)RSqlDatabase::Delete(KTestDbName4); + err = db2.Create(KTestDbName4); + if(err == KErrNone) + { + err = db2.Exec(_L("CREATE TABLE A(I INTEGER); INSERT INTO A(I) VALUES(1); INSERT INTO A(I) VALUES(2);")); + } + TheTest.Printf(_L("Database creation. Last error: %d.\r\n"), err); + TEST(err == KErrNoMemory || err >= 0); + if(err == KErrNoMemory) + { + db[--idx].Close(); + } + else + { + dbCreated = ETrue; + } + db2.Close(); + } + + if(dbCreated) + { + //Create again sql connection objects - as many as possible + err = CreateSqlConnections(idx, db, KMaxConnCount); + TEST(err == KErrNone || err == KErrNoMemory); + //Try to copy the database + err = RSqlDatabase::Copy(KTestDbName4, KTestDbName5); + TheTest.Printf(_L("Copy database. Last error: %d.\r\n"), err); + TEST(err == KErrNone || err == KErrNoMemory); + //Try to delete the databases + if(err == KErrNone) + { + err = RSqlDatabase::Delete(KTestDbName5); + TheTest.Printf(_L("Delete database copy. Last error: %d.\r\n"), err); + TEST(err == KErrNone || err == KErrNoMemory); + } + err = RSqlDatabase::Delete(KTestDbName4); + TheTest.Printf(_L("Delete database. Last error: %d.\r\n"), err); + TEST(err == KErrNone || err == KErrNoMemory); + } + + //Cleanup + for(TInt i=0;i= 80 && ms <= 320);// -60%..+60% + //TEST(ms >= 80 && ms <= 320);// -60%..+60% } //Lock/unlock tests diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/t_sqlstartup.cpp --- a/persistentstorage/sql/TEST/t_sqlstartup.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/t_sqlstartup.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -190,20 +190,23 @@ TheTest.Printf(_L(" %d"), ++failingAllocationNo); OomPreStep(failingAllocationNo); const TUid KDbUd = {0x98765432}; - RArray files; - TRAP(err, server->GetBackUpListL(KDbUd, files)); + RArray files; + TRAP(err, server->GetBackUpListL(KDbUd, EDriveC, files)); fileCnt = files.Count(); if(err == KErrNone) { //No directories should be returned in the list of files for backup for(TInt i=0;iDes(); + TInt rc = KPrivateSubDir().CompareF(fname); TEST(rc != 0); } } + for(TInt j=0;jFs().SetErrorCondition(fsError, cnt); const TUid KDbUd = {0x98765432}; - RArray files; - TRAP(err, server->GetBackUpListL(KDbUd, files)); + RArray files; + TRAP(err, server->GetBackUpListL(KDbUd, EDriveC, files)); fileCnt = files.Count(); if(err == KErrNone) { //No directories should be returned in the list of files for backup for(TInt i=0;iDes(); + TInt rc = KPrivateSubDir().CompareF(fname); TEST(rc != 0); } } + for(TInt j=0;jFs().SetErrorCondition(KErrNone); if(err != KErrNone) @@ -308,6 +314,76 @@ } /** +@SYMTestCaseID PDS-SQL-UT-4224 +@SYMTestCaseDesc CSqlServer::GetBackUpListL() functional test +@SYMTestPriority High +@SYMTestActions Calls CSqlServer::GetBackUpListL() and tests the output, when the drive is read-only, + when there is a sub-directory which name is matching the search pattern. +@SYMTestExpectedResults Test must not fail +*/ +void GetBackupListFunctionalTest() + { + CSqlServer* server = NULL; + TRAPD(err, server = CreateSqlServerL()); + TEST2(err, KErrNone); + //Case 1: database with specified uid bellow do exist (on drive C). There will be one subdirectory matching the search pattern. + const TDriveNumber KTestDrvNum1 = EDriveC; + const TUid KDbUid = {0x98765432}; + TDriveUnit testDrive(KTestDrvNum1); + TDriveName testDriveName = testDrive.Name(); + testDriveName.LowerCase(); + //One test directory will be created, which name will be matching the search pattern. + //The directory name should not be included in the list with the file names. + TFileName testFileName; + err = server->Fs().PrivatePath(testFileName); + TEST2(err, KErrNone); + testFileName.Append(KDbUid.Name()); + _LIT(KTestPath, "t_startup\\"); + testFileName.Append(KTestPath); + testFileName.Append(_L("t_startup.db")); + TParse parse; + err = parse.Set(testFileName, &testDriveName, 0); + TEST2(err, KErrNone); + err = server->Fs().MkDirAll(parse.FullName()); + TEST(err == KErrNone || err == KErrAlreadyExists); + // + RArray files; + TRAP(err, server->GetBackUpListL(KDbUid, KTestDrvNum1, files)); + TEST2(err, KErrNone); + TInt fileCnt = files.Count(); + for(TInt i=0;iDes(); + TheTest.Printf(_L("Db: %S\r\n"), &fname); + TEST(fname.FindF(KTestPath) < 0); + //The name should include the full path + the drive + err = parse.Set(fname, 0, 0); + TEST2(err, KErrNone); + TEST(parse.DrivePresent()); + TEST(parse.PathPresent()); + TDriveName driveName(parse.Drive()); + driveName.LowerCase(); + delete files[i]; + TEST(driveName == testDriveName); + } + files.Close(); + //Case 2: drive Z:. No files should be returned. + const TDriveNumber KTestDrvNum2 = EDriveZ; + TRAP(err, server->GetBackUpListL(KDbUid, KTestDrvNum2, files)); + TEST2(err, KErrNone); + fileCnt = files.Count(); + TEST2(fileCnt, 0); + //Case 3: drive A:. The drive does not exist. No files should be returned. + const TDriveNumber KTestDrvNum3 = EDriveA; + TRAP(err, server->GetBackUpListL(KDbUid, KTestDrvNum3, files)); + TheTest.Printf(_L("Drive %d, err=%d\r\n"), KTestDrvNum3, err); + fileCnt = files.Count(); + TEST2(fileCnt, 0); + // + delete server; + } + +/** @SYMTestCaseID PDS-SQL-UT-4163 @SYMTestCaseDesc Test for DEF144196: SQL, server code coverage can be improved @SYMTestPriority High @@ -429,6 +505,9 @@ TheTest.Next (_L(" @SYMTestCaseID:PDS-SQL-UT-4162 CSqlServer::GetBackUpListL() file I/O error simulation test")); GetBackupListFileIoErrorTest(); + TheTest.Next (_L(" @SYMTestCaseID:PDS-SQL-UT-4224 CSqlServer::GetBackUpListL() functional test")); + GetBackupListFunctionalTest(); + TheTest.Next (_L(" @SYMTestCaseID:PDS-SQL-UT-4163 SQL server, UTF conversion test")); UtfConversionTest(); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/testexecute/SQLite/config/BUR.ini --- a/persistentstorage/sql/TEST/testexecute/SQLite/config/BUR.ini Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/testexecute/SQLite/config/BUR.ini Mon Sep 27 11:59:56 2010 +0100 @@ -1,3 +1,7 @@ +[wait] +Sleep0=5000000 +EndBlock1= + [bur] BackupDir=c:\BackupArchive\ IsPartial=1 diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/testexecute/SQLite/config/Robustness.ini.DEVBOARD --- a/persistentstorage/sql/TEST/testexecute/SQLite/config/Robustness.ini.DEVBOARD Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/testexecute/SQLite/config/Robustness.ini.DEVBOARD Mon Sep 27 11:59:56 2010 +0100 @@ -179,12 +179,12 @@ WaitA0=1 Delete1=E:\Robustness5.db ExpectedError1=KErrNotFound +DefineConfig2=page_size=1024; -Create2=E:\Robustness5.db +Create3=E:\Robustness5.db // Reserve 100K of space. -ReserveDriveSpace3=102400 -Exec4=Create Table Sometable(Someint int primary key, Somereal real, Sometext text); -NoOperation5= +ReserveDriveSpace4=102400 +Exec5=Create Table Sometable(Someint int primary key, Somereal real, Sometext text); // Fill the disk to within 100K of full. NewBlock6=FillDisk100K diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/testexecute/SQLite/group/te_SQL_suite.iby --- a/persistentstorage/sql/TEST/testexecute/SQLite/group/te_SQL_suite.iby Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/testexecute/SQLite/group/te_SQL_suite.iby Mon Sep 27 11:59:56 2010 +0100 @@ -19,52 +19,52 @@ #include #include -file=ABI_DIR\BUILD_DIR\Te_SQL_Suite.exe System\bin\Te_SQL_Suite.exe -file=ABI_DIR\BUILD_DIR\Te_SQL_Suite_cap1.exe System\bin\Te_SQL_Suite_cap1.exe -file=ABI_DIR\BUILD_DIR\Te_SQL_Suite_cap2.exe System\bin\Te_SQL_Suite_cap2.exe +file=ABI_DIR\BUILD_DIR\te_sql_suite.exe System\bin\Te_SQL_Suite.exe +file=ABI_DIR\BUILD_DIR\te_sql_suite_cap1.exe System\bin\Te_SQL_Suite_cap1.exe +file=ABI_DIR\BUILD_DIR\te_sql_suite_cap2.exe System\bin\Te_SQL_Suite_cap2.exe // Script files -data=DATAZ_\tef_sql\te_SQL_Suite.script tef_sql\te_SQL_Suite.script -data=DATAZ_\tef_sql\BasicSQL2.script tef_sql\BasicSQL2.script -data=DATAZ_\tef_sql\BasicSQL2-8S.script tef_sql\BasicSQL2-8S.script -data=DATAZ_\tef_sql\Robustness.script tef_sql\Robustness.script -data=DATAZ_\tef_sql\Concurrent.script tef_sql\Concurrent.script -data=DATAZ_\tef_sql\TypeConversion.script tef_sql\TypeConversion.script -data=DATAZ_\tef_sql\SomeExceptions.script tef_sql\SomeExceptions.script -data=DATAZ_\tef_sql\BasicSQL.script tef_sql\BasicSQL.script -data=DATAZ_\tef_sql\BUR.script tef_sql\BUR.script +data=DATAZ_\tef_sql\te_sql_suite.script tef_sql\te_SQL_Suite.script +data=DATAZ_\tef_sql\basicsql2.script tef_sql\BasicSQL2.script +data=DATAZ_\tef_sql\basicsql2-8s.script tef_sql\BasicSQL2-8S.script +data=DATAZ_\tef_sql\robustness.script tef_sql\Robustness.script +data=DATAZ_\tef_sql\concurrent.script tef_sql\Concurrent.script +data=DATAZ_\tef_sql\typeconversion.script tef_sql\TypeConversion.script +data=DATAZ_\tef_sql\someExceptions.script tef_sql\SomeExceptions.script +data=DATAZ_\tef_sql\basicSQL.script tef_sql\BasicSQL.script +data=DATAZ_\tef_sql\bUr.script tef_sql\BUR.script data=DATAZ_\tef_sql\security.script tef_sql\security.script -data=DATAZ_\tef_sql\Configuration.script tef_sql\Configuration.script -data=DATAZ_\tef_sql\Panics.script tef_sql\Panics.script +data=DATAZ_\tef_sql\configuration.script tef_sql\Configuration.script +data=DATAZ_\tef_sql\panics.script tef_sql\Panics.script data=DATAZ_\tef_sql\collation.script tef_sql\collation.script // Config files -data=DATAZ_\tef_sql\APIBasic.ini tef_sql\APIBasic.ini -data=DATAZ_\tef_sql\APIBasic2.ini tef_sql\APIBasic2.ini -data=DATAZ_\tef_sql\APIBasic2-8S.ini tef_sql\APIBasic2-8S.ini -data=DATAZ_\tef_sql\SomeExceptions.ini tef_sql\SomeExceptions.ini -data=DATAZ_\tef_sql\Robustness.ini tef_sql\Robustness.ini -data=DATAZ_\tef_sql\TypeConversion.ini tef_sql\TypeConversion.ini +data=DATAZ_\tef_sql\apibasic.ini tef_sql\APIBasic.ini +data=DATAZ_\tef_sql\apibasic2.ini tef_sql\APIBasic2.ini +data=DATAZ_\tef_sql\apibasic2-8s.ini tef_sql\APIBasic2-8S.ini +data=DATAZ_\tef_sql\someexceptions.ini tef_sql\SomeExceptions.ini +data=DATAZ_\tef_sql\robustness.ini tef_sql\Robustness.ini +data=DATAZ_\tef_sql\typeConversion.ini tef_sql\TypeConversion.ini data=DATAZ_\tef_sql\constraints.ini tef_sql\constraints.ini data=DATAZ_\tef_sql\views.ini tef_sql\views.ini data=DATAZ_\tef_sql\robust_size.ini tef_sql\robust_size.ini -data=DATAZ_\tef_sql\Configuration.ini tef_sql\Configuration.ini -data=DATAZ_\tef_sql\Concurrent.ini tef_sql\Concurrent.ini -data=DATAZ_\tef_sql\Panics.ini tef_sql\Panics.ini -data=DATAZ_\tef_sql\BUR.ini tef_sql\BUR.ini +data=DATAZ_\tef_sql\configuration.ini tef_sql\Configuration.ini +data=DATAZ_\tef_sql\concurrent.ini tef_sql\Concurrent.ini +data=DATAZ_\tef_sql\panics.ini tef_sql\Panics.ini +data=DATAZ_\tef_sql\bur.ini tef_sql\BUR.ini data=DATAZ_\tef_sql\security.ini tef_sql\security.ini data=DATAZ_\tef_sql\collation.ini tef_sql\collation.ini // Data files -data=DATAZ_\tef_sql\TestData\reference1.txt tef_sql\TestData\reference1.txt -data=DATAZ_\tef_sql\TestData\reference1.bin tef_sql\TestData\reference1.bin -data=DATAZ_\tef_sql\TestData\test1.db tef_sql\TestData\test1.db -data=DATAZ_\tef_sql\TestData\ShortNonDb.db tef_sql\TestData\ShortNonDb.db -data=DATAZ_\tef_sql\TestData\LongNonDb.db tef_sql\TestData\LongNonDb.db -data=DATAZ_\tef_sql\TestData\ReadOnly.db tef_sql\TestData\ReadOnly.db -data=DATAZ_\tef_sql\TestData\Corrupt.db tef_sql\TestData\Corrupt.db -data=DATAZ_\tef_sql\TestData\backup_registration.xml tef_sql\TestData\backup_registration.xml -data=DATAZ_\tef_sql\TestData\[102827c7]corrupt.db tef_sql\TestData\[102827c7]corrupt.db -data=DATAZ_\tef_sql\TestData\ext.pol tef_sql\TestData\ext.pol +data=DATAZ_\tef_sql\testdata\reference1.txt tef_sql\TestData\reference1.txt +data=DATAZ_\tef_sql\testdata\reference1.bin tef_sql\TestData\reference1.bin +data=DATAZ_\tef_sql\testdata\test1.db tef_sql\TestData\test1.db +data=DATAZ_\tef_sql\testdata\shortnonDb.db tef_sql\TestData\ShortNonDb.db +data=DATAZ_\tef_sql\testdata\longnondb.db tef_sql\TestData\LongNonDb.db +data=DATAZ_\tef_sql\testdata\readonly.db tef_sql\TestData\ReadOnly.db +data=DATAZ_\tef_sql\testdata\corrupt.db tef_sql\TestData\Corrupt.db +data=DATAZ_\tef_sql\testdata\backup_registration.xml tef_sql\TestData\backup_registration.xml +data=DATAZ_\tef_sql\testdata\[102827c7]corrupt.db tef_sql\TestData\[102827c7]corrupt.db +data=DATAZ_\tef_sql\testdata\ext.pol tef_sql\TestData\ext.pol #endif // __TE_SQL_SUITE_IBY__ diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/testexecute/SQLite/scripts/BUR.script --- a/persistentstorage/sql/TEST/testexecute/SQLite/scripts/BUR.script Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/testexecute/SQLite/scripts/BUR.script Mon Sep 27 11:59:56 2010 +0100 @@ -49,7 +49,9 @@ RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini setup RUN_TEST_STEP -1 BURTestServer TestBackup z:\TEF_SQL\BUR.ini bur + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_TEST_STEP -1 BURTestServer TestRestore z:\TEF_SQL\BUR.ini bur + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini check END_TESTCASE SYSLIB-SQL-CIT-1834 @@ -67,11 +69,13 @@ //! will be generated. //! //! @SYMREQ REQ5906 - - RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini setup + + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini setup RUN_TEST_STEP -1 BURTestServer TestBackup z:\TEF_SQL\BUR.ini bur + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_UTILS DeleteFile c:\private\10281e17\[102827c7]bur.db RUN_TEST_STEP -1 BURTestServer TestRestore z:\TEF_SQL\BUR.ini bur + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini check END_TESTCASE SYSLIB-SQL-CIT-1835 @@ -92,8 +96,10 @@ RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini setup RUN_TEST_STEP -1 BURTestServer TestBackup z:\TEF_SQL\BUR.ini bur + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini modify RUN_TEST_STEP -1 BURTestServer TestRestore z:\TEF_SQL\BUR.ini bur + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini check END_TESTCASE SYSLIB-SQL-CIT-1836 @@ -114,10 +120,12 @@ RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini setup RUN_TEST_STEP -1 BURTestServer TestBackup z:\TEF_SQL\BUR.ini bur + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_UTILS DeleteFile c:\private\10281e17\[102827c7]bur.db RUN_UTILS CopyFile z:\TEF_SQL\TestData\[102827c7]corrupt.db c:\private\10281e17\[102827c7]bur.db RUN_UTILS MakeReadWrite c:\private\10281e17\[102827c7]bur.db RUN_TEST_STEP -1 BURTestServer TestRestore z:\TEF_SQL\BUR.ini bur + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini check END_TESTCASE SYSLIB-SQL-CIT-1837 @@ -139,9 +147,11 @@ RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini setup RUN_TEST_STEP 100 te_SQL_Suite_cap2 CSQLDDT z:\TEF_SQL\BUR.ini setup2 RUN_TEST_STEP -1 BURTestServer TestBackup z:\TEF_SQL\BUR.ini bur2 + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_UTILS DeleteFile c:\private\10281e17\[102827c7]bur.db RUN_UTILS DeleteFile c:\private\10281e17\[102827c8]bur.db RUN_TEST_STEP -1 BURTestServer TestRestore z:\TEF_SQL\BUR.ini bur2 + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini check RUN_TEST_STEP 100 te_SQL_Suite_cap2 CSQLDDT z:\TEF_SQL\BUR.ini check2 END_TESTCASE SYSLIB-SQL-CIT-1838 @@ -164,10 +174,12 @@ RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini setup3 RUN_TEST_STEP -1 BURTestServer TestBackup z:\TEF_SQL\BUR.ini bur + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_UTILS DeleteFile c:\private\10281e17\[102827c7]bur1.db RUN_UTILS DeleteFile c:\private\10281e17\[102827c7]bur2.db RUN_UTILS DeleteFile c:\private\10281e17\[102827c7]bur3.db RUN_TEST_STEP -1 BURTestServer TestRestore z:\TEF_SQL\BUR.ini bur + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini check3 END_TESTCASE SYSLIB-SQL-CIT-1839-0001 @@ -191,8 +203,10 @@ RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini setup4 RUN_TEST_STEP -1 BURTestServer TestBackup z:\TEF_SQL\BUR.ini bur + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_UTILS DeleteFile c:\private\10281e17\[102827c7]118192 RUN_TEST_STEP -1 BURTestServer TestRestore z:\TEF_SQL\BUR.ini bur + RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini wait RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\BUR.ini check4 END_TESTCASE SYSLIB-SQL-CIT-4026 diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/testexecute/SQLite/scripts/BasicSQL2.script --- a/persistentstorage/sql/TEST/testexecute/SQLite/scripts/BasicSQL2.script Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/testexecute/SQLite/scripts/BasicSQL2.script Mon Sep 27 11:59:56 2010 +0100 @@ -211,6 +211,13 @@ RUN_TEST_STEP 100 te_SQL_Suite CSQLDDT z:\TEF_SQL\APIBasic2.ini LeaveMethods END_TESTCASE SYSLIB-SQL-CIT-1798 +RUN_UTILS DeleteFile C:\Leave1.db +RUN_UTILS DeleteFile C:\MCO1.db +RUN_UTILS DeleteFile C:\MCO2.db +RUN_UTILS DeleteFile C:\MCO3.db +RUN_UTILS DeleteFile C:\MCO4.db +RUN_UTILS DeleteFile C:\MCO5.db + START_TESTCASE SYSLIB-SQL-CIT-1799 //! @SYMTestCaseID SYSLIB-SQL-CIT-1799 //! @SYMTestCaseDesc Tests the effect of multiple sequential Creates and Opens. diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/testexecute/SQLite/scripts/te_SQL_suite.script --- a/persistentstorage/sql/TEST/testexecute/SQLite/scripts/te_SQL_suite.script Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/testexecute/SQLite/scripts/te_SQL_suite.script Mon Sep 27 11:59:56 2010 +0100 @@ -31,6 +31,8 @@ RUN_SCRIPT Z:\TEF_SQL\Panics.script RUN_SCRIPT Z:\TEF_SQL\BasicSQL2.script RUN_SCRIPT Z:\TEF_SQL\BasicSQL2-8S.script -RUN_SCRIPT Z:\TEF_SQL\BUR.script +// TThe following script is temporally commented to make sure the result in ONB for all other scripts will be shown correctly. +// Instead, BUR.script will be placed in build script as a separated test script. +//RUN_SCRIPT Z:\TEF_SQL\BUR.script RUN_SCRIPT Z:\TEF_SQL\security.script diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/testexecute/SQLite/src/sqlfn.cpp --- a/persistentstorage/sql/TEST/testexecute/SQLite/src/sqlfn.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/testexecute/SQLite/src/sqlfn.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -83,7 +83,7 @@ __ASSERT_ALWAYS(err == KErrNone, User::Invariant()); } } -TVerdict CSQLFnStep::doTestPostambleL() +TVerdict CSQLFnStep::doTestStepPostambleL() { // Try to make sure that the database and statement resources have been // properly closed (in case of problems). diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/testexecute/SQLite/src/sqlfn.h --- a/persistentstorage/sql/TEST/testexecute/SQLite/src/sqlfn.h Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/testexecute/SQLite/src/sqlfn.h Mon Sep 27 11:59:56 2010 +0100 @@ -27,7 +27,7 @@ CSQLFnStep(); ~CSQLFnStep(); virtual TVerdict doTestStepL(); - virtual TVerdict doTestPostambleL(); + virtual TVerdict doTestStepPostambleL(); // This big enumeration defines the values associated with particular // actions (as read from a config file and converted to the numeric diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/TEST/testexecute/group/TEF_SQL.iby --- a/persistentstorage/sql/TEST/testexecute/group/TEF_SQL.iby Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/TEST/testexecute/group/TEF_SQL.iby Mon Sep 27 11:59:56 2010 +0100 @@ -17,7 +17,7 @@ #define __TEF_SQL_IBY__ #include -#include +#include //Main SQL TEF Scripts data=DATAZ_\tef_sql\tef_sql.script tef_sql\tef_sql.script diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sql/traces_SqlSrv/fixed_id.definitions --- a/persistentstorage/sql/traces_SqlSrv/fixed_id.definitions Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sql/traces_SqlSrv/fixed_id.definitions Mon Sep 27 11:59:56 2010 +0100 @@ -5,35 +5,38 @@ [TRACE]TRACE_ERROR[0x82]_TSQLUTIL_LEAVE=0x1 [TRACE]TRACE_FATAL[0x81]_TSQLUTIL_PANIC=0x1 [TRACE]TRACE_FATAL[0x81]_TSQLUTIL_PANICCLIENTL=0x2 -[TRACE]TRACE_INTERNALS[0x88]_CONVERTSQLFULL2DISKFULLERRROR=0x7d -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_CSQLBACKUPCLIENT2=0x17 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL0=0x1f -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL1=0x20 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL2=0x21 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL3=0x22 +[TRACE]TRACE_INTERNALS[0x88]_CONVERTSQLFULL2DISKFULLERRROR=0x81 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_CSQLBACKUPCLIENT2=0x1e +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL1=0x21 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL2=0x22 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL3=0x23 [TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL4=0x24 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL5=0x23 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETBACKUPLISTL=0x31 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETEXPECTEDDATASIZE=0x1e -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_INITIALIZEGETPROXYBACKUPDATAL=0x26 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_INITIALIZERESTOREPROXYBASEDATAL=0x27 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_NEWLC=0x16 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_NOTIFYCHANGE=0x19 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL0=0x28 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL1=0x29 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL2=0x2a -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL3=0x2b -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL4=0x2c -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL5=0x2d -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL6=0x2e -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTORECOMPLETE=0x25 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RUNERROR=0x18 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_TERMINATEMULTISTAGEOPERATION1=0x2f -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_TERMINATEMULTISTAGEOPERATION2=0x30 -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_TESTBURSTATUSL1=0x1b -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_TESTBURSTATUSL2=0x1c -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_TESTBURSTATUSL_ENTRY=0x1a -[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_TESTBURSTATUSL_EXIT=0x1d +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL5=0x25 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL6=0x26 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL7=0x27 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_GETEXPECTEDDATASIZE=0x20 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_INITIALIZEGETPROXYBACKUPDATAL=0x1f +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_INITIALIZERESTOREPROXYBASEDATAL=0x28 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_NEWLC=0x1d +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL1=0x2a +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL10=0x33 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL11=0xac +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL2=0x2b +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL3=0x2c +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL4=0x2d +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL5=0x2e +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL6=0x2f +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL7=0x30 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL8=0x31 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL9=0x32 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RESTORECOMPLETE=0x29 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPCLIENT_RUNERROR=0x1c +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPNOTIFIER_CSQLBACKUPNOTIFIER2=0x17 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPNOTIFIER_EXIT=0x1b +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPNOTIFIER_NEWL=0x16 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPNOTIFIER_RUNL1=0x19 +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPNOTIFIER_RUNL2=0x1a +[TRACE]TRACE_INTERNALS[0x88]_CSQLBACKUPNOTIFIER_RUNL_ENTRY=0x18 [TRACE]TRACE_INTERNALS[0x88]_CSQLCOMPACTCONN_CSQLCOMPACTCONN2=0x6 [TRACE]TRACE_INTERNALS[0x88]_CSQLCOMPACTCONN_NEWLC_ENTRY=0x4 [TRACE]TRACE_INTERNALS[0x88]_CSQLCOMPACTCONN_NEWLC_EXIT=0x5 @@ -55,120 +58,122 @@ [TRACE]TRACE_INTERNALS[0x88]_CSQLCOMPACTTIMER_QUEUE=0x12 [TRACE]TRACE_INTERNALS[0x88]_CSQLCOMPACTTIMER_RUNL=0x14 [TRACE]TRACE_INTERNALS[0x88]_CSQLCOMPACTTIMER_RUNL2=0x15 -[TRACE]TRACE_INTERNALS[0x88]_CSQLDRIVESPACE_CSQLDRIVESPACE2=0x70 -[TRACE]TRACE_INTERNALS[0x88]_CSQLDRIVESPACE_GETACCESSL_ENTRY=0x71 -[TRACE]TRACE_INTERNALS[0x88]_CSQLDRIVESPACE_GETACCESSL_EXIT=0x72 -[TRACE]TRACE_INTERNALS[0x88]_CSQLDRIVESPACE_NEWLC_ENTRY=0x6e -[TRACE]TRACE_INTERNALS[0x88]_CSQLDRIVESPACE_NEWLC_EXIT=0x6f -[TRACE]TRACE_INTERNALS[0x88]_CSQLDRIVESPACE_RELEASEACCESS=0x73 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_CACHEDDBCONFIGFILENAMESL=0x79 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_CSQLSERVER2_ENTRY=0x76 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_CSQLSERVER2_EXIT=0x77 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_GETBACKUPLISTL=0x7b -[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_GETBACKUPLISTL_ENTRY=0x7a -[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_GETBACKUPLISTL_EXIT=0x7c -[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_GETCOLLATIONDLLNAMEL=0x78 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_NEWLC_ENTRY=0x74 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_NEWLC_EXIT=0x75 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_APPLYCONFIGUPDATES2L=0x5a -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_APPLYCONFIGUPDATESL=0x5b -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_ATTACHDBL_ENTRY=0x52 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_ATTACHDBL_EXIT=0x53 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_COMPACTL_ENTRY=0x56 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_COMPACTL_EXIT=0x57 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CREATEL_ENTRY=0x4a -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CREATEL_EXIT=0x4b -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CREATENEWDBFILEL=0x50 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CREATESECUREL_ENTRY=0x48 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CREATESECUREL_EXIT=0x49 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CSQLSRVDATABASE2_ENTRY=0x4e -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CSQLSRVDATABASE2_EXIT=0x4f -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_DETACHDBL_ENTRY=0x54 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_DETACHDBL_EXIT=0x55 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_INSERTINATTACHDBMAPL=0x59 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_NEWCOMPACTENTRYL_ENTRY=0x5c -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_NEWCOMPACTENTRYL_EXIT=0x5d -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_OPENEXISTINGDBFILEL=0x51 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_OPENL_ENTRY=0x4c -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_OPENL_EXIT=0x4d -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_RELEASECOMPACTENTRY=0x5e -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_REMOVEFROMMAPSL=0x58 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_CSQLSRVSESSION2_ENTRY=0x80 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_CSQLSRVSESSION2_EXIT=0x81 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_DBDELETEFILEL=0x86 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_NEWL_ENTRY=0x7e -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_NEWL_EXIT=0x7f -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_SERVICEERROR_ENTRY=0x84 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_SERVICEERROR_EXIT=0x85 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_SERVICEL_ENTRY=0x82 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_SERVICEL_EXIT=0x83 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_CSQLSRVSTATEMENT2=0x8c -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_CSQLSRVSTATEMENT2_ENTRY=0x8b -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_CSQLSRVSTATEMENT2_EXIT=0x8d -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_NEWLC_ENTRY=0x87 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_NEWLC_ENTRY2=0x89 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_NEWLC_EXIT=0x88 -[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_NEWLC_EXIT2=0x8a -[TRACE]TRACE_INTERNALS[0x88]_DBCOMPACT_ENTRY=0xa2 -[TRACE]TRACE_INTERNALS[0x88]_DBCOMPACT_EXIT1=0xa3 -[TRACE]TRACE_INTERNALS[0x88]_DBCOMPACT_EXIT2=0xa4 -[TRACE]TRACE_INTERNALS[0x88]_DBEXECSTMT16_ENTRY=0x8e -[TRACE]TRACE_INTERNALS[0x88]_DBEXECSTMT16_EXIT=0x8f -[TRACE]TRACE_INTERNALS[0x88]_DBEXECSTMT8_ENTRY=0x90 -[TRACE]TRACE_INTERNALS[0x88]_DBEXECSTMT8_EXIT=0x91 -[TRACE]TRACE_INTERNALS[0x88]_EXECPRAGMA_ENTRY=0x46 -[TRACE]TRACE_INTERNALS[0x88]_EXECPRAGMA_EXIT=0x47 -[TRACE]TRACE_INTERNALS[0x88]_FINALIZESTMTHANDLE_ENTRY=0xa5 -[TRACE]TRACE_INTERNALS[0x88]_FINALIZESTMTHANDLE_EXIT=0xa6 -[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_DOREADL=0x39 -[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_DORELEASE_ENTRY=0x36 -[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_DORELEASE_EXIT=0x37 -[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_DOSEEKL=0x3b -[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_DOSYNCHL=0x38 -[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_DOWRITEL=0x3a -[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_NEWL_ENTRY1=0x32 -[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_NEWL_ENTRY2=0x33 -[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_NEWL_ENTRY3=0x34 -[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_NEWL_EXIT=0x35 -[TRACE]TRACE_INTERNALS[0x88]_ISCOMPACTTIMELIMITREACHED=0xa1 -[TRACE]TRACE_INTERNALS[0x88]_PRERETRIEVEPRAGMAVALUE_ENTRY=0x9e -[TRACE]TRACE_INTERNALS[0x88]_PRERETRIEVEPRAGMAVALUE_EXIT1=0x9f -[TRACE]TRACE_INTERNALS[0x88]_PRERETRIEVEPRAGMAVALUE_EXIT2=0xa0 -[TRACE]TRACE_INTERNALS[0x88]_SQLAUTHORIZER=0xa7 -[TRACE]TRACE_INTERNALS[0x88]_STMTEXEC_ENTRY=0x98 -[TRACE]TRACE_INTERNALS[0x88]_STMTEXEC_EXIT=0x99 -[TRACE]TRACE_INTERNALS[0x88]_STMTNEXT_ENTRY=0x9a -[TRACE]TRACE_INTERNALS[0x88]_STMTNEXT_EXIT=0x9b -[TRACE]TRACE_INTERNALS[0x88]_STMTPREPARE16L_ENTRY=0x92 -[TRACE]TRACE_INTERNALS[0x88]_STMTPREPARE16L_EXIT=0x93 -[TRACE]TRACE_INTERNALS[0x88]_STMTPREPARE8L_ENTRY=0x96 -[TRACE]TRACE_INTERNALS[0x88]_STMTPREPARE8L_EXIT=0x97 -[TRACE]TRACE_INTERNALS[0x88]_STMTPREPARE8_ENTRY=0x94 -[TRACE]TRACE_INTERNALS[0x88]_STMTPREPARE8_EXIT=0x95 -[TRACE]TRACE_INTERNALS[0x88]_STMTRESET_ENTRY=0x9c -[TRACE]TRACE_INTERNALS[0x88]_STMTRESET_EXIT=0x9d -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL1=0x61 -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL2=0x62 -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL3=0x63 -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL4=0x64 -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL_ENTRY=0x5f -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL_EXIT1=0x60 -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL_EXIT2=0x65 -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_DOEXECUTEDBCONFIGFILEOPSL=0x66 -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL1=0x6a -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL2=0x6b -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL3=0x6c -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL_ENTRY=0x67 -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL_EXIT1=0x68 -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL_EXIT2=0x69 -[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL_EXIT3=0x6d -[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_GETCONFIGPARAMSL_ENTRY=0x42 -[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_GETCONFIGPARAMSL_EXIT1=0x43 -[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_GETCONFIGPARAMSL_EXIT2=0x44 -[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_GETCONFIGPARAMSL_EXIT3=0x45 -[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_INITL1=0x3d -[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_INITL2=0x3e -[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_INITL_ENTRY=0x3c -[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_INITL_EXIT1=0x3f -[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_INITL_EXIT2=0x40 -[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_INITL_EXIT3=0x41 +[TRACE]TRACE_INTERNALS[0x88]_CSQLDRIVESPACE_CSQLDRIVESPACE2=0x72 +[TRACE]TRACE_INTERNALS[0x88]_CSQLDRIVESPACE_GETACCESSL_ENTRY=0x73 +[TRACE]TRACE_INTERNALS[0x88]_CSQLDRIVESPACE_GETACCESSL_EXIT=0x74 +[TRACE]TRACE_INTERNALS[0x88]_CSQLDRIVESPACE_NEWLC_ENTRY=0x70 +[TRACE]TRACE_INTERNALS[0x88]_CSQLDRIVESPACE_NEWLC_EXIT=0x71 +[TRACE]TRACE_INTERNALS[0x88]_CSQLDRIVESPACE_RELEASEACCESS=0x75 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_CACHEDDBCONFIGFILENAMESL=0x7b +[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_CSQLSERVER2_ENTRY=0x78 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_CSQLSERVER2_EXIT=0x79 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_GETBACKUPLISTL=0x7f +[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_GETBACKUPLISTL_ENTRY=0x7c +[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_GETBACKUPLISTL_EXIT1=0x7e +[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_GETBACKUPLISTL_EXIT2=0x80 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_GETBACKUPLISTL_FULLPATH=0x7d +[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_GETCOLLATIONDLLNAMEL=0x7a +[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_NEWLC_ENTRY=0x76 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSERVER_NEWLC_EXIT=0x77 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_APPLYCONFIGUPDATES2L=0x5c +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_APPLYCONFIGUPDATESL=0x5d +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_ATTACHDBL_ENTRY=0x54 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_ATTACHDBL_EXIT=0x55 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_COMPACTL_ENTRY=0x58 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_COMPACTL_EXIT=0x59 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CREATEL_ENTRY=0x4c +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CREATEL_EXIT=0x4d +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CREATENEWDBFILEL=0x52 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CREATESECUREL_ENTRY=0x4a +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CREATESECUREL_EXIT=0x4b +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CSQLSRVDATABASE2_ENTRY=0x50 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_CSQLSRVDATABASE2_EXIT=0x51 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_DETACHDBL_ENTRY=0x56 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_DETACHDBL_EXIT=0x57 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_INSERTINATTACHDBMAPL=0x5b +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_NEWCOMPACTENTRYL_ENTRY=0x5e +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_NEWCOMPACTENTRYL_EXIT=0x5f +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_OPENEXISTINGDBFILEL=0x53 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_OPENL_ENTRY=0x4e +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_OPENL_EXIT=0x4f +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_RELEASECOMPACTENTRY=0x60 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVDATABASE_REMOVEFROMMAPSL=0x5a +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_CSQLSRVSESSION2_ENTRY=0x84 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_CSQLSRVSESSION2_EXIT=0x85 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_DBDELETEFILEL=0x8a +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_NEWL_ENTRY=0x82 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_NEWL_EXIT=0x83 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_SERVICEERROR_ENTRY=0x88 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_SERVICEERROR_EXIT=0x89 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_SERVICEL_ENTRY=0x86 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSESSION_SERVICEL_EXIT=0x87 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_CSQLSRVSTATEMENT2=0x90 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_CSQLSRVSTATEMENT2_ENTRY=0x8f +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_CSQLSRVSTATEMENT2_EXIT=0x91 +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_NEWLC_ENTRY=0x8b +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_NEWLC_ENTRY2=0x8d +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_NEWLC_EXIT=0x8c +[TRACE]TRACE_INTERNALS[0x88]_CSQLSRVSTATEMENT_NEWLC_EXIT2=0x8e +[TRACE]TRACE_INTERNALS[0x88]_DBCOMPACT_ENTRY=0xa6 +[TRACE]TRACE_INTERNALS[0x88]_DBCOMPACT_EXIT1=0xa7 +[TRACE]TRACE_INTERNALS[0x88]_DBCOMPACT_EXIT2=0xa8 +[TRACE]TRACE_INTERNALS[0x88]_DBEXECSTMT16_ENTRY=0x92 +[TRACE]TRACE_INTERNALS[0x88]_DBEXECSTMT16_EXIT=0x93 +[TRACE]TRACE_INTERNALS[0x88]_DBEXECSTMT8_ENTRY=0x94 +[TRACE]TRACE_INTERNALS[0x88]_DBEXECSTMT8_EXIT=0x95 +[TRACE]TRACE_INTERNALS[0x88]_EXECPRAGMA_ENTRY=0x48 +[TRACE]TRACE_INTERNALS[0x88]_EXECPRAGMA_EXIT=0x49 +[TRACE]TRACE_INTERNALS[0x88]_FINALIZESTMTHANDLE_ENTRY=0xa9 +[TRACE]TRACE_INTERNALS[0x88]_FINALIZESTMTHANDLE_EXIT=0xaa +[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_DOREADL=0x3b +[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_DORELEASE_ENTRY=0x38 +[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_DORELEASE_EXIT=0x39 +[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_DOSEEKL=0x3d +[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_DOSYNCHL=0x3a +[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_DOWRITEL=0x3c +[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_NEWL_ENTRY1=0x34 +[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_NEWL_ENTRY2=0x35 +[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_NEWL_ENTRY3=0x36 +[TRACE]TRACE_INTERNALS[0x88]_HBLOBBUF_NEWL_EXIT=0x37 +[TRACE]TRACE_INTERNALS[0x88]_ISCOMPACTTIMELIMITREACHED=0xa5 +[TRACE]TRACE_INTERNALS[0x88]_PRERETRIEVEPRAGMAVALUE_ENTRY=0xa2 +[TRACE]TRACE_INTERNALS[0x88]_PRERETRIEVEPRAGMAVALUE_EXIT1=0xa3 +[TRACE]TRACE_INTERNALS[0x88]_PRERETRIEVEPRAGMAVALUE_EXIT2=0xa4 +[TRACE]TRACE_INTERNALS[0x88]_SQLAUTHORIZER=0xab +[TRACE]TRACE_INTERNALS[0x88]_STMTEXEC_ENTRY=0x9c +[TRACE]TRACE_INTERNALS[0x88]_STMTEXEC_EXIT=0x9d +[TRACE]TRACE_INTERNALS[0x88]_STMTNEXT_ENTRY=0x9e +[TRACE]TRACE_INTERNALS[0x88]_STMTNEXT_EXIT=0x9f +[TRACE]TRACE_INTERNALS[0x88]_STMTPREPARE16L_ENTRY=0x96 +[TRACE]TRACE_INTERNALS[0x88]_STMTPREPARE16L_EXIT=0x97 +[TRACE]TRACE_INTERNALS[0x88]_STMTPREPARE8L_ENTRY=0x9a +[TRACE]TRACE_INTERNALS[0x88]_STMTPREPARE8L_EXIT=0x9b +[TRACE]TRACE_INTERNALS[0x88]_STMTPREPARE8_ENTRY=0x98 +[TRACE]TRACE_INTERNALS[0x88]_STMTPREPARE8_EXIT=0x99 +[TRACE]TRACE_INTERNALS[0x88]_STMTRESET_ENTRY=0xa0 +[TRACE]TRACE_INTERNALS[0x88]_STMTRESET_EXIT=0xa1 +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL1=0x63 +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL2=0x64 +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL3=0x65 +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL4=0x66 +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL_ENTRY=0x61 +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL_EXIT1=0x62 +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_CONFIGUREDATABASEL_EXIT2=0x67 +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_DOEXECUTEDBCONFIGFILEOPSL=0x68 +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL1=0x6c +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL2=0x6d +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL3=0x6e +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL_ENTRY=0x69 +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL_EXIT1=0x6a +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL_EXIT2=0x6b +[TRACE]TRACE_INTERNALS[0x88]_TSQLDBSYSSETTINGS_PROCESSSTATEMENTL_EXIT3=0x6f +[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_GETCONFIGPARAMSL_ENTRY=0x44 +[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_GETCONFIGPARAMSL_EXIT1=0x45 +[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_GETCONFIGPARAMSL_EXIT2=0x46 +[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_GETCONFIGPARAMSL_EXIT3=0x47 +[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_INITL1=0x3f +[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_INITL2=0x40 +[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_INITL_ENTRY=0x3e +[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_INITL_EXIT1=0x41 +[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_INITL_EXIT2=0x42 +[TRACE]TRACE_INTERNALS[0x88]_TSQLSRVCONFIGFILE_INITL_EXIT3=0x43 diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sqlite3api/GROUP/bld.inf --- a/persistentstorage/sqlite3api/GROUP/bld.inf Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sqlite3api/GROUP/bld.inf Mon Sep 27 11:59:56 2010 +0100 @@ -441,7 +441,7 @@ ../TEST/TclScript/where5.test z:/private/10285a82/where5.test ../TEST/TclScript/where6.test z:/private/10285a82/where6.test ../TEST/TclScript/zeroblob.test z:/private/10285a82/zeroblob.test -../TEST/t_sqliteapi.txt z:/private/212C3129/t_sqliteapi.txt +../TEST/t_sqliteapi.txt z:/private/212c3129/t_sqliteapi.txt PRJ_TESTMMPFILES diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/sqlite3api/GROUP/sqlite3tests.iby --- a/persistentstorage/sqlite3api/GROUP/sqlite3tests.iby Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/sqlite3api/GROUP/sqlite3tests.iby Mon Sep 27 11:59:56 2010 +0100 @@ -430,7 +430,7 @@ data=ZPRIVATE\10285a82\where5.test \private\10285a82\where5.test data=ZPRIVATE\10285a82\where6.test \private\10285a82\where6.test data=ZPRIVATE\10285a82\zeroblob.test \private\10285a82\zeroblob.test -data=ZPRIVATE\212C3129\t_sqliteapi.txt \private\212C3129\t_sqliteapi.txt +data=ZPRIVATE\212c3129\t_sqliteapi.txt \private\212c3129\t_sqliteapi.txt //The next line to be uncommented if the testing is performed locally. Otherwise tests will fail - //the following file is missing and needed by the timezone server. diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/BMAKE/ESTOR.MMP --- a/persistentstorage/store/BMAKE/ESTOR.MMP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/BMAKE/ESTOR.MMP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1997-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" @@ -40,6 +40,9 @@ SMPSAFE +//CodeWarrior compilation options - disable the "illegal pragma" warning +OPTION CW -w noillpragmas + userinclude ../INC OS_LAYER_SYSTEMINCLUDE_SYMBIAN userinclude ../../../../security/crypto/weakcrypto/inc diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/ROM/StoreTests.BAT --- a/persistentstorage/store/ROM/StoreTests.BAT Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/ROM/StoreTests.BAT Mon Sep 27 11:59:56 2010 +0100 @@ -1,5 +1,5 @@ @rem -@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). @rem All rights reserved. @rem This component and the accompanying materials are made available @rem under the terms of "Eclipse Public License v1.0" @@ -40,3 +40,4 @@ t_storiter T_storbench t_stortoc +t_storswizzle diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/ROM/StoreTests.IBY --- a/persistentstorage/store/ROM/StoreTests.IBY Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/ROM/StoreTests.IBY Mon Sep 27 11:59:56 2010 +0100 @@ -51,5 +51,6 @@ file=ABI_DIR\BUILD_DIR\t_stortoc.exe test\t_stortoc.exe file=ABI_DIR\BUILD_DIR\t_storverify.exe test\t_storverify.exe file=ABI_DIR\BUILD_DIR\t_storbench.exe test\t_storbench.exe +file=ABI_DIR\BUILD_DIR\t_storswizzle.exe test\t_storswizzle.exe #endif diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/TCONT/t_storset.cpp --- a/persistentstorage/store/TCONT/t_storset.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/TCONT/t_storset.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -35,11 +35,36 @@ */ LOCAL_C void test1L() { + test.Start(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1121 Insertion & Deletion ")); + const TInt KEntryCount=200; - TPagedSet set; set.Connect(CMemPagePool::NewLC()); - test.Start(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1121 Insertion & Deletion ")); + //IsIntact() and IsDirty() test + TBool rc = set.IsIntact(); + test(rc); + rc = set.IsDirty(); + test(!rc); + set.MarkDirty(); + rc = set.IsDirty(); + test(rc); + //IsBroken() test + rc = set.IsBroken(); + test(!rc); + set.MarkBroken(); + rc = set.IsBroken(); + test(!rc);//Empty tree - cannot be marked as broken + TInt yy = 10; + set.InsertL(yy); + set.MarkBroken(); + rc = set.IsBroken(); + test(rc); + set.RepairL(); + rc = set.IsBroken(); + test(!rc); + set.ClearL(); + rc = set.IsBroken(); + test(!rc); TInt32 it=0; //* test(set.InsertL(it)); @@ -131,7 +156,16 @@ Mem::FillZ(checkMap,KEntryCount); TPagedSetIter iter(set); if (iter.ResetL()) - do ++checkMap[iter.AtL()]; while (iter.NextL()); + { + do + { + TUint32 data1 = iter.AtL(); + ++checkMap[data1]; + TUint32 data2; + iter.ExtractAtL(data2); + test(data1 == data2); + }while(iter.NextL()); + } for (ii=0;ii biter(set); test(biter.FirstL()); test(biter.AtL()==jj); + TUint32 data; + biter.ExtractAtL(data); + test(data == jj); test(!biter.NextL()); test(biter.LastL()); test(biter.AtL()==jj); @@ -180,6 +217,8 @@ TPagedSetRIter riter(set); test(riter.ResetL()); test(riter.AtL()==jj); + riter.ExtractAtL(data); + test(data == jj); test(!riter.NextL()); //* test(set.DeleteL(jj)); @@ -309,6 +348,10 @@ test(err==KErrNone); } test(set.Count()==KEntryCount); + TBool rc = set.IsEmpty(); + test(!rc); + set.MarkDirty(); + set.MarkCurrent(); TRAP(err, set.ContainsL(it)); test(err==KErrNone); TRAP(err, set.InsertL(it)); @@ -356,7 +399,7 @@ RDesReadStream rts; ptr.Set(buf->Des()); rts.Open(ptr); - + CEmbeddedStore* estor = CEmbeddedStore::FromLC(rts); RStoreReadStream rstream; rstream.OpenL(*estor, id); @@ -379,6 +422,142 @@ CleanupStack::PopAndDestroy(); } +/** +@SYMTestCaseID PDS-STORE-CT-4065 +@SYMTestCaseDesc TStreamPos tests. +@SYMTestActions Tests operations provided by TStreamPos class. +@SYMTestPriority High +@SYMTestExpectedResults Test must not fail +*/ +void StreamPosTest() + { + TStreamPos pos1; + TStreamPos pos2(5); + pos1 = pos2; + test(pos1 == pos2); + + pos1 = 5 + pos2; + test(pos1 > pos2); + test(pos2 < pos1); + test(pos2 <= pos1); + test(pos1 != pos2); + pos1 = pos1 - 5; + test(pos1 == pos2); + + pos2 += 0; + test(pos1 == pos2); + pos2 -= 0; + test(pos1 == pos2); + } + +struct TTestEntry + { + inline TTestEntry() : + iKey(-1), + iData(-1) + { + } + inline TTestEntry(TInt aKey, TInt aData) : + iKey(aKey), + iData(aData) + { + } + TInt iKey; + TInt iData; + }; + +/** +@SYMTestCaseID PDS-STORE-CT-4066 +@SYMTestCaseDesc TBtreeFix tests. +@SYMTestActions Tests operations provided by TBtreeFix class. +@SYMTestPriority High +@SYMTestExpectedResults Test must not fail +*/ +void BTreeFixTestL() + { + CMemPagePool* pool = CMemPagePool::NewLC(); + + TBtreeToken token(TBtreeToken::EEmpty); + TBool rc = token.IsEmpty(); + test(rc); + rc = token.IsIntact(); + test(rc); + + TBtreeFix bentry(token, EBtreeSecure); + TBtreeKey bkey(sizeof(TInt)); + bentry.Connect(pool, &bkey); + + TBtreePos bpos; + rc = bentry.FindL(bpos, 1); + test(!rc); + rc = bentry.InsertL(bpos, TTestEntry(1, 101)); + test(rc); + rc = bentry.FindL(bpos, 1); + test(rc); + TTestEntry entry1 = bentry.AtL(bpos); + test(entry1.iKey == 1 && entry1.iData == 101); + const void* key = bkey.Key(&entry1); + TInt keyVal = *((const TInt*)key); + test.Printf(_L("keyVal=%d\n"), keyVal); + + rc = bentry.InsertL(bpos, TTestEntry(3, 103)); + test(rc); + rc = bentry.InsertL(bpos, TTestEntry(2, 102)); + test(rc); + + rc = bentry.FindL(bpos, 2); + test(rc); + TTestEntry entry2; + bentry.ExtractAtL(bpos, entry2); + test(entry2.iKey == 2 && entry2.iData == 102); + + rc = bentry.FindL(bpos, 3); + test(rc); + TTestEntry entry3; + bentry.ExtractAtL(bpos, entry3); + test(entry3.iKey == 3 && entry3.iData == 103); + + //============================================== + + TBtreeMark bmark; + if(bentry.ResetL(bmark)) + { + do + { + TTestEntry entry = bentry.AtL(bmark); + test.Printf(_L("AtL(): entry.iKey=%d, entry.iData=%d\n"), entry.iKey, entry.iData); + bentry.ExtractAtL(bmark, entry); + test.Printf(_L("ExtractAtL(): entry.iKey=%d, entry.iData=%d\n"), entry.iKey, entry.iData); + }while(bentry.NextL(bmark)); + } + + rc = bentry.NextL(bmark); + test(!rc); + + //============================================== + + rc = bentry.DeleteL(2); + test(rc); + rc = bentry.FindL(bpos, 2); + test(!rc); + rc = bentry.FindL(bpos, 3); + test(rc); + TRAPD(err, bentry.DeleteAtL(bpos)); + test(err == KErrNone); + rc = bentry.FindL(bpos, 3); + test(!rc); + + bentry.MarkDirty(); + rc = bentry.IsDirty(); + test(rc); + bentry.MarkCurrent(); + rc = bentry.IsDirty(); + test(!rc); + + bentry.ClearL(); + CleanupStack::PopAndDestroy(pool); + } + LOCAL_C void doMainL() { test.Start(_L("Basic operations")); @@ -389,6 +568,10 @@ test3L(); test.Next(_L("Forgotten API")); test4L(); + test.Next(_L("@SYMTestCaseID:PDS-STORE-CT-4065: TStreamPos test")); + StreamPosTest(); + test.Next(_L("@SYMTestCaseID:PDS-STORE-CT-4066: TBtreeFix test")); + BTreeFixTestL(); test.End(); } diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/TFILE/t_storfbuf.cpp --- a/persistentstorage/store/TFILE/t_storfbuf.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/TFILE/t_storfbuf.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -249,7 +249,10 @@ if (file.Replace(TheFs,parse.NameAndExt(),EFileWrite)!=KErrNone) test.Panic(_L("Replacing file")); RFileBuf rbuf(KTestWriteBufSize); - rbuf.Attach(file); + RFile file2 = file;//Keep a copy in file2, because Attach() will clear the passed RFile parameter + rbuf.Attach(file); + rbuf.Detach(); + rbuf.Reattach(file2); testStreamBufWriteL(rbuf); rbuf.SynchL(); rbuf.Close(); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/TFILE/t_storfcomp.cpp --- a/persistentstorage/store/TFILE/t_storfcomp.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/TFILE/t_storfcomp.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -514,10 +514,74 @@ } } -GLDEF_C TInt E32Main() +class CTestStreamStore : public CStreamStore + { +public: + static CTestStreamStore* NewL(); + virtual ~CTestStreamStore(); + +private: + CTestStreamStore(); + virtual MStreamBuf* DoReadL(TStreamId anId) const; + virtual MStreamBuf* DoCreateL(TStreamId& anId); + + }; + +CTestStreamStore* CTestStreamStore::NewL() + { + return new (ELeave) CTestStreamStore; + } + +CTestStreamStore::~CTestStreamStore() + { + } + +CTestStreamStore::CTestStreamStore() + { + } + +MStreamBuf* CTestStreamStore::DoReadL(TStreamId) const + { + return NULL; + } + +MStreamBuf* CTestStreamStore::DoCreateL(TStreamId&) + { + return NULL; + } + +/** +@SYMTestCaseID PDS-STORE-CT-4063 +@SYMTestCaseDesc CStreamStore tests. +@SYMTestActions CStreamStore provides couple of virtual methods in its private section: + DoExtendL(), DoDeleteL(), DoReplaceL(), DoReclaimL(). + They are no-ops and are expected to be overriden in the class derived from + CStreamStore. Their implementations leave with KErrNotsupported. + The test uses a class derived from CStreamStore, which class does not implement + virtuals mentioned above. These virtuals should leave with KErrNotSupported when called. +@SYMTestPriority High +@SYMTestExpectedResults Test must not fail +*/ +void TestStreamStoreVirtualsL() + { + CTestStreamStore* store = CTestStreamStore::NewL(); + TRAPD(err, store->CommitL()); + test(err == KErrNone); + TRAP(err, store->RevertL()); + test(err == KErrNotSupported); + TRAP(err, store->ReclaimL()); + test(err == KErrNotSupported); + TRAP(err, store->CompactL()); + test(err == KErrNotSupported); + TRAP(err, store->DeleteL(TStreamId(1))); + test(err == KErrNotSupported); + delete store; + } + // // Test permanent file store. // +GLDEF_C TInt E32Main() { test.Title(); setupTestDirectory(); @@ -527,6 +591,9 @@ test.Start(_L("Test compaction")); TRAPD(r,testCompactL()); test(r==KErrNone); + test.Next(_L("@SYMTestCaseID:PDS-STORE-CT-4063: Test CStreamStore virtuals")); + TRAP(r, TestStreamStoreVirtualsL()) + test(r==KErrNone); //deletion of data files must be before call to .End() - DEF047652 TDriveUnit drive(static_cast(RFs::GetSystemDrive())); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/TFILE/t_storfdir.cpp --- a/persistentstorage/store/TFILE/t_storfdir.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/TFILE/t_storfdir.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -140,12 +140,28 @@ testWriteL(*store); CleanupStack::PopAndDestroy(); // + test.Next(_L("Writing to replaced file - 2")); + store=CDirectFileStore::ReplaceL(TheFs,parse.NameAndExt(),EFileWrite); + CleanupStack::PushL(store); + store->SetTypeL(TUidType(KDirectFileStoreLayoutUid,KDirectFileStoreLayoutUid)); + testWriteL(*store); + CleanupStack::PopAndDestroy(); +// test.Next(_L("Writing to temp file")); store=CDirectFileStore::TempLC(TheFs,parse.DriveAndPath(),TheTempFile,EFileWrite); store->SetTypeL(TUidType(store->Layout(),KNullUid,KDirectFileStoreLayoutUid)); testWriteL(*store); store->CommitL(); CleanupStack::PopAndDestroy(); + (void)TheFs.Delete(TheTempFile); +// + test.Next(_L("Writing to temp file - 2")); + store=CDirectFileStore::TempL(TheFs,parse.DriveAndPath(),TheTempFile,EFileWrite); + CleanupStack::PushL(store); + store->SetTypeL(TUidType(store->Layout(),KNullUid,KDirectFileStoreLayoutUid)); + testWriteL(*store); + store->CommitL(); + CleanupStack::PopAndDestroy(); // test.Next(_L("Writing to opened file")); store=CDirectFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead|EFileWrite); @@ -164,6 +180,10 @@ RFile file; test(file.Create(TheFs,parse.NameAndExt(),EFileWrite)==KErrNone); store=CDirectFileStore::NewLC(file); + CleanupStack::PopAndDestroy(); + test(file.Open(TheFs,parse.NameAndExt(),EFileWrite)==KErrNone); + store=CDirectFileStore::NewL(file); + CleanupStack::PushL(store); store->SetTypeL(KDirectFileStoreLayoutUid); testWriteL(*store); store->CommitL(); @@ -197,6 +217,13 @@ store=CDirectFileStore::FromLC(file); testReadL(*store); CleanupStack::PopAndDestroy(); + + test.Next(_L("Reading from temp file - 2")); + test(file.Open(TheFs,TheTempFile,EFileRead)==KErrNone); + store=CDirectFileStore::FromL(file); + CleanupStack::PushL(store); + testReadL(*store); + CleanupStack::PopAndDestroy(); } /** @SYMTestCaseID SYSLIB-STORE-CT-1151 diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/TFILE/t_storfperm.cpp --- a/persistentstorage/store/TFILE/t_storfperm.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/TFILE/t_storfperm.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -208,6 +208,15 @@ testWriteL(*store); store->CommitL(); CleanupStack::PopAndDestroy(); + (void)TheFs.Delete(TheTempFile); +// + test.Next(_L("Writing to temp file - 2")); + store=CPermanentFileStore::TempL(TheFs,parse.DriveAndPath(),TheTempFile,EFileWrite); + CleanupStack::PushL(store); + store->SetTypeL(TUidType(store->Layout(),KNullUid,KPermanentFileStoreLayoutUid)); + testWriteL(*store); + store->CommitL(); + CleanupStack::PopAndDestroy(); // test.Next(_L("Writing to opened file")); store=CPermanentFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead|EFileWrite); @@ -393,11 +402,16 @@ test.Next(_L("Detach the file and discard the store")); RFile file=store->File(); store->Detach(); + store->Reattach(file); + RFile& file2 = store->File(); + test(file2.SubSessionHandle() != KNullHandle); + store->Detach(); CleanupStack::PopAndDestroy(); // test.Next(_L("Re-construct the store and check the contents")); store=CFileStore::FromLC(file); testReadL(*store); + store->Reset(); CleanupStack::PopAndDestroy(); } /** @@ -492,7 +506,7 @@ { _LIT(KFileName,"C:\\t_storfperm.dat"); - test.Next(_L(" @SYMTestCaseID:PDS-STORE-UT-4059 ")); + test.Next(_L("@SYMTestCaseID:PDS-STORE-UT-4059: CPermanentFileStore::ReplaceL() test")); CPermanentFileStore* testStore = CPermanentFileStore::ReplaceL(TheFs, KFileName, EFileWrite|EFileWriteBuffered); delete testStore; diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/TFILE/t_storfstrm.cpp --- a/persistentstorage/store/TFILE/t_storfstrm.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/TFILE/t_storfstrm.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -14,6 +14,7 @@ // #include +#include #include const TInt KTestCleanupStack=0x20; @@ -367,6 +368,82 @@ } } +class RTestReadStream : public RReadStream + { +public: + RTestReadStream(MStreamBuf* aSource) : + RReadStream(aSource) + { + } + void Attach(MStreamBuf* aSource) + { + RReadStream::Attach(aSource); + } + void Detach() + { + RReadStream::Detach(); + } + }; + +class RTestWriteStream : public RWriteStream + { +public: + RTestWriteStream(MStreamBuf* aSink) : + RWriteStream(aSink) + { + } + void Attach(MStreamBuf* aSink) + { + RWriteStream::Attach(aSink); + } + void Detach() + { + RWriteStream::Detach(); + } + }; + +/** +@SYMTestCaseID PDS-STORE-CT-4064 +@SYMTestCaseDesc RReadStream, RWriteStream, Pop() and Detach() test. +@SYMTestActions The test calls Pop() and Detach() methods of RReadStream and RWriteStream classes. +@SYMTestPriority High +@SYMTestExpectedResults Test must not fail +*/ +void StreamDetachTestL() + { + test.Next(_L("@SYMTestCaseID:PDS-STORE-CT-4064: RReadStream, RWriteStream, Pop() and Detach() test")); + + TBuf8<100> buf; + TDesBuf desBuf; + desBuf.Set(buf); + MStreamBuf* mbuf = &desBuf; + + _LIT8(KStr, "1234567890"); + + RTestWriteStream wstrm(mbuf); + wstrm.PushL(); + wstrm.Detach(); + wstrm.Attach(mbuf); + TRAPD(err, wstrm.WriteL(KStr)); + test(err == KErrNone); + TRAP(err, wstrm.CommitL()); + test(err == KErrNone); + wstrm.Pop(); + wstrm.Close(); + + RTestReadStream rstrm(mbuf); + rstrm.PushL(); + rstrm.Detach(); + rstrm.Attach(mbuf); + TBuf8<100> buf2; + TRAP(err, rstrm.ReadL(buf2, KStr().Length())); + test(err == KErrNone); + rstrm.Pop(); + rstrm.Close(); + + test(KStr() == buf2); + } + // // Test file-based streams. // @@ -386,6 +463,8 @@ test(r==KErrNone); TRAP(r,testCopyL()); test(r==KErrNone); + TRAP(r, StreamDetachTestL()); + test(r==KErrNone); //deletion of data files must be before call to .End() - DEF047652 TDriveUnit drive(static_cast(RFs::GetSystemDrive())); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/TPAGE/t_storpage.cpp --- a/persistentstorage/store/TPAGE/t_storpage.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/TPAGE/t_storpage.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -235,6 +235,17 @@ const TInt KEntryCount=1000; TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1180 Build set and stream out ")); aPool.Create(*TheStore); + TBool rc = aPool.HasAvailable(); + TEST(!rc); + rc = aPool.IsEmpty(); + TEST(rc); + TStorePagePoolToken token2(TStorePagePoolToken::EEmpty); + token2 = aPool.Token(); + rc = token2.IsEmpty(); + TEST(rc); + rc = token2.HasAvailable(); + TEST(!rc); + TPagedSet set1; set1.Connect(&aPool); @@ -245,7 +256,7 @@ set1.InsertL(it); } aPool.FlushL(); - + RStoreWriteStream out; TStreamId id=out.CreateLC(*TheStore); out<Root(); + RStoreReadStream stream; stream.OpenLC(*file,root); TBuf8<5> b; stream.ReadL(b); test(b==_L8(" root")); - CleanupStack::Pop(); - CEmbeddedStore* store=CEmbeddedStore::FromLC(stream); + CleanupStack::Pop(&stream); + CEmbeddedStore* store=CEmbeddedStore::FromL(stream); + CleanupStack::PushL(store); + testReadL(*store); + CleanupStack::PopAndDestroy(store); + + stream.OpenLC(*file,root); + stream.ReadL(b); + test(b==_L8(" root")); + CleanupStack::Pop(&stream); + store=CEmbeddedStore::FromLC(stream); testReadL(*store); CleanupStack::PopAndDestroy(); // diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/TSTRM/t_storconv.cpp --- a/persistentstorage/store/TSTRM/t_storconv.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/TSTRM/t_storconv.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -798,17 +798,28 @@ TStreamExchange se(&tdb); RShareWriteStream wstream(se); - wstream.Open(se); wstream.WriteL(KTestString); wstream.CommitL(); wstream.Close(); RShareReadStream rstream(se); - rstream.Open(se); rstream.ReadL(des, buf->Length()); rstream.Close(); test( des.Compare(KTestString) ); + + RShareWriteStream wstream2; + wstream2.Open(se); + wstream2.WriteL(KTestString); + wstream2.CommitL(); + wstream2.Close(); + + RShareReadStream rstream2; + rstream2.Open(se); + rstream2.ReadL(des, buf->Length()); + rstream2.Close(); + + test(des.Compare(KTestString)); CleanupStack::PopAndDestroy(2, rwbuf); @@ -937,6 +948,21 @@ User::WaitForRequest(rstatus); test(rstatus == KErrNone); + TBool rc = sm == sm2; + test(!rc); + rc = sm == (const TStreamMark*)&sm2; + test(!rc); + + rc = sm != sm2; + test(rc); + rc = sm != (const TStreamMark*)&sm2; + test(rc); + + rc = sm.IsWith(se); + test(!rc); + rc = sm2.IsWith(se); + test(rc); + TStreamMark sm3(0); TPtr8 des = buf->Des(); bytesprocessed = sm3.ReadL(se, des, des.MaxLength(), rstatus); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/TSTRM/t_storswizzle.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/store/TSTRM/t_storswizzle.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,261 @@ +// 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 "S32STD.H" +#include "S32MEM.H" +#include + +RTest TheTest(_L("t_storswizzle")); + +/////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////// +//Test macros and functions +void Check(TInt aValue, TInt aLine) + { + if(!aValue) + { + RDebug::Print(_L("*** Boolean expression evaluated to false.\r\n")); + TheTest(EFalse, aLine); + } + } +void Check(TInt aValue, TInt aExpected, TInt aLine) + { + if(aValue != aExpected) + { + RDebug::Print(_L("*** Expected error: %d, got: %d.\r\n"), aExpected, aValue); + TheTest(EFalse, aLine); + } + } +#define TEST(arg) ::Check((arg), __LINE__) +#define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) + +/////////////////////////////////////////////////////////////////////////////////////// + +class TRectangle + { +public: + TRectangle(); + TRectangle(TInt aWidth, TInt aHeight); + + void ExternalizeL(RWriteStream& aStream) const; + void InternalizeL(RReadStream& aStream); + +public: + TInt iWidth; + TInt iHeight; + }; + +TBool operator==(const TRectangle& aLeft, const TRectangle& aRight) + { + return aLeft.iWidth == aRight.iWidth && aLeft.iHeight == aRight.iHeight; + } + +TRectangle::TRectangle() : + iWidth(-1), + iHeight(-1) + { + } + +TRectangle::TRectangle(TInt aWidth, TInt aHeight) : + iWidth(aWidth), + iHeight(aHeight) + { + } + +void TRectangle::ExternalizeL(RWriteStream& aStream) const + { + aStream << (TInt32)iWidth; + aStream << (TInt32)iHeight; + } + +void TRectangle::InternalizeL(RReadStream& aStream) + { + TInt32 a; + aStream >> a; + iWidth = a; + aStream >> a; + iHeight = a; + } + +/////////////////////////////////////////////////////////////////////////////////////// + +/** +@SYMTestCaseID PDS-STORE-CT-4060 +@SYMTestCaseDesc TSwizzleC tests. +@SYMTestActions TSwizzleC functionality test. +@SYMTestPriority High +@SYMTestExpectedResults Test must not fail +*/ +void TestSwizzleCL() + { + CBufStore* bufStore = CBufStore::NewLC(100); + + const TInt KWidth = 10; + const TInt KHeight = 20; + TRectangle r1(KWidth, KHeight); + RStoreWriteStream wstrm1; + TStreamId strmId1 = wstrm1.CreateLC(*bufStore); + TSwizzleC swizzle1(&r1); + TEST((const void*)swizzle1 == (const void*)&r1); + wstrm1 << *swizzle1; + wstrm1.CommitL(); + CleanupStack::PopAndDestroy(&wstrm1); + + TRectangle r2; + RStoreReadStream rstrm1; + rstrm1.OpenLC(*bufStore, strmId1); + rstrm1 >> r2; + CleanupStack::PopAndDestroy(&rstrm1); + + TEST(r1 == r2); + + CleanupStack::PopAndDestroy(bufStore); + + TSwizzleC swizzle2(swizzle1); + TEST(swizzle1->iWidth == swizzle2->iWidth); + TEST(swizzle1->iHeight == swizzle2->iHeight); + TEST(swizzle1.AsPtr()->iHeight == swizzle2.AsPtr()->iHeight); + + + TSwizzleC swizzle3; + swizzle3 = &r2; + TEST(swizzle1->iWidth == swizzle3->iWidth); + TEST(swizzle1->iHeight == swizzle3->iHeight); + TEST(swizzle1.AsPtr()->iHeight == swizzle3.AsPtr()->iHeight); + } + +/** +@SYMTestCaseID PDS-STORE-CT-4061 +@SYMTestCaseDesc TSwizzleC tests. +@SYMTestActions TSwizzleC functionality test. +@SYMTestPriority High +@SYMTestExpectedResults Test must not fail +*/ +void TestSwizzleCAny() + { + const TInt KWidth = 10; + const TInt KHeight = 20; + TRectangle r1(KWidth, KHeight); + + TSwizzleC swizzle1(&r1); + TSwizzleC swizzle2(&r1); + TSwizzleC swizzle3; + swizzle3 = &r1; + TEST((const void*)swizzle3 == (const void*)&r1); + + TSwizzleCBase b1 = swizzle1; + TSwizzleCBase b2 = swizzle2; + TBool rc = b1 == b2; + TEST(rc); + rc = b1 != b2; + TEST(!rc); + + TSwizzleC swizzle4(b1); + TEST(swizzle4.AsPtr() == swizzle1.AsPtr()); + + const void* p1 = swizzle1.AsPtr(); + const void* p2 = swizzle2.AsPtr(); + const void* p3 = swizzle3.AsPtr(); + + TEST(((const TRectangle*)p1)->iWidth == ((const TRectangle*)p2)->iWidth); + TEST(((const TRectangle*)p1)->iHeight == ((const TRectangle*)p2)->iHeight); + TEST(((const TRectangle*)p3)->iWidth == ((const TRectangle*)p2)->iWidth); + TEST(((const TRectangle*)p3)->iHeight == ((const TRectangle*)p2)->iHeight); + } + +/** +@SYMTestCaseID PDS-STORE-CT-4062 +@SYMTestCaseDesc TSwizzle tests. +@SYMTestActions TSwizzle functionality test. +@SYMTestPriority High +@SYMTestExpectedResults Test must not fail +*/ +void TestSwizzleAny() + { + const TInt KWidth = 10; + const TInt KHeight = 20; + TRectangle r1(KWidth, KHeight); + + TSwizzle swizzle1(&r1); + TSwizzle swizzle2(&r1); + TSwizzle swizzle3; + swizzle3 = &r1; + TEST((void*)swizzle3 == (void*)&r1); + + TSwizzleBase b1 = swizzle1; + TSwizzleBase b2 = swizzle2; + TBool rc = b1 == b2; + TEST(rc); + rc = b1 != b2; + TEST(!rc); + + TSwizzle swizzle4(b1); + TEST(swizzle4.AsPtr() == swizzle1.AsPtr()); + + void* p1 = swizzle1.AsPtr(); + void* p2 = swizzle2.AsPtr(); + void* p3 = swizzle3.AsPtr(); + + TEST(((TRectangle*)p1)->iWidth == ((TRectangle*)p2)->iWidth); + TEST(((TRectangle*)p1)->iHeight == ((TRectangle*)p2)->iHeight); + TEST(((TRectangle*)p3)->iWidth == ((TRectangle*)p2)->iWidth); + TEST(((TRectangle*)p3)->iHeight == ((TRectangle*)p2)->iHeight); + + ((TRectangle*)p3)->iWidth = 5; + ((TRectangle*)p3)->iHeight = 3; + + TEST2(r1.iWidth, 5); + TEST2(r1.iHeight, 3); + + TSwizzle swizzle5; + swizzle5 = &r1; + TEST2(swizzle5->iWidth, 5); + TEST2(swizzle5->iHeight, 3); + } + +void DoTestsL() + { + TheTest.Start(_L("@SYMTestCaseID:PDS-STORE-CT-4060: TSwizzleC test")); + TestSwizzleCL(); + + TheTest.Next(_L("@SYMTestCaseID:PDS-STORE-CT-4061: TSwizzleC test")); + TestSwizzleCAny(); + + TheTest.Next(_L("@SYMTestCaseID:PDS-STORE-CT-4062: TSwizzle test")); + TestSwizzleAny(); + } + +TInt E32Main() + { + TheTest.Title(); + + CTrapCleanup* tc = CTrapCleanup::New(); + TheTest(tc != NULL); + + __UHEAP_MARK; + + TRAPD(err, DoTestsL()); + TEST2(err, KErrNone); + + __UHEAP_MARKEND; + + TheTest.End(); + TheTest.Close(); + + delete tc; + + User::Heap().Check(); + return KErrNone; + } diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/TSTRM/t_storswizzle.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/store/TSTRM/t_storswizzle.mmp Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,31 @@ +// 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_storswizzle.exe +TARGETTYPE EXE +CAPABILITY NONE + +//The code coverage drops without the next line because the inlined functions will be taken from the "systeminclude" +USERINCLUDE ../INC +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../TSTRM +SOURCE t_storswizzle.cpp + +LIBRARY euser.lib +LIBRARY estor.lib + +VENDORID 0x70000001 + +SMPSAFE diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/UBTREE/UB_UTL.CPP --- a/persistentstorage/store/UBTREE/UB_UTL.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/UBTREE/UB_UTL.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -15,12 +15,15 @@ #include "UB_STD.H" -GLDEF_C void Panic(TBtreePanic aPanic) +#pragma BullseyeCoverage off + // // Panic the process with STORE-B-tree as the category. // +GLDEF_C void Panic(TBtreePanic aPanic) { _LIT(KCategory,"STORE-B-tree"); User::Panic(KCategory,aPanic); } +#pragma BullseyeCoverage on diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/UCONT/UC_SET.CPP --- a/persistentstorage/store/UCONT/UC_SET.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/UCONT/UC_SET.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -80,7 +80,7 @@ // Repair a broken set. // { - TInt count=RepairL(); + TInt count=iTree.RepairL(); iCount=count; return count; } diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/UCONT/UC_UTL.CPP --- a/persistentstorage/store/UCONT/UC_UTL.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/UCONT/UC_UTL.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -15,12 +15,15 @@ #include "UC_STD.H" -GLDEF_C void Panic(TContainerPanic aPanic) +#pragma BullseyeCoverage off + // // Panic the process with STORE-Container as the category. // +GLDEF_C void Panic(TContainerPanic aPanic) { _LIT(KCategory,"STORE-Container"); User::Panic(KCategory,aPanic); } +#pragma BullseyeCoverage on diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/UCRYPT/UE_UTL.CPP --- a/persistentstorage/store/UCRYPT/UE_UTL.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/UCRYPT/UE_UTL.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -15,12 +15,15 @@ #include "UE_STD.H" -GLDEF_C void Panic(TEncryptionPanic aPanic) +#pragma BullseyeCoverage off + // // Panic the process with STORE-Encryption as the category. // +GLDEF_C void Panic(TEncryptionPanic aPanic) { _LIT(KCategory,"STORE-Encryption"); User::Panic(KCategory,aPanic); } +#pragma BullseyeCoverage on diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/UFILE/UF_STOR.CPP --- a/persistentstorage/store/UFILE/UF_STOR.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/UFILE/UF_STOR.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -27,7 +27,12 @@ The resulting file store object is of concrete type, i.e. either CDirectFileStore or CPermanentFileStore. The specific type is determined from the layout information -held in the file store. +held in the file store. Note that if the store object is CPermanentFileStore and the file is writable, +it is strongly recommended to set EFileWriteDirectIO bit in aFileMode. This is because that +when the file server write caching is enabled, the order of file write operations is not guaranteed. +This could cause data inconsistency in some circumstances, for example, when the power is lost in + the middle of database transaction. Therefore, the file write caching should be switched off to maintain integrity. + @param aFs Handle to a file server session. @param aName The full path name of the file containing the store. @@ -46,7 +51,12 @@ The resulting file store object is of concrete type, i.e. either CDirectFileStore or CPermanentFileStore. The specific type is determined from the layout information -held in the file store. +held in the file store. Note that if the store object is CPermanentFileStore and the file is writable, +it is strongly recommended to set EFileWriteDirectIO bit when opening the file. This is because that +when the file server write caching is enabled, the order of file write operations is not guaranteed. +This could cause data inconsistency in some circumstances, for example, when the power is lost in + the middle of database transaction. Therefore, the file write caching should be switched off to maintain integrity. + @param aFs Handle to a file server session. @param aName The full path name of the file containing the store. @@ -98,6 +108,26 @@ return FromLC(aFile,KDefaultFileStoreFactory); } +/** Opens a file containing a store and constructs an appropriate file store object. + +The resulting file store object is of concrete type, i.e. either CDirectFileStore +or CPermanentFileStore. The specific type is determined from the layout information +held in the file store. Note that if the store object is CPermanentFileStore and the file is writable, +it is strongly recommended to set EFileWriteDirectIO bit in aFileMode. This is because that +when the file server write caching is enabled, the order of file write operations is not guaranteed. +This could cause data inconsistency in some circumstances, for example, when the power is lost in +the middle of database transaction. Therefore, the file write caching should be switched off to maintain integrity. + + +@param aFs Handle to a file server session. +@param aName The full path name of the file containing the store. +@param aFileMode The mode in which the file is to be accessed. The mode is +defined by the TFileMode type. +@param TFileStoreFactoryFunction An array of file store factory function. +@return A pointer to the new file store object. +@see TFileMode +@see TFileStoreFactoryFunction +*/ EXPORT_C CFileStore* CFileStore::OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode,const TFileStoreFactoryFunction aFactory[]) // // Open a file store of any of the types supported by aFactory. @@ -108,6 +138,26 @@ return FromL(file,aFactory); } +/** Opens a file containing a store and constructs an appropriate file store object. + +The resulting file store object is of concrete type, i.e. either CDirectFileStore +or CPermanentFileStore. The specific type is determined from the layout information +held in the file store. Note that if the store object is CPermanentFileStore and the file is writable, +it is strongly recommended to set EFileWriteDirectIO bit in aFileMode. This is because that +when the file server write caching is enabled, the order of file write operations is not guaranteed. +This could cause data inconsistency in some circumstances, for example, when the power is lost in +the middle of database transaction. Therefore, the file write caching should be switched off to maintain integrity. + + +@param aFs Handle to a file server session. +@param aName The full path name of the file containing the store. +@param aFileMode The mode in which the file is to be accessed. The mode is +defined by the TFileMode type. +@param TFileStoreFactoryFunction An array of file store factory function. +@return A pointer to the new file store object. +@see TFileMode +@see TFileStoreFactoryFunction +*/ EXPORT_C CFileStore* CFileStore::OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode,const TFileStoreFactoryFunction aFactory[]) // // Open and leave on cleanup stack. @@ -210,6 +260,26 @@ iBuf.Close(); } +/** Opens a file containing a store and constructs an appropriate file store object. + +The resulting file store object is of concrete type, i.e. either CDirectFileStore +or CPermanentFileStore. The specific type is determined from the layout information +held in the file store. Note that if the store object is CPermanentFileStore and the file is writable, +it is strongly recommended to set EFileWriteDirectIO bit in aFileMode. This is because that +when the file server write caching is enabled, the order of file write operations is not guaranteed. +This could cause data inconsistency in some circumstances, for example, when the power is lost in +the middle of database transaction. Therefore, the file write caching should be switched off to maintain integrity. + + +@param aFs Handle to a file server session. +@param aName The full path name of the file containing the store. +@param aFileMode The mode in which the file is to be accessed. The mode is +defined by the TFileMode type. +@param TFileStoreFactoryFunction A file store factory function. +@return A pointer to the new file store object. +@see TFileMode +@see TFileStoreFactoryFunction +*/ EXPORT_C CFileStore* CFileStore::OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode,TFileStoreFactoryFunction aFunction) // // Open a file store using aFunction. @@ -220,6 +290,26 @@ return FromL(file,aFunction); } +/** Opens a file containing a store and constructs an appropriate file store object. + +The resulting file store object is of concrete type, i.e. either CDirectFileStore +or CPermanentFileStore. The specific type is determined from the layout information +held in the file store. Note that if the store object is CPermanentFileStore and the file is writable, +it is strongly recommended to set EFileWriteDirectIO bit in aFileMode. This is because that +when the file server write caching is enabled, the order of file write operations is not guaranteed. +This could cause data inconsistency in some circumstances, for example, when the power is lost in +the middle of database transaction. Therefore, the file write caching should be switched off to maintain integrity. + + +@param aFs Handle to a file server session. +@param aName The full path name of the file containing the store. +@param aFileMode The mode in which the file is to be accessed. The mode is +defined by the TFileMode type. +@param TFileStoreFactoryFunction A file store factory function. +@return A pointer to the new file store object. +@see TFileMode +@see TFileStoreFactoryFunction +*/ EXPORT_C CFileStore* CFileStore::OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode,TFileStoreFactoryFunction aFunction) // // Open and leave on cleanup stack. diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/UFILE/UF_UTL.CPP --- a/persistentstorage/store/UFILE/UF_UTL.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/UFILE/UF_UTL.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -15,15 +15,19 @@ #include "UF_STD.H" -GLDEF_C void Panic(TFilePanic aPanic) +#pragma BullseyeCoverage off + // // Panic the process with STORE-File as the category. // +GLDEF_C void Panic(TFilePanic aPanic) { _LIT(KCategory,"STORE-File"); User::Panic(KCategory,aPanic); } +#pragma BullseyeCoverage on + EXPORT_C CFileStore* FileStoreFactory::DirectLC(RFileBuf& aBuf,const TUidType& aType) /** Opens an existing direct file store and creates a file store object to represent it. diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/ULIB/UL_UTL.CPP --- a/persistentstorage/store/ULIB/UL_UTL.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/ULIB/UL_UTL.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -17,6 +17,9 @@ #if defined (_DEBUG) + +#pragma BullseyeCoverage off + // // Leave to the current control region. // @@ -60,5 +63,8 @@ } return aPtr; } + +#pragma BullseyeCoverage on + #endif diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/UMEM/UM_UTL.CPP --- a/persistentstorage/store/UMEM/UM_UTL.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/UMEM/UM_UTL.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -15,15 +15,19 @@ #include "UM_STD.H" -GLDEF_C void Panic(TMemPanic aPanic) +#pragma BullseyeCoverage off + // // Panic the process with STORE-Memory as the category. // +GLDEF_C void Panic(TMemPanic aPanic) { _LIT(KCategory,"STORE-Memory"); User::Panic(KCategory,aPanic); } +#pragma BullseyeCoverage on + HBufBuf* HBufBuf::NewL(CBufBase& aBuf,TInt aPos,TInt aMode) // // Create a pre-set buffer stream buffer. diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/UPAGE/UP_UTL.CPP --- a/persistentstorage/store/UPAGE/UP_UTL.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/UPAGE/UP_UTL.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -15,12 +15,15 @@ #include "UP_STD.H" -GLDEF_C void Panic(TPagePanic aPanic) +#pragma BullseyeCoverage off + // // Panic the process with STORE-Page as the category. // +GLDEF_C void Panic(TPagePanic aPanic) { _LIT(KCategory,"STORE-Page"); User::Panic(KCategory,aPanic); } +#pragma BullseyeCoverage on diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/USTOR/UT_PERM.CPP --- a/persistentstorage/store/USTOR/UT_PERM.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/USTOR/UT_PERM.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -1329,7 +1329,7 @@ // -3- clear the dirty bit (1 byte "file write" op). The commit operation has completed successfully; MStreamBuf* CPermanentStoreCoord::BeginL(TPermanentStoreHeader& aHeader) { - __ASSERT_DEBUG(!aHeader.IsDirty()&&aHeader.BackupToc()==iToc&&iReloc==0,User::Invariant()); + __ASSERT_DEBUG(!aHeader.IsDirty() && aHeader.BackupToc() == Toc() && iReloc == 0, User::Invariant()); MStreamBuf& buf=*Host().HostL(); buf.SeekL(buf.EWrite,Base()+KPermanentStoreHeaderOffset); TFileQoS fileQos = FileQoSL(); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/USTOR/UT_UTL.CPP --- a/persistentstorage/store/USTOR/UT_UTL.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/USTOR/UT_UTL.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -15,15 +15,19 @@ #include "UT_STD.H" -GLDEF_C void Panic(TStorePanic aPanic) +#pragma BullseyeCoverage off + // // Panic the process with STORE-Store as the category. // +GLDEF_C void Panic(TStorePanic aPanic) { _LIT(KCategory,"STORE-Store"); User::Panic(KCategory,aPanic); } +#pragma BullseyeCoverage on + EXPORT_C void TStreamId::InternalizeL(RReadStream& aStream) /** Internalises an object of this class from a read stream. diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/USTRM/US_BUF.CPP --- a/persistentstorage/store/USTRM/US_BUF.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/USTRM/US_BUF.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -15,9 +15,6 @@ #include "US_STD.H" -EXPORT_C TInt MStreamBuf::Synch() - - /** Synchronises the stream buffer with the stream, returning any error. In effect, this ensures that buffered data is delivered to the stream. @@ -29,12 +26,12 @@ codes. @see MStreamBuf::SynchL() @see MStreamBuf::DoSynchL() */ +EXPORT_C TInt MStreamBuf::Synch() { TRAPD(r,SynchL()); return r; } -EXPORT_C void MStreamBuf::Close() /** Closes the stream buffer. This function attempts to synchronise buffered data with the stream before @@ -42,20 +39,20 @@ @see MStreamBuf::Synch() @see MStreamBuf::Release() */ +EXPORT_C void MStreamBuf::Close() { Synch(); Release(); } -EXPORT_C void MStreamBuf::PushL() /** Puts a cleanup item for this object onto the cleanup stack. This allows allocated resources to be cleaned up if a subsequent leave occurs. */ +EXPORT_C void MStreamBuf::PushL() { CleanupReleasePushL(*this); } -EXPORT_C TInt MStreamBuf::Read(TDes8& aDes,TRequestStatus& aStatus) /** Reads data, asynchronously, from the stream buffer into the specified descriptor; request completion is guaranteed, even if request initiation fails. @@ -70,11 +67,11 @@ value can be different to the maximum length of the descriptor; this is dependent on the implementation. @see MStreamBuf::DoReadL() */ +EXPORT_C TInt MStreamBuf::Read(TDes8& aDes,TRequestStatus& aStatus) { return Read(aDes,aDes.MaxLength(),aStatus); } -EXPORT_C TInt MStreamBuf::Read(TDes8& aDes,TInt aMaxLength,TRequestStatus& aStatus) /** Reads data, asynchronously, from the stream buffer into the specified descriptor; request completion is guaranteed, even if request initiation fails. @@ -89,6 +86,7 @@ can be different to the value supplied in aMaxLength; this is dependent on the implementation. @see MStreamBuf::DoReadL() */ +EXPORT_C TInt MStreamBuf::Read(TDes8& aDes,TInt aMaxLength,TRequestStatus& aStatus) { TInt len=0; TRAPD(r,len=DoReadL(aDes,aMaxLength,aStatus)); @@ -100,7 +98,6 @@ return len; } -EXPORT_C TInt MStreamBuf::ReadL(TDes8& aDes,TRequestStatus& aStatus) /** Reads data, asynchronously, from the stream buffer into the specified descriptor. The function calls the virtual function DoReadL(TDes8&,TInt,TRequestStatus&) @@ -116,11 +113,11 @@ value can be different to the maximum length of the descriptor; this is dependent on the implementation. @see MStreamBuf::DoReadL() */ +EXPORT_C TInt MStreamBuf::ReadL(TDes8& aDes,TRequestStatus& aStatus) { return DoReadL(aDes,aDes.MaxLength(),aStatus); } -EXPORT_C TInt MStreamBuf::ReadL(MStreamInput& anInput,TInt aMaxLength) /** Reads data from the stream buffer into the specified data sink. The function uses the virtual function DoReadL(MStreamInput&,TStreamTransfer) @@ -129,11 +126,11 @@ @param anInput The data sink which is the target for the read operation. @param aMaxLength The maximum amount of data available to be read. @return The amount of data that was not consumed. */ +EXPORT_C TInt MStreamBuf::ReadL(MStreamInput& anInput,TInt aMaxLength) { return aMaxLength-DoReadL(anInput,TStreamTransfer(aMaxLength)).Left(); } -EXPORT_C TInt MStreamBuf::Write(const TDesC8& aDes,TRequestStatus& aStatus) /** Writes data, asynchronously, from the specified descriptor into the stream buffer; request completion is guaranteed, even if request initiation fails. @@ -149,14 +146,15 @@ This can be different to the value supplied in aMaxLength; this is dependent on the implementation. @see MStreamBuf::DoWriteL() */ +EXPORT_C TInt MStreamBuf::Write(const TDesC8& aDes,TRequestStatus& aStatus) { return Write(aDes,aDes.Length(),aStatus); } -EXPORT_C TInt MStreamBuf::Write(const TDesC8& aDes,TInt aMaxLength,TRequestStatus& aStatus) // // Write up to aMaxLength bytes with guaranteed completion. // +EXPORT_C TInt MStreamBuf::Write(const TDesC8& aDes,TInt aMaxLength,TRequestStatus& aStatus) { TInt len=0; TRAPD(r,len=DoWriteL(aDes,aMaxLength,aStatus)); @@ -168,7 +166,6 @@ return len; } -EXPORT_C TInt MStreamBuf::WriteL(const TDesC8& aDes,TRequestStatus& aStatus) /** Writes data, asynchronously, from the specified descriptor into the stream buffer. The function calls the virtual function DoWriteL(const TDesC8&,TInt,TRequestStatus&) @@ -185,11 +182,11 @@ This can be different to the maximum length of the descriptor; this is dependent on the implementation. @see MStreamBuf::DoWriteL() */ +EXPORT_C TInt MStreamBuf::WriteL(const TDesC8& aDes,TRequestStatus& aStatus) { return DoWriteL(aDes,aDes.Length(),aStatus); } -EXPORT_C TInt MStreamBuf::WriteL(MStreamOutput& anOutput,TInt aMaxLength) /** Writes data into the stream buffer from the specified data source. The function calls the virtual function DoWriteL(MStreamOutput&,TStreamTransfer) @@ -198,11 +195,11 @@ @param anOutput The data source for the write operation. @param aMaxLength The maximum amount of data available to be written. @return The amount of data that was not consumed. */ +EXPORT_C TInt MStreamBuf::WriteL(MStreamOutput& anOutput,TInt aMaxLength) { return aMaxLength-DoWriteL(anOutput,TStreamTransfer(aMaxLength)).Left(); } -EXPORT_C void MStreamBuf::DoRelease() /** Frees resources before abandoning the stream buffer. It is called by Release(). @@ -211,9 +208,10 @@ their own implementation, if necessary. @see MStreamBuf::Release() */ - {} +EXPORT_C void MStreamBuf::DoRelease() + { + } -EXPORT_C void MStreamBuf::DoSynchL() /** Synchronises the stream buffer with the stream, leaving if any error occurs. In effect, this ensures that buffered data is delivered to the stream. @@ -224,18 +222,41 @@ their own implementation, if necessary. @see MStreamBuf::SynchL() */ - {} +EXPORT_C void MStreamBuf::DoSynchL() + { + } -EXPORT_C TInt MStreamBuf::DoReadL(TAny*,TInt) +#pragma BullseyeCoverage off + // // Cannot read from this stream buffer. // +EXPORT_C TInt MStreamBuf::DoReadL(TAny*,TInt) { Panic(EStreamCannotRead); return TInt(); } -EXPORT_C TInt MStreamBuf::DoReadL(TDes8& aDes,TInt aMaxLength,TRequestStatus& aStatus) +// +// Cannot write to this stream buffer. +// +EXPORT_C void MStreamBuf::DoWriteL(const TAny*,TInt) + { + Panic(EStreamCannotWrite); + } + +// +// This stream buffer does not support seeking. +// +EXPORT_C TStreamPos MStreamBuf::DoSeekL(TMark,TStreamLocation,TInt) + { + Panic(EStreamCannotSeek); + TStreamPos streamPos(-1); + return streamPos; + } + +#pragma BullseyeCoverage on + /** Reads data from the stream buffer into the specified descriptor. This function is called by ReadL(TDes8&,TInt,TRequestStatus&). @@ -258,6 +279,7 @@ implementation uses, and returns, the value supplied in aMaxLength. Other implementations may choose to use a different value. @see MStreamBuf::ReadL() */ +EXPORT_C TInt MStreamBuf::DoReadL(TDes8& aDes,TInt aMaxLength,TRequestStatus& aStatus) { __ASSERT_DEBUG(aMaxLength<=aDes.MaxLength(),Panic(EStreamReadBeyondEnd)); aDes.SetLength(DoReadL((TUint8*)aDes.Ptr(),aMaxLength)); @@ -266,7 +288,6 @@ return aMaxLength; } -EXPORT_C TStreamTransfer MStreamBuf::DoReadL(MStreamInput& anInput,TStreamTransfer aTransfer) /** Reads data from the stream into the specified data sink. It is called by ReadL(MStreamInput&,TStreamTransfer). @@ -282,19 +303,11 @@ to be read. @return A stream transfer object defining the amount of data that was not consumed. @see MStreamInput::ReadFromL() */ +EXPORT_C TStreamTransfer MStreamBuf::DoReadL(MStreamInput& anInput,TStreamTransfer aTransfer) { return anInput.ReadFromL(*this,aTransfer); } -EXPORT_C void MStreamBuf::DoWriteL(const TAny*,TInt) -// -// Cannot write to this stream buffer. -// - { - Panic(EStreamCannotWrite); - } - -EXPORT_C TInt MStreamBuf::DoWriteL(const TDesC8& aDes,TInt aMaxLength,TRequestStatus& aStatus) /** Writes data from the specified descriptor into this stream buffer. This function is called by WriteL(const TDesC8&,TInt,TRequestStatus&). @@ -316,6 +329,7 @@ This implementation uses, and returns, the value supplied in aMaxLength. Other implementations may choose to use a different value. @see MStreamBuf::WriteL() */ +EXPORT_C TInt MStreamBuf::DoWriteL(const TDesC8& aDes,TInt aMaxLength,TRequestStatus& aStatus) { __ASSERT_DEBUG(aMaxLength<=aDes.Length(),Panic(EStreamWriteBeyondEnd)); DoWriteL(aDes.Ptr(),aMaxLength); @@ -324,31 +338,21 @@ return aMaxLength; } -EXPORT_C TStreamTransfer MStreamBuf::DoWriteL(MStreamOutput& anOutput,TStreamTransfer aTransfer) // // Default implementation turning around to anOutput. // +EXPORT_C TStreamTransfer MStreamBuf::DoWriteL(MStreamOutput& anOutput,TStreamTransfer aTransfer) { return anOutput.WriteToL(*this,aTransfer); } -EXPORT_C TStreamPos MStreamBuf::DoSeekL(TMark,TStreamLocation,TInt) -// -// This stream buffer does not support seeking. -// +/** Sets the pointers that mark out the read and write areas within the intermediate +buffer to null. */ +EXPORT_C TStreamBuf::TStreamBuf() + : iRPtr(NULL),iREnd(NULL),iWPtr(NULL),iWEnd(NULL) { - Panic(EStreamCannotSeek); - TStreamPos streamPos(-1); - return streamPos; } -EXPORT_C TStreamBuf::TStreamBuf() - : iRPtr(NULL),iREnd(NULL),iWPtr(NULL),iWEnd(NULL) -/** Sets the pointers that mark out the read and write areas within the intermediate -buffer to null. */ - {} - -EXPORT_C void TStreamBuf::SetBuf(TArea anArea,TUint8* aPtr,TUint8* anEnd) /** Sets the start and end points of the read and/or the write area within the intermediate buffer. @@ -363,6 +367,7 @@ @param anEnd The end point. @see MStreamBuf::TRead @see MStreamBuf::TWrite */ +EXPORT_C void TStreamBuf::SetBuf(TArea anArea,TUint8* aPtr,TUint8* anEnd) { __ASSERT_ALWAYS(!(anArea&~(ERead|EWrite)),Panic(EStreamAreaInvalid)); if (anArea&ERead) @@ -371,7 +376,6 @@ SetBuf(EWrite,aPtr,anEnd); } -EXPORT_C void TStreamBuf::SetPtr(TArea anArea,TUint8* aPtr) /** Sets the start point of the read and/or the write area within the intermediate buffer. @@ -384,6 +388,7 @@ @param aPtr The start point. @see MStreamBuf::TRead @see MStreamBuf::TWrite */ +EXPORT_C void TStreamBuf::SetPtr(TArea anArea,TUint8* aPtr) { __ASSERT_ALWAYS(!(anArea&~(ERead|EWrite)),Panic(EStreamAreaInvalid)); if (anArea&ERead) @@ -392,10 +397,10 @@ SetPtr(EWrite,aPtr); } -EXPORT_C void TStreamBuf::SetEnd(TArea anArea,TUint8* anEnd) // // Set the end pointer for the buffer area(s) indicated by anArea. // +EXPORT_C void TStreamBuf::SetEnd(TArea anArea,TUint8* anEnd) { __ASSERT_ALWAYS(!(anArea&~(ERead|EWrite)),Panic(EStreamAreaInvalid)); if (anArea&ERead) @@ -404,7 +409,6 @@ SetEnd(EWrite,anEnd); } -EXPORT_C TUint8* TStreamBuf::Ptr(TArea anArea) const /** Gets the current start point of the read or write area within the intermediate buffer. @@ -415,6 +419,7 @@ @return The start point. @see MStreamBuf::TRead @see MStreamBuf::TWrite */ +EXPORT_C TUint8* TStreamBuf::Ptr(TArea anArea) const { if (anArea==ERead) return Ptr(ERead); @@ -423,7 +428,6 @@ return Ptr(EWrite); } -EXPORT_C TUint8* TStreamBuf::End(TArea anArea) const /** Gets the current end point of the read or write area within the intermediate buffer. @@ -434,6 +438,7 @@ by the ERead and EWrite bits. Only one of these can be set, otherwise the function raises a STORE-Stream 17 panic. @return The end point. */ +EXPORT_C TUint8* TStreamBuf::End(TArea anArea) const { if (anArea==ERead) return End(ERead); @@ -442,7 +447,6 @@ return End(EWrite); } -EXPORT_C TInt TStreamBuf::Avail(TArea anArea) const /** Gets the number of bytes available in the read or write area within the intermediate buffer. @@ -451,6 +455,7 @@ write area, as indicated by the ERead and EWrite bits. Only one of these can be set, otherwise the function raises a STORE-Stream 17 panic. @return The number of bytes available. */ +EXPORT_C TInt TStreamBuf::Avail(TArea anArea) const { if (anArea==ERead) return Avail(ERead); @@ -459,7 +464,6 @@ return Avail(EWrite); } -EXPORT_C TInt TStreamBuf::DoReadL(TAny* aPtr,TInt aMaxLength) /** Reads data from the intermediate buffer into the specified memory location. The function calls the virtual function UnderfLowL() to give concrete implementations @@ -474,6 +478,7 @@ @return The number of bytes read. This may be less than the amount requested. @see MStreamBuf::ReadL() @see MStreamBuf::DoReadL() */ +EXPORT_C TInt TStreamBuf::DoReadL(TAny* aPtr,TInt aMaxLength) { __ASSERT_DEBUG(aMaxLength>=0,Panic(EStreamReadLengthNegative)); __ASSERT_DEBUG(aMaxLength>0,Panic(EStreamReadNoTransfer)); @@ -505,7 +510,6 @@ return aMaxLength-left; } -EXPORT_C TStreamTransfer TStreamBuf::DoReadL(MStreamInput& anInput,TStreamTransfer aTransfer) /** Reads data from the intermediate buffer and, if necessary, any remaining data from the stream to the specified target stream input object. @@ -525,6 +529,7 @@ @return The amount of data that was not consumed. @see MStreamInput::ReadFromL() @see MStreamInput::PushL() */ +EXPORT_C TStreamTransfer TStreamBuf::DoReadL(MStreamInput& anInput,TStreamTransfer aTransfer) { __ASSERT_DEBUG(aTransfer>0,Panic(EStreamReadNoTransfer)); __ASSERT_DEBUG(Ptr(ERead)!=NULL||End(ERead)==NULL,Panic(EStreamCannotRead)); @@ -544,7 +549,6 @@ return aTransfer; } -EXPORT_C void TStreamBuf::DoWriteL(const TAny* aPtr,TInt aLength) /** Writes data from the specified memory location into the intermediate buffer. The function calls the virtual function OverfLowL() to give concrete implementations @@ -559,6 +563,7 @@ @return The number of bytes written. @see MStreamBuf::WriteL() @see MStreamBuf::DoWriteL() */ +EXPORT_C void TStreamBuf::DoWriteL(const TAny* aPtr,TInt aLength) { __ASSERT_DEBUG(aLength>=0,Panic(EStreamWriteLengthNegative)); __ASSERT_DEBUG(aLength>0,Panic(EStreamWriteNoTransfer)); @@ -588,10 +593,10 @@ }; } -EXPORT_C TStreamTransfer TStreamBuf::DoWriteL(MStreamOutput& anOutput,TStreamTransfer aTransfer) // // Default implementation filling the buffer before turning around to anOutput. // +EXPORT_C TStreamTransfer TStreamBuf::DoWriteL(MStreamOutput& anOutput,TStreamTransfer aTransfer) { __ASSERT_DEBUG(aTransfer>0,Panic(EStreamWriteNoTransfer)); __ASSERT_DEBUG(Ptr(EWrite)!=NULL||End(EWrite)==NULL,Panic(EStreamCannotWrite)); diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/USTRM/US_UCMP.CPP --- a/persistentstorage/store/USTRM/US_UCMP.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/USTRM/US_UCMP.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -152,11 +152,15 @@ (aCode >= 0x0020 && aCode <= 0x007F); } +#pragma BullseyeCoverage off + void TUnicodeCompressionState::Panic(TPanic aPanic) { User::Panic(_L("ucmp"),aPanic); } +#pragma BullseyeCoverage on + EXPORT_C TUnicodeCompressor::TUnicodeCompressor(): iInputBufferStart(0), iInputBufferSize(0), diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/USTRM/US_UTL.CPP --- a/persistentstorage/store/USTRM/US_UTL.CPP Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/USTRM/US_UTL.CPP Mon Sep 27 11:59:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1998-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" @@ -16,15 +16,19 @@ #include #include "US_STD.H" -GLDEF_C void Panic(TStreamPanic aPanic) +#pragma BullseyeCoverage off + // // Panic the process with STORE-Stream as the category. // +GLDEF_C void Panic(TStreamPanic aPanic) { _LIT(KCategory,"STORE-Stream"); User::Panic(KCategory,aPanic); } +#pragma BullseyeCoverage on + EXPORT_C void TCardinality::ExternalizeL(RWriteStream& aStream) const /** Externalises this object to a write stream. diff -r b8bdbc8f59c7 -r 7d4490026038 persistentstorage/store/group/bld.inf --- a/persistentstorage/store/group/bld.inf Thu Aug 12 11:53:23 2010 +0100 +++ b/persistentstorage/store/group/bld.inf Mon Sep 27 11:59:56 2010 +0100 @@ -103,6 +103,7 @@ ../TSTRM/t_storconv.mmp ../TSTRM/t_storucmp.mmp ../TSTRM/t_storstreamperf.mmp +../TSTRM/t_storswizzle.mmp #endif //PC tool library diff -r b8bdbc8f59c7 -r 7d4490026038 traceservices/tracefw/ulogger/src/pluginframework/inputframework.cpp --- a/traceservices/tracefw/ulogger/src/pluginframework/inputframework.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/traceservices/tracefw/ulogger/src/pluginframework/inputframework.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -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" @@ -169,25 +169,29 @@ //unpack control data payload into array of strings RArray array; - RPointerArray chunksArray; - long i; - for(i=0; i cleaunpArray; + CleanupStack::PushL(TCleanupItem(CleanupHBufCPtrArray, &cleaunpArray)); + + for(long i(0); i < chunks; i++) { - unsigned long currentChunkSize=0; + unsigned long currentChunkSize(0); const void* payloadChunk = iInputData->GetChunk(cData, i, currentChunkSize); - if(payloadChunk && currentChunkSize>0) + if(payloadChunk && currentChunkSize > 0) { - HBufC8 *des8 = HBufC8::NewLC(currentChunkSize+1); + HBufC8* des8 = HBufC8::NewLC(currentChunkSize + 1); des8->Des().Copy((unsigned char const*)payloadChunk, currentChunkSize); - HBufC *des = HBufC::NewLC(des8->Length()); + HBufC* des = HBufC::NewLC(des8->Length()); des->Des().Copy(*des8); - CleanupStack::Pop();//des - CleanupStack::PopAndDestroy();//des8 - chunksArray.AppendL(des); - array.Append(des->Des()); + + array.AppendL(des->Des()); + cleaunpArray.AppendL(des); + + CleanupStack::Pop(&des); // passed ownership to cleaunpArray + CleanupStack::PopAndDestroy(&des8); #if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE) - __LOGBUF(array[array.Count()-1]) + __LOGBUF(array[array.Count() - 1]) #endif } } @@ -198,14 +202,52 @@ iCommand->HandleCommandL(array); //cleanup - chunksArray.ResetAndDestroy(); - chunksArray.Close(); - array.Close(); + CleanupStack::PopAndDestroy(2, &array); // and TCleanupItem(RPointerArray::ResetAndDestroy, &cleaunpArray) } //continue reading if(iContinueReading) + { this->StartReading(); + } + } + +/* + * Cleanup RPointerArray* object by calling ResetAndDestroy to delete memory + * allocated as HBufCs whose ownership has been passed to the RPointerArray. + * + */ +void CInputFramework::CleanupHBufCPtrArray(TAny* aPtr) + { + RPointerArray* ptrArray = reinterpret_cast*>(aPtr); + ptrArray->ResetAndDestroy(); + ptrArray->Close(); + } + + +/* + * Cleanup RPointerArray* object by calling ResetAndDestroy to delete memory + * allocated as HBufCs whose ownership has been passed to the RPointerArray. + * + */ +void CInputFramework::CleanupHBufC8PtrArray(TAny* aPtr) + { + RPointerArray* ptrArray = reinterpret_cast*>(aPtr); + ptrArray->ResetAndDestroy(); + ptrArray->Close(); + } + + +/* + * Cleanup ControlData* (non-CBase) object. + * ControlData is in fact a typedef of char and so a ControlData* points to a char array. + * Such objects are allocated with the standard C++ new[] operator and so delete[] must be used. + * + */ +void CInputFramework::CleanupControlData(TAny* aPtr) + { + ControlData* ctrlData = reinterpret_cast(aPtr); + delete[] ctrlData; } @@ -249,7 +291,7 @@ //create new array with TPtrC8 values RPointerArray values8; - //CleanupStack::PushL( TCleanupItem(ResetAndDestroyPtrArray8, &values8) ); + CleanupStack::PushL( TCleanupItem(CleanupHBufC8PtrArray, &values8) ); RArray array8; CleanupClosePushL(array8); for(TInt i=0; iProcessCommandL(aCommand, array8); //cleanup - CleanupStack::PopAndDestroy(); //array8 - values8.ResetAndDestroy(); - values8.Close(); - + CleanupStack::PopAndDestroy(2, &values8); // and array8 + + // push ack on the stack before doing anything that can leave + CleanupStack::PushL(TCleanupItem(CleanupControlData, ack)); + //prepare acknowledgment TInt ackSize = iInputData->GetSize(ack); RBuf8 ackBuf; - ackBuf.Create(ackSize); + ackBuf.CreateL(ackSize); + CleanupClosePushL(ackBuf); ackBuf.Copy((unsigned char const*)ack, ackSize); #if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE) @@ -283,21 +327,28 @@ #endif if(iInputPlugin) + { iInputPlugin->SendAcknowledgment(ackBuf); //send back acknowledgment - ackBuf.Close(); - delete [] ack; + } + + // clean up + CleanupStack::PopAndDestroy(2, ack); // and ackBuf iControlData.Zero(); iObserver->DoPostProcessing(aCommand); if(!iContinueReading || !iInputPlugin) + { return KErrGeneral; + } /* during 'restart' input framework will be started by observer and we don'e need to restart it in RunL method, this flag will prevent of calling StartReading again. */ - if(aCommand == ERestart) + if(aCommand == ERestart) + { iContinueReading = EFalse; + } return errCode; } diff -r b8bdbc8f59c7 -r 7d4490026038 traceservices/tracefw/ulogger/src/pluginframework/inputframework.h --- a/traceservices/tracefw/ulogger/src/pluginframework/inputframework.h Thu Aug 12 11:53:23 2010 +0100 +++ b/traceservices/tracefw/ulogger/src/pluginframework/inputframework.h Mon Sep 27 11:59:56 2010 +0100 @@ -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" @@ -66,6 +66,9 @@ private: CInputFramework(MInputPlugin *aInputPlugin, MInputFrameworkObserver *aObserver); void ConstructL(const RPointerArray& aInputSettings); + static void CleanupHBufCPtrArray(TAny* aPtr); + static void CleanupHBufC8PtrArray(TAny* aPtr); + static void CleanupControlData(TAny* aPtr); private://data CInputData* iInputData; diff -r b8bdbc8f59c7 -r 7d4490026038 traceservices/tracefw/ulogger/src/uloggerserver/uloggerserver.cpp --- a/traceservices/tracefw/ulogger/src/uloggerserver/uloggerserver.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/traceservices/tracefw/ulogger/src/uloggerserver/uloggerserver.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -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" @@ -636,7 +636,7 @@ /** Function to retrieve the active primary and secondary filters -This should leave with KErrNotFound if cannot find one or any system wide error codes +This should return KErrNotFound if cannot find one or return any of the system wide error codes */ TInt CULoggerServer::GetActiveFilters(RArray& aListBuffer,TInt aFilterType) { @@ -644,7 +644,12 @@ RArray aValues; if(aFilterType == 1) { - ret = GetValuesL(KPrimaryFilterSection,aValues); + TRAPD(err, ret = GetValuesL(KPrimaryFilterSection,aValues)); + if (err != KErrNone) + { + return err; + } + if(ret==KErrNone) { TInt i =0; @@ -654,17 +659,29 @@ { TLex8 lex_val(aValues[++i]); ret = lex_val.Val(int_val,EDecimal); - if(ret==KErrNone) - aListBuffer.Append(int_val); + if(ret == KErrNone) + { + ret = aListBuffer.Append(int_val); + if (ret != KErrNone) + { + return ret; + } + } else + { return KErrCorrupt; + } i++; } } } else if(aFilterType == 2) { - ret = GetValuesL(KSecondaryFilterSection,aValues); + TRAPD(err, ret = GetValuesL(KSecondaryFilterSection,aValues)); + if (err != KErrNone) + { + return err; + } if(ret==KErrNone) { TInt i =0; @@ -674,17 +691,27 @@ { TLex8 lex_val(aValues[++i]); ret = lex_val.Val(int_val,EDecimal); - if(ret==KErrNone) - aListBuffer.Append(int_val); + if(ret == KErrNone) + { + ret = aListBuffer.Append(int_val); + if (ret != KErrNone) + { + return ret; + } + } else + { return KErrCorrupt; + } i++; } } else { if(ret==KErrNotFound)//i.e. if there are no values in the array --> change to if(filters.Count = 0)? + { ret=KErrNone; + } } } return ret; @@ -1148,20 +1175,37 @@ } +/* + * Cleanup RPointerArray* object by calling ResetAndDestroy to delete memory + * allocated as TPluginConfigurations whose ownership has been passed to the RPointerArray. + * + */ +void CULoggerServer::CleanupTPluginConfigArray(TAny* aPtr) + { + RPointerArray* ptrArray = reinterpret_cast*>(aPtr); + ptrArray->ResetAndDestroy(); + ptrArray->Close(); + } + + void CULoggerServer::InitializeFrameworksL() { // //output settings RBuf8 outPluginName; - outPluginName.Create(KMaxPluginName); + outPluginName.CreateL(KMaxPluginName); + CleanupClosePushL(outPluginName); RPointerArray outputPluginSettings; + CleanupStack::PushL(TCleanupItem(CleanupTPluginConfigArray, &outputPluginSettings)); GetPluginAndSettingsL(outPluginName, &outputPluginSettings, EOutputPluginFilter); //control settings RBuf8 inputPluginName; - inputPluginName.Create(KMaxPluginName); + inputPluginName.CreateL(KMaxPluginName); + CleanupClosePushL(inputPluginName); RPointerArray inputPluginSettings; - this->GetPluginAndSettingsL(inputPluginName, &inputPluginSettings, EInputPluginFilter); + CleanupStack::PushL(TCleanupItem(CleanupTPluginConfigArray, &inputPluginSettings)); + GetPluginAndSettingsL(inputPluginName, &inputPluginSettings, EInputPluginFilter); #if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE) __LOG("before creating CPluginAllocator") @@ -1169,26 +1213,27 @@ //create plugin allocator (plugins) if(!iPluginAllocator) + { iPluginAllocator = CPluginAllocator::NewL(outPluginName, inputPluginName); + } #if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE) __LOG("before creating COutputFramework") #endif //Initialize output framework if(!iOutputFramework) + { iOutputFramework = COutputFramework::NewL(*(iPluginAllocator->GetOutputPlugin()), outputPluginSettings); + } //Initialize Control Framework if(!iInputFramework) + { iInputFramework = CInputFramework::NewL(iPluginAllocator->GetInputPlugin(), inputPluginSettings, this); + } //cleanup - outPluginName.Close(); - outputPluginSettings.ResetAndDestroy(); - outputPluginSettings.Close(); - inputPluginName.Close(); - inputPluginSettings.ResetAndDestroy(); - inputPluginSettings.Close(); + CleanupStack::PopAndDestroy(4, &outPluginName); // and outputPluginSettings, inputPluginName and inputPluginSettings iDataWatcher = CULoggerWatcher::NewL(); } @@ -1196,30 +1241,38 @@ void CULoggerServer::PrepareControlDataPayloadL(RBuf8& aPayloadBuf, const RArray& aArray) { - aPayloadBuf.Create(aArray.Count()*32); + aPayloadBuf.CreateL(aArray.Count()*32); for(TInt i=0; i& aArray) { - aPayloadBuf.Create(aArray.Count()*4); + aPayloadBuf.CreateL(aArray.Count()*4); for(TInt i=0; i b; b.Num(aArray[i]); if(aPayloadBuf.MaxSize() < aPayloadBuf.Length()+b.Length()) + { aPayloadBuf.ReAllocL(aPayloadBuf.Length()+(b.Length()*10)); + } aPayloadBuf.Append(b); if(i < aArray.Count()-1) //skip last sparator as it will be added automatically + { aPayloadBuf.Append(DATA_SEPARATOR); + } } } @@ -1355,7 +1408,7 @@ //create string as a payload /* - payloadBuf.Create(dupfilterArray.Count()*4); + payloadBuf.CreateL(dupfilterArray.Count()*4); for(i=0; i b; @@ -1391,7 +1444,7 @@ result.Num(errCode); data = inputData->CreatePackage((void*)result.Ptr(), result.Length()); /* - payloadBuf.Create(128); + payloadBuf.CreateL(128); payloadBuf.Copy(aArguments[i]); man->AppendNewData(ack, (const void*)payloadBuf.Ptr(), payloadBuf.Length()); */ diff -r b8bdbc8f59c7 -r 7d4490026038 traceservices/tracefw/ulogger/src/uloggerserver/uloggerserver.h --- a/traceservices/tracefw/ulogger/src/uloggerserver/uloggerserver.h Thu Aug 12 11:53:23 2010 +0100 +++ b/traceservices/tracefw/ulogger/src/uloggerserver/uloggerserver.h Mon Sep 27 11:59:56 2010 +0100 @@ -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" @@ -154,6 +154,10 @@ //filter related stuff ControlData* SetPrimaryFilters(RArray &aArguments); TInt GetValuesL(const TDesC8& aSectionName, RArray& aListBuffer); + + // cleanup methods + static void CleanupTPluginConfigArray(TAny* aPtr); + private: //data TInt iRunAsService; diff -r b8bdbc8f59c7 -r 7d4490026038 traceservices/tracefw/ulogger/src/uloggerserver/uloggersrvsession.cpp --- a/traceservices/tracefw/ulogger/src/uloggerserver/uloggersrvsession.cpp Thu Aug 12 11:53:23 2010 +0100 +++ b/traceservices/tracefw/ulogger/src/uloggerserver/uloggersrvsession.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -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" @@ -122,34 +122,37 @@ { //Set filter 1 RArray filterArray; + CleanupClosePushL(filterArray); TInt elementsCount = aMessage.Int1(); if(elementsCount > 0) { - HBufC8* desData = HBufC8::NewLC(elementsCount*sizeof(TUint8)); + HBufC8* desData = HBufC8::NewLC(elementsCount); TPtr8 readPtr(desData->Des()); aMessage.ReadL(0, readPtr); CArrayFixFlat *array = new (ELeave) CArrayFixFlat(1); CleanupStack::PushL(array); - TUint8 tmp=1; + TUint8 tmp(1); InternalizeFromBufL(readPtr, *array, tmp); - for(TInt i=0;iCount();++i) + for(TInt i(0); i < array->Count(); ++i) { - filterArray.Append((TUint32)array->At(i)); + filterArray.AppendL((TUint32)array->At(i)); } error = iServer.SetActiveFilterL(filterArray, EPrimaryFilter); - CleanupStack::PopAndDestroy(2,desData); //array, desData - filterArray.Close(); + CleanupStack::PopAndDestroy(3, &filterArray); // and array, desData } else + { error = KErrArgument; + } } break; + case ERemovePrimaryFilter: { //remove primaryfilters @@ -157,29 +160,30 @@ if(elementsCount > 0) { RArray filterArray; - HBufC8* desData = HBufC8::NewLC(elementsCount*sizeof(TUint8)); + CleanupClosePushL(filterArray); + HBufC8* desData = HBufC8::NewLC(elementsCount); TPtr8 readPtr(desData->Des()); aMessage.ReadL(0, readPtr); CArrayFixFlat *array = new (ELeave) CArrayFixFlat(1); CleanupStack::PushL(array); - TUint8 tmp=1; + TUint8 tmp(1); InternalizeFromBufL(readPtr, *array, tmp); - for(TInt i=0;iCount();++i) + for(TInt i(0); i < array->Count(); ++i) { - filterArray.Append((TUint32)array->At(i)); + filterArray.AppendL((TUint32)array->At(i)); } error = iServer.RemoveActiveFilter(filterArray,EPrimaryFilter); - CleanupStack::PopAndDestroy(2,desData); //array, desData - filterArray.Close(); + CleanupStack::PopAndDestroy(3, &filterArray); // and array, desData } else + { error = KErrArgument; - + } } break;