2003-01-20 15:07:49 -05:00
|
|
|
#!/bin/sh
|
2004-02-23 02:17:13 -05: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 03:06:03 -05:00
|
|
|
|
2003-01-20 15:07:49 -05: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 08:47:32 -05:00
|
|
|
# to "curl-autocompile@haxx.se" to be dealt with automatically. The most
|
2003-01-20 15:07:49 -05:00
|
|
|
# current build status (with a resonable backlog) will be published on the
|
2003-01-23 02:37:21 -05:00
|
|
|
# curl site, at http://curl.haxx.se/auto/
|
2003-01-20 15:07:49 -05:00
|
|
|
|
|
|
|
# USAGE:
|
2003-11-07 03:06:03 -05: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 15:07:49 -05:00
|
|
|
|
|
|
|
# version of this script
|
2004-02-23 02:32:45 -05:00
|
|
|
version='$Revision$'
|
2003-01-20 15:07:49 -05:00
|
|
|
fixed=0
|
|
|
|
|
2003-11-07 03:06:03 -05: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 04:46:33 -05:00
|
|
|
LANG="C"
|
|
|
|
|
|
|
|
export LANG
|
|
|
|
|
2004-02-19 07:56:45 -05:00
|
|
|
log() {
|
|
|
|
text=$1
|
|
|
|
if test -n "$text"; then
|
|
|
|
echo "testcurl: $text"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2003-01-20 15:07:49 -05:00
|
|
|
die(){
|
2004-02-19 07:56:45 -05:00
|
|
|
text=$1
|
|
|
|
log "$text"
|
2004-02-23 02:08:59 -05:00
|
|
|
cd $pwd # cd back to the original root dir
|
2004-02-19 07:56:45 -05:00
|
|
|
|
2004-02-19 07:10:07 -05:00
|
|
|
if test -n "$pwd/$build"; then
|
2003-12-15 03:14:30 -05:00
|
|
|
# we have a build directory name, remove the dir
|
2004-02-19 07:56:45 -05:00
|
|
|
log "removing the $build dir"
|
2004-02-19 07:10:07 -05:00
|
|
|
rm -rf "$pwd/$build"
|
|
|
|
fi
|
2004-02-26 02:58:49 -05:00
|
|
|
if test -r "$buildlog"; then
|
2004-02-19 07:10:07 -05:00
|
|
|
# we have a build log output file left, remove it
|
2004-02-26 02:58:49 -05:00
|
|
|
log "removing the $buildlogname file"
|
2004-02-19 07:56:45 -05:00
|
|
|
rm -rf "$buildlog"
|
2003-12-15 03:14:30 -05:00
|
|
|
fi
|
2004-02-19 07:56:45 -05:00
|
|
|
log "ENDING HERE" # last line logged!
|
2003-01-21 05:33:29 -05:00
|
|
|
exit 1
|
2003-01-20 15:07:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if [ -f setup ]; then
|
|
|
|
. "./setup"
|
2003-01-22 02:57:52 -05:00
|
|
|
infixed="$fixed"
|
2003-11-07 03:06:03 -05:00
|
|
|
else
|
|
|
|
infixed=0 # so that "additional args to configure" works properly first time...
|
2003-01-20 15:07:49 -05: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 09:20:08 -05:00
|
|
|
echo "please enter a one line system description"
|
2003-01-20 15:07:49 -05:00
|
|
|
read desc
|
|
|
|
fixed="3"
|
|
|
|
fi
|
|
|
|
|
2003-01-23 02:37:21 -05: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 01:59:52 -05:00
|
|
|
fi
|
|
|
|
|
2003-01-20 15:07:49 -05:00
|
|
|
|
|
|
|
if [ "$fixed" -gt "0" ]; then
|
|
|
|
echo "name='$name'" > setup
|
|
|
|
echo "email='$email'" >> setup
|
|
|
|
echo "desc='$desc'" >> setup
|
2003-01-22 01:59:52 -05:00
|
|
|
echo "confopts='$confopts'" >> setup
|
2003-01-22 02:57:52 -05:00
|
|
|
echo "fixed='$fixed'" >> setup
|
2003-01-20 15:07:49 -05:00
|
|
|
fi
|
|
|
|
|
2004-02-19 07:56:45 -05:00
|
|
|
log "STARTING HERE" # first line logged
|
|
|
|
log "NAME = $name"
|
|
|
|
log "EMAIL = $email"
|
|
|
|
log "DESC = $desc"
|
|
|
|
log "CONFOPTS = $confopts"
|
2004-02-25 04:03:09 -05:00
|
|
|
log "CFLAGS = $CFLAGS"
|
|
|
|
log "CC = $CC"
|
2004-02-19 07:56:45 -05:00
|
|
|
log "version = $version"
|
|
|
|
log "date = `date -u`"
|
2003-01-20 15:07:49 -05: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 03:06:03 -05:00
|
|
|
if [ -d "$CURLDIR" ]; then
|
|
|
|
if [ $CVS -eq 1 -a -d $CURLDIR/CVS ]; then
|
2004-02-19 07:56:45 -05:00
|
|
|
log "curl is verified to be a fine source dir"
|
2004-02-26 08:59:10 -05:00
|
|
|
# remove the generated sources to force them to be re-generated each
|
|
|
|
# time we run this test
|
|
|
|
rm -f $CURLDIR/lib/getdate.c
|
|
|
|
rm -f $CURLDIR/src/hugehelp.c
|
2003-11-07 03:06:03 -05:00
|
|
|
elif [ $CVS -eq 0 -a -f $CURLDIR/testcurl.sh ]; then
|
2004-02-19 07:56:45 -05:00
|
|
|
log "curl is verified to be a fine daily source dir"
|
2003-11-07 03:06:03 -05:00
|
|
|
else
|
2004-02-19 07:56:45 -05:00
|
|
|
die "curl is not a daily source dir or checked out from CVS!"
|
2003-11-07 03:06:03 -05:00
|
|
|
fi
|
2003-01-20 15:07:49 -05:00
|
|
|
fi
|
2003-01-20 15:20:51 -05:00
|
|
|
build="build-$$"
|
2004-02-26 02:58:49 -05:00
|
|
|
buildlogname="buildlog-$$"
|
|
|
|
buildlog="$pwd/$buildlogname"
|
2003-01-20 15:20:51 -05:00
|
|
|
|
2003-01-20 15:07:49 -05:00
|
|
|
# remove any previous left-overs
|
2003-02-17 04:15:26 -05:00
|
|
|
rm -rf build-*
|
2004-02-23 02:08:59 -05:00
|
|
|
rm -rf buildlog-*
|
2003-01-20 15:07:49 -05:00
|
|
|
|
2004-02-26 02:58:49 -05:00
|
|
|
# this is to remove old build logs that ended up in the wrong dir
|
|
|
|
rm -rf $CURLDIR/buildlog-*
|
|
|
|
|
2003-01-20 15:07:49 -05:00
|
|
|
# create a dir to build in
|
2003-01-20 15:20:51 -05:00
|
|
|
mkdir $build
|
2003-01-20 15:07:49 -05:00
|
|
|
|
2003-01-22 01:59:52 -05:00
|
|
|
if [ -d $build ]; then
|
2004-02-19 07:56:45 -05:00
|
|
|
log "build dir $build was created fine"
|
2003-01-22 01:59:52 -05:00
|
|
|
else
|
2004-02-19 07:56:45 -05:00
|
|
|
die "failed to create dir $build"
|
2003-01-22 01:59:52 -05:00
|
|
|
fi
|
|
|
|
|
2003-01-20 15:07:49 -05:00
|
|
|
# get in the curl source tree root
|
2003-11-07 03:06:03 -05:00
|
|
|
cd $CURLDIR
|
|
|
|
|
|
|
|
# Do the CVS thing, or not...
|
|
|
|
if [ $CVS -eq 1 ]; then
|
2004-03-09 06:24:36 -05:00
|
|
|
|
|
|
|
# this is a temporary fix to make things work again, remove later
|
|
|
|
log "remove ares/aclocal.m4"
|
|
|
|
rm -f ares/aclocal.m4
|
|
|
|
|
2004-02-19 07:56:45 -05:00
|
|
|
log "update from CVS"
|
2003-11-07 03:06:03 -05:00
|
|
|
|
|
|
|
cvsup() {
|
|
|
|
# update quietly to the latest CVS
|
2004-02-19 07:56:45 -05:00
|
|
|
log "run cvs up"
|
2003-11-07 03:06:03 -05: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 07:56:45 -05:00
|
|
|
log "failed CVS update attempt number $att."
|
2003-11-07 03:06:03 -05: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 07:56:45 -05:00
|
|
|
die "failed to update from CVS ($cvsstat), exiting"
|
2003-05-27 08:03:24 -04:00
|
|
|
fi
|
2003-11-07 03:06:03 -05:00
|
|
|
|
|
|
|
# remove possible left-overs from the past
|
|
|
|
rm -f configure
|
|
|
|
rm -rf autom4te.cache
|
2003-01-20 15:07:49 -05:00
|
|
|
|
2003-11-07 03:06:03 -05:00
|
|
|
# generate the build files
|
2004-03-01 08:14:26 -05:00
|
|
|
log "invoke buildconf, but filter off the silly aclocal warnings"
|
|
|
|
./buildconf 2>&1 | grep -v "warning: underquoted definition of" | tee $buildlog
|
2004-01-29 02:29:28 -05:00
|
|
|
|
2004-02-19 07:56:45 -05:00
|
|
|
if { grep "^buildconf: OK" $buildlog >/dev/null 2>&1; } then
|
|
|
|
log "buildconf was successful"
|
2004-01-29 02:29:28 -05:00
|
|
|
else
|
2004-02-19 07:56:45 -05:00
|
|
|
die "buildconf was NOT successful"
|
2004-01-29 02:29:28 -05:00
|
|
|
fi
|
|
|
|
|
2003-11-07 03:06:03 -05:00
|
|
|
fi
|
2003-01-20 15:07:49 -05:00
|
|
|
|
|
|
|
if [ -f configure ]; then
|
2004-02-19 07:56:45 -05:00
|
|
|
log "configure created"
|
2003-01-20 15:07:49 -05:00
|
|
|
else
|
2004-02-19 07:56:45 -05:00
|
|
|
die "no configure created"
|
2003-01-20 15:07:49 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
# change to build dir
|
2003-01-20 15:20:51 -05:00
|
|
|
cd "../$build"
|
2003-01-20 15:07:49 -05:00
|
|
|
|
|
|
|
# run configure script
|
2003-11-07 03:06:03 -05:00
|
|
|
../$CURLDIR/configure $confopts 2>&1
|
2003-01-20 15:07:49 -05:00
|
|
|
|
|
|
|
if [ -f lib/Makefile ]; then
|
2004-02-19 07:56:45 -05:00
|
|
|
log "configure seems to have finished fine"
|
2003-01-20 15:07:49 -05:00
|
|
|
else
|
2004-02-19 07:56:45 -05:00
|
|
|
die "configure didn't work"
|
2003-01-20 15:07:49 -05:00
|
|
|
fi
|
|
|
|
|
2004-02-19 07:56:45 -05:00
|
|
|
log "display lib/config.h"
|
2003-01-22 01:59:52 -05:00
|
|
|
grep "^ *#" lib/config.h
|
|
|
|
|
2004-03-02 04:50:37 -05:00
|
|
|
log "display src/config.h"
|
|
|
|
grep "^ *#" src/config.h
|
|
|
|
|
2003-12-12 10:06:17 -05:00
|
|
|
if { grep "define USE_ARES" lib/config.h; } then
|
2004-02-19 07:56:45 -05:00
|
|
|
log "setup to build ares"
|
2003-10-24 18:30:40 -04:00
|
|
|
|
2004-02-19 07:56:45 -05:00
|
|
|
log "build ares"
|
2003-12-11 05:20:44 -05:00
|
|
|
cd ares
|
2004-02-13 02:15:36 -05:00
|
|
|
make 2>&1 | sed -e "s:$pwd::g"
|
2004-02-19 07:56:45 -05:00
|
|
|
|
2004-02-19 11:24:22 -05:00
|
|
|
if [ -f libcares.a ]; then
|
2004-02-19 07:56:45 -05:00
|
|
|
log "ares is now built successfully"
|
|
|
|
else
|
|
|
|
log "ares build failed"
|
|
|
|
fi
|
2003-10-24 18:30:40 -04:00
|
|
|
|
|
|
|
# cd back to the curl build dir
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
2004-02-19 07:56:45 -05:00
|
|
|
log "run make"
|
2003-01-22 01:59:52 -05:00
|
|
|
make -i 2>&1 | sed -e "s:$pwd::g"
|
2003-01-20 15:07:49 -05:00
|
|
|
|
|
|
|
if [ -f src/curl ]; then
|
2004-02-19 07:56:45 -05:00
|
|
|
log "src/curl was created fine"
|
2003-01-20 15:07:49 -05:00
|
|
|
else
|
2004-02-19 07:56:45 -05:00
|
|
|
die "src/curl was not created"
|
2003-01-20 15:07:49 -05:00
|
|
|
fi
|
|
|
|
|
2004-03-03 09:46:37 -05:00
|
|
|
log "display curl --version output"
|
|
|
|
|
|
|
|
./src/curl --version
|
|
|
|
|
2004-02-19 07:56:45 -05:00
|
|
|
log "run make test-full"
|
|
|
|
make test-full 2>&1 | sed -e "s:$pwd::g" | tee $buildlog
|
2003-01-20 15:07:49 -05:00
|
|
|
|
2004-02-19 07:56:45 -05:00
|
|
|
if { grep "^TEST" $buildlog >/dev/null 2>&1; } then
|
|
|
|
log "tests were run"
|
2003-01-20 15:07:49 -05:00
|
|
|
else
|
2004-02-19 07:56:45 -05:00
|
|
|
die "test suite failure"
|
2003-01-20 15:07:49 -05:00
|
|
|
fi
|
|
|
|
|
2004-02-19 07:56:45 -05: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 15:07:49 -05:00
|
|
|
|
2004-02-19 07:56:45 -05:00
|
|
|
# die to cleanup
|
|
|
|
die "ending nicely"
|