From d113927af0397ecaaa3ce3138795464ea119fb84 Mon Sep 17 00:00:00 2001 From: weetmuts Date: Tue, 21 May 2019 19:29:51 +0200 Subject: [PATCH] Add missing test file. --- tests/test_shell2.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 tests/test_shell2.sh diff --git a/tests/test_shell2.sh b/tests/test_shell2.sh new file mode 100755 index 0000000..e913a53 --- /dev/null +++ b/tests/test_shell2.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +PROG="$1" +TEST=testoutput +mkdir -p $TEST + +$PROG --useconfig=tests/config5 > $TEST/test_output.txt + +if [ "$?" == "0" ] +then + INFO=$(cat /tmp/wmbusmeters_meter_shell_test | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/') + EXPECTED=$(echo 'TESTING SHELL {"media":"warm water","meter":"supercom587","name":"Vatten","id":"12345678","total_m3":5.548,"timestamp":"1111-11-11T11:11:11Z"}') + if [ "$INFO" = "$EXPECTED" ] + then + echo meter shell OK + else + echo Failure. + exit 1 + fi +else + echo Failure. + exit 1 +fi