📄 testcurl.sh
字号:
#!/bin/sh############################ 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# to "curl-autocompile@haxx.se" to be dealt with automaticly. The most# current build status (with a resonable backlog) will be published on the# curl site, at http://curl.haxx.se/auto/# USAGE:# testcurl.sh > output# version of this scriptversion=1fixed=0LANG="C"export LANGdie(){ echo "testcurl: ENDING HERE" exit 1}if [ -f setup ]; then . "./setup" infixed="$fixed"fiif [ -z "$name" ]; then echo "please enter your name" read name fixed="1"fiif [ -z "$email" ]; then echo "please enter your contact email address" read email fixed="2"fiif [ -z "$desc" ]; then echo "please enter a one line system desrciption" read desc fixed="3"fiif [ -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" fifiif [ "$fixed" -gt "0" ]; then echo "name='$name'" > setup echo "email='$email'" >> setup echo "desc='$desc'" >> setup echo "confopts='$confopts'" >> setup echo "fixed='$fixed'" >> setupfiecho "testcurl: STARTING HERE"echo "testcurl: NAME = $name"echo "testcurl: EMAIL = $email"echo "testcurl: DESC = $desc"echo "testcurl: CONFOPTS = $confopts"echo "testcurl: version = $version"echo "testcurl: date = `date -u`"# 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'`if [ -d curl -a -d curl/CVS ]; then echo "testcurl: curl is verified to be a fine source dir"else echo "testcurl: curl is not a source dir checked out from CVS!" diefibuild="build-$$"# remove any previous left-oversrm -rf build-*# create a dir to build inmkdir $buildif [ -d $build ]; then echo "testcurl: build dir $build was created fine"else echo "testcurl: failed to create dir $build" diefi# get in the curl source tree rootcd curlecho "testcurl: update from CVS"cvsup() { # update quietly to the latest CVS echo "testcurl: run cvs up" 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` echo "testcurl: failed CVS update attempt number $att." if [ $att -gt 10 ]; then cvsstat="111" break # get out of the loop fi sleep 5doneecho "testcurl: cvs returned: $cvsstat"if [ "$cvsstat" -ne "0" ]; then echo "testcurl: failed to update from CVS, exiting" diefi# figure out the current collected CVS statusnewstat="../allcvs.log"oldstat="../oldcvs.log"find . -name Entries -exec cat {} \; > "$newstat"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" fifi# remove possible left-overs from the pastrm -f configurerm -rf autom4te.cache# generate the build files./buildconf 2>&1if [ -f configure ]; then echo "testcurl: configure created"else echo "testcurl: no configure created" diefi# change to build dircd "../$build"# run configure script../curl/configure $confopts 2>&1if [ -f lib/Makefile ]; then echo "testcurl: configure seems to have finished fine"else echo "testcurl: configure didn't work" diefiecho "testcurl: display lib/config.h"grep "^ *#" lib/config.hif { grep USE_ARES lib/config.h; } then echo "testcurl: setup to build ares" # make an ares dir mkdir ares # run the ares configure cd ares ../../curl/ares/configure 2>&1 echo "testcurl: build ares" make echo "testcurl: ares is now built" # cd back to the curl build dir cd ..fiecho "testcurl: now run make"make -i 2>&1 | sed -e "s:$pwd::g"if [ -f src/curl ]; then echo "testcurl: src/curl was created fine"else echo "testcurl: src/curl was not created" diefiecho "testcurl: now run make test-full"make test-full 2>&1 | sed -e "s:$pwd::g" | tee build.logif { grep "^TESTFAIL:" build.log; } then echo "testcurl: the tests were not successful"else echo "testcurl: the tests were successful!" fi# store the cvs status for the next timemv $newstat $oldstat# get out of dircd ..# delete build dirrm -rf "$build"die
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -