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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
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
--- /dev/null
+
+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