source: trunk/test/testrun_2b.sh@ 173

Last change on this file since 173 was 160, checked in by katerina, 17 years ago

Some more instances of missing TIGER_NOLIM fixed.

File size: 6.2 KB
Line 
1#! /bin/sh
2
3#
4# Copyright Rainer Wichmann (2006)
5#
6# License Information:
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20#
21
22LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
23RCFILE="$PW_DIR/testrc_2"; export RCFILE
24RCFILE_C="$PW_DIR/testrc_1.dyn"; export RCFILE_C
25
26SERVER_BUILDOPTS="--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"; export SERVER_BUILDOPTS
27
28CLIENT_BUILDOPTS="--quiet $TRUST --enable-micro-stealth=137 --enable-debug --enable-network=client --enable-srp --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER${RCFILE_C} --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
29
30testrun2b_internal ()
31{
32 GPG="$1"
33
34 [ -z "$verbose" ] || {
35 echo;
36 echo Working directory: $PW_DIR; echo MAKE is $MAKE; echo GPG is $GPG;
37 echo;
38 }
39
40 [ -z "$verbose" ] || { echo; echo "${S}Building client and server${E}"; echo; }
41
42 if test -r "Makefile"; then
43 $MAKE distclean
44 fi
45
46 ${TOP_SRCDIR}/configure --with-gpg=${GPG} --with-checksum=no ${CLIENT_BUILDOPTS} >/dev/null 2>&1
47
48 if test x$? = x0; then
49 [ -z "$verbose" ] || log_msg_ok "configure...";
50 $MAKE > /dev/null 2>>test_log
51 if test x$? = x0; then
52 [ -z "$verbose" ] || log_msg_ok "make...";
53 else
54 [ -z "$quiet" ] && log_msg_fail "make...";
55 return 1
56 fi
57 else
58 [ -z "$quiet" ] && log_msg_fail "configure...";
59 return 1
60 fi
61
62 SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }' ${SCRIPTDIR}/test.sh`
63
64 tail -n "+$SKIP" ${SCRIPTDIR}/test.sh >/dev/null 2>&1
65 if [ $? -eq 0 ]; then
66 tail -n "+$SKIP" ${SCRIPTDIR}/test.sh | gunzip -c - 2>/dev/null | tar xf - && \
67 mv "./testrc.gpg.asc" "${RCFILE_C}"
68 else
69 tail "+$SKIP" ${SCRIPTDIR}/test.sh | gunzip -c - 2>/dev/null | tar xf - && \
70 mv "./testrc.gpg.asc" "${RCFILE_C}"
71 fi
72 if test x$? = x0; then
73 [ -z "$verbose" ] || log_msg_ok "extract gpg signed files...";
74 else
75 [ -z "$quiet" ] && log_msg_fail "extract gpg signed files...";
76 return 1
77 fi
78
79 # save binary and build server
80
81 cp samhain samhain.build || return 1
82 $MAKE clean >/dev/null || return 1
83
84 ${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS}
85
86 if test x$? = x0; then
87 [ -z "$verbose" ] || log_msg_ok "configure...";
88 $MAKE > /dev/null 2>>test_log
89 if test x$? = x0; then
90 [ -z "$verbose" ] || log_msg_ok "make...";
91 else
92 [ -z "$quiet" ] && log_msg_fail "make...";
93 return 1
94 fi
95
96 else
97 [ -z "$quiet" ] && log_msg_fail "configure...";
98 return 1
99 fi
100
101
102 #####################################################################
103 #
104 #
105 rm -f ./.samhain_file
106 rm -f ./.samhain_log
107 rm -f ./.samhain_lock
108 rm -f ./rc.${SH_LOCALHOST}
109 rm -f ./file.${SH_LOCALHOST}
110
111 cp ${SCRIPTDIR}/testrc_2.in testrc_2
112
113 ./samhain.build -t init -p none
114
115 if test x$? = x0; then
116 [ -z "$verbose" ] || log_msg_ok "init...";
117 else
118 [ -z "$quiet" ] && log_msg_fail "init...";
119 return 1
120 fi
121
122 # Create a password
123
124 SHPW=`./yule -G`
125 if test x"$SHPW" = x; then
126 [ -z "$quiet" ] && log_msg_fail "password not generated -- aborting"
127 return 1
128 fi
129
130 # Set in client
131
132 ./samhain_setpwd samhain.build new $SHPW >/dev/null
133
134 if test x$? = x0; then
135 [ -z "$verbose" ] || log_msg_ok "./samhain_setpwd samhain.build new $SHPW";
136 else
137 [ -z "$quiet" ] && log_msg_fail "./samhain_setpwd samhain.build new $SHPW";
138 return 1
139 fi
140
141 mv samhain.build.new samhain.new || return 1
142
143 rm -f ./.samhain_log*
144 rm -f ./.samhain_lock
145
146 SHCLT=`./yule -P $SHPW`
147
148 if test x$? = x0; then
149 [ -z "$verbose" ] || log_msg_ok "yule -P $SHPW";
150 else
151 [ -z "$quiet" ] && log_msg_fail "yule -P $SHPW";
152 return 1
153 fi
154
155 SHCLT1=`echo "${SHCLT}" | sed s%HOSTNAME%${SH_LOCALHOST}%`
156 AHOST=`find_hostname`
157 SHCLT2=`echo "${SHCLT}" | sed s%HOSTNAME%${AHOST}%`
158
159
160 echo $SHCLT1 >> testrc_2
161 echo $SHCLT2 >> testrc_2
162
163
164 cp "${RCFILE_C}" ./rc.${SH_LOCALHOST}
165 mv $PW_DIR/.samhain_file.asc ./file.${SH_LOCALHOST}
166
167 ALTHOST=`find_hostname`
168 cp "${RCFILE_C}" "./rc.${ALTHOST}"
169 cp ./file.${SH_LOCALHOST} "./file.${ALTHOST}" 2>/dev/null
170}
171
172MAXTEST=1; export MAXTEST
173
174testrun2b ()
175{
176 log_start "RUN FULL CLIENT/SERVER W/GPG";
177 #
178 if [ x"$1" = x ]; then
179 [ -z "$quiet" ] && log_msg_fail "Missing hostname"
180 fi
181 #
182 GPG=`find_path gpg`
183 if [ -z "$GPG" ]; then
184 log_skip 1 $MAXTEST 'gpg not found in $PATH'
185 else
186 eval "$GPG" --list-keys 0F571F6C >/dev/null 2>/dev/null
187 if [ $? -ne 0 ]; then
188 log_skip 1 $MAXTEST 'public PGP key 0x0F571F6C not present'
189 else
190
191 SH_LOCALHOST=$1; export SH_LOCALHOST
192
193 testrun2b_internal "$GPG"
194
195 SAVE_VALGRIND="${VALGRIND}"; VALGRIND=''; export VALGRIND
196 do_test_1_a
197 VALGRIND="${SAVE_VALGRIND}"; export VALGRIND
198 if [ $? -eq 0 ]; then
199 [ -z "$quiet" ] && log_ok 1 ${MAXTEST} "Client download+logging w/gpg";
200 else
201 [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client download+logging w/gpg";
202 fi
203
204 if [ -n "$cleanup" ]; then
205 rm -f ./rc.${SH_LOCALHOST}
206 rm -f ./file.${SH_LOCALHOST}
207 ALTHOST=`find_hostname`
208 rm -f "./file.${ALTHOST}"
209 rm -f "./rc.${ALTHOST}"
210 fi
211 fi
212 fi
213 log_end "RUN FULL CLIENT/SERVER W/GPG"
214}
215
Note: See TracBrowser for help on using the repository browser.