From d39edaa525ad4963df873665893e92410c6f24e5 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sun, 29 Sep 2019 10:01:46 +0200 Subject: [PATCH] simtest: Add non regression test for sa2 shell script Signed-off-by: Sebastien GODARD --- .travis.yml | 2 +- do_test | 4 +- tests/00220 | 9 ++++ tests/00225 | 1 + tests/TLIST | 4 +- tests/expected.sa2 | 119 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 tests/00220 create mode 100644 tests/00225 create mode 100644 tests/expected.sa2 diff --git a/.travis.yml b/.travis.yml index db116a15..0aa0e273 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,2 +1,2 @@ language: c -script: ./configure CFLAGS="-D DEBUG -D TEST" sa_lib_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests && make && make simtest +script: ./configure CFLAGS="-D DEBUG -D TEST" sa_lib_dir=. sar_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests && make && make simtest diff --git a/do_test b/do_test index 7b112a9e..5314fc71 100755 --- a/do_test +++ b/do_test @@ -2,11 +2,11 @@ if [ "$1" = "conf" ] then make distclean - ./configure sa_lib_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests && make CFLAGS="-D DEBUG -D TEST" + ./configure sa_lib_dir=. sar_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests && make CFLAGS="-D DEBUG -D TEST" elif [ "$1" = "comp" ] then make CFLAGS="-D DEBUG -D TEST" else make distclean - ./configure sa_lib_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests && make CFLAGS="-D DEBUG -D TEST" && make simtest + ./configure sa_lib_dir=. sar_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests && make CFLAGS="-D DEBUG -D TEST" && make simtest fi diff --git a/tests/00220 b/tests/00220 new file mode 100644 index 00000000..180e6ad1 --- /dev/null +++ b/tests/00220 @@ -0,0 +1,9 @@ +TZ=GMT +DATE=`date --date=yesterday +%d` +if [ ${DATE} -ne 18 ] +then + rm -f tests/sa${DATE} + mv tests/sa18 tests/sa${DATE} +fi +echo sa2: File is sa${DATE} +LC_ALL=C TZ=GMT ./sa2 -A && mv tests/sar${DATE} tests/out.sa2.tmp diff --git a/tests/00225 b/tests/00225 new file mode 100644 index 00000000..dffce861 --- /dev/null +++ b/tests/00225 @@ -0,0 +1 @@ +diff -u tests/out.sa2.tmp tests/expected.sa2 diff --git a/tests/TLIST b/tests/TLIST index 96be619c..b1f5c9c6 100644 --- a/tests/TLIST +++ b/tests/TLIST @@ -39,8 +39,10 @@ NOTES: ===== sar: Playing with sa1 and sa2 shell scripts 00200 ./sa1 --boot; ./sa1 --unix_time=1555593629 1 1; ./sa1 --unix_time=1555593649 1 1 -00205 LC_ALL=C TZ=GMT ./sar -f tests/sa01 > tests/out.sa1.tmp +00205 LC_ALL=C TZ=GMT ./sar -f tests/sa18 > tests/out.sa1.tmp 00208 diff -u tests/out.sa1.tmp tests/expected.sa1 +00220 LC_ALL=C TZ=GMT ./sa2 -A && mv tests/sar${DATE} tests/out.sa2.tmp +00225 diff -u tests/out.sa2.tmp tests/expected.sa2 ===== 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.sa2 b/tests/expected.sa2 new file mode 100644 index 00000000..0e028166 --- /dev/null +++ b/tests/expected.sa2 @@ -0,0 +1,119 @@ +Linux 1.2.3-TEST (SYSSTAT.TEST) 04/18/19 _x86_64_ (8 CPU) + +13:20:09 LINUX RESTART (8 CPU) + +13:20:29 CPU %usr %nice %sys %iowait %steal %irq %soft %guest %gnice %idle +13:20:49 all 2.28 0.00 1.55 0.50 0.00 0.19 0.19 0.00 0.00 95.29 +13:20:49 0 1.25 0.00 1.51 0.35 0.00 0.19 0.58 0.00 0.00 96.12 +13:20:49 1 2.15 0.00 0.96 0.77 0.00 0.10 0.16 0.00 0.00 95.87 +13:20:49 2 3.27 0.00 1.73 0.77 0.00 0.22 0.10 0.00 0.00 93.90 +13:20:49 3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 +13:20:49 4 3.44 0.00 2.16 0.84 0.00 0.32 0.16 0.00 0.00 93.08 +13:20:49 5 2.76 0.00 2.08 0.16 0.00 0.19 0.10 0.00 0.00 94.71 +13:20:49 7 0.83 0.00 0.83 0.10 0.00 0.10 0.06 0.00 0.00 98.08 +Average: all 2.28 0.00 1.55 0.50 0.00 0.19 0.19 0.00 0.00 95.29 +Average: 0 1.25 0.00 1.51 0.35 0.00 0.19 0.58 0.00 0.00 96.12 +Average: 1 2.15 0.00 0.96 0.77 0.00 0.10 0.16 0.00 0.00 95.87 +Average: 2 3.27 0.00 1.73 0.77 0.00 0.22 0.10 0.00 0.00 93.90 +Average: 3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 +Average: 4 3.44 0.00 2.16 0.84 0.00 0.32 0.16 0.00 0.00 93.08 +Average: 5 2.76 0.00 2.08 0.16 0.00 0.19 0.10 0.00 0.00 94.71 +Average: 6 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 +Average: 7 0.83 0.00 0.83 0.10 0.00 0.10 0.06 0.00 0.00 98.08 + +13:20:29 proc/s cswch/s +13:20:49 4.83 46287.74 +Average: 4.83 46287.74 + +13:20:29 pswpin/s pswpout/s +13:20:49 0.00 0.00 +Average: 0.00 0.00 + +13:20:29 pgpgin/s pgpgout/s fault/s majflt/s pgfree/s pgscank/s pgscand/s pgsteal/s %vmeff +13:20:49 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Average: 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + +13:20:29 tps rtps wtps dtps bread/s bwrtn/s bdscd/s +13:20:49 5.44 2.24 3.20 0.00 0.00 3.20 0.00 +Average: 5.44 2.24 3.20 0.00 0.00 3.20 0.00 + +13:20:29 kbmemfree kbavail kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty kbanonpg kbslab kbkstack kbpgtbl kbvmused +13:20:49 1437740 4389516 3179712 39.04 260172 2821596 12097852 48.54 4042384 1772396 396 2733164 445740 15328 73760 0 +Average: 1437740 4389516 3179712 39.04 260172 2821596 12097852 48.54 4042384 1772396 396 2733164 445740 15328 73760 0 + +13:20:29 kbswpfree kbswpused %swpused kbswpcad %swpcad +13:20:49 16777212 0 0.00 0 0.00 +Average: 16777212 0 0.00 0 0.00 + +13:20:29 kbhugfree kbhugused %hugused kbhugrsvd kbhugsurp +13:20:49 0 0 0.00 0 0 +Average: 0 0 0.00 0 0 + +13:20:29 dentunusd file-nr inode-nr pty-nr +13:20:49 156063 16704 157735 4 +Average: 156063 16704 157735 4 + +13:20:29 runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked +13:20:49 3 956 3.16 3.24 3.43 0 +Average: 3 956 3.16 3.24 3.43 0 + +13:20:29 TTY rcvin/s txmtin/s framerr/s prtyerr/s brk/s ovrun/s +13:20:49 0 0.00 0.00 0.00 0.00 0.00 0.00 +13:20:49 1 0.00 0.00 0.00 0.00 0.00 0.00 +Average: 0 0.00 0.00 0.00 0.00 0.00 0.00 +Average: 1 0.00 0.00 0.00 0.00 0.00 0.00 + +13:20:29 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil +13:20:49 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +13:20:49 virbr0-nic 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +13:20:49 enp6s0 53.55 17.45 64.37 3.38 0.00 0.00 9.25 0.05 +13:20:49 virbr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +13:20:49 wlp5s0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Average: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Average: virbr0-nic 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Average: enp6s0 53.55 17.45 64.37 3.38 0.00 0.00 9.25 0.05 +Average: virbr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Average: wlp5s0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + +13:20:29 IFACE rxerr/s txerr/s coll/s rxdrop/s txdrop/s txcarr/s rxfram/s rxfifo/s txfifo/s +13:20:49 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +13:20:49 virbr0-nic 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +13:20:49 enp6s0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +13:20:49 virbr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +13:20:49 wlp5s0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Average: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Average: virbr0-nic 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Average: enp6s0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Average: virbr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Average: wlp5s0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + +13:20:29 call/s retrans/s read/s write/s access/s getatt/s +13:20:49 0.00 0.00 0.00 0.00 0.00 0.00 +Average: 0.00 0.00 0.00 0.00 0.00 0.00 + +13:20:29 scall/s badcall/s packet/s udp/s tcp/s hit/s miss/s sread/s swrite/s saccess/s sgetatt/s +13:20:49 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Average: 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + +13:20:29 totsck tcpsck udpsck rawsck ip-frag tcp-tw +13:20:49 1316 10 6 0 0 1 +Average: 1316 10 6 0 0 1 + +13:20:29 CPU total/s dropd/s squeezd/s rx_rps/s flw_lim/s +13:20:49 all 0.00 0.00 0.00 0.00 0.00 +13:20:49 0 0.00 0.00 0.00 0.00 0.00 +13:20:49 1 0.00 0.00 0.00 0.00 0.00 +13:20:49 2 0.00 0.00 0.00 0.00 0.00 +13:20:49 3 0.00 0.00 0.00 0.00 0.00 +13:20:49 4 0.00 0.00 0.00 0.00 0.00 +13:20:49 5 0.00 0.00 0.00 0.00 0.00 +13:20:49 7 0.00 0.00 0.00 0.00 0.00 +Average: all 0.00 0.00 0.00 0.00 0.00 +Average: 0 0.00 0.00 0.00 0.00 0.00 +Average: 1 0.00 0.00 0.00 0.00 0.00 +Average: 2 0.00 0.00 0.00 0.00 0.00 +Average: 3 0.00 0.00 0.00 0.00 0.00 +Average: 4 0.00 0.00 0.00 0.00 0.00 +Average: 5 0.00 0.00 0.00 0.00 0.00 +Average: 6 0.00 0.00 0.00 0.00 0.00 +Average: 7 0.00 0.00 0.00 0.00 0.00