2021-03-13 08:08:17 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
PROG="$1"
|
|
|
|
|
|
|
|
TEST=testaes
|
|
|
|
|
|
|
|
rm -rf $TEST
|
|
|
|
mkdir -p $TEST
|
|
|
|
|
|
|
|
TESTNAME="Test log timestamps"
|
|
|
|
|
2022-02-05 15:00:52 +00:00
|
|
|
cat simulations/serial_aes.msg | grep '^[CT]' | grep 76348799 | tr -d '#' > $TEST/test_input.txt
|
2021-03-13 08:08:17 +00:00
|
|
|
cat $TEST/test_input.txt | $PROG --format=json --logtimestamps=always --verbose "stdin:rtlwmbus" \
|
|
|
|
Vatten multical21 76348799 28F64A24988064A079AA2C807D6102AE > $TEST/test_output.txt 2> $TEST/test_stderr.txt
|
|
|
|
|
|
|
|
if ! grep -q "] Started config" $TEST/test_stderr.txt || \
|
|
|
|
! grep -q "] (config) number" $TEST/test_stderr.txt
|
|
|
|
then
|
|
|
|
echo "ERROR: failed --logtimestamps=always"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat $TEST/test_input.txt | $PROG --format=json --logtimestamps=important --verbose "stdin:rtlwmbus" \
|
|
|
|
Vatten multical21 76348799 00112233445566778899AABBCCDDEEFF > $TEST/test_output.txt 2> $TEST/test_stderr.txt
|
|
|
|
|
|
|
|
if ! grep -q "] Started config" $TEST/test_stderr.txt || \
|
|
|
|
! grep -q "^(config) number" $TEST/test_stderr.txt
|
|
|
|
then
|
|
|
|
echo "ERROR: failed --logtimestamps=important"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat $TEST/test_input.txt | $PROG --format=json --logtimestamps=never --verbose "stdin:rtlwmbus" \
|
|
|
|
Vatten multical21 76348799 00112233445566778899AABBCCDDEEFF > $TEST/test_output.txt 2> $TEST/test_stderr.txt
|
|
|
|
|
|
|
|
if ! grep -q "^Started config" $TEST/test_stderr.txt || \
|
|
|
|
! grep -q "^(config) number" $TEST/test_stderr.txt
|
|
|
|
then
|
|
|
|
echo "ERROR: failed --logtimestamps=never"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "OK: $TESTNAME"
|