source: trunk/test/testrun_2a.sh@ 17

Last change on this file since 17 was 1, checked in by katerina, 19 years ago

Initial import

File size: 3.9 KB
Line 
1#! /bin/sh
2
3
4# The following two are the ANSI sequences for start and end embolden
5case $TERM in
6vt*|ansi*|con*|xterm*|linux*|screen*)
7 S=[1m
8 E=[m
9 ;;
10*)
11 S=
12 E=
13 ;;
14esac
15
16PW_DIR=`pwd`
17
18if test x$UID != x; then
19 TRUST="--with-trusted=0,2,$UID"
20else
21 TRUST="--with-trusted=0,2"
22fi
23
24echo; echo "${S}__ STARTING TEST RUN CLIENT/SERVER __${E}"; echo;
25echo Working directory: $PW_DIR
26
27MAKE=`which gmake`
28if test "x$?" = x1 ; then
29 MAKE="make -s"
30else
31 MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"`
32 if test "x$MAKE" = x; then
33 MAKE="make -s"
34 elif test "x$MAKE" = xno; then
35 MAKE="make -s"
36 else
37 if test "x$MAKE" = "xwhich:"; then
38 MAKE="make -s"
39 else
40 MAKE="gmake -s"
41 gmake -v >/dev/null 2>&1 || MAKE="make -s"
42 fi
43 fi
44fi
45
46echo MAKE is $MAKE
47echo
48
49
50
51testrun2a ()
52{
53 #
54 # test standalone compilation
55 #
56 echo "${S}Building client and server${E}"; echo;
57 #
58 if test -r "Makefile"; then
59 $MAKE distclean
60 fi
61 #
62 ${TOP_SRCDIR}/configure --quiet $TRUST --enable-debug --enable-network=client --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock
63 #
64 # --disable-encrypt
65 #
66 if test x$? = x0; then
67 echo "configure completed, exit status 0"; echo;
68 $MAKE > /dev/null
69 if test x$? = x0; then
70 echo "$MAKE completed, exit status $?"; echo;
71 else
72 echo "${S}ERROR:${E} make failed, exit status $?"; echo;
73 exit
74 fi
75
76 else
77 echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
78 exit
79 fi
80
81 # save binary and build server
82 #
83 cp samhain samhain.build
84 make clean
85
86 #
87 ${TOP_SRCDIR}/configure --quiet $TRUST --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST} --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock
88 # --enable-identity=rainer
89 # --with-libwrap
90 #
91 if test x$? = x0; then
92 echo "configure completed, exit status 0"; echo;
93 $MAKE > /dev/null
94 if test x$? = x0; then
95 echo "$MAKE completed, exit status $?"; echo;
96 else
97 echo "${S}ERROR:${E} make failed, exit status $?"; echo;
98 exit
99 fi
100
101 else
102 echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
103 exit
104 fi
105
106 echo "${S}Initialize database${E}"; echo;
107
108 rm -f ./.samhain_file
109 rm -f ./.samhain_log
110 rm -f ./.samhain_lock
111 rm -f ./rc.${SH_LOCALHOST}
112 rm -f ./file.${SH_LOCALHOST}
113
114 cp ${SCRIPTDIR}/testrc_2.in testrc_2
115
116 echo "./samhain.build -t init"
117 ./samhain.build -t init
118
119 SHINI=$?
120
121 # Create a password
122
123 SHPW=`./yule -G`
124 if test x"$SHPW" = x; then
125 echo "password not generated -- aborting"
126 exit 1
127 fi
128
129 # Set in client
130
131 echo "./samhain_setpwd samhain.build new $SHPW"
132 ./samhain_setpwd samhain.build new $SHPW
133
134 mv samhain.build.new samhain.new
135
136 rm -f ./.samhain_log
137 rm -f ./.samhain_lock
138
139 cp ./testrc_2 ./rc.${SH_LOCALHOST}
140 mv ./.samhain_file ./file.${SH_LOCALHOST}
141
142 SHCLT=`./yule -P $SHPW | sed s%HOSTNAME%${SH_LOCALHOST}%`
143
144 echo $SHCLT >> testrc_2
145
146 if test x$SHINI = x0; then
147 echo; echo "${S}Start Server${E}: ./yule &"; echo;
148 ./yule -q &
149 PROC_Y=$!
150 sleep 5
151
152 echo; echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check";
153
154 ./samhain.new -t check -p none -l none -e info
155 if test x$? = x0; then
156 echo "${S}check completed${E}"
157 else
158 echo "${S}ERROR:${E} -- check -- failed, exit status $?"
159 echo
160 kill $PROC_Y
161 exit
162 fi
163
164 kill $PROC_Y
165 sleep 5
166 else
167 echo "${S}ERROR:${E} -- init -- failed, exit status $SHINI";
168 echo;
169 exit
170 fi
171
172}
173
174 if test x$1 = x; then
175 echo
176 echo "Please provide the local hostname as argument."
177 echo
178 exit 8
179 fi
180
181 SH_LOCALHOST=$1; export SH_LOCALHOST
182
183 testrun2a
184
185
186echo; echo "${S}__ END TEST RUN CLIENT/SERVER __${E}"; echo;
187
188exit
189
Note: See TracBrowser for help on using the repository browser.