Bug 497723 - forgot to restore callgrind output cleanup
[valgrind.git] / auxprogs / gsl19test
blobd111d379a51bce9e7365d054af2b3abc012d0b0f
1 #!/bin/sh
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.
13 # You can download gsl and get more info about it at
14 # http://www.gnu.org/software/gsl
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
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
31 if [ $# != 5 ]
32 then
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
41 # nproc is part of coreutils so it's available on GNU/Linux. Not so on Mac OS X.
42 command -v nproc > /dev/null
43 if [ $? -eq 0 ]; then
44 num_cpu=`nproc`
45 else
46 num_cpu=1
49 runcmd () {
50 echo -n " $1 ... "
51 shift
53 (eval "$*") >> log.verbose 2>&1
55 if [ $? = 0 ]
56 then
57 echo "done"
58 return 0
59 else
60 echo "failed"
61 return 1
65 GSL_FILE=$1
66 GSL_CC=$2
67 GSL_CFLAGS=$3
68 GSL_VV=$4
69 GSL_VFLAGS=$5
71 TESTS1="block/test bspline/test cblas/test cdf/test cheb/test"
72 TESTS2="combination/test complex/test const/test deriv/test dht/test"
73 TESTS3="diff/test eigen/test err/test fft/test fit/test histogram/test"
74 TESTS4="ieee-utils/test integration/test interpolation/test linalg/test"
75 TESTS5="matrix/test min/test monte/test multifit/test multimin/test"
76 TESTS6="multiroots/test ntuple/test ode-initval/test permutation/test"
77 TESTS7="poly/test qrng/test randist/test rng/test roots/test siman/test"
78 TESTS8="sort/test specfunc/test statistics/test sum/test sys/test"
79 TESTS9="vector/test wavelet/test"
81 ALL_TESTS="$TESTS1 $TESTS2 $TESTS3 $TESTS4 $TESTS5 $TESTS6 $TESTS7 $TESTS8 $TESTS9"
84 echo "gsl19test: src: " $GSL_FILE
85 echo "gsl19test: cc: " $GSL_CC
86 echo "gsl19test: cflags: " $GSL_CFLAGS
87 echo "gsl19test: valgrind: " $GSL_VV
88 echo "gsl19test: vflags: " $GSL_VFLAGS
90 rm -rf log.verbose gsl-1.9 summary.txt
92 echo > log.verbose
94 echo > summary.txt
95 echo $0 $1 \"$2\" \"$3\" \"$4\" \"$5\" >> summary.txt
96 echo >> summary.txt
98 runcmd "Untarring " \
99 "rm -rf gsl-1.9 && tar xzf $GSL_FILE" && \
101 runcmd "Configuring " \
102 "(cd gsl-1.9 && CC=$GSL_CC CFLAGS=\"$GSL_CFLAGS\" ./configure)" && \
104 runcmd "Building " \
105 "(cd gsl-1.9 && make -j $num_cpu && make -j $num_cpu -k check)"
107 echo -n " Collecting reference results "
108 rm -f out-REF
109 (cd gsl-1.9 && for f in $ALL_TESTS ; \
110 do GSL_TEST_VERBOSE=1 ./$f ; done) > out-REF 2>&1
111 echo " ... done"
113 echo -n " Collecting valgrinded results "
114 rm -f out-V
115 (cd gsl-1.9 && for f in $ALL_TESTS ; \
116 do eval GSL_TEST_VERBOSE=1 $GSL_VV -q --trace-children=yes "$GSL_VFLAGS" ./$f ; done) > out-V 2>&1
117 echo " ... done"
119 echo -n " Native fails: " && (grep FAIL: out-REF | wc -l)
120 echo -n " Native passes: " && (grep PASS: out-REF | wc -l)
121 echo -n " Valgrind fails: " && (grep FAIL: out-V | wc -l)
122 echo -n " Valgrind passes: " && (grep PASS: out-V | wc -l)
124 (echo -n " Native fails: " && (grep FAIL: out-REF | wc -l)) >> summary.txt
125 (echo -n " Native passes: " && (grep PASS: out-REF | wc -l)) >> summary.txt
126 (echo -n " Valgrind fails: " && (grep FAIL: out-V | wc -l)) >> summary.txt
127 (echo -n " Valgrind passes: " && (grep PASS: out-V | wc -l)) >> summary.txt
128 echo >> summary.txt
130 echo