[Kst] kdeextragear-2/kst

George Staikos staikos at kde.org
Tue Nov 30 02:43:42 CET 2004


CVS commit by staikos: 

- Added a configure parameter to enable test coverage with gcc3
- Enhanced runregression to automatically run gcov and report the results on
  relevant files for each testcase


  M +13 -1     configure.in.in   1.38
  M +29 -1     tests/runregression.sh   1.4


--- kdeextragear-2/kst/configure.in.in  #1.37:1.38
@@ -210,5 +210,5 @@
     ],
     [
-      #if KDE_VERSION < ((3<<16) | (2<<8) | (0))
+      #if KDE_VERSION < ((3<<16) | (3<<8) | (89))
          KDE_choke me
       #endif
@@ -235,2 +235,14 @@
 AM_CONDITIONAL(include_linux, test $have_linux = yes)
 
+ac_coverage_compiler=""
+ac_coverage_linker=""
+AC_ARG_WITH(gcc3-coverage,
+    AC_HELP_STRING([--with-gcc3-coverage]),
+    [  ac_coverage_compiler="-fprofile-arcs -ftest-coverage -O0 -fno-inline"
+       ac_coverage_linker="-lgcc"
+    ])
+
+CFLAGS="$CFLAGS $ac_coverage_compiler"
+CXXFLAGS="$CXXFLAGS $ac_coverage_compiler"
+LDFLAGS="$LDFLAGS $ac_coverage_linker"
+

--- kdeextragear-2/kst/tests/runregression.sh  #1.3:1.4
@@ -30,4 +30,7 @@
 
 TESTS="testeqparser testhistogram testscalars"
+testeqparser_FILES="eparse.y escan.l eparse.c escan.c enodes.cpp enodefactory.cpp"
+testhistogram_FILES="ksthistogram.cpp"
+testscalars_FILES="kstscalar.cpp"
 
 for i in $TESTS; do
@@ -36,9 +39,34 @@
                 continue;
         fi
-        $VALGRIND ./$i >>$CONSOLELOG 2>&1
+        echo "-----------------------------------------------------------" >> $CONSOLELOG
+        echo "Running test: $i" >> $CONSOLELOG
+        $VALGRIND ./$i 2>&1 | grep -v QPixmap >>$CONSOLELOG
+        echo >>$CONSOLELOG
         FAILED=$?
         if [ $FAILED -gt 0 ]; then
                 echo "$FAILED testcases failed in $i";
         fi
+        echo Code coverage: >>$CONSOLELOG
+        pushd ../kst
+        filenames='$'"$i"_FILES;
+        list=`eval echo $filenames`
+        for j in $list; do
+                gcov -o .libs -n $j 2>&1 |
+                while true; do
+                        read k
+                        if test $? -ne 0; then
+                                break;
+                        fi
+                        echo "$k" | grep "File \`$j'" >/dev/null 2>&1
+                        if test $? -eq 0; then
+                                read l
+                                echo $j: $l >>$CONSOLELOG
+                                break
+                        fi
+                done
+        done
+        popd
+        echo >>$CONSOLELOG
+        echo >>$CONSOLELOG
 done
 





More information about the Kst mailing list