2020-09-04 09:31:49 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
PROG="$1"
|
|
|
|
|
|
|
|
mkdir -p testoutput
|
|
|
|
TEST=testoutput
|
|
|
|
|
|
|
|
TESTNAME="Test meter with unknown driver"
|
|
|
|
TESTRESULT="ERROR"
|
|
|
|
|
2022-01-06 17:28:22 +00:00
|
|
|
METERS="Dorren lansendw 00010205 NOKEY Forren lansensm 00010206 NOKEY"
|
2020-09-04 09:31:49 +00:00
|
|
|
|
|
|
|
cat > $TEST/test_expected.txt <<EOF
|
|
|
|
(meter) Dorren: meter detection did not match the selected driver lansendw! correct driver is: unknown!
|
2021-10-05 20:16:31 +00:00
|
|
|
(meter) Not printing this warning again for id: 00010205 mfct: (LAS) Lansen Systems, Sweden (0x3033) type: Unknown (0xff) ver: 0x07
|
2020-09-08 18:50:51 +00:00
|
|
|
(meter) please consider opening an issue at https://github.com/weetmuts/wmbusmeters/
|
|
|
|
(meter) to add support for this unknown mfct,media,version combination
|
2022-05-21 18:25:18 +00:00
|
|
|
{"media":"Unknown","meter":"lansendw","name":"Dorren","id":"00010205","status":"OPEN","a_counter":23,"b_counter":0,"timestamp":"1111-11-11T11:11:11Z"}
|
2020-09-04 09:31:49 +00:00
|
|
|
(meter) Forren: meter detection did not match the selected driver lansensm! correct driver is: lansendw
|
2021-10-05 20:16:31 +00:00
|
|
|
(meter) Not printing this warning again for id: 00010206 mfct: (LAS) Lansen Systems, Sweden (0x3033) type: Reserved for sensors (0x1d) ver: 0x07
|
2021-01-06 12:46:12 +00:00
|
|
|
{"media":"reserved","meter":"lansensm","name":"Forren","id":"00010206","status":"OK","timestamp":"1111-11-11T11:11:11Z"}
|
2022-05-21 18:25:18 +00:00
|
|
|
{"media":"Unknown","meter":"lansendw","name":"Dorren","id":"00010205","status":"OPEN","a_counter":23,"b_counter":0,"timestamp":"1111-11-11T11:11:11Z"}
|
2020-09-04 09:31:49 +00:00
|
|
|
{"media":"reserved","meter":"lansensm","name":"Forren","id":"00010206","status":"OK","timestamp":"1111-11-11T11:11:11Z"}
|
|
|
|
EOF
|
|
|
|
|
2021-02-20 21:21:01 +00:00
|
|
|
$PROG --format=json --ignoreduplicates=false --usestdoutforlogging simulations/simulation_unknown.txt $METERS > $TEST/test_output.txt
|
2020-09-04 09:31:49 +00:00
|
|
|
if [ "$?" = "0" ]
|
|
|
|
then
|
|
|
|
cat $TEST/test_output.txt | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/' > $TEST/test_responses.txt
|
|
|
|
diff $TEST/test_expected.txt $TEST/test_responses.txt
|
|
|
|
if [ "$?" = "0" ]
|
|
|
|
then
|
|
|
|
echo OK: $TESTNAME
|
|
|
|
TESTRESULT="OK"
|
|
|
|
else
|
|
|
|
TESTRESULT="ERROR"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$TESTRESULT" = "ERROR" ]
|
|
|
|
then
|
|
|
|
echo ERROR: $TESTNAME
|
|
|
|
exit 1
|
|
|
|
fi
|