--- /dev/null
+rm -f tests/sa-oe.tmp
+rm -f tests/root
+ln -s root1 tests/root
+LC_ALL=C TZ=GMT ./sar --unix_time=1556755203 -o tests/sa-oe.tmp -e 00:00:06 1 10 > /dev/null
--- /dev/null
+LC_ALL=C TZ=GMT ./sar -f tests/sa-oe.tmp > tests/out.sar-oe.tmp && diff -u tests/expected.sar-oe tests/out.sar-oe.tmp
--- /dev/null
+rm -f tests/sa-oe2.tmp
+rm -f tests/root
+ln -s root1 tests/root
+LC_ALL=C TZ=GMT ./sar --unix_time=1556755203 -o tests/sa-oe2.tmp -e 1556755206 2 > /dev/null
--- /dev/null
+LC_ALL=C TZ=GMT ./sar -f tests/sa-oe2.tmp > tests/out.sar-oe2.tmp && diff -u tests/expected.sar-oe2 tests/out.sar-oe2.tmp
-LC_ALL=C TZ="America/New_York" ./sar -f tests/data.tmp -e 1590933000 > tests/out.sar-e-epoch.tmp && diff -u tests/expected.sar-e-epoch tests/out.sar-e-epoch.tmp
+LC_ALL=C TZ="America/New_York" ./sar -f tests/data.tmp -e 1555595349 > tests/out.sar-e-epoch.tmp && diff -u tests/expected.sar-e-epoch tests/out.sar-e-epoch.tmp
--- /dev/null
+LC_ALL=C ./sar -f tests/data.tmp -s 1555594649 -e 1555593629 2>&1 | grep "Usage:" >/dev/null
--- /dev/null
+LC_ALL=C ./sadf tests/data.tmp -s 1555594649 -e 1555593629 2>&1 | grep "Usage:" >/dev/null
-LC_ALL=C TZ="Europe/Paris" ./sadf -d tests/data.tmp -T -s 1590933000 > tests/out.sadf-T-s-epoch.tmp && diff -u tests/expected.sadf-T-s-epoch tests/out.sadf-T-s-epoch.tmp
+LC_ALL=C TZ="Europe/Paris" ./sadf -d tests/data.tmp -T -s 1555595349 > tests/out.sadf-T-s-epoch.tmp && diff -u tests/expected.sadf-T-s-epoch tests/out.sadf-T-s-epoch.tmp
-LC_ALL=C ./sadf -d -e foXobXar 2>&1 |grep "No such file" >/dev/null
+LC_ALL=C ./sadf -d -e foXobXar 2>&1 | grep "No such file" >/dev/null
-LC_ALL=C ./sadf -d tests/data.tmp -s fo:ob 2>&1 |grep "Usage:" >/dev/null
+LC_ALL=C ./sadf -d tests/data.tmp -s fo:ob 2>&1 | grep "Usage:" >/dev/null
-LC_ALL=C ./sadf -d -e fooba 2>&1 |grep "No such file" >/dev/null
+LC_ALL=C ./sadf -d -e fooba 2>&1 | grep "No such file" >/dev/null
--- /dev/null
+LC_ALL=C TZ=GMT ./sar -f tests/data.tmp -s 13:20:19 -e 13:54:09 > tests/out2.sar-se.tmp && diff -u tests/expected2.sar-se tests/out2.sar-se.tmp
--- /dev/null
+LC_ALL=C TZ=GMT ./sar -f tests/data.tmp -s 13:20:19 -e 13:20:39 > tests/out3.sar-se.tmp && diff -u tests/expected3.sar-se tests/out3.sar-se.tmp
--- /dev/null
+LC_ALL=C TZ=GMT ./sadf -d tests/data.tmp -s 13:20:19 -e 1555595649 > tests/out2.sadf-se.tmp && diff -u tests/expected2.sadf-se tests/out2.sadf-se.tmp
01380 LC_ALL=C TZ=GMT ./sar --unix_time=1556755203 -o tests/sa-sigint.tmp 1 10 > /dev/null
[Create binary datafile sa-sigint.tmp. Stop with a simulated Ctrl/C]
01382 LC_ALL=C TZ=GMT ./sar -f tests/sa-sigint.tmp -m CPU > tests/out.sar-sigint.tmp
+01390 LC_ALL=C TZ=GMT ./sar --unix_time=1556755203 -o tests/sa-oe.tmp -e 00:00:06 1 10 > /dev/null
+ [Create binary datafile sa-oe.tmp. Ending time takes precedence over count parameter]
+01392 LC_ALL=C TZ=GMT ./sar -f tests/sa-oe.tmp > tests/out.sar-oe.tmp
+01394 LC_ALL=C TZ=GMT ./sar --unix_time=1556755203 -o tests/sa-oe2.tmp -e 1556755206 2 > /dev/null
+ [Create binary datafile sa-oe2.tmp. Ending time tells sar when to stop collecting]
+01396 LC_ALL=C TZ=GMT ./sar -f tests/sa-oe2.tmp > tests/out.sar-oe2.tmp
===== Testing error cases
01400 LC_ALL=C TZ=GMT ./sar -f tests/data-trunc 2>&1 | grep "End of system activity file unexpected" >/dev/null
01920 LC_ALL=C TZ="America/New_York" ./sadf -r tests/data-tz.tmp -- -uw > tests/out.sadf-r-tz.tmp
01925 LC_ALL=C TZ="America/New_York" ./sadf -r tests/data-tz.tmp -T -- -uw > tests/out.sadf-r-T-tz.tmp
01928 LC_ALL=C TZ="America/New_York" ./sadf -r tests/data-tz.tmp -t -- -uw > tests/out.sadf-r-t-tz.tmp
-01950 LC_ALL=C TZ="America/New_York" ./sar -f tests/data.tmp -e 1590933000 > tests/out.sar-e-epoch.tmp
+01950 LC_ALL=C TZ="America/New_York" ./sar -f tests/data.tmp -e 1555595349 > tests/out.sar-e-epoch.tmp
+01952 LC_ALL=C ./sar -f tests/data.tmp -s 1555594649 -e 1555593629 2>&1 | grep "Usage:" >/dev/null
+01953 LC_ALL=C ./sadf tests/data.tmp -s 1555594649 -e 1555593629 2>&1 | grep "Usage:" >/dev/null
01955 LC_ALL=C ./sadf -d tests/data.tmp -s 1590939000 > tests/out.sadf-s-epoch.tmp
-01957 LC_ALL=C TZ="Europe/Paris" ./sadf -d tests/data.tmp -T -s 1590933000 > tests/out.sadf-T-s-epoch.tmp
+01957 LC_ALL=C TZ="Europe/Paris" ./sadf -d tests/data.tmp -T -s 1555595349 > tests/out.sadf-T-s-epoch.tmp
01960 LC_ALL=C ./sadf -d tests/data.tmp -U -s 1555593629 -e 1555594649 > tests/out.sadf-U-se-epoch.tmp
-01965 LC_ALL=C ./sadf -d tests/data.tmp -s fo:ob:ar 2>&1 |grep "Usage:" >/dev/null
-01970 LC_ALL=C ./sadf -d -e foXobXar 2>&1 |grep "No such file" >/dev/null
-01972 LC_ALL=C ./sadf -d tests/data.tmp -s fo:ob 2>&1 |grep "Usage:" >/dev/null
-01973 LC_ALL=C ./sadf -d -e fooba 2>&1 |grep "No such file" >/dev/null
+01965 LC_ALL=C ./sadf -d tests/data.tmp -s fo:ob:ar 2>&1 | grep "Usage:" >/dev/null
+01970 LC_ALL=C ./sadf -d -e foXobXar 2>&1 | grep "No such file" >/dev/null
+01972 LC_ALL=C ./sadf -d tests/data.tmp -s fo:ob 2>&1 | grep "Usage:" >/dev/null
+01973 LC_ALL=C ./sadf -d -e fooba 2>&1 | grep "No such file" >/dev/null
+01975 LC_ALL=C TZ=GMT ./sar -f tests/data.tmp -s 13:20:19 -e 13:54:09 > tests/out2.sar-se.tmp
+01976 LC_ALL=C TZ=GMT ./sar -f tests/data.tmp -s 13:20:19 -e 13:20:39 > tests/out3.sar-se.tmp
+01977 LC_ALL=C TZ=GMT ./sadf -d tests/data.tmp -s 13:20:19 -e 1555595649 > tests/out2.sadf-se.tmp
===== iostat tests (basic output)
02010 LC_ALL=C TZ=GMT ./iostat 2 3 > tests/out.iostat.tmp
--- /dev/null
+Linux 1.2.3-TEST (SYSSTAT.TEST) 05/02/19 _x86_64_ (9 CPU)
+
+00:00:03 CPU %user %nice %system %iowait %steal %idle
+00:00:04 all 2.15 12.50 2.36 0.12 0.00 82.88
+00:00:05 all 2.28 0.00 1.93 0.48 0.00 95.31
+00:00:06 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
--- /dev/null
+Linux 1.2.3-TEST (SYSSTAT.TEST) 05/02/19 _x86_64_ (9 CPU)
+
+00:00:03 CPU %user %nice %system %iowait %steal %idle
+00:00:05 all 2.15 12.50 2.36 0.12 0.00 82.88
+00:00:07 all 2.28 0.00 1.93 0.48 0.00 95.31
+Average: all 2.20 7.13 2.17 0.27 0.00 88.22
--- /dev/null
+# hostname;interval;timestamp;CPU;%user;%nice;%system;%iowait;%steal;%idle
+SYSSTAT.TEST;31;2019-04-18 13:20:29 UTC;-1;2.28;0.00;1.93;0.48;0.00;95.31
+SYSSTAT.TEST;39;2019-04-18 13:20:39 UTC;-1;2.66;23.20;2.27;0.17;0.00;71.70
+SYSSTAT.TEST;22;2019-04-18 13:20:49 UTC;-1;6.80;8.80;7.53;0.49;0.39;75.90
+SYSSTAT.TEST;-1;2019-04-18 13:37:29 UTC;LINUX-RESTART (9 CPU)
+SYSSTAT.TEST;-1;2019-04-18 13:54:09 UTC;LINUX-RESTART (10 CPU)
--- /dev/null
+Linux 1.2.3-TEST (SYSSTAT.TEST) 04/18/19 _x86_64_ (9 CPU)
+
+13:20:19 CPU %user %nice %system %iowait %steal %idle
+13:20:29 all 2.28 0.00 1.93 0.48 0.00 95.31
+13:20:39 all 2.66 23.20 2.27 0.17 0.00 71.70
+13:20:49 all 6.80 8.80 7.53 0.49 0.39 75.90
+Average: all 4.01 13.45 3.02 0.39 0.00 79.13
+
+13:37:29 LINUX RESTART (9 CPU)
+
+13:54:09 LINUX RESTART (10 CPU)
--- /dev/null
+Linux 1.2.3-TEST (SYSSTAT.TEST) 04/18/19 _x86_64_ (9 CPU)
+
+13:20:19 CPU %user %nice %system %iowait %steal %idle
+13:20:29 all 2.28 0.00 1.93 0.48 0.00 95.31
+13:20:39 all 2.66 23.20 2.27 0.17 0.00 71.70
+Average: all 2.52 14.28 2.14 0.29 0.00 80.78