]> git.ipfire.org Git - thirdparty/squid.git/blob - test-builds.sh
Author: frencesco chemolli <kinkie@squid-cache.org>
[thirdparty/squid.git] / test-builds.sh
1 #!/bin/sh
2 #
3 # Run specific build tests for a given OS environment.
4 #
5 top=`dirname $0`
6
7 cleanup="no"
8 verbose="no"
9 while [ $# -ge 1 ]; do
10 case "$1" in
11 --cleanup)
12 cleanup="yes"
13 shift
14 ;;
15 --verbose)
16 verbose="yes"
17 shift
18 ;;
19 *)
20 break
21 ;;
22 esac
23 done
24
25 # Things to catch
26 errors="^ERROR|\ error:|\ Error\ |No\ such|assertion\ failed|FAIL:"
27
28 logtee() {
29 if [ $verbose = yes ]; then
30 tee $1
31 else
32 cat >$1
33 fi
34 }
35
36 buildtest() {
37 opts=$1
38 layer=`basename $opts .opts`
39 btlayer="bt$layer"
40 log=${btlayer}.log
41 echo "TESTING: ${layer}"
42 rm -f -r ${btlayer} && mkdir ${btlayer}
43 {
44 cd ${btlayer}
45 if test -e $top/test-suite/buildtest.sh ; then
46 $top/test-suite/buildtest.sh $opts
47 elif test -e ../$top/test-suite/buildtest.sh ; then
48 ../$top/test-suite/buildtest.sh $opts
49 fi
50 } 2>&1 | logtee $log
51 grep -E "${errors}" $log && exit 1
52 if test "${cleanup}" = "yes" ; then
53 echo "REMOVE: ${btlayer}"
54 rm -f -r ${btlayer} $log
55 fi
56 result=`tail -2 $log | head -1`
57 test "${result}" = "Build Successful." || ( tail -5 $log ; exit 1 )
58 }
59
60 # Run a single test build by name or opts file
61 if [ -e "$1" ]; then
62
63 buildtest $1
64 exit 0
65 fi
66 tmp=`basename "${1}" .opts`
67 if test -e $top/test-suite/buildtests/${tmp}.opts ; then
68 buildtest $top/test-suite/buildtests/${tmp}.opts
69 exit 0
70 fi
71
72 #
73 # Run specific tests for each combination of configure-time
74 # Options.
75 #
76 # These layers are constructed from detailed knowledge of
77 # component dependencies.
78 #
79 for f in `ls -1 $top/test-suite/buildtests/layer*.opts` ; do
80 buildtest $f
81 done