2 #***************************************************************************
4 # Project ___| | | | _ \| |
6 # | (__| |_| | _ <| |___
7 # \___|\___/|_| \_\_____|
9 # Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
11 # This software is licensed as described in the file COPYING, which
12 # you should have received as part of this distribution. The terms
13 # are also available at http://curl.haxx.se/docs/copyright.html.
15 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
16 # copies of the Software, and permit persons to whom the Software is
17 # furnished to do so, under the terms of the COPYING file.
19 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 # KIND, either express or implied.
22 # $Id: testcurl.sh,v 1.41 2004/03/09 11:24:36 bagder Exp $
23 ###########################################################################
25 ###########################
26 # What is This Script?
27 ###########################
29 # testcurl.sh is the master script to use for automatic testing of CVS-curl.
30 # This is written for the purpose of being run from a crontab job or similar
31 # at a regular interval. The output will be suitable to be mailed automaticly
32 # to "curl-autocompile@haxx.se" to be dealt with automatically. The most
33 # current build status (with a resonable backlog) will be published on the
34 # curl site, at http://curl.haxx.se/auto/
37 # testcurl.sh [curl-daily-name] > output
40 # v1.1 6-Nov-03 - to take an optional parameter, the name of a daily-build
41 # directory. If present, build from that directory, otherwise
42 # perform a normal CVS build.
44 # version of this script
45 version='$Revision: 1.41 $'
48 # Determine if we're running from CVS or a canned copy of curl
49 if [ "$#" -ge "1" -a "$1" ]; then
63 if test -n "$text"; then
64 echo "testcurl: $text"
71 cd $pwd # cd back to the original root dir
73 if test -n "$pwd/$build"; then
74 # we have a build directory name, remove the dir
75 log "removing the $build dir"
78 if test -r "$buildlog"; then
79 # we have a build log output file left, remove it
80 log "removing the $buildlogname file"
83 log "ENDING HERE" # last line logged!
91 infixed=0 # so that "additional args to configure" works properly first time...
94 if [ -z "$name" ]; then
95 echo "please enter your name"
100 if [ -z "$email" ]; then
101 echo "please enter your contact email address"
106 if [ -z "$desc" ]; then
107 echo "please enter a one line system description"
112 if [ -z "$confopts" ]; then
113 if [ $infixed -lt 4 ]; then
114 echo "please enter your additional arguments to configure"
115 echo "examples: --with-ssl --enable-debug --enable-ipv6 --with-krb4"
122 if [ "$fixed" -gt "0" ]; then
123 echo "name='$name'" > setup
124 echo "email='$email'" >> setup
125 echo "desc='$desc'" >> setup
126 echo "confopts='$confopts'" >> setup
127 echo "fixed='$fixed'" >> setup
130 log "STARTING HERE" # first line logged
134 log "CONFOPTS = $confopts"
135 log "CFLAGS = $CFLAGS"
137 log "version = $version"
138 log "date = `date -u`"
140 # Make $pwd to become the path without newline. We'll use that in order to cut
141 # off that path from all possible logs and error messages etc.
143 pwd=`echo $ipwd | sed -e 's/$//g'`
145 if [ -d "$CURLDIR" ]; then
146 if [ $CVS -eq 1 -a -d $CURLDIR/CVS ]; then
147 log "curl is verified to be a fine source dir"
148 # remove the generated sources to force them to be re-generated each
149 # time we run this test
150 rm -f $CURLDIR/lib/getdate.c
151 rm -f $CURLDIR/src/hugehelp.c
152 elif [ $CVS -eq 0 -a -f $CURLDIR/testcurl.sh ]; then
153 log "curl is verified to be a fine daily source dir"
155 die "curl is not a daily source dir or checked out from CVS!"
159 buildlogname="buildlog-$$"
160 buildlog="$pwd/$buildlogname"
162 # remove any previous left-overs
166 # this is to remove old build logs that ended up in the wrong dir
167 rm -rf $CURLDIR/buildlog-*
169 # create a dir to build in
172 if [ -d $build ]; then
173 log "build dir $build was created fine"
175 die "failed to create dir $build"
178 # get in the curl source tree root
181 # Do the CVS thing, or not...
182 if [ $CVS -eq 1 ]; then
184 # this is a temporary fix to make things work again, remove later
185 log "remove ares/aclocal.m4"
186 rm -f ares/aclocal.m4
188 log "update from CVS"
191 # update quietly to the latest CVS
197 # return (1 - RETURNVALUE) so that errors return 0 while goodness
199 return `expr 1 - $cvsstat`
205 log "failed CVS update attempt number $att."
206 if [ $att -gt 10 ]; then
208 break # get out of the loop
213 if [ "$cvsstat" -ne "0" ]; then
214 die "failed to update from CVS ($cvsstat), exiting"
217 # remove possible left-overs from the past
219 rm -rf autom4te.cache
221 # generate the build files
222 log "invoke buildconf, but filter off the silly aclocal warnings"
223 ./buildconf 2>&1 | grep -v "warning: underquoted definition of" | tee $buildlog
225 if { grep "^buildconf: OK" $buildlog >/dev/null 2>&1; } then
226 log "buildconf was successful"
228 die "buildconf was NOT successful"
233 if [ -f configure ]; then
234 log "configure created"
236 die "no configure created"
239 # change to build dir
242 # run configure script
243 ../$CURLDIR/configure $confopts 2>&1
245 if [ -f lib/Makefile ]; then
246 log "configure seems to have finished fine"
248 die "configure didn't work"
251 log "display lib/config.h"
252 grep "^ *#" lib/config.h
254 log "display src/config.h"
255 grep "^ *#" src/config.h
257 if { grep "define USE_ARES" lib/config.h; } then
258 log "setup to build ares"
262 make 2>&1 | sed -e "s:$pwd::g"
264 if [ -f libcares.a ]; then
265 log "ares is now built successfully"
267 log "ares build failed"
270 # cd back to the curl build dir
275 make -i 2>&1 | sed -e "s:$pwd::g"
277 if [ -f src/curl ]; then
278 log "src/curl was created fine"
280 die "src/curl was not created"
283 log "display curl --version output"
287 log "run make test-full"
288 make test-full 2>&1 | sed -e "s:$pwd::g" | tee $buildlog
290 if { grep "^TEST" $buildlog >/dev/null 2>&1; } then
293 die "test suite failure"
296 if { grep "^TESTFAIL:" $buildlog >/dev/null 2>&1; } then
297 log "the tests were not successful"
299 log "the tests were successful!"