X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/6aadaaf234bfd8129e8b4ff7f64c3aef8df54659..93876a5fc8231cae1e9f13caf50492985e7ae76e:/functest/test_services.sh?ds=sidebyside diff --git a/functest/test_services.sh b/functest/test_services.sh index 3323123f..3bc397ae 100755 --- a/functest/test_services.sh +++ b/functest/test_services.sh @@ -1,5 +1,7 @@ #!/bin/sh +source `dirname $0`/functions + BASEPATH=$1 SGCONFPATH="$BASEPATH/stg/projects/sgconf" @@ -12,25 +14,11 @@ then exit 0 fi -printf "Got services list:\n" - -NAMES="" -OLDIFS=$IFS -IFS=$(printf "\n") -for LINE in $RES -do - printf -- "$LINE\n" - NAME=`printf "$LINE" | grep name` - if [ "$?" == "0" ] - then - NAMES="$NAMES\n"`printf "$NAME" | cut -d: -f2 | sed -e 's/^ *//' -e 's/ *$//'` - fi -done -IFS=$OLDIFS +NAMES=`getFields "name" "$RES"` printf "Names:\n$NAMES\n" -NUM=`printf "$NAMES" | wc -l` +NUM=`count "$NAMES"` printf -- "--------\n$NUM\n\n" @@ -56,25 +44,11 @@ then exit 0 fi -printf "Got services list:\n" - -NAMES="" -OLDIFS=$IFS -IFS=$(printf "\n") -for LINE in $RES -do - printf -- "$LINE\n" - NAME=`printf "$LINE" | grep name` - if [ "$?" == "0" ] - then - NAMES="$NAMES\n"`printf "$NAME" | cut -d: -f2 | sed -e 's/^ *//' -e 's/ *$//'` - fi -done -IFS=$OLDIFS +NAMES=`getFields "name" "$RES"` printf "Names:\n$NAMES\n" -NUM=`printf "$NAMES" | wc -l` +NUM=`count "$NAMES"` printf -- "--------\n$NUM\n\n" @@ -100,29 +74,15 @@ then exit 0 fi -printf "Got services list:\n" - -NAMES="" -OLDIFS=$IFS -IFS=$(printf "\n") -for LINE in $RES -do - printf -- "$LINE\n" - NAME=`printf "$LINE" | grep name` - if [ "$?" == "0" ] - then - NAMES="$NAMES\n"`printf "$NAME" | cut -d: -f2 | sed -e 's/^ *//' -e 's/ *$//'` - fi -done -IFS=$OLDIFS +NAMES=`getFields "name" "$RES"` printf "Names:\n$NAMES\n" -NUM=`printf "$NAMES" | wc -l` +NUM=`count "$NAMES"` printf -- "--------\n$NUM\n\n" -if [ "$NUM" != "1" ] +if [ "$NUM" != "0" ] then printf "Services list should be empty.\n" exit 0