2020-04-21 10:40:25 +00:00
#!/bin/sh
2019-03-15 20:49:18 +00:00
PROG = " $1 "
2021-02-20 21:21:01 +00:00
TEST = testoutput
2019-03-15 20:49:18 +00:00
2020-01-27 08:29:40 +00:00
rm -rf $TEST
mkdir -p $TEST
2019-03-15 20:49:18 +00:00
2020-01-27 08:29:40 +00:00
TESTNAME = "Test wrong keys"
2019-11-03 21:00:18 +00:00
TESTRESULT = "ERROR"
2020-01-27 08:29:40 +00:00
cat simulations/simulation_aes.msg | grep '^{' | tr -d '#' > $TEST /test_expected.txt
cat simulations/simulation_aes.msg | grep '^[CT]' | tr -d '#' > $TEST /test_input.txt
cat $TEST /test_input.txt | $PROG --format= json "stdin:rtlwmbus" \
ApWater apator162 88888888 00000000000000000000000000000001 \
Vatten multical21 76348799 28F64A24988064A079AA2C807D6102AF \
Wasser supercom587 77777777 5065747220486F6C79737A6577736B6A \
2020-09-13 14:55:22 +00:00
> $TEST /test_output.txt 2> $TEST /test_stderr.txt
2020-01-27 08:29:40 +00:00
2020-09-13 14:55:22 +00:00
if [ -s $TEST /test_output.txt ]
then
echo "Bad no stdout expected! But got bytes anyway!"
echo " ERROR: $TESTNAME "
TESTRESULT = "ERROR"
exit 1
fi
2019-03-15 20:49:18 +00:00
cat <<EOF > $TE ST/test_expected.txt
2020-10-05 17:47:58 +00:00
Started config rtlwmbus on stdin listening on any
2021-01-06 11:46:37 +00:00
( wmbus) decrypted content failed check, did you use the correct decryption key? Permanently ignoring telegrams from id: 88888888 mfct: ( APA) Apator, Poland ( 0x601) type: Water meter ( 0x07) ver: 0x05
2021-02-20 21:21:01 +00:00
( meter) newly created meter ( ApWater 88888888 apator162) did not handle telegram!
2021-01-24 19:06:21 +00:00
( wmbus) decrypted payload crc failed check, did you use the correct decryption key? 979f payload crc ( calculated 3431) Permanently ignoring telegrams from id: 76348799 mfct: ( KAM) Kamstrup Energi ( 0x2c2d) type: Cold water meter ( 0x16) ver: 0x1b
2021-02-20 21:21:01 +00:00
( meter) newly created meter ( Vatten 76348799 multical21) did not handle telegram!
2021-01-06 11:46:37 +00:00
( wmbus) decrypted content failed check, did you use the correct decryption key? Permanently ignoring telegrams from id: 77777777 mfct: ( SON) Sontex, Switzerland ( 0x4dee) type: Water meter ( 0x07) ver: 0x3c
2021-02-20 21:21:01 +00:00
( meter) newly created meter ( Wasser 77777777 supercom587) did not handle telegram!
2019-03-15 20:49:18 +00:00
EOF
2020-09-13 14:55:22 +00:00
diff $TEST /test_expected.txt $TEST /test_stderr.txt
2020-04-22 06:07:19 +00:00
if [ " $? " = "0" ]
2019-03-15 20:49:18 +00:00
then
2020-01-27 08:29:40 +00:00
echo " OK: $TESTNAME "
TESTRESULT = "OK"
2019-03-15 20:49:18 +00:00
fi
2019-11-03 21:00:18 +00:00
if [ " $TESTRESULT " = "ERROR" ] ; then echo ERROR: $TESTNAME ; exit 1; fi