1#!/bin/sh 2 3# Do an automated test which involves building and regtesting version 4# 1.9 of the GNU Scientific Library (gsl). This has proven to be a 5# very thorough test of Vex's CPU simulations and has exposed bugs 6# which had not been previously discovered. Gsl 1.9 contains more 7# than 6 million tests as part of its regression suite, and so this 8# script's purpose is to runs those tests using valgrind and compare 9# against the same tests run natively. Note that it produces a 10# huge amount of output (about 2 x 620 MByte), so be careful. 11# The older gsl16test script produces only about 2 x 7 MByte per run. 12# 13# You can download gsl and get more info about it at 14# http://www.gnu.org/software/gsl 15 16 17 18# Args: 19# absolute name of gsl-1.9.tar.gz file 20# name of C compiler 21# args for C compiler 22# name of Valgrind 23# args for Valgrind 24 25# Results: 3.7.0 --tool=none 26# x86 1 failure Ubuntu 10.10 27# FAIL: qawo(f456) elist (7.25063790881233303e-15 observed vs 7.25922435194575979e-15 expected) 28# same failure was also present in 3.6.1 29# s390x 0 failures on z196 running SLES11 30 31if [ $# != 5 ] 32then 33 echo "usage: gsl19test /absolute/name/of/gsl-1.9.tar.gz" 34 echo " C-compiler-command" 35 echo " flags-for-C-compiler" 36 echo " Valgrind-command" 37 echo " flags-for-Valgrind" 38 exit 1 39fi 40 41 42runcmd () { 43 echo -n " $1 ... " 44 shift 45 46 (eval "$*") >> log.verbose 2>&1 47 48 if [ $? = 0 ] 49 then 50 echo "done" 51 return 0 52 else 53 echo "failed" 54 return 1 55 fi 56} 57 58GSL_FILE=$1 59GSL_CC=$2 60GSL_CFLAGS=$3 61GSL_VV=$4 62GSL_VFLAGS=$5 63 64TESTS1="block/test bspline/test cblas/test cdf/test cheb/test" 65TESTS2="combination/test complex/test const/test deriv/test dht/test" 66TESTS3="diff/test eigen/test err/test fft/test fit/test histogram/test" 67TESTS4="ieee-utils/test integration/test interpolation/test linalg/test" 68TESTS5="matrix/test min/test monte/test multifit/test multimin/test" 69TESTS6="multiroots/test ntuple/test ode-initval/test permutation/test" 70TESTS7="poly/test qrng/test randist/test rng/test roots/test siman/test" 71TESTS8="sort/test specfunc/test statistics/test sum/test sys/test" 72TESTS9="vector/test wavelet/test" 73 74ALL_TESTS="$TESTS1 $TESTS2 $TESTS3 $TESTS4 $TESTS5 $TESTS6 $TESTS7 $TESTS8 $TESTS9" 75 76 77echo "gsl19test: src: " $GSL_FILE 78echo "gsl19test: cc: " $GSL_CC 79echo "gsl19test: cflags: " $GSL_CFLAGS 80echo "gsl19test: valgrind: " $GSL_VV 81echo "gsl19test: vflags: " $GSL_VFLAGS 82 83rm -rf log.verbose gsl-1.9 summary.txt 84 85echo > log.verbose 86 87echo > summary.txt 88echo $0 $1 \"$2\" \"$3\" \"$4\" \"$5\" >> summary.txt 89echo >> summary.txt 90 91runcmd "Untarring " \ 92 "rm -rf gsl-1.9 && tar xzf $GSL_FILE" && \ 93\ 94runcmd "Configuring " \ 95 "(cd gsl-1.9 && CC=$GSL_CC CFLAGS=\"$GSL_CFLAGS\" ./configure)" && \ 96\ 97runcmd "Building " \ 98 "(cd gsl-1.9 && make && make -k check)" 99 100echo -n " Collecting reference results " 101rm -f out-REF 102(cd gsl-1.9 && for f in $ALL_TESTS ; \ 103 do GSL_TEST_VERBOSE=1 ./$f ; done) &> out-REF 104echo " ... done" 105 106echo -n " Collecting valgrinded results " 107rm -f out-V 108(cd gsl-1.9 && for f in $ALL_TESTS ; \ 109 do GSL_TEST_VERBOSE=1 eval $GSL_VV -v --trace-children=yes "$GSL_VFLAGS" ./$f ; done) &> out-V 110echo " ... done" 111 112echo -n " Native fails: " && (grep FAIL: out-REF | wc -l) 113echo -n " Native passes: " && (grep PASS: out-REF | wc -l) 114echo -n " Valgrind fails: " && (grep FAIL: out-V | wc -l) 115echo -n " Valgrind passes: " && (grep PASS: out-V | wc -l) 116 117(echo -n " Native fails: " && (grep FAIL: out-REF | wc -l)) >> summary.txt 118(echo -n " Native passes: " && (grep PASS: out-REF | wc -l)) >> summary.txt 119(echo -n " Valgrind fails: " && (grep FAIL: out-V | wc -l)) >> summary.txt 120(echo -n " Valgrind passes: " && (grep PASS: out-V | wc -l)) >> summary.txt 121echo >> summary.txt 122 123echo 124