2003-01-20 21:07:49 +01:00
|
|
|
#!/bin/sh
|
2004-02-23 08:17:13 +01:00
|
|
|
#***************************************************************************
|
|
|
|
# _ _ ____ _
|
|
|
|
# Project ___| | | | _ \| |
|
|
|
|
# / __| | | | |_) | |
|
|
|
|
# | (__| |_| | _ <| |___
|
|
|
|
# \___|\___/|_| \_\_____|
|
|
|
|
#
|
|
|
|
# Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
|
|
#
|
|
|
|
# This software is licensed as described in the file COPYING, which
|
|
|
|
# you should have received as part of this distribution. The terms
|
|
|
|
# are also available at http://curl.haxx.se/docs/copyright.html.
|
|
|
|
#
|
|
|
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
# copies of the Software, and permit persons to whom the Software is
|
|
|
|
# furnished to do so, under the terms of the COPYING file.
|
|
|
|
#
|
|
|
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
# KIND, either express or implied.
|
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
###########################################################################
|
2003-11-07 09:06:03 +01:00
|
|
|
|
2003-01-20 21:07:49 +01:00
|
|
|
###########################
|
|
|
|
# What is This Script?
|
|
|
|
###########################
|
|
|
|
|
|
|
|
# testcurl.sh is the master script to use for automatic testing of CVS-curl.
|
|
|
|
# This is written for the purpose of being run from a crontab job or similar
|
|
|
|
# at a regular interval. The output will be suitable to be mailed automaticly
|
2004-02-15 14:47:32 +01:00
|
|
|
# to "curl-autocompile@haxx.se" to be dealt with automatically. The most
|
2003-01-20 21:07:49 +01:00
|
|
|
# current build status (with a resonable backlog) will be published on the
|
2003-01-23 08:37:21 +01:00
|
|
|
# curl site, at http://curl.haxx.se/auto/
|
2003-01-20 21:07:49 +01:00
|
|
|
|
|
|
|
# USAGE:
|
2003-11-07 09:06:03 +01:00
|
|
|
# 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.
|
2003-01-20 21:07:49 +01:00
|
|
|
|
|
|
|
# version of this script
|
2004-02-23 08:17:13 +01:00
|
|
|
version="$Revision$"
|
2003-01-20 21:07:49 +01:00
|
|
|
fixed=0
|
|
|
|
|
2003-11-07 09:06:03 +01:00
|
|
|
# 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
|
|
|
|
|
2003-01-22 10:46:33 +01:00
|
|
|
LANG="C"
|
|
|
|
|
|
|
|
export LANG
|
|
|
|
|
2004-02-19 13:56:45 +01:00
|
|
|
log() {
|
|
|
|
text=$1
|
|
|
|
if test -n "$text"; then
|
|
|
|
echo "testcurl: $text"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2003-01-20 21:07:49 +01:00
|
|
|
die(){
|
2004-02-19 13:56:45 +01:00
|
|
|
text=$1
|
|
|
|
log "$text"
|
2004-02-23 08:08:59 +01:00
|
|
|
cd $pwd # cd back to the original root dir
|
2004-02-19 13:56:45 +01:00
|
|
|
|
2004-02-19 13:10:07 +01:00
|
|
|
if test -n "$pwd/$build"; then
|
2003-12-15 09:14:30 +01:00
|
|
|
# we have a build directory name, remove the dir
|
2004-02-19 13:56:45 +01:00
|
|
|
log "removing the $build dir"
|
2004-02-19 13:10:07 +01:00
|
|
|
rm -rf "$pwd/$build"
|
|
|
|
fi
|
2004-02-19 13:56:45 +01:00
|
|
|
if test -r "$pwd/$buildlog"; then
|
2004-02-19 13:10:07 +01:00
|
|
|
# we have a build log output file left, remove it
|
2004-02-19 13:56:45 +01:00
|
|
|
log "removing the $buildlog file"
|
|
|
|
rm -rf "$buildlog"
|
2003-12-15 09:14:30 +01:00
|
|
|
fi
|
2004-02-19 13:56:45 +01:00
|
|
|
log "ENDING HERE" # last line logged!
|
2003-01-21 11:33:29 +01:00
|
|
|
exit 1
|
2003-01-20 21:07:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if [ -f setup ]; then
|
|
|
|
. "./setup"
|
2003-01-22 08:57:52 +01:00
|
|
|
infixed="$fixed"
|
2003-11-07 09:06:03 +01:00
|
|
|
else
|
|
|
|
infixed=0 # so that "additional args to configure" works properly first time...
|
2003-01-20 21:07:49 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$name" ]; then
|
|
|
|
echo "please enter your name"
|
|
|
|
read name
|
|
|
|
fixed="1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$email" ]; then
|
|
|
|
echo "please enter your contact email address"
|
|
|
|
read email
|
|
|
|
fixed="2"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$desc" ]; then
|
2004-01-05 15:20:08 +01:00
|
|
|
echo "please enter a one line system description"
|
2003-01-20 21:07:49 +01:00
|
|
|
read desc
|
|
|
|
fixed="3"
|
|
|
|
fi
|
|
|
|
|
2003-01-23 08:37:21 +01:00
|
|
|
if [ -z "$confopts" ]; then
|
|
|
|
if [ $infixed -lt 4 ]; then
|
|
|
|
echo "please enter your additional arguments to configure"
|
|
|
|
echo "examples: --with-ssl --enable-debug --enable-ipv6 --with-krb4"
|
|
|
|
read confopts
|
|
|
|
fixed="4"
|
|
|
|
fi
|
2003-01-22 07:59:52 +01:00
|
|
|
fi
|
|
|
|
|
2003-01-20 21:07:49 +01:00
|
|
|
|
|
|
|
if [ "$fixed" -gt "0" ]; then
|
|
|
|
echo "name='$name'" > setup
|
|
|
|
echo "email='$email'" >> setup
|
|
|
|
echo "desc='$desc'" >> setup
|
2003-01-22 07:59:52 +01:00
|
|
|
echo "confopts='$confopts'" >> setup
|
2003-01-22 08:57:52 +01:00
|
|
|
echo "fixed='$fixed'" >> setup
|
2003-01-20 21:07:49 +01:00
|
|
|
fi
|
|
|
|
|
2004-02-19 13:56:45 +01:00
|
|
|
log "STARTING HERE" # first line logged
|
|
|
|
log "NAME = $name"
|
|
|
|
log "EMAIL = $email"
|
|
|
|
log "DESC = $desc"
|
|
|
|
log "CONFOPTS = $confopts"
|
|
|
|
log "version = $version"
|
|
|
|
log "date = `date -u`"
|
2003-01-20 21:07:49 +01:00
|
|
|
|
|
|
|
# Make $pwd to become the path without newline. We'll use that in order to cut
|
|
|
|
# off that path from all possible logs and error messages etc.
|
|
|
|
ipwd=`pwd`
|
|
|
|
pwd=`echo $ipwd | sed -e 's/$//g'`
|
|
|
|
|
2003-11-07 09:06:03 +01:00
|
|
|
if [ -d "$CURLDIR" ]; then
|
|
|
|
if [ $CVS -eq 1 -a -d $CURLDIR/CVS ]; then
|
2004-02-19 13:56:45 +01:00
|
|
|
log "curl is verified to be a fine source dir"
|
2003-11-07 09:06:03 +01:00
|
|
|
elif [ $CVS -eq 0 -a -f $CURLDIR/testcurl.sh ]; then
|
2004-02-19 13:56:45 +01:00
|
|
|
log "curl is verified to be a fine daily source dir"
|
2003-11-07 09:06:03 +01:00
|
|
|
else
|
2004-02-19 13:56:45 +01:00
|
|
|
die "curl is not a daily source dir or checked out from CVS!"
|
2003-11-07 09:06:03 +01:00
|
|
|
fi
|
2003-01-20 21:07:49 +01:00
|
|
|
fi
|
2003-01-20 21:20:51 +01:00
|
|
|
build="build-$$"
|
2004-02-19 13:56:45 +01:00
|
|
|
buildlog="buildlog-$$"
|
2003-01-20 21:20:51 +01:00
|
|
|
|
2003-01-20 21:07:49 +01:00
|
|
|
# remove any previous left-overs
|
2003-02-17 10:15:26 +01:00
|
|
|
rm -rf build-*
|
2004-02-23 08:08:59 +01:00
|
|
|
rm -rf buildlog-*
|
2003-01-20 21:07:49 +01:00
|
|
|
|
|
|
|
# create a dir to build in
|
2003-01-20 21:20:51 +01:00
|
|
|
mkdir $build
|
2003-01-20 21:07:49 +01:00
|
|
|
|
2003-01-22 07:59:52 +01:00
|
|
|
if [ -d $build ]; then
|
2004-02-19 13:56:45 +01:00
|
|
|
log "build dir $build was created fine"
|
2003-01-22 07:59:52 +01:00
|
|
|
else
|
2004-02-19 13:56:45 +01:00
|
|
|
die "failed to create dir $build"
|
2003-01-22 07:59:52 +01:00
|
|
|
fi
|
|
|
|
|
2003-01-20 21:07:49 +01:00
|
|
|
# get in the curl source tree root
|
2003-11-07 09:06:03 +01:00
|
|
|
cd $CURLDIR
|
|
|
|
|
|
|
|
# Do the CVS thing, or not...
|
|
|
|
if [ $CVS -eq 1 ]; then
|
2004-02-19 13:56:45 +01:00
|
|
|
log "update from CVS"
|
2003-11-07 09:06:03 +01:00
|
|
|
|
|
|
|
cvsup() {
|
|
|
|
# update quietly to the latest CVS
|
2004-02-19 13:56:45 +01:00
|
|
|
log "run cvs up"
|
2003-11-07 09:06:03 +01:00
|
|
|
cvs -Q up -dP 2>&1
|
|
|
|
|
|
|
|
cvsstat=$?
|
|
|
|
|
|
|
|
# return (1 - RETURNVALUE) so that errors return 0 while goodness
|
|
|
|
# returns 1
|
|
|
|
return `expr 1 - $cvsstat`
|
|
|
|
}
|
|
|
|
|
|
|
|
att="0"
|
|
|
|
while cvsup; do
|
|
|
|
att=`expr $att + 1`
|
2004-02-19 13:56:45 +01:00
|
|
|
log "failed CVS update attempt number $att."
|
2003-11-07 09:06:03 +01:00
|
|
|
if [ $att -gt 10 ]; then
|
|
|
|
cvsstat="111"
|
|
|
|
break # get out of the loop
|
|
|
|
fi
|
|
|
|
sleep 5
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$cvsstat" -ne "0" ]; then
|
2004-02-19 13:56:45 +01:00
|
|
|
die "failed to update from CVS ($cvsstat), exiting"
|
2003-05-27 14:03:24 +02:00
|
|
|
fi
|
2003-11-07 09:06:03 +01:00
|
|
|
|
|
|
|
# remove possible left-overs from the past
|
|
|
|
rm -f configure
|
|
|
|
rm -rf autom4te.cache
|
2003-01-20 21:07:49 +01:00
|
|
|
|
2003-11-07 09:06:03 +01:00
|
|
|
# generate the build files
|
2004-02-19 13:56:45 +01:00
|
|
|
./buildconf 2>&1 | tee $buildlog
|
2004-01-29 08:29:28 +01:00
|
|
|
|
2004-02-19 13:56:45 +01:00
|
|
|
if { grep "^buildconf: OK" $buildlog >/dev/null 2>&1; } then
|
|
|
|
log "buildconf was successful"
|
2004-01-29 08:29:28 +01:00
|
|
|
else
|
2004-02-19 13:56:45 +01:00
|
|
|
die "buildconf was NOT successful"
|
2004-01-29 08:29:28 +01:00
|
|
|
fi
|
|
|
|
|
2003-11-07 09:06:03 +01:00
|
|
|
fi
|
2003-01-20 21:07:49 +01:00
|
|
|
|
|
|
|
if [ -f configure ]; then
|
2004-02-19 13:56:45 +01:00
|
|
|
log "configure created"
|
2003-01-20 21:07:49 +01:00
|
|
|
else
|
2004-02-19 13:56:45 +01:00
|
|
|
die "no configure created"
|
2003-01-20 21:07:49 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# change to build dir
|
2003-01-20 21:20:51 +01:00
|
|
|
cd "../$build"
|
2003-01-20 21:07:49 +01:00
|
|
|
|
|
|
|
# run configure script
|
2003-11-07 09:06:03 +01:00
|
|
|
../$CURLDIR/configure $confopts 2>&1
|
2003-01-20 21:07:49 +01:00
|
|
|
|
|
|
|
if [ -f lib/Makefile ]; then
|
2004-02-19 13:56:45 +01:00
|
|
|
log "configure seems to have finished fine"
|
2003-01-20 21:07:49 +01:00
|
|
|
else
|
2004-02-19 13:56:45 +01:00
|
|
|
die "configure didn't work"
|
2003-01-20 21:07:49 +01:00
|
|
|
fi
|
|
|
|
|
2004-02-19 13:56:45 +01:00
|
|
|
log "display lib/config.h"
|
2003-01-22 07:59:52 +01:00
|
|
|
grep "^ *#" lib/config.h
|
|
|
|
|
2003-12-12 16:06:17 +01:00
|
|
|
if { grep "define USE_ARES" lib/config.h; } then
|
2004-02-19 13:56:45 +01:00
|
|
|
log "setup to build ares"
|
2003-10-25 00:30:40 +02:00
|
|
|
|
2004-02-19 13:56:45 +01:00
|
|
|
log "build ares"
|
2003-12-11 11:20:44 +01:00
|
|
|
cd ares
|
2004-02-13 08:15:36 +01:00
|
|
|
make 2>&1 | sed -e "s:$pwd::g"
|
2004-02-19 13:56:45 +01:00
|
|
|
|
2004-02-19 17:24:22 +01:00
|
|
|
if [ -f libcares.a ]; then
|
2004-02-19 13:56:45 +01:00
|
|
|
log "ares is now built successfully"
|
|
|
|
else
|
|
|
|
log "ares build failed"
|
|
|
|
fi
|
2003-10-25 00:30:40 +02:00
|
|
|
|
|
|
|
# cd back to the curl build dir
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
2004-02-19 13:56:45 +01:00
|
|
|
log "run make"
|
2003-01-22 07:59:52 +01:00
|
|
|
make -i 2>&1 | sed -e "s:$pwd::g"
|
2003-01-20 21:07:49 +01:00
|
|
|
|
|
|
|
if [ -f src/curl ]; then
|
2004-02-19 13:56:45 +01:00
|
|
|
log "src/curl was created fine"
|
2003-01-20 21:07:49 +01:00
|
|
|
else
|
2004-02-19 13:56:45 +01:00
|
|
|
die "src/curl was not created"
|
2003-01-20 21:07:49 +01:00
|
|
|
fi
|
|
|
|
|
2004-02-19 13:56:45 +01:00
|
|
|
log "run make test-full"
|
|
|
|
make test-full 2>&1 | sed -e "s:$pwd::g" | tee $buildlog
|
2003-01-20 21:07:49 +01:00
|
|
|
|
2004-02-19 13:56:45 +01:00
|
|
|
if { grep "^TEST" $buildlog >/dev/null 2>&1; } then
|
|
|
|
log "tests were run"
|
2003-01-20 21:07:49 +01:00
|
|
|
else
|
2004-02-19 13:56:45 +01:00
|
|
|
die "test suite failure"
|
2003-01-20 21:07:49 +01:00
|
|
|
fi
|
|
|
|
|
2004-02-19 13:56:45 +01:00
|
|
|
if { grep "^TESTFAIL:" $buildlog >/dev/null 2>&1; } then
|
|
|
|
log "the tests were not successful"
|
|
|
|
else
|
|
|
|
log "the tests were successful!"
|
|
|
|
fi
|
2003-01-20 21:07:49 +01:00
|
|
|
|
2004-02-19 13:56:45 +01:00
|
|
|
# die to cleanup
|
|
|
|
die "ending nicely"
|