From 9f9c7a5dbfdf6d5a849e9f76b60e8c400a7e1222 Mon Sep 17 00:00:00 2001 From: Carlos Gomes Martinho Date: Tue, 14 Apr 2020 11:01:07 +0200 Subject: [PATCH] fix: unit tests --- test/generate-xml.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/test/generate-xml.sh b/test/generate-xml.sh index d03aa1f..02e2d88 100755 --- a/test/generate-xml.sh +++ b/test/generate-xml.sh @@ -12,23 +12,25 @@ # #------------------------------------------------------------------------------ -# Check if mbus_parse_hex exists -if [ ! -x ./mbus_parse_hex ]; then - echo "mbus_parse_hex not found" - exit 3 -fi - # Check commandline parameter -if [ $# -ne 1 ]; then +if [ $# -ne 2 ]; then echo "usage: $0 directory" exit 3 fi directory="$1" -# Check directory +# Check if mbus_parse_hex exists +if [ ! -x $2 ]; then + echo "mbus_parse_hex not found" + exit 3 +fi + +mbus_parse_hex="$2" + +# # Check directory if [ ! -d "$directory" ]; then - echo "usage: $0 directory" + echo "$directory not found" exit 3 fi @@ -40,7 +42,7 @@ for hexfile in "$directory"/*.hex; do filename=`basename $hexfile .hex` # Parse hex file and write XML in file - ./mbus_parse_hex "$hexfile" > "$directory/$filename.xml.new" + $mbus_parse_hex "$hexfile" > "$directory/$filename.xml.new" result=$? # Check parsing result @@ -74,4 +76,3 @@ for hexfile in "$directory"/*.hex; do esac done -