3 ###########################
5 ###########################
7 # testcurl.sh is the master script to use for automatic testing of CVS-curl.
8 # This is written for the purpose of being run from a crontab job or similar
9 # at a regular interval. The output will be suitable to be mailed automaticly
10 # to "curl-autocompile@haxx.se" to be dealt with automaticly. The most
11 # current build status (with a resonable backlog) will be published on the
12 # curl site, at http://curl.haxx.se/auto/
15 # testcurl.sh [curl-daily-name] > output
18 # v1.1 6-Nov-03 - to take an optional parameter, the name of a daily-build
19 # directory. If present, build from that directory, otherwise
20 # perform a normal CVS build.
22 # version of this script
26 # Determine if we're running from CVS or a canned copy of curl
27 if [ "$#" -ge "1" -a "$1" ]; then
40 echo "testcurl: ENDING HERE"
41 if test -n "$build"; then
42 # we have a build directory name, remove the dir
52 infixed=0 # so that "additional args to configure" works properly first time...
55 if [ -z "$name" ]; then
56 echo "please enter your name"
61 if [ -z "$email" ]; then
62 echo "please enter your contact email address"
67 if [ -z "$desc" ]; then
68 echo "please enter a one line system description"
73 if [ -z "$confopts" ]; then
74 if [ $infixed -lt 4 ]; then
75 echo "please enter your additional arguments to configure"
76 echo "examples: --with-ssl --enable-debug --enable-ipv6 --with-krb4"
83 if [ "$fixed" -gt "0" ]; then
84 echo "name='$name'" > setup
85 echo "email='$email'" >> setup
86 echo "desc='$desc'" >> setup
87 echo "confopts='$confopts'" >> setup
88 echo "fixed='$fixed'" >> setup
91 echo "testcurl: STARTING HERE"
92 echo "testcurl: NAME = $name"
93 echo "testcurl: EMAIL = $email"
94 echo "testcurl: DESC = $desc"
95 echo "testcurl: CONFOPTS = $confopts"
96 echo "testcurl: version = $version"
97 echo "testcurl: date = `date -u`"
99 # Make $pwd to become the path without newline. We'll use that in order to cut
100 # off that path from all possible logs and error messages etc.
102 pwd=`echo $ipwd | sed -e 's/$//g'`
104 if [ -d "$CURLDIR" ]; then
105 if [ $CVS -eq 1 -a -d $CURLDIR/CVS ]; then
106 echo "testcurl: curl is verified to be a fine source dir"
107 elif [ $CVS -eq 0 -a -f $CURLDIR/testcurl.sh ]; then
108 echo "testcurl: curl is verified to be a fine daily source dir"
110 echo "testcurl: curl is not a daily source dir or checked out from CVS!"
116 # remove any previous left-overs
119 # create a dir to build in
122 if [ -d $build ]; then
123 echo "testcurl: build dir $build was created fine"
125 echo "testcurl: failed to create dir $build"
129 # get in the curl source tree root
132 # Do the CVS thing, or not...
133 if [ $CVS -eq 1 ]; then
134 echo "testcurl: update from CVS"
137 # update quietly to the latest CVS
138 echo "testcurl: run cvs up"
143 # return (1 - RETURNVALUE) so that errors return 0 while goodness
145 return `expr 1 - $cvsstat`
151 echo "testcurl: failed CVS update attempt number $att."
152 if [ $att -gt 10 ]; then
154 break # get out of the loop
159 echo "testcurl: cvs returned: $cvsstat"
161 if [ "$cvsstat" -ne "0" ]; then
162 echo "testcurl: failed to update from CVS, exiting"
166 # figure out the current collected CVS status
167 newstat="../allcvs.log"
168 oldstat="../oldcvs.log"
169 find . -name Entries -exec cat {} \; > "$newstat"
171 if [ -r "$oldstat" ]; then
172 # there is a previous cvs stat file to compare with
173 if { cmp "$oldstat" "$newstat"; } then
174 echo "testcurl: this is the same CVS status as before"
175 echo "testcurl: ALREADY TESTED THIS SETUP BEFORE"
178 echo "testcurl: there has been a change in the CVS"
182 # remove possible left-overs from the past
184 rm -rf autom4te.cache
186 # generate the build files
190 if [ -f configure ]; then
191 echo "testcurl: configure created"
193 echo "testcurl: no configure created"
197 # change to build dir
200 # run configure script
201 ../$CURLDIR/configure $confopts 2>&1
203 if [ -f lib/Makefile ]; then
204 echo "testcurl: configure seems to have finished fine"
206 echo "testcurl: configure didn't work"
210 echo "testcurl: display lib/config.h"
211 grep "^ *#" lib/config.h
213 if { grep "define USE_ARES" lib/config.h; } then
214 echo "testcurl: setup to build ares"
216 echo "testcurl: build ares"
219 echo "testcurl: ares is now built"
221 # cd back to the curl build dir
225 echo "testcurl: now run make"
226 make -i 2>&1 | sed -e "s:$pwd::g"
228 if [ -f src/curl ]; then
229 echo "testcurl: src/curl was created fine"
231 echo "testcurl: src/curl was not created"
235 echo "testcurl: now run make test-full"
236 make test-full 2>&1 | sed -e "s:$pwd::g" | tee build.log
238 if { grep "^TESTFAIL:" build.log; } then
239 echo "testcurl: the tests were not successful"
241 echo "testcurl: the tests were successful!"
244 if [ $CVS -eq 1 ]; then
245 # store the cvs status for the next time