2019-02-28 16:30:29 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
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
|
2019-04-27 11:31:13 +00:00
|
|
|
LOGFILE_EXPECTED=$TEST/logfile.expected
|
2019-02-28 16:30:29 +00:00
|
|
|
|
|
|
|
mkdir -p $TEST
|
|
|
|
rm -f $LOGFILE
|
|
|
|
|
2019-04-27 11:31:13 +00:00
|
|
|
cat > $LOGFILE_EXPECTED <<EOF
|
2019-02-28 16:30:29 +00:00
|
|
|
No meters configured. Printing id:s of all telegrams heard!
|
|
|
|
|
|
|
|
Received telegram from: 12345678
|
2019-04-01 21:22:09 +00:00
|
|
|
manufacturer: (SON) Sontex, Switzerland
|
2019-02-28 16:30:29 +00:00
|
|
|
device type: Warm Water (30°C-90°C) meter
|
|
|
|
Received telegram from: 11111111
|
2019-04-01 21:22:09 +00:00
|
|
|
manufacturer: (SON) Sontex, Switzerland
|
2019-02-28 16:30:29 +00:00
|
|
|
device type: Water meter
|
|
|
|
Received telegram from: 12345699
|
2019-04-01 21:22:09 +00:00
|
|
|
manufacturer: (SEN) Sensus Metering Systems, Germany
|
2019-02-28 16:30:29 +00:00
|
|
|
device type: Water meter
|
2019-03-11 16:31:34 +00:00
|
|
|
Received telegram from: 33225544
|
2019-04-01 21:22:09 +00:00
|
|
|
manufacturer: (SEN) Sensus Metering Systems, Germany
|
2019-03-11 16:31:34 +00:00
|
|
|
device type: Water meter
|
2019-03-20 21:16:45 +00:00
|
|
|
Received telegram from: 20202020
|
2019-04-01 21:22:09 +00:00
|
|
|
manufacturer: (APA) Apator, Poland
|
2019-03-20 21:16:45 +00:00
|
|
|
device type: Water meter
|
2019-08-12 09:47:39 +00:00
|
|
|
Received telegram from: 21202020
|
|
|
|
manufacturer: (APA) Apator, Poland
|
|
|
|
device type: Water meter
|
2019-09-07 09:19:45 +00:00
|
|
|
Received telegram from: 22202020
|
|
|
|
manufacturer: (APA) Apator, Poland
|
|
|
|
device type: Water meter
|
2019-03-20 21:16:45 +00:00
|
|
|
Received telegram from: 10101010
|
2019-04-01 21:22:09 +00:00
|
|
|
manufacturer: (APA) Apator, Poland
|
2019-03-20 21:16:45 +00:00
|
|
|
device type: Electricity meter
|
2019-04-27 11:31:13 +00:00
|
|
|
Received telegram from: 34333231
|
|
|
|
manufacturer: (TCH) Techem Service
|
|
|
|
device type: Warm water
|
2019-05-04 06:52:25 +00:00
|
|
|
Received telegram from: 58234965
|
|
|
|
manufacturer: (TCH) Techem Service
|
|
|
|
device type: Heat meter
|
2019-05-21 13:18:06 +00:00
|
|
|
Received telegram from: 88018801
|
|
|
|
manufacturer: (INE) INNOTAS Elektronik, Germany
|
|
|
|
device type: Heat Cost Allocator
|
2019-10-14 14:53:02 +00:00
|
|
|
Received telegram from: 00010203
|
|
|
|
manufacturer: (LAS) Lansen Systems, Sweden
|
|
|
|
device type: Room sensor (eg temperature or humidity)
|
2019-02-28 16:30:29 +00:00
|
|
|
EOF
|
2019-04-27 11:31:13 +00:00
|
|
|
|
|
|
|
EXPECTED=$(cat $LOGFILE_EXPECTED)
|
2019-02-28 16:30:29 +00:00
|
|
|
|
|
|
|
RES=$($PROG --logfile=$LOGFILE --t1 simulations/simulation_t1.txt 2>&1)
|
|
|
|
|
|
|
|
if [ ! "$RES" = "" ]
|
|
|
|
then
|
|
|
|
ERRORS=true
|
|
|
|
echo Expected no output on stdout and stderr
|
|
|
|
echo but got------------------
|
|
|
|
echo $RES
|
|
|
|
echo ---------------------
|
|
|
|
fi
|
|
|
|
|
|
|
|
GOT=$(cat $LOGFILE)
|
|
|
|
|
|
|
|
if [ ! "$GOT" = "$EXPECTED" ]
|
|
|
|
then
|
|
|
|
echo GOT--------------
|
|
|
|
echo $GOT
|
|
|
|
echo EXPECTED---------
|
|
|
|
echo $EXPECTED
|
|
|
|
echo -----------------
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo OK: listen to all with logfile
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
GOT=$($PROG --t1 simulations/simulation_t1.txt 2>&1)
|
|
|
|
|
|
|
|
if [ ! "$GOT" = "$EXPECTED" ]
|
|
|
|
then
|
|
|
|
echo GOT--------------
|
|
|
|
echo $GOT
|
|
|
|
echo EXPECTED---------
|
|
|
|
echo $EXPECTED
|
|
|
|
echo -----------------
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo OK: listen to all with stdout
|
|
|
|
fi
|