Home | History | Annotate | Download | only in auxprogs
      1 #!/bin/sh
      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 # 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
     30 
     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
     39 fi
     40 
     41 
     42 runcmd () {
     43    echo -n "   $1  ... "
     44    shift
     45 
     46    (eval "$*") >> log.verbose 2>&1
     47 
     48    if [ $? = 0 ]
     49    then
     50       echo "done"
     51       return 0
     52    else
     53       echo "failed"
     54       return 1
     55    fi
     56 }
     57 
     58 GSL_FILE=$1
     59 GSL_CC=$2
     60 GSL_CFLAGS=$3
     61 GSL_VV=$4
     62 GSL_VFLAGS=$5
     63 
     64 TESTS1="block/test bspline/test cblas/test cdf/test cheb/test"
     65 TESTS2="combination/test complex/test const/test deriv/test dht/test"
     66 TESTS3="diff/test eigen/test err/test fft/test fit/test histogram/test"
     67 TESTS4="ieee-utils/test integration/test interpolation/test linalg/test"
     68 TESTS5="matrix/test min/test monte/test multifit/test multimin/test"
     69 TESTS6="multiroots/test ntuple/test ode-initval/test permutation/test"
     70 TESTS7="poly/test qrng/test randist/test rng/test roots/test siman/test"
     71 TESTS8="sort/test specfunc/test statistics/test sum/test sys/test"
     72 TESTS9="vector/test wavelet/test"
     73 
     74 ALL_TESTS="$TESTS1 $TESTS2 $TESTS3 $TESTS4 $TESTS5 $TESTS6 $TESTS7 $TESTS8 $TESTS9"
     75 
     76 
     77 echo "gsl19test: src:      " $GSL_FILE
     78 echo "gsl19test: cc:       " $GSL_CC
     79 echo "gsl19test: cflags:   " $GSL_CFLAGS
     80 echo "gsl19test: valgrind: " $GSL_VV
     81 echo "gsl19test: vflags:   " $GSL_VFLAGS
     82 
     83 rm -rf log.verbose gsl-1.9 summary.txt
     84 
     85 echo > log.verbose
     86 
     87 echo > summary.txt
     88 echo $0  $1  \"$2\"  \"$3\"  \"$4\"  \"$5\" >> summary.txt
     89 echo >> summary.txt
     90 
     91 runcmd "Untarring                     " \
     92        "rm -rf gsl-1.9 && tar xzf $GSL_FILE" && \
     93 \
     94 runcmd "Configuring                   " \
     95        "(cd gsl-1.9 && CC=$GSL_CC CFLAGS=\"$GSL_CFLAGS\" ./configure)" && \
     96 \
     97 runcmd "Building                      " \
     98        "(cd gsl-1.9 && make && make -k check)"
     99 
    100 echo -n "   Collecting reference results  "
    101 rm -f out-REF
    102 (cd gsl-1.9 && for f in $ALL_TESTS ; \
    103                do GSL_TEST_VERBOSE=1 ./$f ; done) &> out-REF
    104 echo "  ... done"
    105 
    106 echo -n "   Collecting valgrinded results "
    107 rm -f out-V
    108 (cd gsl-1.9 && for f in $ALL_TESTS ; \
    109                do GSL_TEST_VERBOSE=1 eval $GSL_VV -v --trace-children=yes "$GSL_VFLAGS" ./$f ; done) &> out-V
    110 echo "  ... done"
    111 
    112 echo -n "   Native fails:    " && (grep FAIL: out-REF | wc -l)
    113 echo -n "   Native passes:   " && (grep PASS: out-REF | wc -l)
    114 echo -n "   Valgrind fails:  " && (grep FAIL: out-V | wc -l)
    115 echo -n "   Valgrind passes: " && (grep PASS: out-V | wc -l)
    116 
    117 (echo -n "   Native fails:    " && (grep FAIL: out-REF | wc -l)) >> summary.txt
    118 (echo -n "   Native passes:   " && (grep PASS: out-REF | wc -l)) >> summary.txt
    119 (echo -n "   Valgrind fails:  " && (grep FAIL: out-V | wc -l)) >> summary.txt
    120 (echo -n "   Valgrind passes: " && (grep PASS: out-V | wc -l)) >> summary.txt
    121 echo >> summary.txt
    122 
    123 echo
    124