File indexing completed on 2024-05-19 04:32:47

0001 #!/bin/sh
0002 #
0003 
0004 VALGRIND=
0005 GCOV=
0006 
0007 if [ "x$1" == "x-g" ]; then
0008         GCOV=1
0009 fi
0010 
0011 if [ "x$1" == "x-v" ]; then
0012         VALGRIND="valgrind -v --num-callers=25";
0013 fi
0014 
0015 if [ "x$1" == "x-t" ]; then
0016         VALGRIND="valgrind -v --skin=helgrind --num-callers=25";
0017 fi
0018 
0019 
0020 ######### All settings are above this line
0021 
0022 CONSOLELOG=`mktemp /tmp/Kst_regressionlog.XXXXXX` || exit 4
0023 echo Logging to $CONSOLELOG
0024 
0025 make check
0026 if [ $? -ne 0 ]; then
0027         echo "ERROR BUILDING TESTCASES"
0028         exit -1;
0029 fi
0030 
0031 TESTS="testeqparser testhistogram testscalars testlabelparser testrvector testvector healpix/testhealpix"
0032 testeqparser_FILES="eparse.y escan.l eparse.c escan.c enodes.cpp enodefactory.cpp"
0033 testhistogram_FILES="ksthistogram.cpp"
0034 testscalars_FILES="kstscalar.cpp"
0035 testlabelparser_FILES="labelparser.cpp"
0036 testrvector_FILES="kstrvector.cpp"
0037 testvector_FILES="kstvector.cpp"
0038 
0039 for i in $TESTS; do
0040         if [ ! -e $i ]; then
0041                 echo "ERROR: Couldn't find test $i.  Not running."
0042                 continue;
0043         fi
0044         echo "-----------------------------------------------------------" >> $CONSOLELOG
0045         echo "Running test: $i" >> $CONSOLELOG
0046         output=`$VALGRIND ./$i $* 2>&1`
0047         FAILED=$?
0048         echo "$output" | grep -v QPixmap >>$CONSOLELOG
0049         if [ $FAILED -gt 0 ]; then
0050                 echo "$FAILED testcases failed in $i" | tee -a $CONSOLELOG
0051         fi
0052         echo >>$CONSOLELOG
0053         echo Code coverage: >>$CONSOLELOG
0054         pushd ../kst >/dev/null 2>&1
0055         filenames='$'"$i"_FILES;
0056         list=`eval echo $filenames`
0057         for j in $list; do
0058                 gcov -o .libs -n $j 2>&1 |
0059                 while true; do
0060                         read k
0061                         if test $? -ne 0; then
0062                                 break;
0063                         fi
0064                         echo "$k" | grep "File \`$j'" >/dev/null 2>&1
0065                         if test $? -eq 0; then
0066                                 read l
0067                                 echo $j: $l >>$CONSOLELOG
0068                                 break
0069                         fi
0070                 done
0071         done
0072         popd >/dev/null 2>&1
0073         echo >>$CONSOLELOG
0074         echo >>$CONSOLELOG
0075 done
0076 
0077 exit 0
0078