]> granicus.if.org Git - sysstat/commitdiff
Add new non regression tests
authorSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 11 Nov 2020 15:38:43 +0000 (16:38 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 11 Nov 2020 15:38:43 +0000 (16:38 +0100)
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
tests/00200
tests/00240 [new file with mode: 0644]
tests/00245 [new file with mode: 0644]
tests/00250 [new file with mode: 0644]
tests/00255 [new file with mode: 0644]
tests/TLIST
tests/expected.sa1-rot [new file with mode: 0644]

index dea0069b285d05780d277e810283c7143e597f61..6033cb8c05363a17c8c4e1aabd9107943433ce7b 100644 (file)
@@ -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 (file)
index 0000000..6998bbb
--- /dev/null
@@ -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 (file)
index 0000000..0a57864
--- /dev/null
@@ -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 (file)
index 0000000..58397ed
--- /dev/null
@@ -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 (file)
index 0000000..dda5d72
--- /dev/null
@@ -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
index 099f2e8a5d68f2bb6ffd7e630030d313d0b2be3b..9813b0c222c2f2dcb6dfaa20a50fbc8b64aad052 100644 (file)
@@ -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 (file)
index 0000000..bf78f7d
--- /dev/null
@@ -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