]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Henrik Nordstrom <hno@squid-cache.org>
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 23 Feb 2009 10:33:39 +0000 (23:33 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 23 Feb 2009 10:33:39 +0000 (23:33 +1300)
TestBed: Allow out-of-tree builds and separate .opts files.

logfile creation moved to test-builds.sh, where it's used.

--verbose mode for showing the actual output while tests is running

test-build.sh generally cleaned up a bit with less duplicated code

1  2 
test-builds.sh

diff --cc test-builds.sh
index a8a9d2f4ed054b213e1523cd3e9c5d4cbb731564,d72dd94f38be4269d7d774bdc1412a2b10def7e0..36a2e4ca471354a2a69f92e973974913196abd62
@@@ -12,14 -25,43 +25,47 @@@ don
  # 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