]> git.stg.codes - stg.git/blob - functest/test_services.sh
Lower C++ version, minmal GCC version, compiler-related flags.
[stg.git] / functest / test_services.sh
1 #!/bin/sh
2
3 source `dirname $0`/functions
4
5 BASEPATH=$1
6
7 SGCONFPATH="$BASEPATH/stg/build/sgconf"
8
9 printf "Check initial service list... "
10
11 RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --get-services`
12
13 if [ "$?" != "0" ]
14 then
15     printf "Error.\n"
16     printf "Failed to get services list. Result:\n$RES\n"
17     exit 0
18 fi
19
20 NAMES=`getFields "name" "$RES"`
21
22 NUM=`count "$NAMES"`
23
24 if [ "$NUM" != "0" ]
25 then
26     printf "Failed.\n"
27     printf "Services list should be empty.\n"
28     printf "Names:\n$NAMES\n"
29     printf -- "--------\n$NUM\n\n"
30     exit 0
31 fi
32
33 printf "Ok.\nCheck adding services... "
34
35 RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --add-service test`
36
37 if [ "$?" != "0" ]
38 then
39     printf "Error.\n"
40     printf "Failed to add new service. Result:\n$RES\n"
41     exit 0
42 fi
43
44 printf "Ok.\nCheck new service list... "
45
46 RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --get-services`
47
48 if [ "$?" != "0" ]
49 then
50     printf "Error.\n"
51     printf "Failed to get services list. Result:\n$RES\n"
52     exit 0
53 fi
54
55 NAMES=`getFields "name" "$RES"`
56
57 NUM=`count "$NAMES"`
58
59 if [ "$NUM" != "1" ]
60 then
61     printf "Failed.\n"
62     printf "Services list should have exactly one entry.\n"
63     printf "Names:\n$NAMES\n"
64     printf -- "--------\n$NUM\n\n"
65     exit 0
66 fi
67
68 printf "Ok.\nCheck deletion exisiting service... "
69
70 RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --del-service test`
71
72 if [ "$?" != "0" ]
73 then
74     printf "Error.\n"
75     printf "Failed to delete a service. Result:\n$RES\n"
76     exit 0
77 fi
78
79 printf "Ok.\nCheck new service list... "
80
81 RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --get-services`
82
83 if [ "$?" != "0" ]
84 then
85     printf "Error.\n"
86     printf "Failed to get services list. Result:\n$RES\n"
87     exit 0
88 fi
89
90 NAMES=`getFields "name" "$RES"`
91
92 NUM=`count "$NAMES"`
93
94 if [ "$NUM" != "0" ]
95 then
96     printf "Failed.\n"
97     printf "Services list should be empty.\n"
98     printf "Names:\n$NAMES\n"
99     printf -- "--------\n$NUM\n\n"
100     exit 0
101 fi
102
103 printf "Ok.\n"