Ralph Mitchell's update that allows this script to take an existing

directory name and build/run/test curl in there instead of trying to update
from CVS. Using this approach, this script can be used to test daily tarballs
etc.
This commit is contained in:
Daniel Stenberg 2003-11-07 08:06:03 +00:00
parent b1aa8eb7ef
commit 3de511b248
1 changed files with 85 additions and 60 deletions

View File

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
########################### ###########################
# What is This Script? # What is This Script?
########################### ###########################
@ -11,12 +12,26 @@
# curl site, at http://curl.haxx.se/auto/ # curl site, at http://curl.haxx.se/auto/
# USAGE: # USAGE:
# testcurl.sh > output # testcurl.sh [curl-daily-name] > output
# Updated:
# v1.1 6-Nov-03 - to take an optional parameter, the name of a daily-build
# directory. If present, build from that directory, otherwise
# perform a normal CVS build.
# version of this script # version of this script
version=1 version=1.1
fixed=0 fixed=0
# Determine if we're running from CVS or a canned copy of curl
if [ "$#" -ge "1" -a "$1" ]; then
CURLDIR=$1
CVS=0
else
CURLDIR="curl"
CVS=1
fi
LANG="C" LANG="C"
export LANG export LANG
@ -29,6 +44,8 @@ die(){
if [ -f setup ]; then if [ -f setup ]; then
. "./setup" . "./setup"
infixed="$fixed" infixed="$fixed"
else
infixed=0 # so that "additional args to configure" works properly first time...
fi fi
if [ -z "$name" ]; then if [ -z "$name" ]; then
@ -80,13 +97,16 @@ echo "testcurl: date = `date -u`"
ipwd=`pwd` ipwd=`pwd`
pwd=`echo $ipwd | sed -e 's/$//g'` pwd=`echo $ipwd | sed -e 's/$//g'`
if [ -d curl -a -d curl/CVS ]; then if [ -d "$CURLDIR" ]; then
echo "testcurl: curl is verified to be a fine source dir" if [ $CVS -eq 1 -a -d $CURLDIR/CVS ]; then
else echo "testcurl: curl is verified to be a fine source dir"
echo "testcurl: curl is not a source dir checked out from CVS!" elif [ $CVS -eq 0 -a -f $CURLDIR/testcurl.sh ]; then
die echo "testcurl: curl is verified to be a fine daily source dir"
else
echo "testcurl: curl is not a daily source dir or checked out from CVS!"
die
fi
fi fi
build="build-$$" build="build-$$"
# remove any previous left-overs # remove any previous left-overs
@ -103,63 +123,66 @@ else
fi fi
# get in the curl source tree root # get in the curl source tree root
cd curl cd $CURLDIR
echo "testcurl: update from CVS" # Do the CVS thing, or not...
if [ $CVS -eq 1 ]; then
echo "testcurl: update from CVS"
cvsup() { cvsup() {
# update quietly to the latest CVS # update quietly to the latest CVS
echo "testcurl: run cvs up" echo "testcurl: run cvs up"
cvs -Q up -dP 2>&1 cvs -Q up -dP 2>&1
cvsstat=$? cvsstat=$?
# return (1 - RETURNVALUE) so that errors return 0 while goodness # return (1 - RETURNVALUE) so that errors return 0 while goodness
# returns 1 # returns 1
return `expr 1 - $cvsstat` return `expr 1 - $cvsstat`
} }
att="0" att="0"
while cvsup; do while cvsup; do
att=`expr $att + 1` att=`expr $att + 1`
echo "testcurl: failed CVS update attempt number $att." echo "testcurl: failed CVS update attempt number $att."
if [ $att -gt 10 ]; then if [ $att -gt 10 ]; then
cvsstat="111" cvsstat="111"
break # get out of the loop break # get out of the loop
fi
sleep 5
done
echo "testcurl: cvs returned: $cvsstat"
if [ "$cvsstat" -ne "0" ]; then
echo "testcurl: failed to update from CVS, exiting"
die
fi fi
sleep 5
done # figure out the current collected CVS status
newstat="../allcvs.log"
echo "testcurl: cvs returned: $cvsstat" oldstat="../oldcvs.log"
find . -name Entries -exec cat {} \; > "$newstat"
if [ "$cvsstat" -ne "0" ]; then
echo "testcurl: failed to update from CVS, exiting" if [ -r "$oldstat" ]; then
die # there is a previous cvs stat file to compare with
fi if { cmp "$oldstat" "$newstat"; } then
echo "testcurl: this is the same CVS status as before"
# figure out the current collected CVS status echo "testcurl: ALREADY TESTED THIS SETUP BEFORE"
newstat="../allcvs.log" #die
oldstat="../oldcvs.log" else
find . -name Entries -exec cat {} \; > "$newstat" echo "testcurl: there has been a change in the CVS"
fi
if [ -r "$oldstat" ]; then
# there is a previous cvs stat file to compare with
if { cmp "$oldstat" "$newstat"; } then
echo "testcurl: this is the same CVS status as before"
echo "testcurl: ALREADY TESTED THIS SETUP BEFORE"
#die
else
echo "testcurl: there has been a change in the CVS"
fi fi
# remove possible left-overs from the past
rm -f configure
rm -rf autom4te.cache
# generate the build files
./buildconf 2>&1
fi fi
# remove possible left-overs from the past
rm -f configure
rm -rf autom4te.cache
# generate the build files
./buildconf 2>&1
if [ -f configure ]; then if [ -f configure ]; then
echo "testcurl: configure created" echo "testcurl: configure created"
else else
@ -171,7 +194,7 @@ fi
cd "../$build" cd "../$build"
# run configure script # run configure script
../curl/configure $confopts 2>&1 ../$CURLDIR/configure $confopts 2>&1
if [ -f lib/Makefile ]; then if [ -f lib/Makefile ]; then
echo "testcurl: configure seems to have finished fine" echo "testcurl: configure seems to have finished fine"
@ -191,7 +214,7 @@ if { grep USE_ARES lib/config.h; } then
# run the ares configure # run the ares configure
cd ares cd ares
../../curl/ares/configure 2>&1 ../../$CURLDIR/ares/configure 2>&1
echo "testcurl: build ares" echo "testcurl: build ares"
make make
@ -220,8 +243,10 @@ else
echo "testcurl: the tests were successful!" echo "testcurl: the tests were successful!"
fi fi
# store the cvs status for the next time if [ $CVS -eq 1 ]; then
mv $newstat $oldstat # store the cvs status for the next time
mv $newstat $oldstat
fi
# get out of dir # get out of dir
cd .. cd ..