1 #!/bin/bash 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 26 if [ $# != 5 ] 27 then 28 echo "usage: gsl19test /absolute/name/of/gsl-1.9.tar.gz" 29 echo " C-compiler-command" 30 echo " flags-for-C-compiler" 31 echo " Valgrind-command" 32 echo " flags-for-Valgrind" 33 exit 1 34 fi 35 36 37 runcmd () { 38 echo -n " $1 ... " 39 shift 40 41 (eval "$*") >> log.verbose 2>&1 42 43 if [ $? == 0 ] 44 then 45 echo "done" 46 return 0 47 else 48 echo "failed" 49 return 1 50 fi 51 } 52 53 GSL_FILE=$1 54 GSL_CC=$2 55 GSL_CFLAGS=$3 56 GSL_VV=$4 57 GSL_VFLAGS=$5 58 59 TESTS1="block/test bspline/test cblas/test cdf/test cheb/test" 60 TESTS2="combination/test complex/test const/test deriv/test dht/test" 61 TESTS3="diff/test eigen/test err/test fft/test fit/test histogram/test" 62 TESTS4="ieee-utils/test integration/test interpolation/test linalg/test" 63 TESTS5="matrix/test min/test monte/test multifit/test multimin/test" 64 TESTS6="multiroots/test ntuple/test ode-initval/test permutation/test" 65 TESTS7="poly/test qrng/test randist/test rng/test roots/test siman/test" 66 TESTS8="sort/test specfunc/test statistics/test sum/test sys/test" 67 TESTS9="vector/test wavelet/test" 68 69 ALL_TESTS="$TESTS1 $TESTS2 $TESTS3 $TESTS4 $TESTS5 $TESTS6 $TESTS7 $TESTS8 $TESTS9" 70 71 72 echo "gsl19test: src: " $GSL_FILE 73 echo "gsl19test: cc: " $GSL_CC 74 echo "gsl19test: cflags: " $GSL_CFLAGS 75 echo "gsl19test: valgrind: " $GSL_VV 76 echo "gsl19test: vflags: " $GSL_VFLAGS 77 78 rm -rf log.verbose gsl-1.9 summary.txt 79 80 echo > log.verbose 81 82 echo > summary.txt 83 echo $0 $1 \"$2\" \"$3\" \"$4\" \"$5\" >> summary.txt 84 echo >> summary.txt 85 86 runcmd "Untarring " \ 87 "rm -rf gsl-1.9 && tar xzf $GSL_FILE" && \ 88 \ 89 runcmd "Configuring " \ 90 "(cd gsl-1.9 && CC=$GSL_CC CFLAGS=\"$GSL_CFLAGS\" ./configure)" && \ 91 \ 92 runcmd "Building " \ 93 "(cd gsl-1.9 && make && make -k check)" 94 95 echo -n " Collecting reference results " 96 rm -f out-REF 97 (cd gsl-1.9 && for f in $ALL_TESTS ; \ 98 do GSL_TEST_VERBOSE=1 ./$f ; done) &> out-REF 99 echo " ... done" 100 101 echo -n " Collecting valgrinded results " 102 rm -f out-V 103 (cd gsl-1.9 && for f in $ALL_TESTS ; \ 104 do GSL_TEST_VERBOSE=1 eval $GSL_VV -v --trace-children=yes "$GSL_VFLAGS" ./$f ; done) &> out-V 105 echo " ... done" 106 107 echo -n " Native fails: " && (grep FAIL: out-REF | wc -l) 108 echo -n " Native passes: " && (grep PASS: out-REF | wc -l) 109 echo -n " Valgrind fails: " && (grep FAIL: out-V | wc -l) 110 echo -n " Valgrind passes: " && (grep PASS: out-V | wc -l) 111 112 (echo -n " Native fails: " && (grep FAIL: out-REF | wc -l)) >> summary.txt 113 (echo -n " Native passes: " && (grep PASS: out-REF | wc -l)) >> summary.txt 114 (echo -n " Valgrind fails: " && (grep FAIL: out-V | wc -l)) >> summary.txt 115 (echo -n " Valgrind passes: " && (grep PASS: out-V | wc -l)) >> summary.txt 116 echo >> summary.txt 117 118 echo 119