From 639b4001876622d0af2ad34ffaf6aa9e16c7e31e Mon Sep 17 00:00:00 2001 From: Peter Stamfest Date: Thu, 21 Aug 2014 00:36:39 +0200 Subject: [PATCH] Add a dump-restore test --- tests/Makefile.am | 3 ++- tests/dump-restore | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 tests/dump-restore 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 + -- 2.47.3