aboutsummaryrefslogtreecommitdiff
path: root/auxprogs/gsl16test
blob: 22f7cab2e8f03e32daced30ed07046387db0d378 (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/sh

# Do an automated test which involves building and regtesting version
# 1.6 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 contains more
# than 100,000 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.
# 
# You can download gsl and get more info about it at 
# http://www.gnu.org/software/gsl



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

# Results:  3.7.0   --tool=none
#     x86   1 failure  Ubuntu 10.10
#           FAIL: qawo(f456) elist (7.25063790881233303e-15 observed vs 7.25922435194575979e-15 expected)
#           same failure was also present in 3.6.1
#     s390x 0 failures  on z900 running RHEL4

if [ $# != 5 ]
then 
   echo "usage: gsl16test /absolute/name/of/gsl-1.6-patched.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 cblas/test cdf/test cheb/test combination/test"
TESTS2="complex/test const/test deriv/test dht/test diff/test"
TESTS3="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 "gsl16test: src:      " $GSL_FILE
echo "gsl16test: cc:       " $GSL_CC
echo "gsl16test: cflags:   " $GSL_CFLAGS
echo "gsl16test: valgrind: " $GSL_VV
echo "gsl16test: vflags:   " $GSL_VFLAGS

rm -rf log.verbose gsl-1.6-patched 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.6-patched && tar xzf $GSL_FILE" && \
\
runcmd "Configuring                   " \
       "(cd gsl-1.6-patched && CC=$GSL_CC CFLAGS=\"$GSL_CFLAGS\" ./configure)" && \
\
runcmd "Building                      " \
       "(cd gsl-1.6-patched && make -j4 && make -k check)"

echo -n "   Collecting reference results  "
rm -f out-REF
(cd gsl-1.6-patched && for f in $ALL_TESTS ; do ./$f ; done) &> out-REF
echo "  ... done"

echo -n "   Collecting valgrinded results "
rm -f out-VAL
(cd gsl-1.6-patched && for f in $ALL_TESTS ; do eval $GSL_VV -v --trace-children=yes "$GSL_VFLAGS" ./$f ; done) &> out-VAL
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-VAL | wc -l)
echo -n "   Valgrind passes: " && (grep PASS: out-VAL | 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-VAL | wc -l)) >> summary.txt
(echo -n "   Valgrind passes: " && (grep PASS: out-VAL | wc -l)) >> summary.txt
echo >> summary.txt

echo