From 36ef7c3e6d8e6067b3a620ed07bdf423c5a39a23 Mon Sep 17 00:00:00 2001 From: Peter Stamfest Date: Mon, 3 Mar 2014 08:25:54 +0100 Subject: [PATCH] Add some test scripts in new tests directory --- tests/functions | 10 ++++ tests/modify-test1.create.dump | 79 ++++++++++++++++++++++++++++++ tests/modify-test1.mod1.dump | 89 ++++++++++++++++++++++++++++++++++ tests/modify1 | 25 ++++++++++ 4 files changed, 203 insertions(+) create mode 100644 tests/functions create mode 100644 tests/modify-test1.create.dump create mode 100644 tests/modify-test1.mod1.dump create mode 100755 tests/modify1 diff --git a/tests/functions b/tests/functions new file mode 100644 index 00000000..715abe2e --- /dev/null +++ b/tests/functions @@ -0,0 +1,10 @@ + + +function fail { + echo >&2 "FAILED:" "$@" + exit 1 +} + +function ok { + echo >&2 "OK:" "$@" +} diff --git a/tests/modify-test1.create.dump b/tests/modify-test1.create.dump new file mode 100644 index 00000000..af422d61 --- /dev/null +++ b/tests/modify-test1.create.dump @@ -0,0 +1,79 @@ + + + + + 0003 + 60 + 1300003020 + + + a + GAUGE + 120 + 0.0000000000e+00 + NaN + + + 510 + 0.0000000000e+00 + 0 + + + + + AVERAGE + 1 + + + 5.0000000000e-01 + + + + 5.1000000000e+02 + 0.0000000000e+00 + NaN + 0 + + + + 4.2000000000e+02 + 4.3000000000e+02 + 4.4000000000e+02 + 4.5000000000e+02 + 4.6000000000e+02 + 4.7000000000e+02 + 4.8000000000e+02 + 4.9000000000e+02 + 5.0000000000e+02 + 5.1000000000e+02 + + + + AVERAGE + 5 + + + 5.0000000000e-01 + + + + 4.7000000000e+02 + 4.9000000000e+02 + 1.0100000000e+03 + 0 + + + + 3.0000000000e+01 + 7.0000000000e+01 + 1.2000000000e+02 + 1.7000000000e+02 + 2.2000000000e+02 + 2.7000000000e+02 + 3.2000000000e+02 + 3.7000000000e+02 + 4.2000000000e+02 + 4.7000000000e+02 + + + diff --git a/tests/modify-test1.mod1.dump b/tests/modify-test1.mod1.dump new file mode 100644 index 00000000..f21b8252 --- /dev/null +++ b/tests/modify-test1.mod1.dump @@ -0,0 +1,89 @@ + + + + + 0003 + 60 + 1300003020 + + + a + GAUGE + 120 + 0.0000000000e+00 + NaN + + + 510 + 0.0000000000e+00 + 0 + + + + + AVERAGE + 1 + + + 5.0000000000e-01 + + + + 5.1000000000e+02 + 0.0000000000e+00 + NaN + 0 + + + + 3.2000000000e+02 + 3.2000000000e+02 + 3.2000000000e+02 + 3.7000000000e+02 + 3.7000000000e+02 + 3.7000000000e+02 + 3.7000000000e+02 + 3.7000000000e+02 + 4.2000000000e+02 + 4.2000000000e+02 + 4.2000000000e+02 + 4.3000000000e+02 + 4.4000000000e+02 + 4.5000000000e+02 + 4.6000000000e+02 + 4.7000000000e+02 + 4.8000000000e+02 + 4.9000000000e+02 + 5.0000000000e+02 + 5.1000000000e+02 + + + + AVERAGE + 5 + + + 5.0000000000e-01 + + + + 4.7000000000e+02 + 4.9000000000e+02 + 1.0100000000e+03 + 0 + + + + 3.0000000000e+01 + 7.0000000000e+01 + 1.2000000000e+02 + 1.7000000000e+02 + 2.2000000000e+02 + 2.7000000000e+02 + 3.2000000000e+02 + 3.7000000000e+02 + 4.2000000000e+02 + 4.7000000000e+02 + + + diff --git a/tests/modify1 b/tests/modify1 new file mode 100755 index 00000000..5d0c3c7f --- /dev/null +++ b/tests/modify1 @@ -0,0 +1,25 @@ +#!/bin/bash + +BASEDIR=$(dirname $0) + +. $BASEDIR/functions + +RRDTOOL=$BASEDIR/../src/rrdtool + +BASE=$BASEDIR/modify-test1 + +$RRDTOOL create ${BASE}a.rrd --start 1300000000 --step 60 DS:a:GAUGE:120:0:U RRA:AVERAGE:0.5:1:10 RRA:AVERAGE:0.5:5:10 +# add 50 values to +N=10 +for T in $(seq 1300000020 60 1300003020) ; do + rrdtool update ${BASE}a.rrd --template a $T:$N + let N=$N+10 +done + +$RRDTOOL dump ${BASE}a.rrd | diff - $BASEDIR/modify-test1.create.dump && ok "create" || fail "create" + +# extend base RRA, refill from coarse RRA +$RRDTOOL modify ${BASE}a.rrd ${BASE}b.rrd RRA#0:+10 + +$RRDTOOL dump ${BASE}b.rrd | diff - $BASEDIR/modify-test1.mod1.dump && ok "extend base RRA" || fail "extend base RRA" + -- 2.47.3