kopia lustrzana https://github.com/weetmuts/wmbusmeters
Fix test.
rodzic
99876d175b
commit
422793be04
|
@ -1360,7 +1360,7 @@ void logAlarm(string type, string msg)
|
|||
envs.push_back("ALARM_TYPE="+type);
|
||||
envs.push_back("ALARM_MESSAGE="+msg);
|
||||
|
||||
warning("(alarm) %s %s\n", type.c_str(), msg.c_str());
|
||||
warning("(alarm) %s: %s\n", type.c_str(), msg.c_str());
|
||||
|
||||
for (auto &s : alarm_shells_)
|
||||
{
|
||||
|
|
14
src/wmbus.cc
14
src/wmbus.cc
|
@ -3434,7 +3434,7 @@ void WMBusCommonImplementation::checkStatus()
|
|||
if (protocol_error_count_ >= 20)
|
||||
{
|
||||
string msg;
|
||||
strprintf(msg, "Hit max protocol errors(%d)! Resetting device %s %s!", protocol_error_count_, toString(type()), device().c_str());
|
||||
strprintf(msg, "too many protocol errors(%d) resetting %s %s", protocol_error_count_, device().c_str(), toString(type()));
|
||||
logAlarm("device_failure", msg);
|
||||
bool ok = reset();
|
||||
if (ok)
|
||||
|
@ -3444,7 +3444,7 @@ void WMBusCommonImplementation::checkStatus()
|
|||
return;
|
||||
}
|
||||
|
||||
strprintf(msg, "Failed to reset wmbus device %s %s! Emergency exit!", toString(type()), device().c_str());
|
||||
strprintf(msg, "failed to reset wmbus device %s %s exiting wmbusmeters", device().c_str(), toString(type()));
|
||||
logAlarm("device_failure", msg);
|
||||
manager_->stop();
|
||||
return;
|
||||
|
@ -3473,10 +3473,10 @@ void WMBusCommonImplementation::checkStatus()
|
|||
string now = strdatetime(&nowtm);
|
||||
|
||||
string msg;
|
||||
strprintf(msg, "Hit timeout(%d s) and %s is within expected activity (%s)!"
|
||||
" Now %d seconds since last telegram was received! Resetting device %s %s!",
|
||||
timeout_, now.c_str(), expected_activity_.c_str(),
|
||||
since, toString(type()), device().c_str());
|
||||
strprintf(msg, "%d seconds of inactivity resetting %s %s "
|
||||
"(timeout %ds expected %s now %s)",
|
||||
since, device().c_str(), toString(type()),
|
||||
timeout_, expected_activity_.c_str(), now.c_str());
|
||||
|
||||
logAlarm("inactivity", msg);
|
||||
|
||||
|
@ -3487,7 +3487,7 @@ void WMBusCommonImplementation::checkStatus()
|
|||
}
|
||||
else
|
||||
{
|
||||
strprintf(msg, "Failed to reset wmbus device %s %s! Emergency exit!", toString(type()), device().c_str());
|
||||
strprintf(msg, "failed to reset wmbus device %s %s exiting wmbusmeters", device().c_str(), toString(type()));
|
||||
logAlarm("device_failure", msg);
|
||||
manager_->stop();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ echo "RUNNING $TESTNAME ..."
|
|||
$PROG --useconfig=tests/config7 --device=simulations/simulation_alarm.txt | sed 's/....-..-.. ..:../1111-11-11 11:11/' > $TEST/test_output.txt
|
||||
|
||||
cat > $TEST/test_expected.txt <<EOF
|
||||
(alarm) TIMEOUT_ERROR Hit timeout(1 s) and 1111-11-11 11:11 is within expected activity (mon-sun(00-23))! Now 2 seconds since last telegram was received! Resetting device DEVICE_SIMULATOR simulations/simulation_alarm.txt!
|
||||
(alarm) inactivity: 2 seconds of inactivity resetting simulations/simulation_alarm.txt DEVICE_SIMULATOR (timeout 1s expected mon-sun(00-23) now 1111-11-11 11:11)
|
||||
(wmbus) successfully reset wmbus device
|
||||
EOF
|
||||
|
||||
|
@ -25,7 +25,7 @@ METER =={"media":"cold water","meter":"multical21","name":"Water","id":"76348799
|
|||
EOF
|
||||
|
||||
cat > /tmp/wmbusmeters_alarm_expected <<EOF
|
||||
ALARM_SHELL TIMEOUT_ERROR Hit timeout(1 s) and 1111-11-11 11:11 is within expected activity (mon-sun(00-23))! Now 2 seconds since last telegram was received! Resetting device DEVICE_SIMULATOR simulations/simulation_alarm.txt!
|
||||
ALARM_SHELL inactivity 2 seconds of inactivity resetting simulations/simulation_alarm.txt DEVICE_SIMULATOR (timeout 1s expected mon-sun(00-23) now 1111-11-11 11:11)
|
||||
EOF
|
||||
|
||||
REST=$(diff $TEST/test_output.txt $TEST/test_expected.txt)
|
||||
|
|
Ładowanie…
Reference in New Issue