#!/bin/sh PROG="$1" TEST=testoutput mkdir -p $TEST performCheck() { if [ "$?" = "0" ] then cat $TEST/test_output.txt | grep -v == | grep -v \# | grep -v Indirect | grep -v Direct | grep -v -e "^$" | grep -v SUMMARY | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/' > $TEST/test_response.txt diff $TEST/test_expected.txt $TEST/test_response.txt if [ "$?" = "0" ] then echo "OK: $TESTNAME" TESTRESULT="OK" else if [ "$USE_MELD" = "true" ] then meld $TEST/test_expected.txt $TEST/test_response.txt fi fi else echo "ERROR: $TESTNAME $0" echo "wmbusmeters returned error code: $?" cat $TEST/test_output.txt fi } ######################################################################################################################## ######################################################################################################################## ######################################################################################################################## TESTNAME="Test no driver root" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test bad driver name" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test no meter_type" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test bad meter_type" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test no default_fields" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test no detect mvt:s" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test bad mvt" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test no field name" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test bad field name with unit" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test field missing quantity" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test field bad quantity" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test field with no matcher and null output" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test field with calculate" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test field matcher without measurement_type" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test field matcher with bad measurement_type " TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test field matcher without vif_range" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test proper field matcher" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck TESTNAME="Test lookup of bits" TESTRESULT="ERROR" cat > $TEST/driver.xmq < $TEST/test_expected.txt < $TEST/test_output.txt 2>&1 || true performCheck