From 2a4fb18f27a08ff257a15077766716aeac6e8e8c Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Wed, 11 Nov 2020 16:38:43 +0100 Subject: [PATCH] Add new non regression tests Signed-off-by: Sebastien GODARD --- tests/00200 | 6 +++--- tests/00240 | 22 ++++++++++++++++++++++ tests/00245 | 2 ++ tests/00250 | 22 ++++++++++++++++++++++ tests/00255 | 2 ++ tests/TLIST | 6 +++++- tests/expected.sa1-rot | 6 ++++++ 7 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 tests/00240 create mode 100644 tests/00245 create mode 100644 tests/00250 create mode 100644 tests/00255 create mode 100644 tests/expected.sa1-rot diff --git a/tests/00200 b/tests/00200 index dea0069..6033cb8 100644 --- a/tests/00200 +++ b/tests/00200 @@ -2,12 +2,12 @@ rm -f tests/sa18 rm -f tests/root ln -s root1 tests/root -./sa1 --boot --unix_time=1555593609 +TZ=GMT ./sa1 --boot --unix_time=1555593609 rm -f tests/root ln -s root2 tests/root -./sa1 --unix_time=1555593629 1 1 +TZ=GMT ./sa1 --unix_time=1555593629 1 1 rm -f tests/root ln -s root3 tests/root -./sa1 --unix_time=1555593649 1 1 +TZ=GMT ./sa1 --unix_time=1555593649 1 1 diff --git a/tests/00240 b/tests/00240 new file mode 100644 index 0000000..6998bbb --- /dev/null +++ b/tests/00240 @@ -0,0 +1,22 @@ +rm -f tests/sa[012]* +rm -f tests/sa[012]* + +rm -f tests/root +ln -s root1 tests/root +STEP=`TZ=GMT date --date="yesterday 23:59:57" +%s` +TZ=GMT ./sadc --unix_time=${STEP} - 1 1 >/dev/null + +rm -f tests/root +ln -s root2 tests/root +STEP=`TZ=GMT date --date="yesterday 23:59:58" +%s` +TZ=GMT ./sa1 --unix_time=${STEP} 1 1 + +rm -f tests/root +ln -s root3 tests/root +STEP=`TZ=GMT date --date="yesterday 23:59:59" +%s` +TZ=GMT ./sa1 --unix_time=${STEP} 1 1 + +rm -f tests/root +ln -s root4 tests/root +STEP=`TZ=GMT date --date="today 00:00:01" +%s` +TZ=GMT ./sa1 --rotate --unix_time=${STEP} 1 1 diff --git a/tests/00245 b/tests/00245 new file mode 100644 index 0000000..0a57864 --- /dev/null +++ b/tests/00245 @@ -0,0 +1,2 @@ +DATE=`date --date=yesterday +%d` +LC_ALL=C TZ=GMT ./sar -f tests/sa${DATE} | grep -v SYSSTAT > tests/out.sa1-rot.tmp && diff -u tests/expected.sa1-rot tests/out.sa1-rot.tmp diff --git a/tests/00250 b/tests/00250 new file mode 100644 index 0000000..58397ed --- /dev/null +++ b/tests/00250 @@ -0,0 +1,22 @@ +rm -f tests/sa[012]* +rm -f tests/sa[012]* + +rm -f tests/root +ln -s root1 tests/root +STEP=`TZ=GMT date --date="yesterday 23:59:57" +%s` +TZ=GMT ./sadc -D --unix_time=${STEP} - 1 1 >/dev/null + +rm -f tests/root +ln -s root2 tests/root +STEP=`TZ=GMT date --date="yesterday 23:59:58" +%s` +TZ=GMT ./sa1 -D --unix_time=${STEP} 1 1 + +rm -f tests/root +ln -s root3 tests/root +STEP=`TZ=GMT date --date="yesterday 23:59:59" +%s` +TZ=GMT ./sa1 -D --unix_time=${STEP} 1 1 + +rm -f tests/root +ln -s root4 tests/root +STEP=`TZ=GMT date --date="today 00:00:01" +%s` +TZ=GMT ./sa1 --rotate iso --unix_time=${STEP} 1 1 diff --git a/tests/00255 b/tests/00255 new file mode 100644 index 0000000..dda5d72 --- /dev/null +++ b/tests/00255 @@ -0,0 +1,2 @@ +DATE=`date --date=yesterday +%Y%m%d` +LC_ALL=C TZ=GMT ./sar -f tests/sa${DATE} | grep -v SYSSTAT > tests/out1.sa1-rot.tmp && diff -u tests/expected.sa1-rot tests/out1.sa1-rot.tmp diff --git a/tests/TLIST b/tests/TLIST index 099f2e8..9813b0c 100644 --- a/tests/TLIST +++ b/tests/TLIST @@ -39,11 +39,15 @@ NOTES: 00190 LC_ALL=C TZ=GMT S_TIME_FORMAT= S_COLORS=always S_COLORS_SGR="C=33;22:H=31;1:I=32;22:M=35;1:N=34;1:R=31;22:Z=36;22" ./sar -C -u --getenv -f tests/data.tmp > tests/out.sar-always.tmp ===== sar: Playing with sa1 and sa2 shell scripts -00200 ./sa1 --boot; ./sa1 --unix_time=1555593629 1 1; ./sa1 --unix_time=1555593649 1 1 +00200 TZ=GMT ./sa1 --boot; TZ=GMT ./sa1 --unix_time=1555593629 1 1; TZ=GMT ./sa1 --unix_time=1555593649 1 1 00205 LC_ALL=C TZ=GMT ./sar -f tests/sa18 > tests/out.sa1.tmp 00220 LC_ALL=C TZ=GMT ./sa2 -A && mv tests/sar${DATE} tests/out.sa2.tmp && rm -f tests/sa${DATE} 00230 ./cron/sysstat.sleep post hibernate 00235 LC_ALL=C TZ=GMT ./sar -f tests/sa01 -C > tests/out.sa1-sleep.tmp +00240 TZ=GMT ./sa1 --rotate --unix_time=${STEP} 1 1 +00245 LC_ALL=C TZ=GMT ./sar -f tests/sa${DATE} | grep -v SYSSTAT > tests/out.sa1-rot.tmp +00250 TZ=GMT ./sa1 --rotate iso --unix_time=${STEP} 1 1 +00255 LC_ALL=C TZ=GMT ./sar -f tests/sa${DATE} | grep -v SYSSTAT > tests/out1.sa1-rot.tmp ===== Checking JSON output validity 00300 ./sadf -j tests/data.tmp -C -- -A | $VER_JSON >/dev/null && ./sadf -j tests/data.tmp | $VER_JSON >/dev/null && ./sadf -t -j tests/data.tmp | $VER_JSON >/dev/null diff --git a/tests/expected.sa1-rot b/tests/expected.sa1-rot new file mode 100644 index 0000000..bf78f7d --- /dev/null +++ b/tests/expected.sa1-rot @@ -0,0 +1,6 @@ + +23:59:57 CPU %user %nice %system %iowait %steal %idle +23:59:58 all 2.15 12.50 2.36 0.12 0.00 82.88 +23:59:59 all 2.28 0.00 1.93 0.48 0.00 95.31 +00:00:01 all 2.67 23.08 2.40 0.17 0.00 71.68 +Average: all 2.40 13.65 2.26 0.23 0.00 81.46 -- 2.40.0