persistentstorage/sqlite3api/TEST/t_sqliteperf.cpp
changeset 55 44f437012c90
parent 40 b8bdbc8f59c7
equal deleted inserted replaced
51:7d4490026038 55:44f437012c90
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    83 static void Check(TInt aValue, TInt aLine)
    83 static void Check(TInt aValue, TInt aLine)
    84 	{
    84 	{
    85 	if(!aValue)
    85 	if(!aValue)
    86 		{
    86 		{
    87 		DeleteTestFiles();
    87 		DeleteTestFiles();
       
    88 		Print("*** Expression evaluated to false\r\n");
    88 		TestTestLine(EFalse, aLine);
    89 		TestTestLine(EFalse, aLine);
    89 		}
    90 		}
    90 	}
    91 	}
    91 static void Check(TInt aValue, TInt aExpected, TInt aLine)
    92 static void Check(TInt aValue, TInt aExpected, TInt aLine)
    92 	{
    93 	{
    93 	if(aValue != aExpected)
    94 	if(aValue != aExpected)
    94 		{
    95 		{
    95 		DeleteTestFiles();
    96 		DeleteTestFiles();
    96 		RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
    97 		PrintIII("*** Expected error: %d, got: %d. Ignore: %d\r\n", aExpected, aValue, 0);
    97 		TestTestLine(EFalse, aLine);
    98 		TestTestLine(EFalse, aLine);
    98 		}
    99 		}
    99 	}
   100 	}
   100 #define TEST(arg) ::Check((arg), __LINE__)
   101 #define TEST(arg) ::Check((arg), __LINE__)
   101 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
   102 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
   103 ///////////////////////////////////////////////////////////////////////////////////////
   104 ///////////////////////////////////////////////////////////////////////////////////////
   104 
   105 
   105 static TInt KillProcess(const TDesC& aProcessName)
   106 static TInt KillProcess(const TDesC& aProcessName)
   106 	{
   107 	{
   107 	TFullName name;
   108 	TFullName name;
   108 	//RDebug::Print(_L("Find and kill \"%S\" process.\n"), &aProcessName);
       
   109 	TBuf<64> pattern(aProcessName);
   109 	TBuf<64> pattern(aProcessName);
   110 	TInt length = pattern.Length();
   110 	TInt length = pattern.Length();
   111 	pattern += _L("*");
   111 	pattern += _L("*");
   112 	TFindProcess procFinder(pattern);
   112 	TFindProcess procFinder(pattern);
   113 
   113 
   120 				c == TChar('_') ||
   120 				c == TChar('_') ||
   121 				c == TChar('-'))
   121 				c == TChar('-'))
   122 				{
   122 				{
   123 				// If the found name is other valid application name
   123 				// If the found name is other valid application name
   124 				// starting with aProcessName string.
   124 				// starting with aProcessName string.
   125 				//RDebug::Print(_L(":: Process name: \"%S\".\n"), &name);
       
   126 				continue;
   125 				continue;
   127 				}
   126 				}
   128 			}
   127 			}
   129 		RProcess proc;
   128 		RProcess proc;
   130 		if (proc.Open(name) == KErrNone)
   129 		if (proc.Open(name) == KErrNone)
   131 			{
   130 			{
   132 			proc.Kill(0);
   131 			proc.Kill(0);
   133 			//RDebug::Print(_L("\"%S\" process killed.\n"), &name);
       
   134 			}
   132 			}
   135 		proc.Close();
   133 		proc.Close();
   136 		}
   134 		}
   137 	return KErrNone;
   135 	return KErrNone;
   138 	}
   136 	}