]>
git.ipfire.org Git - thirdparty/squid.git/blob - test-builds.sh
4 ## Copyright (C) 1996-2021 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
41 #environment variable will be picked up by buildtest.sh
42 cache_file
=${cache_file:-/tmp/config.cache.$$}
46 --aggressively-use-config-cache)
47 #environment variable will be picked up by buildtest.sh
48 #note: use ONLY if you know what you're doing
49 cache_file
=${cache_file:-/tmp/config.cache}
50 remove_cache_file
="false"
56 remove_cache_file
="false"
67 if [ $verbose = yes ]; then
77 layer
=`basename ${opts} .opts`
80 echo "TESTING: ${layer}"
81 if test -e ${btlayer}; then
82 chmod -R 777 ${btlayer};
84 rm -f -r ${btlayer} ||
( echo "FATAL: Failed to prepare test build sandpit." ; exit 1 )
86 if test "${verbose}" = "yes" ; then
92 if test -e $top/test-suite
/buildtest.sh
; then
93 $top/test-suite
/buildtest.sh
"${action}" ${opts} 2>&1
95 elif test -e ..
/$top/test-suite
/buildtest.sh
; then
96 ..
/$top/test-suite
/buildtest.sh
"${action}" ..
/${opts} 2>&1
99 echo "Error: cannot find $top/test-suite/buildtest.sh script"
103 # log the result for the outer script to notice
104 echo "buildtest.sh result is $result";
105 } 2>&1 | logtee
${log}
107 result
=1 # failure by default
108 if grep -q '^buildtest.sh result is 0$' ${log}; then
112 # Display BUILD parameters to double check that we are building the
113 # with the right parameters. TODO: Make less noisy.
114 grep -E "BUILD" ${log}
116 errors
="^ERROR|\ error:|\ Error\ |No\ such|assertion\ failed|FAIL:|:\ undefined"
117 grep -E "${errors}" ${log}
119 if test $result -eq 0; then
120 # successful execution
121 if test "${verbose}" = "yes"; then
122 echo "Build OK. Global result is $globalResult."
124 if test "${cleanup}" = "yes" ; then
125 echo "REMOVE DATA: ${btlayer}"
126 chmod -R 777 ${btlayer}
128 echo "REMOVE LOG: ${log}"
132 if test "${verbose}" != "yes" ; then
133 echo "Build Failed. Last log lines are:"
142 # if using cache, make sure to clear it up first
143 if [ -n "$cache_file" -a -e "$cache_file" -a "$remove_cache_file" = "true" ]; then
147 # Decide what tests to run, $* contains test spec names or filenames.
148 # Use all knows specs if $* is empty or a special macro called 'all'.
149 if test -n "$*" -a "$*" != all
; then
152 tests
=`ls -1 $top/test-suite/buildtests/layer*.opts`
156 if test -e "$t"; then
157 # A configuration file
159 elif test -e "$top/test-suite/buildtests/${t}.opts"; then
160 # A well-known configuration name
161 cfg
="$top/test-suite/buildtests/${t}.opts"
163 echo "Error: Unknown test specs '$t'"
168 # run the test, if any
169 if test -n "$cfg"; then
170 buildtest
"$cfg" "$action"
173 # quit on errors unless we should $keepGoing
174 if test $globalResult -ne 0 -a $keepGoing != yes; then
179 # if using cache, make sure to clear it up first
180 if [ -n "$cache_file" -a -e "$cache_file" -a "$remove_cache_file" = "true" ]; then