From: Peter Stamfest Date: Wed, 20 Aug 2014 22:36:39 +0000 (+0200) Subject: Add a dump-restore test X-Git-Tag: v1.5.0-rc1~42^2~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=639b4001876622d0af2ad34ffaf6aa9e16c7e31e;p=thirdparty%2Frrdtool-1.x.git Add a dump-restore test --- diff --git a/tests/Makefile.am b/tests/Makefile.am index adf9711e..9033bd75 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,7 @@ TESTS = modify1 modify2 modify3 modify4 modify5 \ tune1 tune2 rpn1 \ - rrdcreate + rrdcreate \ + dump-restore EXTRA_DIST = Makefile.am \ alltests functions \ modify1 modify-test1.create.dump modify-test1.mod1.dump \ diff --git a/tests/dump-restore b/tests/dump-restore new file mode 100755 index 00000000..a3fa7694 --- /dev/null +++ b/tests/dump-restore @@ -0,0 +1,33 @@ +#!/bin/bash + +. $(dirname $0)/functions + +BASE=$BASEDIR/$(basename $0)-test +BUILD=$BUILDDIR/$(basename $0)-test + +ST=1300000000 +$RRDTOOL create ${BUILD}a1.rrd --start $(($ST-1)) --step 60 DS:a:GAUGE:120:0:U RRA:AVERAGE:0.5:1:20 RRA:AVERAGE:0.5:5:2 RRA:MIN:0.5:5:2 RRA:MAX:0.5:5:2 RRA:LAST:0.5:5:2 +report create1 + +V=10 +N=0 +CNT=25 +for A in $(seq $ST 60 $(($ST + 60*($CNT - 1))) ) ; do + V=$(($V + 20)) + N=$(($N + 1)) + ST=$A + $RRDTOOL update ${BUILD}a1.rrd $A:$V + + rm -f ${BUILD}a1.xml ${BUILD}r1.rrd ${BUILD}r1.xml + + $RRDTOOL dump ${BUILD}a1.rrd ${BUILD}a1.xml + $RRDTOOL restore ${BUILD}a1.xml ${BUILD}r1.rrd + $RRDTOOL dump ${BUILD}r1.rrd ${BUILD}r1.xml + + $DIFF ${BUILD}a1.xml ${BUILD}r1.xml + report dump-restore-cycle $N/$CNT +done + +rm -f ${BUILD}a1.xml ${BUILD}r1.rrd ${BUILD}r1.xml +rm -f ${BUILD}a1.rrd +