persistentstorage/sql/TEST/t_sqlfilesrvcrash1.cpp
changeset 55 44f437012c90
parent 51 7d4490026038
equal deleted inserted replaced
51:7d4490026038 55:44f437012c90
    57 void Check(TInt aValue, TInt aLine)
    57 void Check(TInt aValue, TInt aLine)
    58     {
    58     {
    59     if(!aValue)
    59     if(!aValue)
    60         {
    60         {
    61         DeleteTestFiles();
    61         DeleteTestFiles();
    62         RDebug::Print(_L("*** Line %d\r\n"), aLine);
    62         TheTest.Printf(_L("*** Line %d. Expression evaluated to false\r\n"), aLine);
    63         TheTest(EFalse, aLine);
    63         TheTest(EFalse, aLine);
    64         }
    64         }
    65     }
    65     }
    66 void Check(TInt aValue, TInt aExpected, TInt aLine)
    66 void Check(TInt aValue, TInt aExpected, TInt aLine)
    67     {
    67     {
    68     if(aValue != aExpected)
    68     if(aValue != aExpected)
    69         {
    69         {
    70         DeleteTestFiles();
    70         DeleteTestFiles();
    71         RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
    71         TheTest.Printf(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
    72         TheTest(EFalse, aLine);
    72         TheTest(EFalse, aLine);
    73         }
    73         }
    74     }
    74     }
    75 
    75 
    76 #define TEST(arg) ::Check((arg), __LINE__)
    76 #define TEST(arg) ::Check((arg), __LINE__)
   122     }
   122     }
   123 
   123 
   124 TInt KillProcess(const TDesC& aProcessName)
   124 TInt KillProcess(const TDesC& aProcessName)
   125     {
   125     {
   126     TFullName name;
   126     TFullName name;
   127     //RDebug::Print(_L("Find and kill \"%S\" process.\n"), &aProcessName);
       
   128     TBuf<64> pattern(aProcessName);
   127     TBuf<64> pattern(aProcessName);
   129     TInt length = pattern.Length();
   128     TInt length = pattern.Length();
   130     pattern += _L("*");
   129     pattern += _L("*");
   131     TFindProcess procFinder(pattern);
   130     TFindProcess procFinder(pattern);
   132 
   131 
   137             TChar c(name[length]);
   136             TChar c(name[length]);
   138             if (c.IsAlphaDigit() ||
   137             if (c.IsAlphaDigit() ||
   139                 c == TChar('_') ||
   138                 c == TChar('_') ||
   140                 c == TChar('-'))
   139                 c == TChar('-'))
   141                 {
   140                 {
   142                 //RDebug::Print(_L(":: Process name: \"%S\".\n"), &name);
       
   143                 continue;
   141                 continue;
   144                 }
   142                 }
   145             }
   143             }
   146         RProcess proc;
   144         RProcess proc;
   147         if (proc.Open(name) == KErrNone)
   145         if (proc.Open(name) == KErrNone)
   148             {
   146             {
   149             RDebug::Print(_L("About to kill process \"%S\", This will force a reboot\n"), &name);
       
   150             proc.Kill(0);
   147             proc.Kill(0);
   151             
       
   152             }
   148             }
   153         proc.Close();
   149         proc.Close();
   154         }
   150         }
   155     return KErrNone;
   151     return KErrNone;
   156     }
   152     }