]> git.stg.codes - stg.git/blob - functest/test_admins.sh
Use separate etst files for subsystems.
[stg.git] / functest / test_admins.sh
1 #!/bin/sh
2
3 BASEPATH=$1
4
5 SGCONFPATH="$BASEPATH/stg/projects/sgconf"
6
7 RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --get-admins`
8
9 if [ "$?" != "0" ]
10 then
11     printf "Failed to get admins list. Result:\n$RES\n"
12     exit 0
13 fi
14
15 printf "Got admins list:\n"
16
17 LOGINS=""
18 OLDIFS=$IFS
19 IFS=$(printf "\n")
20 for LINE in $RES
21 do
22     printf -- "$LINE\n"
23     LOGIN=`printf "$LINE" | grep login`
24     if [ "$?" == "0" ]
25     then
26         LOGINS="$LOGINS\n"`printf "$LOGIN" | cut -d: -f2 | sed -e 's/^ *//' -e 's/ *$//'`
27     fi
28 done
29 IFS=$OLDIFS
30
31 printf "Logins:\n$LOGINS\n"
32
33 NUM=`printf "$LOGINS" | wc -l`
34
35 printf -- "--------\n$NUM\n\n"