#
# Run specific build tests for a given OS environment.
#
+ top=`dirname $0`
cleanup="no"
- if test "${1}" = "--cleanup" ; then
+ verbose="no"
+ while [ $# -ge 1 ]; do
+ case "$1" in
+ --cleanup)
cleanup="yes"
shift
- fi
+ ;;
+ --verbose)
+ verbose="yes"
+ shift
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
# Things to catch
errors="^ERROR|\ error:|\ Error\ |No\ such|assertion\ failed|FAIL:"
- # Run a single test build by name
- tmp="${1}"
- if test -e ./test-suite/buildtests/${tmp}.opts ; then
- echo "TESTING: ${tmp}"
- rm -f -r bt${tmp} && mkdir bt${tmp} && cd bt${tmp}
- ../test-suite/buildtest.sh ../test-suite/buildtests/${tmp}
- grep -E "${errors}" buildtest_*.log && exit 1
- cd ..
+ logtee() {
+ if [ $verbose = yes ]; then
+ tee $1
+ else
+ cat >$1
+ fi
+ }
+
+ buildtest() {
+ opts=$1
+ layer=`basename $opts .opts`
+ btlayer="bt$layer"
+ log=${btlayer}.log
+ echo "TESTING: ${layer}"
+ rm -f -r ${btlayer} && mkdir ${btlayer}
+ {
+ cd ${btlayer}
- $top/test-suite/buildtest.sh $opts
++ if test -e $top/test-suite/buildtest.sh ; then
++ $top/test-suite/buildtest.sh $opts
++ elif test -e ../$top/test-suite/buildtest.sh ; then
++ ../$top/test-suite/buildtest.sh $opts
++ fi
+ } 2>&1 | logtee $log
+ grep -E "${errors}" $log && exit 1
+ if test "${cleanup}" = "yes" ; then
+ echo "REMOVE: ${btlayer}"
+ rm -f -r ${btlayer} $log
+ fi
+ result=`tail -2 $log | head -1`
+ test "${result}" = "Build Successful." || ( tail -5 $log ; exit 1 )
+ }
+
+ # Run a single test build by name or opts file
+ if [ -e "$1" ]; then
+
+ buildtest $1
+ exit 0
+ fi
+ tmp=`basename "${1}" .opts`
+ if test -e $top/test-suite/buildtests/${tmp}.opts ; then
+ buildtest $top/test-suite/buildtests/${tmp}.opts
exit 0
fi
# These layers are constructed from detailed knowledge of
# component dependencies.
#
- for f in `ls -1 ./test-suite/buildtests/layer*.opts` ; do
- layer=`echo "${f}" | grep -o -E "layer-[0-9]*-[^\.]*"`
- rm -f -r bt${layer} && mkdir bt${layer} && cd bt${layer}
- arg=`echo "${f}" | sed s/\\.opts//`
- echo "TESTING: ${arg}"
- ../test-suite/buildtest.sh ".${arg}"
- grep -E "${errors}" buildtest_*.log && exit 1
- result=`tail -2 buildtest_*.log | head -1`
- test "${result}" = "Build Successful." || ( tail -5 buildtest_*.log ; exit 1 )
- cd ..
- if test "${cleanup}" = "yes" ; then
- echo "REMOVE: bt${layer}"
- rm -f -r bt${layer}
- fi
+ for f in `ls -1 $top/test-suite/buildtests/layer*.opts` ; do
+ buildtest $f
done