persistentstorage/dbms/tdbms/t_dbsrv.cpp
branchRCL_3
changeset 23 26645d81f48d
parent 0 08ec8eefde2f
child 24 cc28652e0254
equal deleted inserted replaced
21:28839de615b4 23:26645d81f48d
  1255 		CleanupStack::Pop(KTestCleanupStack);\
  1255 		CleanupStack::Pop(KTestCleanupStack);\
  1256 		});
  1256 		});
  1257 	test(r==KErrNone);
  1257 	test(r==KErrNone);
  1258 	}
  1258 	}
  1259 
  1259 
       
  1260 LOCAL_C void  KillDbmsServer()
       
  1261     {
       
  1262     _LIT(KDbmsServer,"edbsrv.exe");
       
  1263      TFullName name;
       
  1264     TBuf<64> pattern(KDbmsServer);
       
  1265     TInt length = pattern.Length();
       
  1266     pattern += _L("*");
       
  1267     TFindProcess procFinder(pattern);
       
  1268 
       
  1269     while (procFinder.Next(name) == KErrNone)
       
  1270         {
       
  1271         if (name.Length() > length)
       
  1272             {//If found name is a string containing aProcessName string.
       
  1273             TChar c(name[length]);
       
  1274             if (c.IsAlphaDigit() ||
       
  1275                 c == TChar('_') ||
       
  1276                 c == TChar('-'))
       
  1277                 {
       
  1278                 // If the found name is other valid application name
       
  1279                 // starting with aProcessName string.
       
  1280                 //RDebug::Print(_L(":: Process name: \"%S\".\n"), &name);
       
  1281                 continue;
       
  1282                 }
       
  1283             }
       
  1284         RProcess proc;
       
  1285         if (proc.Open(name) == KErrNone)
       
  1286             {
       
  1287             proc.Kill(0);
       
  1288             //RDebug::Print(_L("\"%S\" process killed.\n"), &name);
       
  1289             }
       
  1290         proc.Close();
       
  1291         }
       
  1292     }
  1260 void DoTests()
  1293 void DoTests()
  1261 	{
  1294 	{
  1262 	TVersionName n=RDbs::Version().Name();
  1295 	TVersionName n=RDbs::Version().Name();
  1263 	test.Printf(_L("DBMS server v%S\n"),&n);
  1296 	test.Printf(_L("DBMS server v%S\n"),&n);
  1264 	TInt r;
  1297 	TInt r;
  1320 	
  1353 	
  1321 	test.Title();
  1354 	test.Title();
  1322 	setupTestDirectory();
  1355 	setupTestDirectory();
  1323 	DeleteTestFiles();
  1356 	DeleteTestFiles();
  1324 	setupCleanup();
  1357 	setupCleanup();
       
  1358 	KillDbmsServer();
  1325 	DoTests();
  1359 	DoTests();
  1326 	delete TheTrapCleanup;
  1360 	delete TheTrapCleanup;
  1327 	DeleteTestFiles();
  1361 	DeleteTestFiles();
  1328 	
  1362 	
  1329 	test.End();
  1363 	test.End();