diff --git a/etc/scdaq/scdaq.conf b/etc/scdaq/scdaq.conf index 63fabdf31c2bcbf68da12a284827ccb0beac8a3e..36f37f4f7f917febe552ce0eb78f7e85f318203d 100644 --- a/etc/scdaq/scdaq.conf +++ b/etc/scdaq/scdaq.conf @@ -59,7 +59,7 @@ enable_stream_processor:yes # Note: When changing the processing type, change also "output_filename_prefix" # in the file output section. # -#processor_type:GMT +processor_type: # Enable software zero-supression doZS:yes @@ -70,9 +70,9 @@ doZS:yes ## ################################################################################ -#output_filename_prefix:scout_GMT +output_filename_prefix: -#output_filename_base:/fff/BU0/ramdisk/scdaq +output_filename_base: max_file_size:8589934592 diff --git a/scripts/runSCdaq.sh b/scripts/runSCdaq.sh index ef52faf617fe73aceb27d8d68369d334c3e7cdc7..a247598e70aabd0ddb1d250730c5fe17d368daca 100755 --- a/scripts/runSCdaq.sh +++ b/scripts/runSCdaq.sh @@ -15,6 +15,10 @@ while true do echo "Starting scdaq..." /opt/scdaq/bin/scdaq --config /etc/scdaq/scdaq.conf 2>&1 + if [[ ${PIPESTATUS[0]} == 78 ]]; then # Numerical value of EX_CONFIG. + # If the configuration is incomplete there's no point in us retrying forever.. + exit 1 + fi echo "Resetting the board..." ../scripts/reset-firmware.sh echo "Clearing caches..." diff --git a/src/config.cc b/src/config.cc index 5e3a1482f451fcc9c1194aeb3bd692545aeca7b9..b292669b545d5a4be892b43e8a87ddb147711423 100644 --- a/src/config.cc +++ b/src/config.cc @@ -3,6 +3,8 @@ #include "log.h" config::config(std::string filename){ + bool valid = true; + std::ifstream in(filename.c_str(),std::ios_base::in); std::string line; while ( !std::getline(in, line).eof() ) { @@ -31,19 +33,25 @@ config::config(std::string filename){ std::string key = line.substr(0, delim); std::string value = line.substr(delim + 1); - if (key.empty() || value.empty()) { + if (key.empty()) { // Skip ill formated lines continue; } - //std::cout << "key: " << key << ", value: " << value << "\n"; + if (value.empty()) { + LOG(ERROR) << "Configuration entry " << key << " has no value!"; + valid &= false; + } vmap[key] = value; } + + if (!valid) { + throw std::invalid_argument("Configuration error: Keys with no value detected!"); + } } void config::print()const { for (std::map<std::string,std::string>::const_iterator it = vmap.begin(); it!=vmap.end(); it++){ LOG(INFO) << "key " << it->first << " value " << it->second; } - } diff --git a/src/config.h b/src/config.h index e25680e5059012f9fb9711a88589ac29c0af1bbe..f54c5f92d3a1186d5814dff16a6e7bcf90e12afd 100644 --- a/src/config.h +++ b/src/config.h @@ -10,7 +10,7 @@ class config{ public: - + enum class InputType { WZDMA, DMA, FILEDMA, MICRONDMA, FILE }; config(std::string filename); @@ -144,9 +144,9 @@ public: return boost::lexical_cast<uint32_t>(v.c_str()); } private: - + std::map<std::string,std::string> vmap; - + }; #endif diff --git a/src/scdaq.cc b/src/scdaq.cc index 21f4c28a9d0b825c957131b43fbe52ef9e54f1f7..9377febae5acd07bd198fd35a42cc40d072708af 100644 --- a/src/scdaq.cc +++ b/src/scdaq.cc @@ -9,6 +9,7 @@ #include <cctype> #include <string> #include <iostream> +#include <sysexits.h> #include <boost/bind.hpp> #include <boost/asio.hpp> @@ -198,7 +199,9 @@ if(argc < 2){ // utility::report_elapsed_time((tbb::tick_count::now() - mainStartTime).seconds()); return retval; - + } catch (std::exception& e) { + LOG(FATAL) << "Configuration invalid! Error text is \"" << e.what() << "\" Bailing out."; + return EX_CONFIG; } catch(std::exception& e) { LOG(ERROR) << "Error occurred. error text is: \"" << e.what() << "\""; return 1;