persistentstorage/dbms/tdbms/t_dbsrv.cpp
branchRCL_3
changeset 24 cc28652e0254
parent 23 26645d81f48d
equal deleted inserted replaced
23:26645d81f48d 24:cc28652e0254
  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     }
       
  1293 void DoTests()
  1260 void DoTests()
  1294 	{
  1261 	{
  1295 	TVersionName n=RDbs::Version().Name();
  1262 	TVersionName n=RDbs::Version().Name();
  1296 	test.Printf(_L("DBMS server v%S\n"),&n);
  1263 	test.Printf(_L("DBMS server v%S\n"),&n);
  1297 	TInt r;
  1264 	TInt r;
  1353 	
  1320 	
  1354 	test.Title();
  1321 	test.Title();
  1355 	setupTestDirectory();
  1322 	setupTestDirectory();
  1356 	DeleteTestFiles();
  1323 	DeleteTestFiles();
  1357 	setupCleanup();
  1324 	setupCleanup();
  1358 	KillDbmsServer();
       
  1359 	DoTests();
  1325 	DoTests();
  1360 	delete TheTrapCleanup;
  1326 	delete TheTrapCleanup;
  1361 	DeleteTestFiles();
  1327 	DeleteTestFiles();
  1362 	
  1328 	
  1363 	test.End();
  1329 	test.End();