]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Add a dump-restore test
authorPeter Stamfest <peter@stamfest.at>
Wed, 20 Aug 2014 22:36:39 +0000 (00:36 +0200)
committerPeter Stamfest <peter@stamfest.at>
Sun, 31 Aug 2014 20:15:32 +0000 (22:15 +0200)
tests/Makefile.am
tests/dump-restore [new file with mode: 0755]

index adf9711e6302c66087b23da124a41e38c680d791..9033bd751c42b3b2df6d4654de92f83b4f3d2d94 100644 (file)
@@ -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 (executable)
index 0000000..a3fa769
--- /dev/null
@@ -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 
+