]>
git.ipfire.org Git - thirdparty/squid.git/blob - test-builds.sh
4 ## Copyright (C) 1996-2018 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
=/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
=/tmp
/config.cache
50 remove_cache_file
="false"
61 if [ $verbose = yes ]; then
71 layer
=`basename ${opts} .opts`
74 echo "TESTING: ${layer}"
75 if test -e ${btlayer}; then
76 chmod -R 777 ${btlayer};
78 rm -f -r ${btlayer} ||
( echo "FATAL: Failed to prepare test build sandpit." ; exit 1 )
80 if test "${verbose}" = "yes" ; then
86 if test -e $top/test-suite
/buildtest.sh
; then
87 $top/test-suite
/buildtest.sh
"${action}" ${opts} 2>&1
89 elif test -e ..
/$top/test-suite
/buildtest.sh
; then
90 ..
/$top/test-suite
/buildtest.sh
"${action}" ..
/${opts} 2>&1
93 echo "Error: cannot find $top/test-suite/buildtest.sh script"
97 # log the result for the outer script to notice
98 echo "buildtest.sh result is $result";
99 } 2>&1 | logtee
${log}
101 result
=1 # failure by default
102 if grep -q '^buildtest.sh result is 0$' ${log}; then
106 # Display BUILD parameters to double check that we are building the
107 # with the right parameters. TODO: Make less noisy.
108 grep -E "BUILD" ${log}
110 errors
="^ERROR|\ error:|\ Error\ |No\ such|assertion\ failed|FAIL:|:\ undefined"
111 grep -E "${errors}" ${log}
113 if test $result -eq 0; then
114 # successful execution
115 if test "${verbose}" = "yes"; then
116 echo "Build OK. Global result is $globalResult."
118 if test "${cleanup}" = "yes" ; then
119 echo "REMOVE DATA: ${btlayer}"
120 chmod -R 777 ${btlayer}
122 echo "REMOVE LOG: ${log}"
126 if test "${verbose}" != "yes" ; then
127 echo "Build Failed. Last log lines are:"
136 # if using cache, make sure to clear it up first
137 if [ -n "$cache_file" -a -e "$cache_file" -a "$remove_cache_file" = "true" ]; then
141 # Decide what tests to run, $* contains test spec names or filenames.
142 # Use all knows specs if $* is empty or a special macro called 'all'.
143 if test -n "$*" -a "$*" != all
; then
146 tests
=`ls -1 $top/test-suite/buildtests/layer*.opts`
150 if test -e "$t"; then
151 # A configuration file
153 elif test -e "$top/test-suite/buildtests/${t}.opts"; then
154 # A well-known configuration name
155 cfg
="$top/test-suite/buildtests/${t}.opts"
157 echo "Error: Unknown test specs '$t'"
162 # run the test, if any
163 if test -n "$cfg"; then
164 buildtest
"$cfg" "$action"
167 # quit on errors unless we should $keepGoing
168 if test $globalResult -ne 0 -a $keepGoing != yes; then
173 # if using cache, make sure to clear it up first
174 if [ -n "$cache_file" -a -e "$cache_file" -a "$remove_cache_file" = "true" ]; then