本文整理汇总了C++中TestObject::getTestID方法的典型用法代码示例。如果您正苦于以下问题:C++ TestObject::getTestID方法的具体用法?C++ TestObject::getTestID怎么用?C++ TestObject::getTestID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestObject
的用法示例。
在下文中一共展示了TestObject::getTestID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processCMDCLEAN_REQUEST
void AgentThread::processCMDCLEAN_REQUEST(int socketHandle)
{
try {
ConsoleServer::debugMsg(1,"Processing CMDCLEAN_REQUEST\n");
// read the serialized TestObject which we will stop
TestObject test;
test.readTestObject(socketHandle);
// now send a signal indicating we are processing the request
Utils::sendSignal(socketHandle,RESPONSE_PROCESSING);
//clean the files now
for (int i = 0; i < getProcessCount(); i++) {
// check for any instance of test running with the same id
TestObject *curr = getProcess(i)->getTestObject();
if (curr->getTestID().compare(test.getTestID())==0) {
// clean up the trace files
ConsoleServer::debugMsg(1,
"Cleaning environment file :%s\n",
curr->getEnvFileName().c_str());
if (Utils::delete_file(curr->getEnvFileName())!=0)
ConsoleServer::debugMsg(1,"No environment file was found :%s\n",
curr->getEnvFileName().c_str());
ConsoleServer::debugMsg(1,"Cleaning stdout file :%s\n",
curr->getStdOutFileName().c_str());
if (Utils::delete_file(curr->getStdOutFileName())!=0)
ConsoleServer::debugMsg(1,"No stdout file was found :%s\n",
curr->getStdOutFileName().c_str());
ConsoleServer::debugMsg(1,"Cleaning stderr file :%s\n",
curr->getStdErrFileName().c_str());
if (Utils::delete_file(curr->getStdErrFileName())!=0)
ConsoleServer::debugMsg(1,"No stderr file was found :%s\n",
curr->getStdErrFileName().c_str());
// remove from our list of test objects
ConsoleServer::debugMsg(1,"Removing process from process pool\n");
delProcess(i);
break;
}
}
// now send a signal indicating we have finished
Utils::sendSignal(socketHandle,RESPONSE_FINISHED_OK);
}
catch (char * message) {
ConsoleServer::debugMsg(1,"Error processing CMDCLEAN_REQUEST request:%s\n",message);
Utils::sendSignal(socketHandle,RESPONSE_FINISHED_ERROR);
}
};
示例2: processCMDSTOP_REQUEST
void AgentThread::processCMDSTOP_REQUEST(int socketHandle)
{
try {
ConsoleServer::debugMsg(1,"Processing CMDSTOP_REQUEST\n");
// read the serialized TestObject which we will stop
TestObject test;
test.readTestObject(socketHandle);
// now send a signal indicating we are processing the request
Utils::sendSignal(socketHandle,RESPONSE_PROCESSING);
// find the exit code, blocking for requested timeout if neccesary
int wasRunning = FALSE;
int status;
for (int i = 0; i < getProcessCount(); i++) {
// check for any instance of test running with the same id
TestObject *curr = getProcess(i)->getTestObject();
if (curr==NULL) {
printf("Error: Null process found on process list");
return;
}
if (curr->getTestID().compare(test.getTestID())==0) {
ConsoleServer::debugMsg(5,"Stopping process\n");
wasRunning = TRUE;
status = getProcess(i)->checkExitValue();
// flush and close it's output streams
getProcess(i)->interrupt();
Utils::sendSignal(socketHandle,status);
break;
}
}
if (!wasRunning) {
// the process was never started, so assume it failed
ConsoleServer::debugMsg(1,"Process was not running :%s\n",test.getTestID().c_str());
}
else {
// now send a signal indicating we have finished
Utils::sendSignal(socketHandle,RESPONSE_FINISHED_OK);
}
}
catch (char * message) {
ConsoleServer::debugMsg(1,"Error processing CMDSTOP_REQUEST request:%s\n",message);
Utils::sendSignal(socketHandle,RESPONSE_FINISHED_ERROR);
}
};
示例3: processGETTRACEPATHS_REQUEST
void AgentThread::processGETTRACEPATHS_REQUEST(int socketHandle)
{
try {
ConsoleServer::debugMsg(1,"Processing GETTRACEPATHS_REQUEST\n");
// read the serialized TestObject which we want the exit code of
TestObject test;
test.readTestObject(socketHandle);
// now send a signal indicating we are processing the request
Utils::sendSignal(socketHandle,RESPONSE_PROCESSING);
int wasRun = FALSE;
for (int i = 0; i < getProcessCount(); i++) {
// check for any instance of test running with the same id
TestObject *curr = getProcess(i)->getTestObject();
if (curr->getTestID().compare(test.getTestID())==0) {
wasRun = true;
Utils::sendSignal(socketHandle,RESPONSE_FINISHED_OK);
ConsoleServer::debugMsg(9,"Sending trace file paths\n");
ConsoleServer::debugMsg(9,"Env file :%s\n",curr->getEnvFileName().c_str());
ConsoleServer::debugMsg(9,"StdOut file :%s\n",curr->getStdOutFileName().c_str());
ConsoleServer::debugMsg(9,"StdErr file :%s\n",curr->getStdErrFileName().c_str());
// ---- send the env, stdout and stderr files --------------------
Utils::writeString(socketHandle,curr->getEnvFileName());
Utils::writeString(socketHandle,curr->getStdOutFileName());
Utils::writeString(socketHandle,curr->getStdErrFileName());
// ----------------------------------
break;
}
}
if (!wasRun) {
// the process was never started, so assume it failed
ConsoleServer::debugMsg(1,"Process was never started :%s\n",test.getTestID().c_str());
Utils::writeInt(socketHandle,RESPONSE_FINISHED_ERROR);
}
else {
// now send a signal indicating we have finished
Utils::sendSignal(socketHandle,RESPONSE_FINISHED_OK);
}
}
catch (char *message) {
ConsoleServer::debugMsg(1,"Error processing GETTRACEPATHS_REQUEST request:%s\n",message);
Utils::sendSignal(socketHandle,RESPONSE_FINISHED_ERROR);
}
}
示例4: processCMDSTATUS_REQUEST
void AgentThread::processCMDSTATUS_REQUEST(int socketHandle)
{
TestObject test;
try {
ConsoleServer::debugMsg(1,"Processing CMDSTATUS_REQUEST\n");
// read the serialized TestObject which we will stop
test.readTestObject(socketHandle);
// now send a signal indicating we are processing the request
Utils::sendSignal(socketHandle,RESPONSE_PROCESSING);
// find the exit code, blocking if neccesary
int wasRunning = FALSE;
for (int i = 0; i < getProcessCount(); i++) {
// check for any instance of test running with the same id
TestObject *curr = getProcess(i)->getTestObject();
if (curr->getTestID().compare(test.getTestID())==0) {
ConsoleServer::debugMsg(8,"Found started process :%s\n",test.getTestID().c_str());
int status = getProcess(i)->getExitValue();
ConsoleServer::debugMsg(5,"Returning CMDSTATUS value :%d\n",status);
Utils::writeInt(socketHandle,status);
wasRunning = TRUE;
break;
}
}
if (!wasRunning) {
// the process was never started, so assume it failed
ConsoleServer::debugMsg(1,"Process was never started :%s\n",test.getTestID().c_str());
Utils::writeInt(socketHandle,FAILED);
}
else {
// now send a signal indicating we have finished
Utils::sendSignal(socketHandle,RESPONSE_FINISHED_OK);
}
}
catch (char * message) {
ConsoleServer::debugMsg(1,"Error processing CMDSTATUS_REQUEST request:%s\n",message);
Utils::sendSignal(socketHandle,RESPONSE_FINISHED_ERROR);
}
}