persistentstorage/sql/TEST/t_sqlconfigfile.cpp
changeset 55 44f437012c90
parent 29 cce6680bbf1c
equal deleted inserted replaced
51:7d4490026038 55:44f437012c90
    49 // Destroy functions
    49 // Destroy functions
    50 
    50 
    51 TInt KillProcess(const TDesC& aProcessName)
    51 TInt KillProcess(const TDesC& aProcessName)
    52 	{
    52 	{
    53 	TFullName name;
    53 	TFullName name;
    54 	//RDebug::Print(_L("Find and kill \"%S\" process.\n"), &aProcessName);
       
    55 	TBuf<64> pattern(aProcessName);
    54 	TBuf<64> pattern(aProcessName);
    56 	TInt length = pattern.Length();
    55 	TInt length = pattern.Length();
    57 	pattern += _L("*");
    56 	pattern += _L("*");
    58 	TFindProcess procFinder(pattern);
    57 	TFindProcess procFinder(pattern);
    59 
    58 
    66 				c == TChar('_') ||
    65 				c == TChar('_') ||
    67 				c == TChar('-'))
    66 				c == TChar('-'))
    68 				{
    67 				{
    69 				// If the found name is other valid application name
    68 				// If the found name is other valid application name
    70 				// starting with aProcessName string.
    69 				// starting with aProcessName string.
    71 				//RDebug::Print(_L(":: Process name: \"%S\".\n"), &name);
       
    72 				continue;
    70 				continue;
    73 				}
    71 				}
    74 			}
    72 			}
    75 		RProcess proc;
    73 		RProcess proc;
    76 		if (proc.Open(name) == KErrNone)
    74 		if (proc.Open(name) == KErrNone)
    77 			{
    75 			{
    78 			proc.Kill(0);
    76 			proc.Kill(0);
    79 			//RDebug::Print(_L("\"%S\" process killed.\n"), &name);
       
    80 			}
    77 			}
    81 		proc.Close();
    78 		proc.Close();
    82 		}
    79 		}
    83 	return KErrNone;
    80 	return KErrNone;
    84 	}
    81 	}
    98 void Check(TInt aValue, TInt aLine)
    95 void Check(TInt aValue, TInt aLine)
    99 	{
    96 	{
   100 	if(!aValue)
    97 	if(!aValue)
   101 		{
    98 		{
   102 		DestroyTestEnv();
    99 		DestroyTestEnv();
       
   100 		TheTest.Printf(_L("*** Expression evaluated to false\r\n"));
   103 		TheTest(EFalse, aLine);
   101 		TheTest(EFalse, aLine);
   104 		}
   102 		}
   105 	}
   103 	}
   106 void Check(TInt aValue, TInt aExpected, TInt aLine)
   104 void Check(TInt aValue, TInt aExpected, TInt aLine)
   107 	{
   105 	{
   108 	if(aValue != aExpected)
   106 	if(aValue != aExpected)
   109 		{
   107 		{
   110 		DestroyTestEnv();
   108 		DestroyTestEnv();
   111 		RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
   109 		TheTest.Printf(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
   112 		TheTest(EFalse, aLine);
   110 		TheTest(EFalse, aLine);
   113 		}
   111 		}
   114 	}
   112 	}
   115 #define TEST(arg) ::Check((arg), __LINE__)
   113 #define TEST(arg) ::Check((arg), __LINE__)
   116 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
   114 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)