=====
00010	./sar -V >/dev/null
00011	./iostat -V >/dev/null
00012	./mpstat -V >/dev/null
00013	./sadc -V >/dev/null
00014	./sadf -V >/dev/null
00015	./pidstat -V >/dev/null
00016	./tapestat -V >/dev/null
00017	./cifsiostat -V >/dev/null

=====	Creating data.tmp
00100	5 x ./sadc --unix_time=XXXXXXXXX -S XALL,-A_PWR_FAN,-A_PWR_IN,-A_PWR_TEMP tests/data.tmp 1 1 >/dev/null
00110	./sadc --unix_time=XXXXXXXXX tests/data.tmp
00120	./sadc --unix_time=1555594749 -C "Testing sysstat!" tests/data.tmp

=====	sar: Reading data.tmp
00130	LC_ALL=C TZ=GMT ./sar -C -u -P ALL -f tests/data.tmp > tests/out.sar-u.tmp
00131	LC_ALL=C TZ=GMT ./sar -bBdFHqSvwWy -I SUM -I ALL -m CPU -n ALL -r ALL -u ALL -P ALL -f tests/data.tmp > tests/out.sar-all.tmp
	[Don't take into account sensors statistics which are not read from test root directory]
00134	diff -u tests/out.u.tmp tests/expected.sar-u
00136	diff -u tests/out.sar-all.tmp tests/expected.sar-all

=====	Appending data to data.tmp
00140	./sadc --unix_time=1555595649 tests/data.tmp
00150	2 x ./sadc --unix_time=XXXXXXXXX -S XALL tests/data.tmp 1 1 >/dev/null

=====	sar: Reading data.tmp
00160	LC_ALL=C TZ=GMT ./sar -C -u -P ALL -f tests/data.tmp > tests/out2.sar-u.tmp
00161	LC_ALL=C TZ=GMT ./sar -A -f tests/data.tmp > tests/out2.sar-all.tmp
00164	diff -u tests/out2.sar-u.tmp tests/expected2.sar-u
00166	diff -u tests/out2.sar-all.tmp tests/expected2.sar-all

=====	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
00310	./mpstat -A -o JSON | $VER_JSON >/dev/null
00320	./iostat -t -p ALL -o JSON | $VER_JSON >/dev/null

=====	Checking XML output validity
00400	./sadf -x tests/data.tmp -C -- -A | $VER_XML --schema xml/sysstat.xsd - >/dev/null && ./sadf -x tests/data.tmp | $VER_XML --schema xml/sysstat.xsd - >/dev/null && ./sadf -T -x tests/data.tmp | $VER_XML --schema xml/sysstat.xsd - >/dev/null
00410	./sadf -x tests/data.tmp -C -- -A | $VER_XML --dtdvalid xml/sysstat-*.dtd - >/dev/null && ./sadf -x tests/data.tmp | $VER_XML --dtdvalid xml/sysstat-*.dtd - >/dev/null && ./sadf -t -x tests/data.tmp | $VER_XML --dtdvalid xml/sysstat-*.dtd - >/dev/null

=====	Checking sadf output
00500	./sadf -p tests/data.tmp -C -- -A > tests/out.sadf-p.tmp
00501	diff -u tests/out.sadf-p.tmp tests/expected.sadf-p
00510	./sadf -d tests/data.tmp -C -- -A > tests/out.sadf-d.tmp
00511	diff -u tests/out.sadf-d.tmp tests/expected.sadf-d
00520	./sadf -x tests/data.tmp -C -- -A > tests/out.sadf-x.tmp
00521	diff -u tests/out.sadf-x.tmp tests/expected.sadf-x
00530	./sadf -j tests/data.tmp -C -- -A > tests/out.sadf-j.tmp
00531	diff -u tests/out.sadf-j.tmp tests/expected.sadf-j
00540	./sadf -g tests/data.tmp -C -- -A > tests/out.sadf-g.tmp
00541	diff -u tests/out.sadf-g.tmp tests/expected.sadf-g
00545	./sadf -g tests/data.tmp -- -F MOUNT > tests/out1.sadf-g.tmp
00546	diff -u tests/out1.sadf-g.tmp tests/expected1.sadf-g
00550	TZ=GMT ./sadf -g -O autoscale,packed,oneday,showidle,showtoc,skipempty,showinfo,bwcol tests/data.tmp -T -C -- -A > tests/out2.sadf-g.tmp
00551	diff -u tests/out2.sadf-g.tmp tests/expected2.sadf-g
00560	./sadf -H tests/data.tmp > tests/out.sadf-H.tmp
00561	diff -u tests/out.sadf-H.tmp tests/expected.sadf-H
00570	./sadf -r -O debug tests/data.tmp -C -- -A > tests/out.sadf-r.tmp
00571	diff -u tests/out.sadf-r.tmp tests/expected.sadf-r
00580	./sadf -d -s 13:20:20 -e 13:20:40 --iface=enp6s0 --dev=sda --fs=/dev/sda6 tests/data.tmp -- -n DEV -Fdp > tests/out.sadf-se.tmp
00582	diff -u tests/out.sadf-se.tmp tests/expected.sadf-se

=====	Checking sadf conversion
00600	./sadf -c tests/data-9.1.6 > tests/data-9.1.6.tmp
00605	LC_ALL=C TZ=GMT ./sar -C -A -f tests/data-9.1.6.tmp > tests/out.data-9.1.6.tmp
00607	diff -u tests/out.data-9.1.6.tmp tests/expected.data-9.1.6
00610	./sadf -c tests/data-10.3.1 > tests/data-10.3.1.tmp
00615	LC_ALL=C TZ=GMT ./sar -C -A -f tests/data-10.3.1.tmp > tests/out.data-10.3.1.tmp
00617	diff -u tests/out.data-10.3.1.tmp tests/expected.data-10.3.1
00620	./sadf -c tests/data-11.6.5 > tests/data-11.6.5.tmp
00625	LC_ALL=C TZ=GMT ./sar -C -A -f tests/data-11.6.5.tmp > tests/out.data-11.6.5.tmp
00627	diff -u tests/out.data-11.6.5.tmp tests/expected.data-11.6.5	

=====	Reading datafile from another architecture
00700	LC_ALL=C TZ=GMT ./sar -C -A -f tests/data-ppc-11.7.2 > tests/out.data-ppc-11.7.2.tmp
00702	diff -u tests/out.data-ppc-11.7.2.tmp tests/expected.data-ppc-11.7.2

=====	Testing sar's options
00800	LC_ALL=C TZ=GMT ./sar --iface=lo,enp6s0,eth0 -n DEV,EDEV -f tests/data.tmp > tests/out.sar-iface.tmp
00802	diff -u tests/out.sar-iface.tmp tests/expected.sar-iface
00810	LC_ALL=C TZ=GMT ./sar --dev=sda -dp -f tests/data.tmp > tests/out.sar-dev.tmp
00812	diff -u tests/out.sar-dev.tmp tests/expected.sar-dev
00820	LC_ALL=C TZ=GMT ./sar --fs=/dev/sda6,/dev/foo -F -f tests/data.tmp > tests/out.sar-fs.tmp
00822	diff -u tests/out.sar-fs.tmp tests/expected.sar-fs
00830	LC_ALL=C TZ=GMT ./sar --dec=0 -A -f tests/data.tmp > tests/out.sar-dec.tmp
00832	diff -u tests/out.sar-dec.tmp tests/expected.sar-dec
00840	LC_ALL=C TZ=GMT ./sar --human -A -f tests/data.tmp > tests/out.sar-human.tmp
00842	diff -u tests/out.sar-human.tmp tests/expected.sar-human
00850	LC_ALL=C TZ=GMT ./sar -s 13:20:20 -e 13:20:40 -f tests/data.tmp > tests/out.sar-se.tmp
00852	diff -u tests/out.sar-se.tmp tests/expected.sar-se
00860	LC_ALL=C TZ=GMT ./sar -i 60 -uw -P ALL -f tests/data.tmp > tests/out.sar-i.tmp
00862	diff -u tests/out.sar-i.tmp tests/expected.sar-i
	[WARNING: /proc/uptime files are not consistent with unix_time values used. Don't trust timestamps!]
00870	LC_ALL=C TZ=GMT ./sar 60 -uw -P ALL -f tests/data.tmp > tests/out2.sar-i.tmp
00872	diff -u tests/out2.sar-i.tmp tests/expected.sar-i
00880	LC_ALL=C TZ=GMT ./sar 60 2 -f tests/data.tmp > tests/out3.sar-i.tmp
00882	diff -u tests/out3.sar-i.tmp tests/expected3.sar-i
00900	LC_ALL=C TZ=GMT ./sar -h -j UUID -f tests/data.tmp > tests/out.sar-jUUID.tmp
00902	diff -u tests/out.sar-jUUID.tmp tests/expected.sar-jUUID
00910	LC_ALL=C TZ=GMT ./sar -uw -f tests/data-cd -s 23:59:58 -e 00:00:00 > tests/out.sar-cd.tmp
	[Testing options -s/-e on a file contents spanning two consecutive days]
	[Work only with very simple file contents (no LINUX RESTART or COMMENT records)]
00912	diff -u tests/out.sar-cd.tmp tests/expected.sar-cd
00920	LC_ALL=C TZ=GMT ./sar -f tests/data.tmp -e 13:30 -z -n DEV -dp > tests/out.sar-z.tmp
00922	diff -u tests/out.sar-z.tmp tests/expected.sar-z
00930	LC_ALL=C TZ=GMT ./sar -ur 0 > tests/out.sar-0.tmp
00932	diff -u tests/out.sar-0.tmp tests/expected.sar-0
00940	LC_ALL=C TZ=GMT ./sar 1 2 > tests/out.sar.tmp
00942	diff -u tests/out.sar.tmp tests/expected.sar1

=====	Creating data0.tmp with no data inside
01000	./sadc --unix_time=1555593609 -S A_NULL,A_PCSW tests/data0.tmp >/dev/null

=====	sar/sadf: Reading data0.tmp
01100	LC_ALL=C TZ=GMT ./sar -A -f tests/data0.tmp > tests/out0.sar-A.tmp
01102	diff -u tests/out0.sar-A.tmp tests/expected0.sar-A
01110	./sadf tests/data0.tmp -- -A > tests/out0.sadf.tmp
01112	diff -u tests/out0.sadf.tmp tests/expected0.sadf
01120	./sadf -x tests/data0.tmp -- -A > tests/out0.sadf-x.tmp
01122	diff -u tests/out0.sadf-x.tmp tests/expected0.sadf-x
01130	./sadf -j tests/data0.tmp -- -A | $VER_JSON >/dev/null
01140	LC_ALL=C TZ=GMT ./sar -r -f tests/data0.tmp 2>&1 | grep "Requested activities not available" >/dev/null
01145	./sadf tests/data0.tmp 2>&1 | grep "Requested activities not available" >/dev/null
01150	./sadf -g tests/data0.tmp -- -A > tests/out0.sadf-g.tmp
01152	diff -u tests/out0.sadf-g.tmp tests/expected0.sadf-g

=====	Append data to data0.tmp then read its contents
01200	2 x ./sadc --unix_time=xxxxxxxxx [ -S XALL ] tests/data0.tmp [ 1 1 ] >/dev/null
01210	LC_ALL=C TZ=GMT ./sar -A -f tests/data0.tmp > tests/out01.sar-A.tmp
01212	diff -u tests/out01.sar-A.tmp tests/expected01.sar-A
01220	./sadf -d tests/data0.tmp -- -A > tests/out01.sadf-d.tmp
01222	diff -u tests/out01.sadf-d.tmp tests/expected01.sadf-d
01230	./sadf -j tests/data0.tmp -- -A | $VER_JSON >/dev/null
01240	./sadf -g tests/data0.tmp -- -A > tests/out01.sadf-g.tmp
01242	diff -u tests/out01.sadf-g.tmp tests/expected01.sadf-g
01250	./sadf -H tests/data0.tmp > tests/out01.sadf-H.tmp
01252	diff -u tests/out01.sadf-H.tmp tests/expected01.sadf-H

=====	Playing with standard activity datafiles
01300	echo foo >tests/sa01 ; ./sadc 1 1 - 2>&1 | grep "Invalid system activity" >/dev/null
01305	./sadc -F 1 1 -
01310	LC_ALL=C TZ=GMT ./sar -f tests/sa01 > tests/out3.sar-u.tmp
01312	diff -u tests/out3.sar-u.tmp tests/expected3.sar-u
01314	LC_ALL=C TZ=GMT ./sar > tests/out31.sar-u.tmp
01316	diff -u tests/out31.sar-u.tmp tests/expected3.sar-u
01320	./sadc -D -
01330	LC_ALL=C TZ=GMT ./sar -f tests/sa19700101 > tests/out32.sar-u.tmp
01332	diff -u tests/out32.sar-u.tmp tests/expected32.sar-u
01335	LC_ALL=C TZ=GMT ./sar > tests/out33.sar-u.tmp
01337	diff -u tests/out33.sar-u.tmp tests/expected32.sar-u
01340	./sadf > tests/out3.sadf.tmp
01342	diff -u tests/out3.sadf.tmp tests/expected3.sadf
01350	TZ=GMT ./sadc --unix_time=1556755199 - 1 3
	[Create sa01 and sa02 - Timestamp can be obtained with: date +%s --date='Wed May  1 23:59:59 CEST 2019']
01352	LC_ALL=C TZ=GMT ./sar -f tests/sa01 > tests/out33.sar-u.tmp; LC_ALL=C TZ=GMT ./sar -f tests/sa02 >> tests/out33.sar-u.tmp
01355	diff -u tests/out33.sar-u.tmp tests/expected33.sar-u
01360	LC_ALL=C TZ=GMT ./sar --unix_time=1556755203 -1 > tests/out.sar-1.tmp
	[Go to day 02 and try to read sa01]
01362	diff -u tests/out.sar-1.tmp tests/expected.sar-1
01370	LC_ALL=C TZ=GMT ./sar --unix_time=1556755203 -D -o 1 2 > /dev/null
	[Create datafile sa20190502]
01372	LC_ALL=C TZ=GMT ./sar -f tests/sa20190502 > tests/out.sar-D.tmp
01375	diff -u tests/out.sar-D.tmp tests/expected.sar-D

=====	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
01410	./sar 0 0 2>&1 | grep "Usage:" >/dev/null
01415	./sar 0 2 2>&1 | grep "Usage:" >/dev/null
01420	./sar 2 0 2>&1 | grep "Usage:" >/dev/null
01425	./sar 2 2 2 2>&1 | grep "Usage:" >/dev/null
01430	./sar -o foo 2>&1 | grep "Usage:" >/dev/null
01440	LC_ALL=C TZ=GMT ./sar --unix_time=123456789 2>&1 | grep "Please check" >/dev/null
