Changeset 60170 in vbox
- Timestamp:
- Mar 23, 2016 2:30:00 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/testcase/tstVBoxMultipleVM.cpp
r60169 r60170 49 49 static volatile bool g_RunTest = true; 50 50 static RTSEMEVENT g_PingEevent; 51 static volatile uint64_t 51 static volatile uint64_t g_Counter = 0; 52 52 static RTTEST g_hTest; 53 static Bstr tstMachineName = "tstVBoxMultipleVM test multiple VM start/stop";54 53 55 54 /* Arguments of test thread */ … … 86 85 87 86 88 static int tstStartVM(IVirtualBox * pVBox, ISession* pSession, Bstr machineID, BOOL skipUnlok)87 static int tstStartVM(IVirtualBox *pVBox, ISession *pSession, Bstr machineID, bool fSkipUnlock) 89 88 { 90 89 HRESULT rc; … … 98 97 if(SUCCEEDED(rc)) 99 98 rc = machine->LaunchVMProcess(pSession, Bstr("headless").raw(), 100 Bstr("").raw(), progress.asOutParam());99 Bstr("").raw(), progress.asOutParam()); 101 100 if (SUCCEEDED(rc) && !progress.isNull()) 102 101 { … … 119 118 } 120 119 else 121 {122 120 RTPrintf("VM '%ls' started.\n", machineName.raw()); 123 }124 121 } 125 122 } 126 123 } 127 if (!skipUnlok) 128 { 124 if (!fSkipUnlock) 129 125 pSession->UnlockMachine(); 130 }131 126 else 132 {133 127 RTPrintf("Session unlock skipped.\n"); 134 } 135 } 136 return rc; 137 } 138 139 140 static int tstStopVM(IVirtualBox* pVBox, ISession* pSession, Bstr machineID, BOOL skipUnlok) 128 } 129 return rc; 130 } 131 132 133 static int tstStopVM(IVirtualBox* pVBox, ISession* pSession, Bstr machineID, bool fSkipUnlock) 141 134 { 142 135 HRESULT rc; … … 151 144 rc = TST_COM_EXPR(machine->COMGETTER(State)(&machineState)); 152 145 // check that machine is in running state 153 if ( machineState == MachineState_Running146 if ( machineState == MachineState_Running 154 147 || machineState == MachineState_Paused) 155 148 { … … 190 183 } 191 184 } 192 if (!skipUnlok) 193 { 185 if (!fSkipUnlock) 194 186 pSession->UnlockMachine(); 195 }196 187 else 197 {198 188 RTPrintf("Session unlock skipped.\n"); 199 }200 189 } 201 190 } … … 205 194 206 195 /** 207 * Get random maxCount machines from list of existing VMs 208 * Note: can return less then maxCount machines 209 */ 210 static int tstGetMachinesList(IVirtualBox *pVBox, uint32_t maxCount, TMachinesList& listToFill) 196 * Get random @a maxCount machines from list of existing VMs. 197 * 198 * @note Can return less then maxCount machines. 199 */ 200 static int tstGetMachinesList(IVirtualBox *pVBox, uint32_t maxCount, TMachinesList &listToFill) 211 201 { 212 202 HRESULT rc; … … 223 213 if (machines[idx]) 224 214 { 225 Bstr strId;215 Bstr bstrId; 226 216 Bstr machineName; 227 CHECK_ERROR(machines[idx], COMGETTER(Id)( strId.asOutParam()));217 CHECK_ERROR(machines[idx], COMGETTER(Id)(bstrId.asOutParam())); 228 218 if (SUCCEEDED(rc)) 229 219 CHECK_ERROR(machines[idx], COMGETTER(Name)(machineName.asOutParam())); … … 231 221 { 232 222 if (Utf8Str(machineName).startsWith("umtvm")) 233 listToFill.push_back( strId);223 listToFill.push_back(bstrId); 234 224 } 235 225 } … … 279 269 // stop all machines in the pack 280 270 for (TMachinesList::iterator it = machinesList.begin(); 281 271 it != machinesList.end() && g_RunTest; 282 272 ++it) 283 273 { … … 304 294 305 295 306 static int tstCreateMachines(IVirtualBox *pVBox)296 static int tstCreateMachines(IVirtualBox *pVBox) 307 297 { 308 298 HRESULT rc; … … 334 324 335 325 336 static int tstClean(IVirtualBox * pVBox, IVirtualBoxClient*pClient)326 static int tstClean(IVirtualBox *pVBox, IVirtualBoxClient *pClient) 337 327 { 338 328 HRESULT rc; … … 494 484 * Examples: 495 485 * - tstVBoxClientWatcherLoad --packsize 500 --lock 10 --time 14400 --machines 4000 496 * It will create 4000 VMs with names "utmvm0"..."utmvm3999" 497 * It will start 500 random VMs together, stop them, 498 * without closing their session with probability 10%, 499 * will repeat this during 4 hours. 500 * After test it will delete all "utmvm..." machines. 486 * It will create 4000 VMs with names "utmvm0"..."utmvm3999". It will start 487 * 500 random VMs together, stop them, without closing their session with 488 * probability 10%, will repeat this over 4 hours. After test it will 489 * delete all "utmvm..." machines. 501 490 * 502 491 * - tstVBoxClientWatcherLoad --packsize 1 --lock 30 --time 3600 --machines 1000 503 * It will create 1000 VMs with names "utmvm0"..."utmvm999" 504 * It will start random VM - stop them, 505 * without closing their session with probability 30%, 506 * will repeat this during 30 minutes. 507 * After test it will delete all "utmvm..." machines. 492 * It will create 1000 VMs with names "utmvm0"..."utmvm999". It will start 493 * random VM - stop them, without closing their session with probability 494 * 30%, will repeat this over 30 minutes. After test it will delete all 495 * "utmvm..." machines. 508 496 */ 509 497 int main(int argc, char **argv) … … 530 518 RTPrintf("Arguments packSize = %d, percentUnlok = %d, time = %lld.\n", 531 519 g_Args.machinesPackSize, g_Args.percentsUnlok, g_Args.cMsExecutionTime); 532 520 533 521 RTTHREAD hThread; 534 522 rc = RTThreadCreate(&hThread, tstThreadRun, (void *)&g_Args, … … 565 553 } 566 554 RTSemEventDestroy(g_PingEevent); 567 555 568 556 com::Shutdown(); 569 557 if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.