]>
git.ipfire.org Git - thirdparty/squid.git/blob - test-builds.sh
3 # Run all or some build tests for a given OS environment.
12 remove_cache_file
="true"
13 while [ $# -ge 1 ]; do
28 #environment variable will be picked up by buildtest.sh
29 cache_file
=/tmp
/config.cache.$$
33 --aggressively-use-config-cache)
34 #environment variable will be picked up by buildtest.sh
35 #note: use ONLY if you know what you're doing
36 cache_file
=/tmp
/config.cache
37 remove_cache_file
="false"
48 if [ $verbose = yes ]; then
57 layer
=`basename ${opts} .opts`
60 echo "TESTING: ${layer}"
61 if test -e ${btlayer}; then
62 chmod -R 777 ${btlayer};
64 rm -f -r ${btlayer} ||
( echo "FATAL: Failed to prepare test build sandpit." ; exit 1 )
66 if test "${verbose}" = "yes" ; then
72 if test -e $top/test-suite
/buildtest.sh
; then
73 $top/test-suite
/buildtest.sh
${opts} 2>&1
75 elif test -e ..
/$top/test-suite
/buildtest.sh
; then
76 ..
/$top/test-suite
/buildtest.sh ..
/${opts} 2>&1
79 echo "Error: cannot find $top/test-suite/buildtest.sh script"
83 # log the result for the outer script to notice
84 echo "buildtest.sh result is $result";
85 } 2>&1 | logtee
${log}
87 result
=1 # failure by default
88 if grep -q '^buildtest.sh result is 0$' ${log}; then
92 # Display BUILD parameters to double check that we are building the
93 # with the right parameters. TODO: Make less noisy.
94 grep -E "BUILD" ${log}
96 errors
="^ERROR|\ error:|\ Error\ |No\ such|assertion\ failed|FAIL:|:\ undefined"
97 grep -E "${errors}" ${log}
99 if test $result -eq 0; then
100 # successful execution
101 if test "${verbose}" = "yes"; then
102 echo "Build OK. Global result is $globalResult."
104 if test "${cleanup}" = "yes" ; then
105 echo "REMOVE DATA: ${btlayer}"
106 chmod -R 777 ${btlayer}
108 echo "REMOVE LOG: ${log}"
112 if test "${verbose}" != "yes" ; then
113 echo "Build Failed. Last log lines are:"
122 # if using cache, make sure to clear it up first
123 if [ -n "$cache_file" -a -e "$cache_file" -a "$remove_cache_file" = "true" ]; then
127 # Decide what tests to run, $* contains test spec names or filenames.
128 # Use all knows specs if $* is empty or a special macro called 'all'.
129 if test -n "$*" -a "$*" != all
; then
132 tests
=`ls -1 $top/test-suite/buildtests/layer*.opts`
136 if test -e "$t"; then
137 # A configuration file
139 elif test -e "$top/test-suite/buildtests/${t}.opts"; then
140 # A well-known configuration name
141 cfg
="$top/test-suite/buildtests/${t}.opts"
143 echo "Error: Unknown test specs '$t'"
148 # run the test, if any
149 if test -n "$cfg"; then
153 # quit on errors unless we should $keepGoing
154 if test $globalResult -ne 0 -a $keepGoing != yes; then
159 # if using cache, make sure to clear it up first
160 if [ -n "$cache_file" -a -e "$cache_file" -a "$remove_cache_file" = "true" ]; then