persistentstorage/dbms/tdbms/t_dbsrv.cpp
branchRCL_3
changeset 23 26645d81f48d
parent 0 08ec8eefde2f
child 24 cc28652e0254
--- a/persistentstorage/dbms/tdbms/t_dbsrv.cpp	Thu Aug 19 11:36:21 2010 +0300
+++ b/persistentstorage/dbms/tdbms/t_dbsrv.cpp	Tue Aug 31 16:57:14 2010 +0300
@@ -1257,6 +1257,39 @@
 	test(r==KErrNone);
 	}
 
+LOCAL_C void  KillDbmsServer()
+    {
+    _LIT(KDbmsServer,"edbsrv.exe");
+     TFullName name;
+    TBuf<64> pattern(KDbmsServer);
+    TInt length = pattern.Length();
+    pattern += _L("*");
+    TFindProcess procFinder(pattern);
+
+    while (procFinder.Next(name) == KErrNone)
+        {
+        if (name.Length() > length)
+            {//If found name is a string containing aProcessName string.
+            TChar c(name[length]);
+            if (c.IsAlphaDigit() ||
+                c == TChar('_') ||
+                c == TChar('-'))
+                {
+                // If the found name is other valid application name
+                // starting with aProcessName string.
+                //RDebug::Print(_L(":: Process name: \"%S\".\n"), &name);
+                continue;
+                }
+            }
+        RProcess proc;
+        if (proc.Open(name) == KErrNone)
+            {
+            proc.Kill(0);
+            //RDebug::Print(_L("\"%S\" process killed.\n"), &name);
+            }
+        proc.Close();
+        }
+    }
 void DoTests()
 	{
 	TVersionName n=RDbs::Version().Name();
@@ -1322,6 +1355,7 @@
 	setupTestDirectory();
 	DeleteTestFiles();
 	setupCleanup();
+	KillDbmsServer();
 	DoTests();
 	delete TheTrapCleanup;
 	DeleteTestFiles();