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