#!/bin/sh
#
+##
+## Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+##
+## Squid software is distributed under GPLv2+ license and includes
+## contributions from numerous individuals and organizations.
+## Please see the COPYING and CONTRIBUTORS files for details.
+##
# Run all or some build tests for a given OS environment.
#
top=`dirname $0`
cleanup="no"
verbose="no"
keepGoing="no"
+remove_cache_file="true"
while [ $# -ge 1 ]; do
case "$1" in
--cleanup)
keepGoing="yes"
shift
;;
+ --use-config-cache)
+ #environment variable will be picked up by buildtest.sh
+ cache_file=/tmp/config.cache.$$
+ export cache_file
+ shift
+ ;;
+ --aggressively-use-config-cache)
+ #environment variable will be picked up by buildtest.sh
+ #note: use ONLY if you know what you're doing
+ cache_file=/tmp/config.cache
+ remove_cache_file="false"
+ export cache_file
+ shift
+ ;;
*)
break
;;
btlayer="bt${layer}"
log=${btlayer}.log
echo "TESTING: ${layer}"
- rm -f -r ${btlayer} && mkdir ${btlayer}
+ if test -e ${btlayer}; then
+ chmod -R 777 ${btlayer};
+ fi
+ rm -f -r ${btlayer} || ( echo "FATAL: Failed to prepare test build sandpit." ; exit 1 )
+ mkdir ${btlayer}
+ if test "${verbose}" = "yes" ; then
+ ls -la ${btlayer}
+ fi
{
result=255
cd ${btlayer}
errors="^ERROR|\ error:|\ Error\ |No\ such|assertion\ failed|FAIL:|:\ undefined"
grep -E "${errors}" ${log}
- if test "${cleanup}" = "yes" ; then
- echo "REMOVE DATA: ${btlayer}"
- chmod -R 777 ${btlayer}
- rm -f -r ${btlayer}
- fi
-
if test $result -eq 0; then
# successful execution
- if test "$verbose" = yes; then
+ if test "${verbose}" = "yes"; then
echo "Build OK. Global result is $globalResult."
fi
+ if test "${cleanup}" = "yes" ; then
+ echo "REMOVE DATA: ${btlayer}"
+ chmod -R 777 ${btlayer}
+ rm -f -r ${btlayer}
+ echo "REMOVE LOG: ${log}"
+ rm -f -r ${log}
+ fi
else
- echo "Build Failed. Last log lines are:"
- tail -20 ${log}
- globalResult=1
- fi
-
- if test "${cleanup}" = "yes" ; then
- echo "REMOVE LOG: ${log}"
- rm -f -r ${log}
+ if test "${verbose}" != "yes" ; then
+ echo "Build Failed. Last log lines are:"
+ tail -20 ${log}
+ else
+ echo "Build FAILED."
+ fi
+ globalResult=1
fi
}
+# if using cache, make sure to clear it up first
+if [ -n "$cache_file" -a -e "$cache_file" -a "$remove_cache_file" = "true" ]; then
+ rm $cache_file
+fi
+
# Decide what tests to run, $* contains test spec names or filenames.
# Use all knows specs if $* is empty or a special macro called 'all'.
if test -n "$*" -a "$*" != all; then
fi
done
+# if using cache, make sure to clear it up first
+if [ -n "$cache_file" -a -e "$cache_file" -a "$remove_cache_file" = "true" ]; then
+ rm $cache_file
+fi
+
exit $globalResult