sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 1 | #!/bin/bash |
sewardj | 1bad800 | 2005-07-04 23:44:10 +0000 | [diff] [blame] | 2 | |
| 3 | # Do an automated test which involves building and regtesting version |
| 4 | # 1.6 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 contains more |
| 7 | # than 100,000 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. |
| 10 | # |
| 11 | # You can download gsl and get more info about it at |
| 12 | # http://www.gnu.org/software/gsl |
| 13 | |
| 14 | |
| 15 | |
| 16 | # Args: |
| 17 | # absolute name of gsl-1.6.tar.gz file |
| 18 | # name of C compiler |
| 19 | # args for C compiler |
| 20 | # name of Valgrind |
| 21 | # args for Valgrind |
| 22 | |
| 23 | |
sewardj | d2ea411 | 2005-07-04 23:54:41 +0000 | [diff] [blame] | 24 | if [ $# != 5 ] |
| 25 | then |
sewardj | 4d3ab3e | 2005-12-30 22:50:01 +0000 | [diff] [blame] | 26 | echo "usage: gsl16test /absolute/name/of/gsl-1.6-patched.tar.gz" |
sewardj | d2ea411 | 2005-07-04 23:54:41 +0000 | [diff] [blame] | 27 | echo " C-compiler-command" |
| 28 | echo " flags-for-C-compiler" |
| 29 | echo " Valgrind-command" |
| 30 | echo " flags-for-Valgrind" |
| 31 | exit 1 |
| 32 | fi |
| 33 | |
| 34 | |
sewardj | 1bad800 | 2005-07-04 23:44:10 +0000 | [diff] [blame] | 35 | runcmd () { |
| 36 | echo -n " $1 ... " |
| 37 | shift |
| 38 | |
| 39 | (eval "$*") >> log.verbose 2>&1 |
| 40 | |
| 41 | if [ $? == 0 ] |
| 42 | then |
| 43 | echo "done" |
| 44 | return 0 |
| 45 | else |
| 46 | echo "failed" |
| 47 | return 1 |
| 48 | fi |
| 49 | } |
| 50 | |
| 51 | GSL_FILE=$1 |
| 52 | GSL_CC=$2 |
| 53 | GSL_CFLAGS=$3 |
| 54 | GSL_VV=$4 |
| 55 | GSL_VFLAGS=$5 |
| 56 | |
| 57 | TESTS1="block/test cblas/test cdf/test cheb/test combination/test" |
| 58 | TESTS2="complex/test const/test deriv/test dht/test diff/test" |
| 59 | TESTS3="eigen/test err/test fft/test fit/test histogram/test" |
| 60 | TESTS4="ieee-utils/test integration/test interpolation/test linalg/test" |
| 61 | TESTS5="matrix/test min/test monte/test multifit/test multimin/test" |
| 62 | TESTS6="multiroots/test ntuple/test ode-initval/test permutation/test" |
| 63 | TESTS7="poly/test qrng/test randist/test rng/test roots/test siman/test" |
| 64 | TESTS8="sort/test specfunc/test statistics/test sum/test sys/test" |
| 65 | TESTS9="vector/test wavelet/test" |
| 66 | |
| 67 | ALL_TESTS="$TESTS1 $TESTS2 $TESTS3 $TESTS4 $TESTS5 $TESTS6 $TESTS7 $TESTS8 $TESTS9" |
| 68 | |
| 69 | echo "gsl16test: src: " $GSL_FILE |
| 70 | echo "gsl16test: cc: " $GSL_CC |
| 71 | echo "gsl16test: cflags: " $GSL_CFLAGS |
| 72 | echo "gsl16test: valgrind: " $GSL_VV |
| 73 | echo "gsl16test: vflags: " $GSL_VFLAGS |
| 74 | |
sewardj | b9c7c79 | 2005-07-24 11:18:41 +0000 | [diff] [blame] | 75 | rm -rf log.verbose gsl-1.6-patched summary.txt |
sewardj | 1bad800 | 2005-07-04 23:44:10 +0000 | [diff] [blame] | 76 | |
| 77 | echo > log.verbose |
| 78 | |
sewardj | b9c7c79 | 2005-07-24 11:18:41 +0000 | [diff] [blame] | 79 | echo > summary.txt |
| 80 | echo $0 $1 \"$2\" \"$3\" \"$4\" \"$5\" >> summary.txt |
| 81 | echo >> summary.txt |
| 82 | |
sewardj | 1bad800 | 2005-07-04 23:44:10 +0000 | [diff] [blame] | 83 | runcmd "Untarring " \ |
sewardj | b9c7c79 | 2005-07-24 11:18:41 +0000 | [diff] [blame] | 84 | "rm -rf gsl-1.6-patched && tar xzf $GSL_FILE" && \ |
sewardj | 1bad800 | 2005-07-04 23:44:10 +0000 | [diff] [blame] | 85 | \ |
| 86 | runcmd "Configuring " \ |
sewardj | b9c7c79 | 2005-07-24 11:18:41 +0000 | [diff] [blame] | 87 | "(cd gsl-1.6-patched && CC=$GSL_CC CFLAGS=\"$GSL_CFLAGS\" ./configure)" && \ |
sewardj | 1bad800 | 2005-07-04 23:44:10 +0000 | [diff] [blame] | 88 | \ |
| 89 | runcmd "Building " \ |
sewardj | b9c7c79 | 2005-07-24 11:18:41 +0000 | [diff] [blame] | 90 | "(cd gsl-1.6-patched && make && make -k check)" |
sewardj | 1bad800 | 2005-07-04 23:44:10 +0000 | [diff] [blame] | 91 | |
| 92 | echo -n " Collecting reference results " |
| 93 | rm -f out-REF |
sewardj | b9c7c79 | 2005-07-24 11:18:41 +0000 | [diff] [blame] | 94 | (cd gsl-1.6-patched && for f in $ALL_TESTS ; do ./$f ; done) &> out-REF |
sewardj | 1bad800 | 2005-07-04 23:44:10 +0000 | [diff] [blame] | 95 | echo " ... done" |
| 96 | |
| 97 | echo -n " Collecting valgrinded results " |
| 98 | rm -f out-V |
sewardj | b9c7c79 | 2005-07-24 11:18:41 +0000 | [diff] [blame] | 99 | (cd gsl-1.6-patched && for f in $ALL_TESTS ; do eval $GSL_VV -v --trace-children=yes "$GSL_VFLAGS" ./$f ; done) &> out-V |
sewardj | 1bad800 | 2005-07-04 23:44:10 +0000 | [diff] [blame] | 100 | echo " ... done" |
| 101 | |
| 102 | echo -n " Native fails: " && (grep FAIL: out-REF | wc -l) |
| 103 | echo -n " Native passes: " && (grep PASS: out-REF | wc -l) |
| 104 | echo -n " Valgrind fails: " && (grep FAIL: out-V | wc -l) |
| 105 | echo -n " Valgrind passes: " && (grep PASS: out-V | wc -l) |
| 106 | |
sewardj | b9c7c79 | 2005-07-24 11:18:41 +0000 | [diff] [blame] | 107 | (echo -n " Native fails: " && (grep FAIL: out-REF | wc -l)) >> summary.txt |
| 108 | (echo -n " Native passes: " && (grep PASS: out-REF | wc -l)) >> summary.txt |
| 109 | (echo -n " Valgrind fails: " && (grep FAIL: out-V | wc -l)) >> summary.txt |
| 110 | (echo -n " Valgrind passes: " && (grep PASS: out-V | wc -l)) >> summary.txt |
| 111 | echo >> summary.txt |
| 112 | |
sewardj | 1bad800 | 2005-07-04 23:44:10 +0000 | [diff] [blame] | 113 | echo |