]>
git.ipfire.org Git - thirdparty/squid.git/blob - test-builds.sh
4 ## Copyright (C) 1996-2023 The Squid Software Foundation and contributors
6 ## Squid software is distributed under GPLv2+ license and includes
7 ## contributions from numerous individuals and organizations.
8 ## Please see the COPYING and CONTRIBUTORS files for details.
10 # Run all or some build tests for a given OS environment.
20 remove_cache_file
="true"
21 while [ $# -ge 1 ]; do
45 #environment variable will be picked up by buildtest.sh
46 cache_file
=${cache_file:-/tmp/config.cache.$$}
50 --aggressively-use-config-cache)
51 #environment variable will be picked up by buildtest.sh
52 #note: use ONLY if you know what you're doing
53 cache_file
=${cache_file:-/tmp/config.cache}
54 remove_cache_file
="false"
60 remove_cache_file
="false"
76 tee $1 |
awk '{printf "."; n++; if (!(n % 80)) print "" } END {print ""}'
86 layer
=`basename ${opts} .opts`
89 echo "TESTING: ${layer}"
90 if test -e ${btlayer}; then
91 chmod -R 777 ${btlayer};
93 rm -f -r ${btlayer} ||
( echo "FATAL: Failed to prepare test build sandpit." ; exit 1 )
95 if test "${verbose}" = "yes" ; then
101 if test -e $top/test-suite
/buildtest.sh
; then
102 $top/test-suite
/buildtest.sh
"${action}" ${opts} 2>&1
104 elif test -e ..
/$top/test-suite
/buildtest.sh
; then
105 ..
/$top/test-suite
/buildtest.sh
"${action}" ..
/${opts} 2>&1
108 echo "Error: cannot find $top/test-suite/buildtest.sh script"
112 # log the result for the outer script to notice
113 echo "buildtest.sh result is $result";
114 } 2>&1 | logtee
${log}
116 result
=1 # failure by default
117 if grep -q '^buildtest.sh result is 0$' ${log}; then
121 # Display BUILD parameters to double check that we are building the
122 # with the right parameters. TODO: Make less noisy.
123 grep -E "BUILD" ${log}
125 errors
="^ERROR|[ ]error:|[ ]Error[ ]|No[ ]such|assertion[ ]failed|FAIL:|:[ ]undefined"
126 grep -E "${errors}" ${log}
128 if test $result -eq 0; then
129 # successful execution
130 if test "${verbose}" = "yes"; then
131 echo "Build OK. Global result is $globalResult."
133 if test "${cleanup}" = "yes" ; then
134 echo "REMOVE DATA: ${btlayer}"
135 chmod -R 777 ${btlayer}
137 echo "REMOVE LOG: ${log}"
141 if test "${verbose}" != "yes" ; then
143 echo "Log start: ${log}"
145 echo "Log end: ${log}"
153 # if using cache, make sure to clear it up first
154 if [ -n "$cache_file" -a -e "$cache_file" -a "$remove_cache_file" = "true" ]; then
158 if [ -f "$top/configure" -a -f "$top/libltdl/configure" ]; then
159 echo "Already bootstrapped, skipping step"
161 (cd "$top"; .
/bootstrap.sh
)
164 # Decide what tests to run, $* contains test spec names or filenames.
165 # Use all knows specs if $* is empty or a special macro called 'all'.
166 if test -n "$*" -a "$*" != all
; then
169 tests
=`ls -1 $top/test-suite/buildtests/layer*.opts`
173 if test -e "$t"; then
174 # A configuration file
176 elif test -e "$top/test-suite/buildtests/${t}.opts"; then
177 # A well-known configuration name
178 cfg
="$top/test-suite/buildtests/${t}.opts"
180 echo "Error: Unknown test specs '$t'"
185 # run the test, if any
186 if test -n "$cfg"; then
187 buildtest
"$cfg" "$action"
190 # quit on errors unless we should $keepGoing
191 if test $globalResult -ne 0 -a $keepGoing != yes; then
196 # if using cache, make sure to clear it up first
197 if [ -n "$cache_file" -a -e "$cache_file" -a "$remove_cache_file" = "true" ]; then