summaryrefslogtreecommitdiff
path: root/auxprogs/gsl19test
blob: 4b1d1405a236411e2f5625abb1df745a5ae3d85e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash

# Do an automated test which involves building and regtesting version
# 1.9 of the GNU Scientific Library (gsl).  This has proven to be a 
# very thorough test of Vex's CPU simulations and has exposed bugs 
# which had not been previously discovered.  Gsl 1.9 contains more
# than 6 million tests as part of its regression suite, and so this
# script's purpose is to runs those tests using valgrind and compare 
# against the same tests run natively.  Note that it produces a
# huge amount of output (about 2 x 620 MByte), so be careful.
# The older gsl16test script produces only about 2 x 7 MByte per run.
# 
# You can download gsl and get more info about it at 
# http://www.gnu.org/software/gsl



# Args:
#     absolute name of gsl-1.9.tar.gz file
#     name of C compiler
#     args for C compiler
#     name of Valgrind
#     args for Valgrind


if [ $# != 5 ]
then 
   echo "usage: gsl19test /absolute/name/of/gsl-1.9.tar.gz"
   echo "                 C-compiler-command"      
   echo "                 flags-for-C-compiler"     
   echo "                 Valgrind-command"
   echo "                 flags-for-Valgrind"
   exit 1
fi


runcmd () {
   echo -n "   $1  ... "
   shift

   (eval "$*") >> log.verbose 2>&1

   if [ $? == 0 ]
   then
      echo "done"
      return 0
   else
      echo "failed"
      return 1
   fi
}

GSL_FILE=$1
GSL_CC=$2
GSL_CFLAGS=$3
GSL_VV=$4
GSL_VFLAGS=$5

TESTS1="block/test bspline/test cblas/test cdf/test cheb/test"
TESTS2="combination/test complex/test const/test deriv/test dht/test"
TESTS3="diff/test eigen/test err/test fft/test fit/test histogram/test"
TESTS4="ieee-utils/test integration/test interpolation/test linalg/test"
TESTS5="matrix/test min/test monte/test multifit/test multimin/test"
TESTS6="multiroots/test ntuple/test ode-initval/test permutation/test"
TESTS7="poly/test qrng/test randist/test rng/test roots/test siman/test"
TESTS8="sort/test specfunc/test statistics/test sum/test sys/test"
TESTS9="vector/test wavelet/test"

ALL_TESTS="$TESTS1 $TESTS2 $TESTS3 $TESTS4 $TESTS5 $TESTS6 $TESTS7 $TESTS8 $TESTS9"


echo "gsl19test: src:      " $GSL_FILE
echo "gsl19test: cc:       " $GSL_CC
echo "gsl19test: cflags:   " $GSL_CFLAGS
echo "gsl19test: valgrind: " $GSL_VV
echo "gsl19test: vflags:   " $GSL_VFLAGS

rm -rf log.verbose gsl-1.9 summary.txt

echo > log.verbose

echo > summary.txt
echo $0  $1  \"$2\"  \"$3\"  \"$4\"  \"$5\" >> summary.txt
echo >> summary.txt

runcmd "Untarring                     " \
       "rm -rf gsl-1.9 && tar xzf $GSL_FILE" && \
\
runcmd "Configuring                   " \
       "(cd gsl-1.9 && CC=$GSL_CC CFLAGS=\"$GSL_CFLAGS\" ./configure)" && \
\
runcmd "Building                      " \
       "(cd gsl-1.9 && make && make -k check)"

echo -n "   Collecting reference results  "
rm -f out-REF
(cd gsl-1.9 && for f in $ALL_TESTS ; \
               do GSL_TEST_VERBOSE=1 ./$f ; done) &> out-REF
echo "  ... done"

echo -n "   Collecting valgrinded results "
rm -f out-V
(cd gsl-1.9 && for f in $ALL_TESTS ; \
               do GSL_TEST_VERBOSE=1 eval $GSL_VV -v --trace-children=yes "$GSL_VFLAGS" ./$f ; done) &> out-V
echo "  ... done"

echo -n "   Native fails:    " && (grep FAIL: out-REF | wc -l)
echo -n "   Native passes:   " && (grep PASS: out-REF | wc -l)
echo -n "   Valgrind fails:  " && (grep FAIL: out-V | wc -l)
echo -n "   Valgrind passes: " && (grep PASS: out-V | wc -l)

(echo -n "   Native fails:    " && (grep FAIL: out-REF | wc -l)) >> summary.txt
(echo -n "   Native passes:   " && (grep PASS: out-REF | wc -l)) >> summary.txt
(echo -n "   Valgrind fails:  " && (grep FAIL: out-V | wc -l)) >> summary.txt
(echo -n "   Valgrind passes: " && (grep PASS: out-V | wc -l)) >> summary.txt
echo >> summary.txt

echo