# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1273589379 -10800 # Node ID 04ec7606545c67dc981324711a141e89ce3b350e # Parent 6b6fd149daa2ae94a1a4590a8f264d6ce8977022 Revision: 201019 Kit: 201019 diff -r 6b6fd149daa2 -r 04ec7606545c loggingservices/eventlogger/Rom/logengtest.iby --- a/loggingservices/eventlogger/Rom/logengtest.iby Tue Apr 27 18:25:57 2010 +0300 +++ b/loggingservices/eventlogger/Rom/logengtest.iby Tue May 11 17:49:39 2010 +0300 @@ -25,11 +25,8 @@ //for t_logview2 #include -//Include cntmodel stuff to allow manual test t_logcntmatch to be run -data=MULTI_LINGUIFY(RSC ZRESOURCE\CNTMODEL\CNTMODEL RESOURCE\CNTMODEL\CNTMODEL) -#include +ECOM_PLUGIN(t_logcntmatchplugin.dll,2000862e.rsc) -file=ABI_DIR\BUILD_DIR\t_logenvcreate.exe Test\t_logenvcreate.exe file=ABI_DIR\BUILD_DIR\t_logtype.exe Test\t_logtype.exe file=ABI_DIR\BUILD_DIR\t_logapi.exe Test\t_logapi.exe file=ABI_DIR\BUILD_DIR\t_logapi2.exe Test\t_logapi2.exe @@ -63,7 +60,6 @@ file=ABI_DIR\BUILD_DIR\t_logapi_helper.exe Test\t_logapi_helper.exe file=ABI_DIR\BUILD_DIR\t_logcompat.exe Test\t_logcompat.exe file=ABI_DIR\BUILD_DIR\t_logsimid.exe Test\t_logsimid.exe -file=ABI_DIR\BUILD_DIR\t_logenvdestroy.exe Test\t_logenvdestroy.exe data=ZSYSTEM\test\logengtests.bat Test\logengtests.bat data=ZSYSTEM\data\oldLogdbu.dat system\data\oldLogdbu.dat @@ -74,7 +70,4 @@ //the following file is missing and needed by the time zone server. //data=ZPRIVATE\10202BE9\1020383e.txt private\10202be9\1020383e.txt -data=ZPRIVATE\101f401d\CntModel.ini \PRIVATE\101f401d\CntModel.ini -data=ZPRIVATE\101f401d\SQLite__Contacts.cdb \PRIVATE\101f401d\SQLite__Contacts.cdb - #endif diff -r 6b6fd149daa2 -r 04ec7606545c loggingservices/eventlogger/group/BLD.INF --- a/loggingservices/eventlogger/group/BLD.INF Tue Apr 27 18:25:57 2010 +0300 +++ b/loggingservices/eventlogger/group/BLD.INF Tue May 11 17:49:39 2010 +0300 @@ -66,7 +66,6 @@ PRJ_TESTMMPFILES -../test/t_logenvcreate.mmp ../test/t_logtype.mmp ../test/t_logapi.mmp ../test/t_logapi2.mmp @@ -100,7 +99,7 @@ ../test/t_logapi_helper.mmp support ../test/t_logcompat.mmp ../test/t_logsimid.mmp -../test/t_logenvdestroy.mmp +../test/t_logcntmatchplugin.mmp support PRJ_TESTEXTENSIONS start extension syslibs/test/logeng_copytestfiles diff -r 6b6fd149daa2 -r 04ec7606545c loggingservices/eventlogger/group/logengtests.bat --- a/loggingservices/eventlogger/group/logengtests.bat Tue Apr 27 18:25:57 2010 +0300 +++ b/loggingservices/eventlogger/group/logengtests.bat Tue May 11 17:49:39 2010 +0300 @@ -14,7 +14,6 @@ @rem Description: @rem -t_logenvcreate.exe t_logtype.exe t_logapi.exe t_logapi2.exe @@ -46,4 +45,3 @@ t_logservipc.exe t_logcompat.exe t_logsimid.exe -t_logenvdestroy.exe diff -r 6b6fd149daa2 -r 04ec7606545c loggingservices/eventlogger/logcntmodel/inc/logcntmodel.h --- a/loggingservices/eventlogger/logcntmodel/inc/logcntmodel.h Tue Apr 27 18:25:57 2010 +0300 +++ b/loggingservices/eventlogger/logcntmodel/inc/logcntmodel.h Tue May 11 17:49:39 2010 +0300 @@ -65,8 +65,11 @@ /** Interface UID to be used by all contacts model plugin's for log engine @internalAll */ -const TUid KUidEComLogCntInterface = {0x20008029}; - +#ifdef SYSLIBS_TEST + const TUid KUidEComLogCntInterface = {0x20008030}; +#else + const TUid KUidEComLogCntInterface = {0x20008029}; +#endif /** Provides an interface for ECom plugins @internalAll */ class CLogCntModel: public CBase, public MLogCntModel diff -r 6b6fd149daa2 -r 04ec7606545c loggingservices/eventlogger/test/inc/t_logcntmatchplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/loggingservices/eventlogger/test/inc/t_logcntmatchplugin.h Tue May 11 17:49:39 2010 +0300 @@ -0,0 +1,75 @@ +// 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: +// Header file of the ECom impletementation of for testing contact matching. +// + +#ifndef __CNTMATCHLOG_H__ +#define __CNTMATCHLOG_H__ + +#include +#include +#include +#include + +//The contact items +const TInt KNumberOfItems = 7; + +_LIT(KNumber1, "447700900000"); +_LIT(KNumber2, "+441632960000"); +_LIT(KNumber3, "07700900001"); +_LIT(KNumber4, "447756900111"); +_LIT(KNumber5, "447756900111"); +_LIT(KNumber6, "1234567890"); +_LIT(KNumber7, "0123456789"); + +_LIT(KFirstName1, "Barney"); +_LIT(KFirstName2, "Elma"); +_LIT(KFirstName3, "Peter"); +_LIT(KFirstName4, "Abc"); +_LIT(KFirstName5, "Rtyu"); +_LIT(KFirstName6, "Zxcvb"); +_LIT(KFirstName7, "AAA"); + +_LIT(KLastName1, "Rubble"); +_LIT(KLastName2, "Fudd"); +_LIT(KLastName3, "Harper"); +_LIT(KLastName4, "Lkjhgf"); +_LIT(KLastName5, "Poiuytqwe"); +_LIT(KLastName6, "Mnbvcxz"); +_LIT(KLastName7, "BBB"); + +/** Plugin implementation that provide contacts matching functionality. + +@internalAll +*/ +class CLogTestCntMatch : public CLogCntModel + { +public: + static CLogTestCntMatch* NewL(); + virtual void OpenContactsL(); + virtual void CloseContacts(); + virtual TLogContactItemId MatchPhoneNumberL(const TDesC& aNumber, TInt aMatchLengthFromRight); + virtual void ReadContactNameL(TLogContactItemId aContactId, TDes &aName, TLogContactNameFormat aNameFormat); + +private: + ~CLogTestCntMatch(); + CLogTestCntMatch(); + + void ConstructL(); + CDesCArray* iTelNumbers; + CDesCArray* iContactFirstNames; + CDesCArray* iContactLastNames; + }; + +#endif diff -r 6b6fd149daa2 -r 04ec7606545c loggingservices/eventlogger/test/src/2000862e.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/loggingservices/eventlogger/test/src/2000862e.rss Tue May 11 17:49:39 2010 +0300 @@ -0,0 +1,40 @@ +// 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 "ecom/registryinfov2.rh" +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + + dll_uid = 0x2000862e;//should match name of this file i.e 2000862e.rss + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x20008030;//match the ecom plugin uid const TUid KUidEComLogCntInterface = {0x20008030}; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2000862a;//matching IMPLEMENTATION_PROXY_ENTRY() in cntmatchlog.cpp + version_no = 1; + display_name = "default contacts matching Implementation"; + default_data = "default"; + opaque_data = ""; + } + }; + } + }; + } diff -r 6b6fd149daa2 -r 04ec7606545c loggingservices/eventlogger/test/src/t_logcntmatch.cpp --- a/loggingservices/eventlogger/test/src/t_logcntmatch.cpp Tue Apr 27 18:25:57 2010 +0300 +++ b/loggingservices/eventlogger/test/src/t_logcntmatch.cpp Tue May 11 17:49:39 2010 +0300 @@ -23,43 +23,7 @@ #include #include #include "t_logutil2.h" - -///////////////////////////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////////////// - -//The test uses a test contact database (SQLite__Contacts.cdb), part of LogEng data files. -//The test contact database contains the follwing contacts: -//{1, KPhoneNumber, KGivenName, KFamilyName} -//{2, KNumber1, KFirstName1, KLastName1} -//{3, KNumber2, KFirstName2, KLastName2} -//{4, KNumber3, KFirstName3, KLastName3} -//{5, KNumber4, KFirstName4, KLastName4} -//{6, KNumber4, KFirstName5, KLastName5} -//{7, KTestNum, KFirstName6, KLastName6} - -//The records data -_LIT(KFirstName1, "Barney"); -_LIT(KFirstName2, "Elma"); -_LIT(KFirstName3, "Peter"); -_LIT(KLastName1, "Rubble"); -_LIT(KLastName2, "Fudd"); -_LIT(KLastName3, "Harper"); -_LIT(KNumber1, "447700900000"); -_LIT(KNumber2, "+441632960000"); -_LIT(KNumber3, "07700 900001"); -//_LIT(KFirstName4, "Abc"); -_LIT(KFirstName5, "Rtyu"); -_LIT(KFirstName6, "Zxcvb"); -//_LIT(KLastName4, "Lkjhgf"); -//_LIT(KLastName5, "Poiuytqwe"); -_LIT(KLastName6, "Mnbvcxz"); -_LIT(KNumber4, "447756900111"); -//_LIT(KNumber5, "+441987960222"); -//_LIT(KNumber6, "07700 608101"); -_LIT(KGivenName, "AAA"); -_LIT(KFamilyName, "BBB"); -_LIT(KPhoneNumber, "0123456789"); -_LIT(KTestNum, "1234567890"); +#include "t_logcntmatchplugin.h" RTest TheTest(_L("t_logcntmatch")); @@ -281,10 +245,10 @@ CleanupStack::PushL(event); event->SetEventType(KLogCallEventTypeUid); - TInt count = KTestNum().Length(); + TInt count = KNumber6().Length(); while(count--) { - TPtrC num = KTestNum().Right(KTestNum().Length() - count); + TPtrC num = KNumber6().Right(KNumber6().Length() - count); event->SetNumber(num); // Add event @@ -333,7 +297,7 @@ CLogEvent* event = CLogEvent::NewL(); CleanupStack::PushL(event); event->SetEventType(KLogCallEventTypeUid); - event->SetNumber(KPhoneNumber); + event->SetNumber(KNumber7); active->StartL(); aClient.AddEvent(*event, active->iStatus); CActiveScheduler::Start(); @@ -343,7 +307,7 @@ //Check result TEST(event->Contact() != KLogNullContactId); - ::CheckContactName(*event, KGivenName, KFamilyName); + ::CheckContactName(*event, KFirstName7, KLastName7); TEST(event->Flags() & KLogEventContactSearched); //Cleanup @@ -372,8 +336,9 @@ CLogClient* client = CLogClient::NewL(theFs); CleanupStack::PushL(client); - //All tests bellow are likely to fail if 101f401d.txt file exists in CentralRepository private data cage - //and the contact mach count is set to 0 in that file. + //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. 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")); diff -r 6b6fd149daa2 -r 04ec7606545c loggingservices/eventlogger/test/src/t_logcntmatchplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/loggingservices/eventlogger/test/src/t_logcntmatchplugin.cpp Tue May 11 17:49:39 2010 +0300 @@ -0,0 +1,187 @@ +// 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: +// The ECom impletementation of testing contact matching. +// + +#include "t_logcntmatchplugin.h" +#include +#include + +/** Creates a CLogTestCntMatch object +*/ +CLogTestCntMatch* CLogTestCntMatch::NewL() + { + RDebug::Print(_L("CLogTestCntMatch::NewL()")); + CLogTestCntMatch* self = new (ELeave) CLogTestCntMatch; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CLogTestCntMatch::ConstructL() + { + iTelNumbers = new(ELeave) CDesCArrayFlat(KNumberOfItems); + iContactFirstNames = new(ELeave) CDesCArrayFlat(KNumberOfItems); + iContactLastNames = new(ELeave) CDesCArrayFlat(KNumberOfItems); + } + +CLogTestCntMatch::CLogTestCntMatch() + { + } + +CLogTestCntMatch::~CLogTestCntMatch() + { + delete iTelNumbers; + delete iContactFirstNames; + delete iContactLastNames; + } + +/** Interface of ECOM. In real phone, it should opens the contacts DB +*/ +void CLogTestCntMatch::OpenContactsL() + { + RDebug::Print(_L("Test Mock Contact Matching: OpenContactsL ")); + + iTelNumbers->Reset(); + iContactFirstNames->Reset(); + iContactLastNames->Reset(); + + iTelNumbers->AppendL(KNumber1); + iContactFirstNames->AppendL(KFirstName1); + iContactLastNames->AppendL(KLastName1); + + iTelNumbers->AppendL(KNumber2); + iContactFirstNames->AppendL(KFirstName2); + iContactLastNames->AppendL(KLastName2); + + iTelNumbers->AppendL(KNumber3); + iContactFirstNames->AppendL(KFirstName3); + iContactLastNames->AppendL(KLastName3); + + iTelNumbers->AppendL(KNumber4); + iContactFirstNames->AppendL(KFirstName4); + iContactLastNames->AppendL(KLastName4); + + iTelNumbers->AppendL(KNumber5); + iContactFirstNames->AppendL(KFirstName5); + iContactLastNames->AppendL(KLastName5); + + iTelNumbers->AppendL(KNumber6); + iContactFirstNames->AppendL(KFirstName6); + iContactLastNames->AppendL(KLastName6); + + iTelNumbers->AppendL(KNumber7); + iContactFirstNames->AppendL(KFirstName7); + iContactLastNames->AppendL(KLastName7); + } + +/** Interface of ECOM. In real phone, it should closes the contacts DB +*/ +void CLogTestCntMatch::CloseContacts() + { + RDebug::Print(_L("OpenContactsL is called")); + iContactFirstNames->Reset(); + iContactLastNames->Reset(); + iTelNumbers->Reset(); + } + +/** Attempts to find a contact item ID for the contact items which contains + the specified telephone number in a telephone, fax or SMS type field for tests. + If more than one contact item contains the telephone number this should be + treated the same as no contact found. + @param aNumber Phone number string + @param aMatchLengthFromRight Number of digits from the right of the phone number to use. + @return The contact Id found that contains the phone number. KLogNullContactId if none or more than one is found. +*/ +TLogContactItemId CLogTestCntMatch::MatchPhoneNumberL(const TDesC& aNumber, TInt aMatchLengthFromRight) + { + RDebug::Print(_L("CLogTestCntMatch::MatchPhoneNumberL()")); + __ASSERT_ALWAYS(iTelNumbers->Length() == KNumberOfItems && + iContactFirstNames->Length()==KNumberOfItems && + iContactLastNames->Length()==KNumberOfItems, _L("CLogTestCntMatch::MatchPhoneNumberL")); + + TLogContactItemId contactId = KLogNullContactId; + TInt numHit = 0; + const TInt KMinLength = 7; + TInt pos = -1; + if(aNumber.Length() >= KMinLength) + { + for (TInt ii = 0; ii < KNumberOfItems && numHit < 2; ++ii) + { + TPtrC number((*iTelNumbers)[ii]); + TInt numDigToMatch = aNumber.Length()(pos)+1; + } + } + + return contactId; + } + +/** Gets the text data for the family and given name fields of a given contact Id for tests. + + @param aContactId Contact Id to find data for + @param aName On return contains the family and given name in the desired format if found, leave with KErrNotFound otherwise. + @param aNameFormat Desired format of returned string - Chinese or Western format +*/ +void CLogTestCntMatch::ReadContactNameL(TLogContactItemId aContactId, TDes &aName, TLogContactNameFormat aNameFormat) + { + RDebug::Print(_L("CLogTestCntMatch::ReadContactNameL()")); + __ASSERT_ALWAYS(iTelNumbers->Length() == KNumberOfItems && + iContactFirstNames->Length()==KNumberOfItems && + iContactLastNames->Length()==KNumberOfItems, _L("CLogTestCntMatch::ReadContactNameL")); + + if(aContactId < 1 && aContactId > KNumberOfItems) + { + User::Leave(KErrNotFound); + } + if(aNameFormat == ELogWesternFormat) + { + aName.Append((*iContactFirstNames)[aContactId-1]); + aName.Append(' '); + aName.Append((*iContactLastNames)[aContactId-1]); + } + else //ELogChineseFormat + { + aName.Append((*iContactLastNames)[aContactId-1]); + aName.Append((*iContactFirstNames)[aContactId-1]); + aName.Append(' '); + } + } + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x2000862a, CLogTestCntMatch::NewL) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + diff -r 6b6fd149daa2 -r 04ec7606545c loggingservices/eventlogger/test/src/t_logenvcreate.cpp --- a/loggingservices/eventlogger/test/src/t_logenvcreate.cpp Tue Apr 27 18:25:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -// 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" -// 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: -// EventLogger - copying EventLogger test files from Z: to C: -// Please, ensure that t_logenvcreate test is executed before the other EventLogger component tests -// -// - -#include -#include -#include "t_logutil.h" - -RTest TheTest(_L("t_logenvcreate - copying EventLogger test files to C:")); - -_LIT(KContactsServerName, "!CNTSRV"); - -_LIT(KContactsServerPrivateDirC, "c:\\private\\10003a73\\"); - -_LIT(KZFileName1, "z:\\private\\101f401d\\CntModel.ini"); -_LIT(KZFileName2, "z:\\private\\101f401d\\SQLite__Contacts.cdb"); - -_LIT(KCFileName1, "c:\\private\\10003a73\\CntModel.ini"); -_LIT(KCFileName2, "c:\\private\\10003a73\\SQLite__Contacts.cdb"); - -void DoRun() - { - RFs fs; - TInt err = fs.Connect(); - TEST2(err, KErrNone); - - TheTest.Start(_L(" @SYMTestCaseID: PDS-LOGENG-CT-4048 Copy EventLogger test files from Z: to C: ")); - - err = BaflUtils::CopyFile(fs, KZFileName1, KCFileName1); - TEST2(err, KErrNone); - err = fs.SetAtt(KCFileName1, 0, KEntryAttReadOnly); - TEST2(err, KErrNone); - - err = BaflUtils::CopyFile(fs, KZFileName2, KCFileName2); - TEST2(err, KErrNone); - err = fs.SetAtt(KCFileName2, 0, KEntryAttReadOnly); - TEST2(err, KErrNone); - fs.Close(); - } - -void CreateContactsServerPrivateDir() - { - RFs fs; - TInt err = fs.Connect(); - TEST2(err, KErrNone); - - TRAP(err, BaflUtils::EnsurePathExistsL(fs, KContactsServerPrivateDirC)); - TEST2(err, KErrNone); - - fs.Close(); - } - -TInt E32Main() - { - TheTest.Title(); - - CTrapCleanup* tc = CTrapCleanup::New(); - - __UHEAP_MARK; - - KillProcess(KContactsServerName); - - CreateContactsServerPrivateDir(); - - DoRun(); - - __UHEAP_MARKEND; - - TheTest.End(); - TheTest.Close(); - - delete tc; - - User::Heap().Check(); - return KErrNone; - } diff -r 6b6fd149daa2 -r 04ec7606545c loggingservices/eventlogger/test/src/t_logenvdestroy.cpp --- a/loggingservices/eventlogger/test/src/t_logenvdestroy.cpp Tue Apr 27 18:25:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -// 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" -// 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: -// EventLogger - deleting EventLogger test files from C: -// Please, ensure that t_logenvdestroy test is executed after the EventLogger component tests -// -// - -#include -#include -#include "t_logutil.h" - -RTest TheTest(_L("t_logenvdestroy - deleting EventLogger test files from C:")); - -_LIT(KCFileName1, "c:\\private\\10003a73\\CntModel.ini"); -_LIT(KCFileName2, "c:\\private\\10003a73\\SQLite__Contacts.cdb"); - -/////////////////////////////////////////////////////////////////////////////////////// - -void DoDeleteFile(RFs& aFs, const TDesC& aFilePath) - { - TInt err = BaflUtils::DeleteFile(aFs, aFilePath); - if(err != KErrNone && err != KErrNotFound) - { - TheTest.Printf(_L("Error %d deleting \"%S\" file.\n"), err, &aFilePath); - } - } - -void DoRun() - { - RFs fs; - TInt err = fs.Connect(); - TEST2(err, KErrNone); - - TheTest.Start(_L(" @SYMTestCaseID: PDS-LOGENG-CT-4049 Deleting EventLogger test files from C:")); - - DoDeleteFile(fs, KCFileName1); - DoDeleteFile(fs, KCFileName2); - - fs.Close(); - } - -TInt E32Main() - { - TheTest.Title(); - - CTrapCleanup* tc = CTrapCleanup::New(); - - __UHEAP_MARK; - - DoRun(); - - __UHEAP_MARKEND; - - TheTest.End(); - TheTest.Close(); - - delete tc; - - User::Heap().Check(); - return KErrNone; - } diff -r 6b6fd149daa2 -r 04ec7606545c loggingservices/eventlogger/test/t_logcntmatchplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/loggingservices/eventlogger/test/t_logcntmatchplugin.mmp Tue May 11 17:49:39 2010 +0300 @@ -0,0 +1,42 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// t_logcntmatchplugin.dll. Mock ECom plugin contacts matching implementation for logeng +// +// + +TARGET t_logcntmatchplugin.dll +TARGETTYPE PLUGIN + +UID 0x10009d8d 0x2000862e + +CAPABILITY ProtServ ReadUserData WriteUserData + +SOURCEPATH ../test/src +SOURCE t_logcntmatchplugin.cpp + +USERINCLUDE ../test/inc +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +START RESOURCE 2000862e.rss + TARGET t_logcntmatchplugin.rsc +END + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY logcntmodel.lib + +VENDORID 0x70000001 + +SMPSAFE diff -r 6b6fd149daa2 -r 04ec7606545c persistentstorage/centralrepository/cenrepsrv/install.cpp --- a/persistentstorage/centralrepository/cenrepsrv/install.cpp Tue Apr 27 18:25:57 2010 +0300 +++ b/persistentstorage/centralrepository/cenrepsrv/install.cpp Tue May 11 17:49:39 2010 +0300 @@ -73,8 +73,11 @@ CCentRepSWIWatcher::~CCentRepSWIWatcher() { Cancel(); - iSWIKey.Cancel(); - iSWIKey.Close(); + if(iSWIKey.Handle() != KNullHandle) + { + iSWIKey.Cancel(); + iSWIKey.Close(); + } iInstallEntryArray.ResetAndDestroy(); iCurrentInstallDirEntries.ResetAndDestroy(); } diff -r 6b6fd149daa2 -r 04ec7606545c persistentstorage/sql/OsLayer/FileBuf64.cpp --- a/persistentstorage/sql/OsLayer/FileBuf64.cpp Tue Apr 27 18:25:57 2010 +0300 +++ b/persistentstorage/sql/OsLayer/FileBuf64.cpp Tue May 11 17:49:39 2010 +0300 @@ -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,53 +22,98 @@ extern TBool TheOsCallTimeDetailedProfileEnabled;//If true, the OS porting layer call details are enabled and for each call an entry will be added to the log file (epocwind.out). -#define PROFILE_READ(pos,amount) \ +#define PROFILE_READ(pos, amount, err) \ do \ { \ if(TheOsCallTimeDetailedProfileEnabled) \ { \ ++iFileReadCount; iFileReadAmount += (amount); \ - RDebug::Print(_L(" -- FRead this=%X, Cnt=%d, Pos=%ld, Amt=%d, Ttl=%ld\r\n"), (TUint32)this, iFileReadCount, pos, amount, iFileReadAmount); \ + RDebug::Print(_L("[SQL-FBUF]¬RD¬%X¬%d¬%ld¬%d¬%ld¬%d\r\n"), (TUint32)this, iFileReadCount, pos, amount, iFileReadAmount, err); \ } \ } while(0) -#define PROFILE_WRITE(pos,amount) \ +#define PROFILE_WRITE(pos, amount, err) \ do \ { \ if(TheOsCallTimeDetailedProfileEnabled) \ { \ ++iFileWriteCount; iFileWriteAmount += (amount); \ - RDebug::Print(_L(" -- FWrite this=%X, Cnt=%d, Pos=%ld, Amt=%d, Ttl=%ld\r\n"), (TUint32)this, iFileWriteCount, pos, amount, iFileWriteAmount); \ + RDebug::Print(_L("[SQL-FBUF]¬WR¬%X¬%d¬%ld¬%d¬%ld¬%d\r\n"), (TUint32)this, iFileWriteCount, pos, amount, iFileWriteAmount, err); \ } \ } while(0) -#define PROFILE_SIZE() \ +#define PROFILE_SIZE(size, err) \ do \ { \ if(TheOsCallTimeDetailedProfileEnabled) \ { \ ++iFileSizeCount; \ - RDebug::Print(_L(" -- FSize this=%X, Cnt=%d\r\n"), (TUint32)this, iFileSizeCount); \ + RDebug::Print(_L("[SQL-FBUF]¬SZ¬%X¬%d¬%ld¬%d¬%ld¬%d\r\n"), (TUint32)this, iFileSizeCount, size, 0, 0LL, err); \ } \ } while(0) -#define PROFILE_SETSIZE() \ +#define PROFILE_SETSIZE(size, err) \ do \ { \ if(TheOsCallTimeDetailedProfileEnabled) \ { \ ++iFileSetSizeCount; \ - RDebug::Print(_L(" -- FSetSize this=%X, Cnt=%d\r\n"), (TUint32)this, iFileSetSizeCount); \ + RDebug::Print(_L("[SQL-FBUF]¬SS¬%X¬%d¬%ld¬%d¬%ld¬%d\r\n"), (TUint32)this, iFileSetSizeCount, size, 0, 0LL, err); \ } \ } while(0) -#define PROFILE_FLUSH() \ +#define PROFILE_FLUSH(err) \ do \ { \ if(TheOsCallTimeDetailedProfileEnabled) \ { \ ++iFileFlushCount; \ - RDebug::Print(_L(" -- FFlush this=%X, Cnt=%d\r\n"), (TUint32)this, iFileFlushCount); \ + RDebug::Print(_L("[SQL-FBUF]¬SY¬%X¬%d¬%ld¬%d¬%ld¬%d\r\n"), (TUint32)this, iFileFlushCount, 0LL, 0, 0LL, err); \ + } \ + } while(0) + +#define PROFILE_CREATE(fname, err) \ + do \ + { \ + if(TheOsCallTimeDetailedProfileEnabled) \ + { \ + RDebug::Print(_L("[SQL-FBUF]¬CR¬%X¬%S¬%d\r\n"), (TUint32)this, &fname, err); \ + } \ + } while(0) + +#define PROFILE_OPEN(fname, err) \ + do \ + { \ + if(TheOsCallTimeDetailedProfileEnabled) \ + { \ + RDebug::Print(_L("[SQL-FBUF]¬OP¬%X¬%S¬%d\r\n"), (TUint32)this, &fname, err); \ + } \ + } while(0) + +#define PROFILE_TEMP(fname, err) \ + do \ + { \ + if(TheOsCallTimeDetailedProfileEnabled) \ + { \ + RDebug::Print(_L("[SQL-FBUF]¬TP¬%X¬%S¬%d\r\n"), (TUint32)this, &fname, err); \ + } \ + } while(0) + +#define PROFILE_ADOPT(fname, err) \ + do \ + { \ + if(TheOsCallTimeDetailedProfileEnabled) \ + { \ + RDebug::Print(_L("[SQL-FBUF]¬AT¬%X¬%S¬%d\r\n"), (TUint32)this, &fname, err); \ + } \ + } while(0) + +#define PROFILE_CLOSE() \ + do \ + { \ + if(TheOsCallTimeDetailedProfileEnabled) \ + { \ + RDebug::Print(_L("[SQL-FBUF]¬CL¬%X\r\n"), (TUint32)this); \ } \ } while(0) @@ -80,12 +125,18 @@ #else -#define PROFILE_READ(pos,amount) void(0) -#define PROFILE_WRITE(pos,amount) void(0) +#define PROFILE_READ(pos,amount, err) void(0) +#define PROFILE_WRITE(pos,amount, err) void(0) -#define PROFILE_SIZE() void(0) -#define PROFILE_SETSIZE() void(0) -#define PROFILE_FLUSH() void(0) +#define PROFILE_SIZE(size, err) void(0) +#define PROFILE_SETSIZE(size, err) void(0) +#define PROFILE_FLUSH(err) void(0) + +#define PROFILE_CREATE(fname, err) void(0) +#define PROFILE_OPEN(fname, err) void(0) +#define PROFILE_TEMP(fname, err) void(0) +#define PROFILE_ADOPT(fname, err) void(0) +#define PROFILE_CLOSE() void(0) #endif//_SQLPROFILER @@ -238,6 +289,7 @@ { err = iFile.Create(aFs, aFileName, aFileMode); } + PROFILE_CREATE(aFileName, err); return DoPostInit(err); } @@ -269,6 +321,7 @@ { err = iFile.Open(aFs, aFileName, aFileMode); } + PROFILE_OPEN(aFileName, err); return DoPostInit(err); } @@ -300,6 +353,7 @@ { err = iFile.Temp(aFs, aPath, aFileName, aFileMode); } + PROFILE_TEMP(aFileName, err); return DoPostInit(err); } @@ -336,6 +390,7 @@ { err = iFile.AdoptFromClient(aMsg, aFsIndex, aFileIndex); } + PROFILE_ADOPT(KNullDesC, err); return DoPostInit(err); } @@ -356,6 +411,7 @@ iFile.Close(); User::Free(iBase); iBase = 0; + PROFILE_CLOSE(); } /** @@ -441,7 +497,7 @@ if(err == KErrNone) { err = iFile.Read(aFilePos, aDes); - PROFILE_READ(aFilePos, aDes.Size()); + PROFILE_READ(aFilePos, aDes.Size(), err); } __FILEBUF64_INVARIANT(); return err; @@ -472,7 +528,7 @@ iNextReadFilePosHits = 0; TPtr8 ptr2(outptr, len); err = iFile.Read(aFilePos, ptr2); - PROFILE_READ(aFilePos, ptr2.Size()); + PROFILE_READ(aFilePos, ptr2.Size(), err); if(err == KErrNone) { iNextReadFilePos = aFilePos + len; @@ -496,7 +552,7 @@ } TPtr8 ptr(iBase, Min(iCapacity, (len + readahead))); err = iFile.Read(aFilePos, ptr); - PROFILE_READ(aFilePos, ptr.Size()); + PROFILE_READ(aFilePos, ptr.Size(), err); if(err == KErrNone) { iFilePos = aFilePos; @@ -787,8 +843,8 @@ __FILEBUF64_INVARIANT(); return KErrNone; } - PROFILE_SIZE(); TInt err = iFile.Size(iFileSize); + PROFILE_SIZE(iFileSize, err); if(err != KErrNone) { DoDiscard(); @@ -825,8 +881,8 @@ { iLength = aFileSize - iFilePos; } - PROFILE_SETSIZE(); TInt err = iFile.SetSize(aFileSize); + PROFILE_SETSIZE(aFileSize, err); if(err != KErrNone) { DoDiscard(); @@ -857,8 +913,8 @@ __FILEBUF64_INVARIANT(); return err; } - PROFILE_FLUSH(); err = iFile.Flush(); + PROFILE_FLUSH(err); if(err != KErrNone) { DoDiscard(); @@ -889,9 +945,9 @@ __FILEBUF64_INVARIANT(); return KErrNone; } - PROFILE_WRITE(iFilePos, iLength); TPtrC8 data(iBase, iLength); TInt err = iFile.Write(iFilePos, data); + PROFILE_WRITE(iFilePos, iLength, err); if(err == KErrNone) { iFileSize = Max(iFileSize, (iFilePos + iLength)); diff -r 6b6fd149daa2 -r 04ec7606545c persistentstorage/sql/OsLayer/os_symbian.cpp --- a/persistentstorage/sql/OsLayer/os_symbian.cpp Tue Apr 27 18:25:57 2010 +0300 +++ b/persistentstorage/sql/OsLayer/os_symbian.cpp Tue May 11 17:49:39 2010 +0300 @@ -360,7 +360,7 @@ { TOsCallProfile('M', "CL"), TOsCallProfile('M', "RD"), TOsCallProfile('M', "WR"), TOsCallProfile('M', "TR"), TOsCallProfile('M', "SY"), TOsCallProfile('M', "FS"), TOsCallProfile('M', "LK"), TOsCallProfile('M', "UL"), - TOsCallProfile('M', "CL"), TOsCallProfile('M', "FC"), TOsCallProfile('M', "SS"), TOsCallProfile('M', "DC"), + TOsCallProfile('M', "RL"), TOsCallProfile('M', "FC"), TOsCallProfile('M', "SS"), TOsCallProfile('M', "DC"), TOsCallProfile('M', "OP"), TOsCallProfile('M', "DE"), TOsCallProfile('M', "AC"), TOsCallProfile('M', "FN"), TOsCallProfile('M', "RN"), TOsCallProfile('M', "SL"), TOsCallProfile('M', "CT"), TOsCallProfile('M', "LE") }; @@ -371,7 +371,7 @@ { TOsCallProfile('J', "CL"), TOsCallProfile('J', "RD"), TOsCallProfile('J', "WR"), TOsCallProfile('J', "TR"), TOsCallProfile('J', "SY"), TOsCallProfile('J', "FS"), TOsCallProfile('J', "LK"), TOsCallProfile('J', "UL"), - TOsCallProfile('J', "CL"), TOsCallProfile('J', "FC"), TOsCallProfile('J', "SS"), TOsCallProfile('J', "DC"), + TOsCallProfile('J', "RL"), TOsCallProfile('J', "FC"), TOsCallProfile('J', "SS"), TOsCallProfile('J', "DC"), TOsCallProfile('J', "OP"), TOsCallProfile('J', "DE"), TOsCallProfile('J', "AC"), TOsCallProfile('J', "FN"), TOsCallProfile('J', "RN"), TOsCallProfile('J', "SL"), TOsCallProfile('J', "CT"), TOsCallProfile('J', "LE") }; @@ -384,11 +384,15 @@ //aProfileRef - a reference to the related TOsCallProfile object - TheOsCallMProfile[] or TheOsCallJProfile[] entry; //aOffset - file offset in bytes; //aBytes - amount of bytes to be read/written; - TOsCallCounter(TInt64& aOsCallTicksEntryRef, TOsCallProfile& aOsCallProfileRef, TInt64 aOffset, TInt aBytes) : + //aOptional - might be NULL. Used to print out the name of the file being processed. + TOsCallCounter(TInt64& aOsCallTicksEntryRef, TOsCallProfile& aOsCallProfileRef, TInt64 aOffset, TInt aBytes, + const sqlite3_file* aHandle, const char* aOptional) : iOsCallTicksEntryRef(aOsCallTicksEntryRef), iOsCallProfileRef(aOsCallProfileRef), iOffset(aOffset), - iBytes(aBytes) + iBytes(aBytes), + iHandle((TUint)aHandle), + iOptional((const TUint8*)aOptional) { if(TheOsCallTimeProfileEnabled) { @@ -411,8 +415,15 @@ ++iOsCallProfileRef.iCallCounter; iOsCallProfileRef.iTicksTotal += diffTicks; iOsCallProfileRef.iBytesTotal += iBytes; - // 1 2 3 4 5 6 7 8 9 10 - RDebug::Print(_L("'%c','%c%c',%d,%d,%ld,%d,%ld,%ld,%ld\n"), + TFileName fname; + if(iOptional) + { + TPtrC8 fn8(iOptional); + fname.Copy(fn8); + } + // 0 1 2 3 4 5 6 7 8 9 10 11 + RDebug::Print(_L("[SQL-OS]¬%X¬%c¬%c%c¬%d¬%d¬%ld¬%d¬%ld¬%ld¬%ld¬%S\n"), + iHandle, //0 iOsCallProfileRef.iType, //1 iOsCallProfileRef.iIdentifier[0], //2 iOsCallProfileRef.iIdentifier[1], //3 @@ -422,7 +433,8 @@ iBytes, //7 diffTicks, //8 iOsCallProfileRef.iBytesTotal, //9 - iOsCallProfileRef.iTicksTotal); //10 + iOsCallProfileRef.iTicksTotal, //10 + &fname); //11 } } } @@ -432,6 +444,8 @@ TInt64 iOffset; TInt iBytes; TUint32 iStartTicks; + TUint iHandle; + const TUint8* iOptional; }; inline TOsCallProfile& OsCallProfile(TBool aType, TInt aIndex) @@ -439,7 +453,7 @@ return aType ? TheOsCallJProfile[aIndex] : TheOsCallMProfile[aIndex]; } -# define __OSTIME_COUNTER(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes) TOsCallCounter osCallCounter(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes) +# define __OSTIME_COUNTER(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes, aHandle, aOpt) TOsCallCounter osCallCounter(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes, aHandle, aOpt) #else //_SQLPROFILER @@ -451,7 +465,7 @@ # define __OS_CALL(aOpType, a1, a2) void(0) -# define __OSTIME_COUNTER(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes) void(0) +# define __OSTIME_COUNTER(aOsCallTicksRef, aOsCallProfileRef, aOffset, aBytes, aHandle, aOpt) void(0) #endif//_SQLPROFILER @@ -1483,7 +1497,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileClose, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileClose], ::OsCallProfile(dbFile.iIsJournal, EOsFileClose), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileClose], ::OsCallProfile(dbFile.iIsJournal, EOsFileClose), 0, 0, aDbFile, 0); __FS_CALL(EFsOpFileClose, 0); dbFile.iFileBuf.Close(); if(dbFile.iFullName) @@ -1525,7 +1539,7 @@ TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileRead, 0, 0); __COUNTER_INCR(TheSqlSrvProfilerFileRead); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileRead], ::OsCallProfile(dbFile.iIsJournal, EOsFileRead), aOffset, aAmt); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileRead], ::OsCallProfile(dbFile.iIsJournal, EOsFileRead), aOffset, aAmt, aDbFile, 0); TPtr8 ptr((TUint8*)aBuf, 0, aAmt); TInt err = dbFile.iFileBuf.Read(aOffset, ptr); TInt cnt = ptr.Length(); @@ -1588,7 +1602,7 @@ TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileWrite, 0, 0); __COUNTER_INCR(TheSqlSrvProfilerFileWrite); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileWrite], ::OsCallProfile(dbFile.iIsJournal, EOsFileWrite), aOffset, aAmt); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileWrite], ::OsCallProfile(dbFile.iIsJournal, EOsFileWrite), aOffset, aAmt, aDbFile, 0); TInt err = KErrAccessDenied; if(!dbFile.iReadOnly) { @@ -1642,7 +1656,7 @@ TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileTruncate, 0, 0); __COUNTER_INCR(TheSqlSrvProfilerFileSetSize); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileTruncate], ::OsCallProfile(dbFile.iIsJournal, EOsFileTruncate), aLength, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileTruncate], ::OsCallProfile(dbFile.iIsJournal, EOsFileTruncate), aLength, 0, aDbFile, 0); if(dbFile.iReadOnly) { COsLayerData::Instance().SetOsErrorCode(KErrAccessDenied); @@ -1678,7 +1692,7 @@ TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileSync, 0, 0); __COUNTER_INCR(TheSqlSrvProfilerFileSync); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileSync], ::OsCallProfile(dbFile.iIsJournal, EOsFileSync), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileSync], ::OsCallProfile(dbFile.iIsJournal, EOsFileSync), 0, 0, aDbFile, 0); if(dbFile.iReadOnly) { COsLayerData::Instance().SetOsErrorCode(KErrAccessDenied); @@ -1713,7 +1727,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileFileSize, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileFileSize], ::OsCallProfile(dbFile.iIsJournal, EOsFileFileSize), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileFileSize], ::OsCallProfile(dbFile.iIsJournal, EOsFileFileSize), 0, 0, aDbFile, 0); __FS_CALL(EFsOpFileSize, 0); TInt err = dbFile.iFileBuf.Size(*aSize); COsLayerData::Instance().SetOsErrorCode(err); @@ -1747,7 +1761,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileLock, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileLock], ::OsCallProfile(dbFile.iIsJournal, EOsFileLock), aLockType, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileLock], ::OsCallProfile(dbFile.iIsJournal, EOsFileLock), aLockType, 0, aDbFile, 0); //If there is already a lock of this type or more restrictive on the database file, do nothing. if(dbFile.iLockType >= aLockType) { @@ -1780,7 +1794,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileUnlock, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileUnlock], ::OsCallProfile(dbFile.iIsJournal, EOsFileUnlock), aLockType, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileUnlock], ::OsCallProfile(dbFile.iIsJournal, EOsFileUnlock), aLockType, 0, aDbFile, 0); dbFile.iLockType = aLockType; return SQLITE_OK; } @@ -1809,7 +1823,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileCheckReservedLock, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileCheckReservedLock], ::OsCallProfile(dbFile.iIsJournal, EOsFileCheckReservedLock), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileCheckReservedLock], ::OsCallProfile(dbFile.iIsJournal, EOsFileCheckReservedLock), 0, 0, aDbFile, 0); *aResOut = dbFile.iLockType >= SQLITE_LOCK_RESERVED ? 1 : 0; return SQLITE_OK; } @@ -1845,7 +1859,7 @@ SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KFileFileCtr, aOp)); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileFileControl, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileFileControl], ::OsCallProfile(dbFile.iIsJournal, EOsFileFileControl), aOp, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileFileControl], ::OsCallProfile(dbFile.iIsJournal, EOsFileFileControl), aOp, 0, aDbFile, 0); TInt err = KErrNone; switch(aOp) { @@ -1896,7 +1910,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileSectorSize, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileSectorSize], ::OsCallProfile(dbFile.iIsJournal, EOsFileSectorSize), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileSectorSize], ::OsCallProfile(dbFile.iIsJournal, EOsFileSectorSize), 0, 0, aDbFile, 0); __ASSERT_DEBUG(dbFile.iSectorSize > 0, User::Panic(KPanicCategory, EPanicInternalError)); if(dbFile.iSectorSize > 0) { @@ -1927,7 +1941,7 @@ SQLUTRACE_PROFILER(aDbFile); TDbFile& dbFile = ::DbFile(aDbFile); __OS_CALL(EOsFileDeviceCharacteristics, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsFileDeviceCharacteristics], ::OsCallProfile(dbFile.iIsJournal, EOsFileDeviceCharacteristics), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsFileDeviceCharacteristics], ::OsCallProfile(dbFile.iIsJournal, EOsFileDeviceCharacteristics), 0, 0, aDbFile, 0); __ASSERT_DEBUG(dbFile.iDeviceCharacteristics >= 0, User::Panic(KPanicCategory, EPanicInternalError)); if(dbFile.iDeviceCharacteristics >= 0) { @@ -2218,7 +2232,7 @@ { SQLUTRACE_PROFILER(aVfs); __OS_CALL(EOsVfsOpen, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsVfsOpen], ::OsCallProfile(EFalse, EOsVfsOpen), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsVfsOpen], ::OsCallProfile(EFalse, EOsVfsOpen), 0, 0, aDbFile, aFileName); COsLayerData& osLayerData = COsLayerData::Instance(); TFileName fname; if(aFileName && !::ConvertToUnicode(aFileName, fname)) @@ -2367,7 +2381,7 @@ { SQLUTRACE_PROFILER(aVfs); __OS_CALL(EOsVfsDelete, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsVfsDelete], ::OsCallProfile(EFalse, EOsVfsDelete), 0, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsVfsDelete], ::OsCallProfile(EFalse, EOsVfsDelete), 0, 0, 0, aFileName); COsLayerData& osLayerData = COsLayerData::Instance(); TBuf fname; if(!::ConvertToUnicode(aFileName, fname)) @@ -2415,7 +2429,7 @@ { SQLUTRACE_PROFILER(aVfs); __OS_CALL(EOsVfsAccess, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsVfsAccess], ::OsCallProfile(EFalse, EOsVfsAccess), aFlags, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsVfsAccess], ::OsCallProfile(EFalse, EOsVfsAccess), aFlags, 0, 0, aFileName); COsLayerData& osLayerData = COsLayerData::Instance(); TBuf fname; if(!::ConvertToUnicode(aFileName, fname)) @@ -2492,7 +2506,7 @@ { SQLUTRACE_PROFILER(aVfs); __OS_CALL(EOsVfsFullPathName, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsVfsFullPathName], ::OsCallProfile(EFalse, EOsVfsFullPathName), aBufLen, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsVfsFullPathName], ::OsCallProfile(EFalse, EOsVfsFullPathName), aBufLen, 0, 0, aRelative); COsLayerData& osLayerData = COsLayerData::Instance(); osLayerData.StoreFhData(NULL, EFalse); //Convert the received file name to UTF16 @@ -2539,7 +2553,7 @@ { SQLUTRACE_PROFILER(aVfs); __OS_CALL(EOsVfsRandomness, 0, 0); - __OSTIME_COUNTER(TheOsCallTicks[EOsVfsRandomness], ::OsCallProfile(EFalse, EOsVfsRandomness), aBufLen, 0); + __OSTIME_COUNTER(TheOsCallTicks[EOsVfsRandomness], ::OsCallProfile(EFalse, EOsVfsRandomness), aBufLen, 0, 0, 0); COsLayerData& osLayerData = COsLayerData::Instance(); const TInt KRandIterations = aBufLen / sizeof(int); for(TInt i=0;i= 0 || (ipcCallIdx == KErrNotFound && TheSqlSrvProfilerTraceLevel == 2)) { - TheSqlSrvProfileTraceBuf.Format(_L("% 8X¬%012ld¬IPC¬%08u¬%20.20S¬%012ld¬%010d¬%08d¬%04d¬%04d¬%04d¬%04d¬rc=%d"), + TheSqlSrvProfileTraceBuf.Format(_L("[SQL]¬%X¬%ld¬IPC¬%u¬%S¬%ld¬%d¬%d¬%d¬%d¬%d¬%d¬rc¬%d"), aDbHandle, timeFromStart, aIpcCounter, @@ -788,7 +788,7 @@ TPtrC ipcCallName; (void)SqlIpcTraceIdxAndName(aFuncCode, ipcCallName); TInt64 timeFromStart = SqlTimeFromStartUs(); - TheSqlSrvProfileTraceBuf.Format(_L("% 8X¬%012ld¬ERR¬%08u¬%20.20S¬err=%d"), + TheSqlSrvProfileTraceBuf.Format(_L("[SQL]¬%X¬%ld¬ERR¬%u¬%S¬err¬%d"), aDbHandle, timeFromStart, aIpcCounter, @@ -823,13 +823,13 @@ _LIT(KEmptyStr, ""); if(pos == 0) { - line.Format(_L("% 8X¬%012ld¬SQL¬%12.12S¬"), aDbHandle, timeFromStart, aPrepare ? &KPrepare : &KExec); + line.Format(_L("[SQL]¬%X¬%ld¬SQL¬%S¬"), aDbHandle, timeFromStart, aPrepare ? &KPrepare : &KExec); } else { if(!TheSqlSrvProfilerTraceToFile) { - line.Format(_L("% 8X¬%012ld¬SQL¬%12.12S¬"), aDbHandle, timeFromStart, &KEmptyStr); + line.Format(_L("[SQL]¬%X¬%ld¬SQL¬%S¬"), aDbHandle, timeFromStart, &KEmptyStr); } } TInt l = Min(len, (line.MaxLength() - line.Length())); @@ -868,13 +868,13 @@ _LIT(KEmptyStr, ""); if(pos == 0) { - line.Format(_L("% 8X¬%012ld¬SQL¬%12.12S¬"), aDbHandle, timeFromStart, aPrepare ? &KPrepare : &KExec); + line.Format(_L("[SQL]¬%X¬%ld¬SQL¬%S¬"), aDbHandle, timeFromStart, aPrepare ? &KPrepare : &KExec); } else { if(!TheSqlSrvProfilerTraceToFile) { - line.Format(_L("% 8X¬%012ld¬SQL¬%12.12S¬"), aDbHandle, timeFromStart, &KEmptyStr); + line.Format(_L("[SQL]¬%X¬%ld¬SQL¬%S¬"), aDbHandle, timeFromStart, &KEmptyStr); } } TInt l = Min(len, (line.MaxLength() - line.Length())); @@ -904,7 +904,7 @@ return; } TInt64 timeFromStart = SqlTimeFromStartUs(); - TheSqlSrvProfileTraceBuf.Format(_L("% 08X¬%012ld¬CRE¬%S"), + TheSqlSrvProfileTraceBuf.Format(_L("[SQL]¬%X¬%ld¬CRE¬%S"), aDbHandle, timeFromStart, &aDbName); @@ -926,7 +926,7 @@ return; } TInt64 timeFromStart = SqlTimeFromStartUs(); - TheSqlSrvProfileTraceBuf.Format(_L("% 8X¬%012ld¬OPN¬%S"), + TheSqlSrvProfileTraceBuf.Format(_L("[SQL]¬%X¬%ld¬OPN¬%S"), aDbHandle, timeFromStart, &aDbName); @@ -944,7 +944,7 @@ return; } TInt64 timeFromStart = SqlTimeFromStartUs(); - TheSqlSrvProfileTraceBuf.Format(_L("% 8X¬%012ld¬CSE"), + TheSqlSrvProfileTraceBuf.Format(_L("[SQL]¬%X¬%ld¬CSE"), aDbHandle, timeFromStart); SqlSrvProfilePrintf(ESqlSrvProfilerNonSqlTrace); @@ -986,7 +986,7 @@ RDebug::Print(_L("SQL trace file creation failed with err=%d"), err); } } - TheSqlSrvProfileTraceBuf.Format(_L("% 8X¬%012ld¬SRV¬START"), 0, timeFromStart); + TheSqlSrvProfileTraceBuf.Format(_L("[SQL]¬%X¬%ld¬SRV¬START"), 0, timeFromStart); SqlSrvProfilePrintf(ESqlSrvProfilerNonSqlTrace); } @@ -994,7 +994,7 @@ void SqlPrintServerStop() { TInt64 timeFromStart = SqlTimeFromStartUs(); - TheSqlSrvProfileTraceBuf.Format(_L("% 8X¬%012ld¬SRV¬STOP"), 0, timeFromStart); + TheSqlSrvProfileTraceBuf.Format(_L("[SQL]¬%X¬%ld¬SRV¬STOP"), 0, timeFromStart); SqlSrvProfilePrintf(ESqlSrvProfilerNonSqlTrace); if(TheSqlSrvProfilerTraceToFile) { diff -r 6b6fd149daa2 -r 04ec7606545c persistentstorage/sql/TEST/t_sqlload.cpp --- a/persistentstorage/sql/TEST/t_sqlload.cpp Tue Apr 27 18:25:57 2010 +0300 +++ b/persistentstorage/sql/TEST/t_sqlload.cpp Tue May 11 17:49:39 2010 +0300 @@ -69,6 +69,14 @@ RSqlDatabase::Delete(KTestDbName1); } +void GetHomeTimeAsString(TDes& aStr) + { + TTime time; + time.HomeTime(); + TDateTime dt = time.DateTime(); + aStr.Format(_L("%02d:%02d:%02d.%06d"), dt.Hour(), dt.Minute(), dt.Second(), dt.MicroSecond()); + } + /////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////// //Test macros and functions @@ -115,6 +123,31 @@ /////////////////////////////////////////////////////////////////////////////////////// +//StatementMaxNumberTest() timeouts in WDP builds. +//This function is used to check whether the time limit is reaqched or not. +TBool IsTimeLimitReached() + { + struct TStartTime + { + TStartTime() + { + iTime.HomeTime(); + } + TTime iTime; + }; + + static TStartTime startTime; + const TInt KTestTimeLimit = 500;//seconds + + TTime currTime; + currTime.HomeTime(); + + TTimeIntervalSeconds s; + TInt err = currTime.SecondsFrom(startTime.iTime, s); + TEST2(err, KErrNone); + return s.Int() > KTestTimeLimit; + } + void CreateTestDir() { RFs fs; @@ -540,43 +573,67 @@ creates as many as possible SQL statements. The expected result is that either the statement creation process will fail with KErrNoMemory or the max number of statements to be created is reached (100000). - Then the test deletes 1/2 of the created statements object and + 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 + with WDP feature switched on the test may timeout. @SYMTestExpectedResults Test must not fail @SYMDEF DEF145236 */ void StatementMaxNumberTest() { + TBuf<30> time; + GetHomeTimeAsString(time); + TheTest.Printf(_L("=== %S: Create database\r\n"), &time); + (void)RSqlDatabase::Delete(KTestDbName1); RSqlDatabase db; TInt err = db.Create(KTestDbName1); TEST2(err, KErrNone); err = db.Exec(_L("CREATE TABLE A(I INTEGER); INSERT INTO A(I) VALUES(1); INSERT INTO A(I) VALUES(2);")); TEST(err >= 0); + + GetHomeTimeAsString(time); + TheTest.Printf(_L("=== %S: Create statements array\r\n"), &time); //Reserve memory for the statement objects const TInt KMaxStmtCount = 100000; RSqlStatement* stmt = new RSqlStatement[KMaxStmtCount]; TEST(stmt != NULL); TInt stmtCnt = 0; - + //Create as many statement objects as possible err = KErrNone; for(TInt i=0;(i=0 AND I<10")); + if((i % 100) == 0) + { + GetHomeTimeAsString(time); + TheTest.Printf(_L("=== %S: Create % 5d statements\r\n"), &time, i + 1); + if(IsTimeLimitReached()) + { + TheTest.Printf(_L("=== %S: The time limit reached.\r\n"), &time); + break; + } + } } TheTest.Printf(_L("%d created statement objects. Last error: %d.\r\n"), stmtCnt, err); TEST(err == KErrNone || err == KErrNoMemory); //Close 1/2 of the statements to free some memory - for(TInt i=stmtCnt-1;i>=0;i-=2) + for(TInt i=stmtCnt-1,j=0;i>=0;i-=2,++j) { stmt[i].Close(); + if((j % 100) == 0) + { + GetHomeTimeAsString(time); + TheTest.Printf(_L("=== %S: % 5d statements closed\r\n"), &time, j + 1); + } } //Now, there should be enough memory to be able to execute Next() on the rest of the statements - for(TInt i=stmtCnt-2;i>=0;i-=2) + for(TInt i=stmtCnt-2,j=0;i>=0;i-=2,++j) { err = stmt[i].Next(); TEST2(err, KSqlAtRow); @@ -584,12 +641,27 @@ TEST2(err, KSqlAtRow); err = stmt[i].Next(); TEST2(err, KSqlAtEnd); + if((j % 100) == 0) + { + GetHomeTimeAsString(time); + TheTest.Printf(_L("=== %S: % 5d statements processed\r\n"), &time, j + 1); + } + if(IsTimeLimitReached()) + { + TheTest.Printf(_L("=== %S: The time limit reached.\r\n"), &time); + break; + } } - + //Cleanup - for(TInt i=stmtCnt-1;i>=0;--i) + for(TInt i=stmtCnt-1,j=0;i>=0;--i,++j) { stmt[i].Close(); + if((j % 100) == 0) + { + GetHomeTimeAsString(time); + TheTest.Printf(_L("=== %S: % 5d statements closed\r\n"), &time, j + 1); + } } delete [] stmt; db.Close(); diff -r 6b6fd149daa2 -r 04ec7606545c persistentstorage/sql/TEST/t_sqlsecurity6.cpp --- a/persistentstorage/sql/TEST/t_sqlsecurity6.cpp Tue Apr 27 18:25:57 2010 +0300 +++ b/persistentstorage/sql/TEST/t_sqlsecurity6.cpp Tue May 11 17:49:39 2010 +0300 @@ -98,7 +98,7 @@ void DoTestsL() { - TheTest.Start(_L("@SYMTestCaseID:PDS-SQL-CT-4199")); + TheTest.Start(_L("@SYMTestCaseID:PDS-SQL-CT-4199 Invalid secure UIDs test")); InvalidSecureUidsTest(); }