blob: 3a3f28c1faf8fd94eb418e292118505b1c02dfa1 [file] [log] [blame]
sewardj1bad8002005-07-04 23:44:10 +00001#!/bin/bash
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
sewardjd2ea4112005-07-04 23:54:41 +000024if [ $# != 5 ]
25then
26 echo "usage: gsl15test /absolute/name/of/gsl-1.6.tar.gz"
27 echo " C-compiler-command"
28 echo " flags-for-C-compiler"
29 echo " Valgrind-command"
30 echo " flags-for-Valgrind"
31 exit 1
32fi
33
34
sewardj1bad8002005-07-04 23:44:10 +000035runcmd () {
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
51GSL_FILE=$1
52GSL_CC=$2
53GSL_CFLAGS=$3
54GSL_VV=$4
55GSL_VFLAGS=$5
56
57TESTS1="block/test cblas/test cdf/test cheb/test combination/test"
58TESTS2="complex/test const/test deriv/test dht/test diff/test"
59TESTS3="eigen/test err/test fft/test fit/test histogram/test"
60TESTS4="ieee-utils/test integration/test interpolation/test linalg/test"
61TESTS5="matrix/test min/test monte/test multifit/test multimin/test"
62TESTS6="multiroots/test ntuple/test ode-initval/test permutation/test"
63TESTS7="poly/test qrng/test randist/test rng/test roots/test siman/test"
64TESTS8="sort/test specfunc/test statistics/test sum/test sys/test"
65TESTS9="vector/test wavelet/test"
66
67ALL_TESTS="$TESTS1 $TESTS2 $TESTS3 $TESTS4 $TESTS5 $TESTS6 $TESTS7 $TESTS8 $TESTS9"
68
69echo "gsl16test: src: " $GSL_FILE
70echo "gsl16test: cc: " $GSL_CC
71echo "gsl16test: cflags: " $GSL_CFLAGS
72echo "gsl16test: valgrind: " $GSL_VV
73echo "gsl16test: vflags: " $GSL_VFLAGS
74
75rm -rf log.verbose gsl-1.6
76
77echo > log.verbose
78
79runcmd "Untarring " \
80 "rm -rf gsl-1.6 && tar xzf $GSL_FILE" && \
81\
82runcmd "Configuring " \
sewardj20859562005-07-05 00:00:40 +000083 "(cd gsl-1.6 && CC=$GSL_CC CFLAGS=\"$GSL_CFLAGS\" ./configure)" && \
sewardj1bad8002005-07-04 23:44:10 +000084\
85runcmd "Building " \
86 "(cd gsl-1.6 && make && make -k check)"
87
88echo -n " Collecting reference results "
89rm -f out-REF
90(cd gsl-1.6 && for f in $ALL_TESTS ; do ./$f ; done) &> out-REF
91echo " ... done"
92
93echo -n " Collecting valgrinded results "
94rm -f out-V
sewardj4e953392005-07-05 00:59:08 +000095(cd gsl-1.6 && for f in $ALL_TESTS ; do $GSL_VV -v --trace-children=yes "$GSL_VFLAGS" ./$f ; done) &> out-V
sewardj1bad8002005-07-04 23:44:10 +000096echo " ... done"
97
98echo -n " Native fails: " && (grep FAIL: out-REF | wc -l)
99echo -n " Native passes: " && (grep PASS: out-REF | wc -l)
100echo -n " Valgrind fails: " && (grep FAIL: out-V | wc -l)
101echo -n " Valgrind passes: " && (grep PASS: out-V | wc -l)
102
103echo