diff --git a/tests/test_driver_detection.sh b/tests/test_driver_detection.sh new file mode 100755 index 0000000..715797c --- /dev/null +++ b/tests/test_driver_detection.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +PROG="$1" + +if [ "$PROG" = "" ] +then + echo Please supply the binary to be tested as the first argument. + exit 1 +fi + +TEST=testoutput +LOGFILE=$TEST/logfile + +TESTNAME="Test detection of drivers for all telegrams" +TESTRESULT="ERROR" + +mkdir -p $TEST +rm -f $LOGFILE + +$PROG simulations/simulation_driver_detection.txt 2> $LOGFILE + +if [ "$?" != "0" ] +then + echo "ERROR: $TESTNAME" + exit 1 +fi + +RES=$(grep unknown $LOGFILE) + +if [ ! -z "$RES" ] +then + echo "ERROR: $TESTNAME" + echo "Found unknown driver!" + echo ----------------- + cat $LOGFILE + echo ----------------- + exit 1 +else + echo OK: $TESTNAME +fi diff --git a/tests/test_pipe.sh b/tests/test_pipe.sh new file mode 100755 index 0000000..505b642 --- /dev/null +++ b/tests/test_pipe.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +PROG="$1" + +if [ "$PROG" = "" ] +then + echo Please supply the binary to be tested as the first argument. + exit 1 +fi + +OUTPUT=$( \ +for ((i=1;i<=1000;i++)); \ +do \ + echo "T1;1;1;2019-04-03 19:00:42.000;97;148;88888888;0x2e44333003020100071b7a634820252f2f0265840842658308820165950802fb1aae0142fb1aae018201fb1aa9012f" \ + | $PROG --silent stdin:rtlwmbus rum lansenth 00010203 NOKEY \ + | grep -q 21.8 ; [ "$?" = "0" ] || echo ERR ; \ +done) + +if [ -n "$OUTPUT" ] +then + echo ERROR: reading all stdin before closing down + echo $OUTPUT + exit 1 +else + echo OK: reading all stdin before closing down +fi + +exit 0