persistentstorage/dbms/tdbms/t_dbbug.cpp
branchRCL_3
changeset 23 26645d81f48d
parent 0 08ec8eefde2f
child 24 cc28652e0254
equal deleted inserted replaced
21:28839de615b4 23:26645d81f48d
   343 public:
   343 public:
   344 	static void TestL();
   344 	static void TestL();
   345 	static const TDesC& Name();
   345 	static const TDesC& Name();
   346 private:
   346 private:
   347 	static void WaitForServerExit();
   347 	static void WaitForServerExit();
       
   348 	static void KillDbmsServer();
   348 	static TInt Thread(TAny*);
   349 	static TInt Thread(TAny*);
   349 	};
   350 	};
   350 
   351 
   351 const TDesC& Defect_COMBBAR_463J5D::Name()
   352 const TDesC& Defect_COMBBAR_463J5D::Name()
   352 	{
   353 	{
   353 	_LIT(KName,"COMBBAR_463J5D");
   354 	_LIT(KName,"COMBBAR_463J5D");
   354 	return KName;
   355 	return KName;
   355 	}
   356 	}
       
   357 
       
   358 void Defect_COMBBAR_463J5D::KillDbmsServer()
       
   359     {
       
   360     _LIT(KDbmsServer,"edbsrv.exe");
       
   361      TFullName name;
       
   362     //RDebug::Print(_L("Find and kill \"%S\" process.\n"), &aProcessName);
       
   363     TBuf<64> pattern(KDbmsServer);
       
   364     TInt length = pattern.Length();
       
   365     pattern += _L("*");
       
   366     TFindProcess procFinder(pattern);
       
   367 
       
   368     while (procFinder.Next(name) == KErrNone)
       
   369         {
       
   370         if (name.Length() > length)
       
   371             {//If found name is a string containing aProcessName string.
       
   372             TChar c(name[length]);
       
   373             if (c.IsAlphaDigit() ||
       
   374                 c == TChar('_') ||
       
   375                 c == TChar('-'))
       
   376                 {
       
   377                 // If the found name is other valid application name
       
   378                 // starting with aProcessName string.
       
   379                 //RDebug::Print(_L(":: Process name: \"%S\".\n"), &name);
       
   380                 continue;
       
   381                 }
       
   382             }
       
   383         RProcess proc;
       
   384         if (proc.Open(name) == KErrNone)
       
   385             {
       
   386             proc.Kill(0);
       
   387             //RDebug::Print(_L("\"%S\" process killed.\n"), &name);
       
   388             }
       
   389         proc.Close();
       
   390         }
       
   391     }
   356 
   392 
   357 void Defect_COMBBAR_463J5D::WaitForServerExit()
   393 void Defect_COMBBAR_463J5D::WaitForServerExit()
   358 	{
   394 	{
   359 	_LIT(KDbmsServer,"*!DBMS server");
   395 	_LIT(KDbmsServer,"*!DBMS server");
   360 	TFullName n;
   396 	TFullName n;
   390 @SYMREQ                 REQ0000
   426 @SYMREQ                 REQ0000
   391 */
   427 */
   392 void Defect_COMBBAR_463J5D::TestL()
   428 void Defect_COMBBAR_463J5D::TestL()
   393 	{
   429 	{
   394 	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0584 "));
   430 	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0584 "));
   395 	Print(_S("Wait for the server to exit"));
   431 	Print(_S("Kill the server if it has started"));
   396 	WaitForServerExit();
   432 	KillDbmsServer();
   397 //
   433 //
   398 	Print(_S("Create the launching threads"));
   434 	Print(_S("Create the launching threads"));
   399 	RThread t1,t2;
   435 	RThread t1,t2;
   400 	TRequestStatus s1,s2;
   436 	TRequestStatus s1,s2;
   401 	_LIT(KThread1,"t1");
   437 	_LIT(KThread1,"t1");