2020-04-21 10:40:25 +00:00
|
|
|
#!/bin/sh
|
2019-02-28 16:30:29 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2019-11-03 21:00:18 +00:00
|
|
|
TESTNAME="Test listen and print any meter heard in logfile"
|
|
|
|
TESTRESULT="ERROR"
|
|
|
|
|
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: 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
|
2020-02-12 06:52:29 +00:00
|
|
|
Received telegram from: 11776622
|
|
|
|
manufacturer: (TCH) Techem Service
|
|
|
|
device type: Heat Cost Allocator
|
2019-05-21 13:18:06 +00:00
|
|
|
Received telegram from: 88018801
|
|
|
|
manufacturer: (INE) INNOTAS Elektronik, Germany
|
|
|
|
device type: Heat Cost Allocator
|
2020-06-22 08:44:47 +00:00
|
|
|
Received telegram from: 00010204
|
|
|
|
manufacturer: (LAS) Lansen Systems, Sweden
|
|
|
|
device type: Smoke detector
|
|
|
|
Received telegram from: 00010204
|
|
|
|
manufacturer: (LAS) Lansen Systems, Sweden
|
|
|
|
device type: Smoke detector
|
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-10-14 18:26:31 +00:00
|
|
|
Received telegram from: 11772288
|
|
|
|
manufacturer: (BMT) BMETERS, Italy
|
|
|
|
device type: Room sensor (eg temperature or humidity)
|
2019-11-10 07:09:21 +00:00
|
|
|
Received telegram from: 21242472
|
|
|
|
manufacturer: (SAP) Sappel
|
|
|
|
device type: Oil meter
|
2020-02-02 20:31:46 +00:00
|
|
|
Received telegram from: 66290778
|
|
|
|
manufacturer: (DME) DIEHL Metering, Germany
|
|
|
|
device type: Unknown
|
2019-11-26 13:24:17 +00:00
|
|
|
Received telegram from: 64646464
|
|
|
|
manufacturer: (DME) DIEHL Metering, Germany
|
|
|
|
device type: Water meter
|
2019-12-07 13:46:28 +00:00
|
|
|
Received telegram from: 86868686
|
|
|
|
manufacturer: (BMT) BMETERS, Italy
|
|
|
|
device type: Water meter
|
2020-01-27 15:53:18 +00:00
|
|
|
Received telegram from: 72727272
|
|
|
|
manufacturer: (AXI) UAB Axis Industries, Lithuania
|
|
|
|
device type: Water meter
|
2020-02-06 12:14:46 +00:00
|
|
|
Received telegram from: 22992299
|
|
|
|
manufacturer: (EBZ) eBZ, Germany
|
|
|
|
device type: Radio converter (meter side)
|
2020-02-06 14:41:48 +00:00
|
|
|
Received telegram from: 77997799
|
|
|
|
manufacturer: (ESY) EasyMeter
|
|
|
|
device type: Radio converter (meter side)
|
|
|
|
Received telegram from: 77997799
|
|
|
|
manufacturer: (ESY) EasyMeter
|
|
|
|
device type: Radio converter (meter side)
|
2020-02-06 17:20:47 +00:00
|
|
|
Received telegram from: 55995599
|
|
|
|
manufacturer: (EMH) EMH metering formerly EMH Elektrizitatszahler
|
|
|
|
device type: Electricity meter
|
2020-02-23 17:41:21 +00:00
|
|
|
Received telegram from: 004444dd
|
|
|
|
manufacturer: (APT) Unknown
|
|
|
|
device type: Gas meter
|
2020-05-30 07:51:25 +00:00
|
|
|
Received telegram from: 74737271
|
|
|
|
manufacturer: (BMT) BMETERS, Italy
|
|
|
|
device type: Water meter
|
2019-02-28 16:30:29 +00:00
|
|
|
EOF
|
2019-04-27 11:31:13 +00:00
|
|
|
|
2019-02-28 16:30:29 +00:00
|
|
|
RES=$($PROG --logfile=$LOGFILE --t1 simulations/simulation_t1.txt 2>&1)
|
|
|
|
|
|
|
|
if [ ! "$RES" = "" ]
|
|
|
|
then
|
2019-11-03 21:00:18 +00:00
|
|
|
echo ERROR: $TESTNAME
|
2019-02-28 16:30:29 +00:00
|
|
|
echo Expected no output on stdout and stderr
|
|
|
|
echo but got------------------
|
|
|
|
echo $RES
|
|
|
|
echo ---------------------
|
2019-11-03 21:00:18 +00:00
|
|
|
exit 1
|
2019-02-28 16:30:29 +00:00
|
|
|
fi
|
|
|
|
|
2020-02-23 17:41:21 +00:00
|
|
|
RES=$(diff $LOGFILE $LOGFILE_EXPECTED)
|
2020-01-27 15:53:18 +00:00
|
|
|
|
2020-02-23 17:41:21 +00:00
|
|
|
if [ ! -z "$RES" ]
|
2019-02-28 16:30:29 +00:00
|
|
|
then
|
2019-11-03 21:00:18 +00:00
|
|
|
echo ERROR: $TESTNAME
|
2020-02-23 17:41:21 +00:00
|
|
|
echo -----------------
|
|
|
|
diff $LOGFILE $LOGFILE_EXPECTED
|
2019-02-28 16:30:29 +00:00
|
|
|
echo -----------------
|
|
|
|
exit 1
|
|
|
|
else
|
2019-11-03 21:00:18 +00:00
|
|
|
echo OK: $TESTNAME
|
2019-02-28 16:30:29 +00:00
|
|
|
fi
|
|
|
|
|
2019-11-03 21:00:18 +00:00
|
|
|
TESTNAME="Test listen and print any meter heard on stdout"
|
|
|
|
TESTRESULT="ERROR"
|
|
|
|
|
2020-02-23 17:41:21 +00:00
|
|
|
$PROG --t1 simulations/simulation_t1.txt 2>&1 > $LOGFILE
|
|
|
|
|
|
|
|
RES=$(diff $LOGFILE $LOGFILE_EXPECTED)
|
2019-02-28 16:30:29 +00:00
|
|
|
|
2020-02-23 17:41:21 +00:00
|
|
|
if [ ! -z "$RES" ]
|
2019-02-28 16:30:29 +00:00
|
|
|
then
|
2019-11-03 21:00:18 +00:00
|
|
|
echo ERROR: $TESTNAME
|
2020-02-23 17:41:21 +00:00
|
|
|
echo -----------------
|
|
|
|
diff $LOGFILE $LOGFILE_EXPECTED
|
2019-02-28 16:30:29 +00:00
|
|
|
echo -----------------
|
|
|
|
exit 1
|
|
|
|
else
|
2019-11-03 21:00:18 +00:00
|
|
|
echo OK: $TESTNAME
|
2019-02-28 16:30:29 +00:00
|
|
|
fi
|