Add additional test for running device with plugins without DeviceRunner

This commit is contained in:
Alexey Rybalchenko
2019-06-12 12:53:11 +02:00
committed by Dennis Klein
parent 4281d7b27e
commit 5271d4236e
5 changed files with 70 additions and 21 deletions

View File

@@ -24,27 +24,27 @@ DeviceRunner::DeviceRunner(int argc, char* const argv[], bool printLogo)
, fEvents()
{}
bool DeviceRunner::HandleGeneralOptions()
bool DeviceRunner::HandleGeneralOptions(const fair::mq::ProgOptions& config, bool printLogo)
{
if (fConfig.Count("help")) {
fConfig.PrintHelp();
if (config.Count("help")) {
config.PrintHelp();
return false;
}
if (fConfig.Count("print-options")) {
fConfig.PrintOptionsRaw();
if (config.Count("print-options")) {
config.PrintOptionsRaw();
return false;
}
if (fConfig.Count("print-channels") || fConfig.Count("version")) {
if (config.Count("print-channels") || config.Count("version")) {
fair::Logger::SetConsoleSeverity("nolog");
} else {
string severity = fConfig.GetProperty<string>("severity");
string logFile = fConfig.GetProperty<string>("log-to-file");
string logFileSeverity = fConfig.GetProperty<string>("file-severity");
bool color = fConfig.GetProperty<bool>("color");
string severity = config.GetProperty<string>("severity");
string logFile = config.GetProperty<string>("log-to-file");
string logFileSeverity = config.GetProperty<string>("file-severity");
bool color = config.GetProperty<bool>("color");
string verbosity = fConfig.GetProperty<string>("verbosity");
string verbosity = config.GetProperty<string>("verbosity");
fair::Logger::SetVerbosity(verbosity);
if (logFile != "") {
@@ -55,7 +55,7 @@ bool DeviceRunner::HandleGeneralOptions()
fair::Logger::SetConsoleSeverity(severity);
}
if (fPrintLogo) {
if (printLogo) {
LOG(info) << endl
<< " ______ _ _______ _________ " << endl
<< " / ____/___ _(_)_______ |/ /_ __ \\ version " << FAIRMQ_GIT_VERSION << endl
@@ -64,7 +64,7 @@ bool DeviceRunner::HandleGeneralOptions()
<< " /_/ \\__,_/_/_/ /_/ /_/ \\___\\_\\ " << FAIRMQ_LICENSE << " © " << FAIRMQ_COPYRIGHT << endl;
}
fConfig.PrintOptions();
config.PrintOptions();
}
return true;
@@ -122,7 +122,7 @@ auto DeviceRunner::Run() -> int
fConfig.ParseAll(fRawCmdLineArgs, true);
if (!HandleGeneralOptions()) {
if (!HandleGeneralOptions(fConfig)) {
return 0;
}

View File

@@ -56,7 +56,7 @@ class DeviceRunner
auto Run() -> int;
auto RunWithExceptionHandlers() -> int;
bool HandleGeneralOptions();
static bool HandleGeneralOptions(const fair::mq::ProgOptions& config, bool printLogo = true);
void SubscribeForConfigChange();
void UnsubscribeFromConfigChange();

View File

@@ -363,12 +363,12 @@ void ProgOptions::AddChannel(const string& name, const FairMQChannel& channel)
SetVarMapValue<bool>(string(prefix + "autoBind"), channel.GetAutoBind());
}
void ProgOptions::PrintHelp()
void ProgOptions::PrintHelp() const
{
cout << fAllOptions << endl;
}
void ProgOptions::PrintOptions()
void ProgOptions::PrintOptions() const
{
map<string, ValInfo> mapinfo;
@@ -412,7 +412,7 @@ void ProgOptions::PrintOptions()
LOG(debug) << ss.str();
}
void ProgOptions::PrintOptionsRaw()
void ProgOptions::PrintOptionsRaw() const
{
const vector<boost::shared_ptr<po::option_description>>& options = fAllOptions.options();

View File

@@ -144,9 +144,9 @@ class ProgOptions
fEvents.Unsubscribe<fair::mq::PropertyChangeAsString, std::string>(subscriber);
}
void PrintHelp();
void PrintOptions();
void PrintOptionsRaw();
void PrintHelp() const;
void PrintOptions() const;
void PrintOptionsRaw() const;
const boost::program_options::variables_map& GetVarMap() const { return fVarMap; }