wmbusmeters/tests/test_key_warnings.sh

42 wiersze
1.6 KiB
Bash
Czysty Zwykły widok Historia

2021-01-06 12:28:56 +00:00
#!/bin/sh
PROG="$1"
mkdir -p testoutput
TEST=testoutput
TESTNAME="Test that failed decryption warning only prints once."
TESTRESULT="OK"
$PROG --format=json simulations/simulation_bad_keys.txt room fhkvdataiii 03065716 NOKEY > $TEST/test_output.txt 2> $TEST/test_stderr.txt
2021-01-06 18:48:56 +00:00
cat > $TEST/expected_err.txt <<EOF
(meter) room: meter detection did not match the selected driver fhkvdataiii! correct driver is: fhkvdataiv
(meter) Not printing this warning agin for id: 03065716 mfct: (TCH) Techem Service (0x5068) type: Heat Cost Allocator (0x08) ver: 0x94
(wmbus) decrypted content failed check, did you use the correct decryption key? Permanently ignoring telegrams from id: 03065716 mfct: (TCH) Techem Service (0x5068) type: Heat Cost Allocator (0x08) ver: 0x94
2021-01-06 18:48:56 +00:00
EOF
diff $TEST/test_stderr.txt $TEST/expected_err.txt
2021-01-06 12:28:56 +00:00
2021-01-06 18:48:56 +00:00
if [ "$?" != "0" ]
2021-01-06 12:28:56 +00:00
then
TESTRESULT="ERROR"
fi
2021-01-06 18:48:56 +00:00
$PROG --format=json simulations/simulation_bad_keys.txt room fhkvdataiv 03065716 00112233445566778899AABBCCDDEEFF > $TEST/test_output.txt 2> $TEST/test_stderr.txt
cat > $TEST/expected_err.txt <<EOF
(meter) room: meter detection did not match the selected driver fhkvdataiv! correct driver is: fhkvdataiii
(meter) Not printing this warning agin for id: 03065716 mfct: (TCH) Techem Service (0x5068) type: Heat Cost Allocator (0x80) ver: 0x94
(wmbus) decrypted content failed check, did you use the correct decryption key? Permanently ignoring telegrams from id: 03065716 mfct: (TCH) Techem Service (0x5068) type: Heat Cost Allocator (0x08) ver: 0x94
EOF
diff $TEST/test_stderr.txt $TEST/expected_err.txt
if [ "$?" != "0" ]
2021-01-06 12:28:56 +00:00
then
TESTRESULT="ERROR"
fi
echo ${TESTRESULT}: $TESTNAME