version 1.5, 2007/08/10 21:30:29
|
version 1.6, 2008/02/22 19:23:48
|
|
|
char strTime[256]; | char strTime[256]; |
struct tm tmTime; | struct tm tmTime; |
int rc; | int rc; |
String fileName = String::EMPTY; |
String fileName; |
ofstream log_file; | ofstream log_file; |
| |
| |
|
|
cout<<StressTestControllerCommand::COMMAND_NAME\ | cout<<StressTestControllerCommand::COMMAND_NAME\ |
<<"::Failed to generate required files for tests. "<<endl; | <<"::Failed to generate required files for tests. "<<endl; |
command.removeUnusedFiles(); | command.removeUnusedFiles(); |
exit (Command::RC_ERROR); |
return Command::RC_ERROR; |
} | } |
| |
// | // |
|
|
log_file.close(); | log_file.close(); |
cout<<"Cannot get file "<<command.getStressTestLogFile()<<endl; | cout<<"Cannot get file "<<command.getStressTestLogFile()<<endl; |
command.removeUnusedFiles(); | command.removeUnusedFiles(); |
exit (Command::RC_ERROR); |
return Command::RC_ERROR; |
} | } |
strftime(strTime,256,"%d/%m/%Y at %H:%M:%S\n",&tmTime); | strftime(strTime,256,"%d/%m/%Y at %H:%M:%S\n",&tmTime); |
log_file<<StressTestControllerCommand::COMMAND_NAME\ | log_file<<StressTestControllerCommand::COMMAND_NAME\ |
|
|
| |
log_file.close(); | log_file.close(); |
command.removeUnusedFiles(); | command.removeUnusedFiles(); |
exit (Command::RC_ERROR); |
return Command::RC_ERROR; |
} | } |
catch (...) | catch (...) |
{ | { |
|
|
"::Unknown exception caught when setting commands."<<endl; | "::Unknown exception caught when setting commands."<<endl; |
log_file.close(); | log_file.close(); |
command.removeUnusedFiles(); | command.removeUnusedFiles(); |
exit (Command::RC_ERROR); |
return Command::RC_ERROR; |
} | } |
| |
// | // |
|
|
// Log file not required when help or verbose is opted. | // Log file not required when help or verbose is opted. |
// | // |
FileSystem::removeFile(command.getStressTestLogFile()); | FileSystem::removeFile(command.getStressTestLogFile()); |
exit (rc); |
return rc; |
} | } |
| |
String filename; | String filename; |
|
|
// | // |
// Check for file in default directory as well | // Check for file in default directory as well |
// | // |
fileName = String::EMPTY; |
fileName = StressTestControllerCommand::DEFAULT_CFGDIR; |
fileName.append(StressTestControllerCommand::DEFAULT_CFGDIR); |
|
fileName.append(filename); | fileName.append(filename); |
| |
if (!FileSystem::exists(fileName)) | if (!FileSystem::exists(fileName)) |
|
|
cerr << "\" does not exist."<<endl; | cerr << "\" does not exist."<<endl; |
log_file.close(); | log_file.close(); |
command.removeUnusedFiles(); | command.removeUnusedFiles(); |
exit (Command::RC_ERROR); |
return Command::RC_ERROR; |
} | } |
log_file<<StressTestControllerCommand::COMMAND_NAME<< | log_file<<StressTestControllerCommand::COMMAND_NAME<< |
"::Using config file: "<<fileName<<endl; | "::Using config file: "<<fileName<<endl; |
|
|
// | // |
// Use default file in default dir. | // Use default file in default dir. |
// | // |
fileName = String::EMPTY; |
fileName = StressTestControllerCommand::DEFAULT_CFGDIR; |
fileName.append(StressTestControllerCommand::DEFAULT_CFGDIR); |
|
fileName.append(StressTestControllerCommand::FILENAME); | fileName.append(StressTestControllerCommand::FILENAME); |
// | // |
// Use hard coded default configuration values if default conf. file | // Use hard coded default configuration values if default conf. file |
|
|
": " << msg << endl; | ": " << msg << endl; |
log_file.close(); | log_file.close(); |
command.removeUnusedFiles(); | command.removeUnusedFiles(); |
exit (Command::RC_ERROR); |
return Command::RC_ERROR; |
|
|
} | } |
catch (Exception& e ) | catch (Exception& e ) |
{ | { |
|
|
cerr << msg << endl; | cerr << msg << endl; |
log_file.close(); | log_file.close(); |
command.removeUnusedFiles(); | command.removeUnusedFiles(); |
exit (Command::RC_ERROR); |
return Command::RC_ERROR; |
} | } |
catch (...) | catch (...) |
{ | { |
|
|
"::Unknown exception caught when acquiring configuration."<<endl; | "::Unknown exception caught when acquiring configuration."<<endl; |
log_file.close(); | log_file.close(); |
command.removeUnusedFiles(); | command.removeUnusedFiles(); |
exit (Command::RC_ERROR); |
return Command::RC_ERROR; |
} | } |
| |
log_file << StressTestControllerCommand::COMMAND_NAME << | log_file << StressTestControllerCommand::COMMAND_NAME << |
|
|
"::Failed to Generate Client Commands."<< endl; | "::Failed to Generate Client Commands."<< endl; |
log_file.close(); | log_file.close(); |
command.removeUnusedFiles(); | command.removeUnusedFiles(); |
exit (Command::RC_ERROR); |
return Command::RC_ERROR; |
} | } |
| |
// | // |
|
|
cout <<" Client log: "<< | cout <<" Client log: "<< |
FileSystem::extractFileName(command.getStressClientLogFile())<<endl; | FileSystem::extractFileName(command.getStressClientLogFile())<<endl; |
log_file.close(); | log_file.close(); |
exit (rc); |
|
return rc; | return rc; |
} /* main */ | } /* main */ |