]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Valgrind support for the test suite. valgrind gets used when called as "make check...
authorPeter Stamfest <peter@stamfest.at>
Wed, 12 Mar 2014 20:11:12 +0000 (21:11 +0100)
committerPeter Stamfest <peter@stamfest.at>
Thu, 13 Mar 2014 16:38:07 +0000 (17:38 +0100)
tests/functions
tests/modify3
tests/modify4
tests/modify5

index 9a6802fb0d7895784e17d8dd991c849218bd064f..2f5a13d749688e27dfbc582518dcaa7158be8eee 100644 (file)
@@ -1,14 +1,26 @@
 
-
 BASEDIR=$(dirname $0)
 if [ -z "$RRDTOOL" ] ; then 
-       RRDTOOL=$BASEDIR/../src/rrdtool
+       case "$TESTS_STYLE" in
+       valgrind)
+               echo >&2 "# Note: exit code 111 indicates a valgrind detected memory problem" 
+               RRDTOOL="libtool --mode=execute valgrind --tool=memcheck \
+                       --suppressions=$BASEDIR/valgrind-supressions \
+                       --leak-check=full --show-reachable=yes \
+                       --leak-resolution=high --num-callers=20 \
+                       --error-exitcode=111 --log-file=/dev/null \
+                       $BASEDIR/../src/rrdtool"
+               ;;
+       *)
+               RRDTOOL=$BASEDIR/../src/rrdtool
+               ;;
+       esac
 fi
 
 DIFF="diff -u"
 
 function fail {
-       echo >&2 "FAILED:" "$@"
+       echo >&2 "FAILED: (rc=$?)" "$@"
        if [ -n "$CONTINUE" ] ; then
                return
        fi
index 0db4a42034d0c74b8125e8767e980362c2f7f3f5..c49ec10cceef8123f21c650a2ceebc607af784a6 100755 (executable)
@@ -8,14 +8,14 @@ $RRDTOOL create ${BASE}a.rrd --start 1300000000 --step 60 DS:a:GAUGE:120:0:U  DS
 # add 50 values to 
 N=10
 for T in $(seq 1300000020 60 1300003020) ; do
-       rrdtool update ${BASE}a.rrd --template a:b:c $T:$N:$((10000+$N)):$((20000+$N))
+       rrdtool update ${BASE}a.rrd --template a:b:c $T:$N:$((10000+$N)):$((20000+$N)) || fail update
        let N=$N+10
 done
 
 $RRDTOOL dump ${BASE}a.rrd | diff - $BASEDIR/modify-test3.create.dump && ok "create" || fail "create"
 
 # extend base RRA, refill from coarse RRA
-$RRDTOOL modify ${BASE}a.rrd ${BASE}b.rrd DEL:a RRA#0:+10
+$RRDTOOL modify ${BASE}a.rrd ${BASE}b.rrd DEL:a RRA#0:+10 || fail modify
 
 $RRDTOOL dump ${BASE}b.rrd | diff - $BASEDIR/modify-test3.mod1.dump && ok "extend base RRA" || fail "extend base RRA"
 
index 9f501d2b8d0d39a89bfefd2605c9845d1ae712c1..a493acfc14f53ee558d60893899fb1a11b349da7 100755 (executable)
@@ -10,15 +10,15 @@ BASE=$BASEDIR/modify4-test
 # test: add the additional RRA to the first and compare dumps 
 
 
-$RRDTOOL create ${BASE}a1.rrd --start 1300000000 --step 60 DS:a:GAUGE:120:0:U  RRA:AVERAGE:0.5:1:100 RRA:AVERAGE:0.5:5:2 RRA:MIN:0.5:5:2 RRA:MAX:0.5:5:2 RRA:LAST:0.5:5:2
-$RRDTOOL create ${BASE}a2.rrd --start 1300000000 --step 60 DS:a:GAUGE:120:0:U  RRA:AVERAGE:0.5:1:100 RRA:AVERAGE:0.5:5:2 RRA:MIN:0.5:5:2 RRA:MAX:0.5:5:2 RRA:LAST:0.5:5:2 RRA:AVERAGE:0.5:4:10
+$RRDTOOL create ${BASE}a1.rrd --start 1300000000 --step 60 DS:a:GAUGE:120:0:U  RRA:AVERAGE:0.5:1:100 RRA:AVERAGE:0.5:5:2 RRA:MIN:0.5:5:2 RRA:MAX:0.5:5:2 RRA:LAST:0.5:5:2 || fail create1
+$RRDTOOL create ${BASE}a2.rrd --start 1300000000 --step 60 DS:a:GAUGE:120:0:U  RRA:AVERAGE:0.5:1:100 RRA:AVERAGE:0.5:5:2 RRA:MIN:0.5:5:2 RRA:MAX:0.5:5:2 RRA:LAST:0.5:5:2 RRA:AVERAGE:0.5:4:10 || fail create2
 
 # add 50 values - note that we do NOT add it exactly for boundary times, and 
 # that we end at a NON CDP boundary for 5-PDP RRAs:
 N=10
 for T in $(seq 1300000050 60 1300002990) ; do
-       $RRDTOOL update ${BASE}a1.rrd --template a $T:$N
-       $RRDTOOL update ${BASE}a2.rrd --template a $T:$N
+       $RRDTOOL update ${BASE}a1.rrd --template a $T:$N || fail update1
+       $RRDTOOL update ${BASE}a2.rrd --template a $T:$N || fail update2
        let N=$N+10
 done
 
@@ -27,12 +27,12 @@ report create 1
 $RRDTOOL dump ${BASE}a2.rrd | $DIFF ${BASE}a2-create.dump -
 report create 2
 
-$RRDTOOL modify ${BASE}a2.rrd ${BASE}b2.rrd DELRRA:5
+$RRDTOOL modify ${BASE}a2.rrd ${BASE}b2.rrd DELRRA:5 || fail modify
 
 $RRDTOOL dump ${BASE}b2.rrd | $DIFF ${BASE}a1-create.dump -
 report "remove additional RRA from second - must then be equal original first"
 
-$RRDTOOL modify ${BASE}a1.rrd ${BASE}b1.rrd RRA:AVERAGE:0.5:4:10
+$RRDTOOL modify ${BASE}a1.rrd ${BASE}b1.rrd RRA:AVERAGE:0.5:4:10 || fail modify
 
 $RRDTOOL dump ${BASE}b1.rrd | $DIFF ${BASE}a2-create.dump -
 report "add additional RRA to first - must then be equal original second"
index bbf00dca5105d1e22d93e38fe6bf279f21fb620e..5a9f7b96e547d73c7951daf6c93e85c6d3d35c87 100755 (executable)
@@ -10,8 +10,8 @@ BASE=$BASEDIR/modify5-test
 # test: add the additional RRA to the first and compare dumps 
 
 
-$RRDTOOL create ${BASE}a1.rrd --start 1300000000 --step 60 DS:a:GAUGE:120:0:U  RRA:AVERAGE:0.5:1:100 RRA:AVERAGE:0.5:5:2 RRA:MIN:0.5:5:2 RRA:MAX:0.5:5:2 RRA:LAST:0.5:5:2
-$RRDTOOL create ${BASE}a2.rrd --start 1300000000 --step 60 DS:a:GAUGE:120:0:U  RRA:AVERAGE:0.5:1:100 RRA:AVERAGE:0.5:5:2 RRA:MIN:0.5:5:2 RRA:MAX:0.5:5:2 RRA:LAST:0.5:5:2 RRA:AVERAGE:0.5:4:10
+$RRDTOOL create ${BASE}a1.rrd --start 1300000000 --step 60 DS:a:GAUGE:120:0:U  RRA:AVERAGE:0.5:1:100 RRA:AVERAGE:0.5:5:2 RRA:MIN:0.5:5:2 RRA:MAX:0.5:5:2 RRA:LAST:0.5:5:2 || fail create1
+$RRDTOOL create ${BASE}a2.rrd --start 1300000000 --step 60 DS:a:GAUGE:120:0:U  RRA:AVERAGE:0.5:1:100 RRA:AVERAGE:0.5:5:2 RRA:MIN:0.5:5:2 RRA:MAX:0.5:5:2 RRA:LAST:0.5:5:2 RRA:AVERAGE:0.5:4:10 || fail create2
 
 # add 50 values - note that we do NOT add it exactly for boundary times, and 
 # that we end at a NON CDP boundary for 5-PDP RRAs:
@@ -21,8 +21,8 @@ for T in $(seq 1300000050 60 1300002990) ; do
        UPDATE_STRING="$UPDATE_STRING $T:$N"
        let N=$N+10
 done
-$RRDTOOL update ${BASE}a1.rrd --template a $UPDATE_STRING
-$RRDTOOL update ${BASE}a2.rrd --template a $UPDATE_STRING
+$RRDTOOL update ${BASE}a1.rrd --template a $UPDATE_STRING || fail update1
+$RRDTOOL update ${BASE}a2.rrd --template a $UPDATE_STRING || fail update2
 
 $RRDTOOL dump ${BASE}a1.rrd | $DIFF ${BASE}a1-create.dump -
 report create 1