From: Sebastien GODARD Date: Sat, 28 Sep 2019 13:48:32 +0000 (+0200) Subject: simtest: Add more non regression tests X-Git-Tag: v12.1.7~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26fb3c3c26fe86d61fee08124d44f905aff2c8c8;p=sysstat simtest: Add more non regression tests Test sa1 shell script. Also look for FIXME tags in code. Signed-off-by: Sebastien GODARD --- diff --git a/.travis.yml b/.travis.yml index e69b5fd..db116a1 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=. sa_dir=tests && make && make simtest +script: ./configure CFLAGS="-D DEBUG -D TEST" sa_lib_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests && make && make simtest diff --git a/do_test b/do_test index d80f805..7b112a9 100755 --- a/do_test +++ b/do_test @@ -2,11 +2,11 @@ if [ "$1" = "conf" ] then make distclean - ./configure sa_lib_dir=. conf_dir=. sa_dir=tests && make CFLAGS="-D DEBUG -D TEST" + ./configure sa_lib_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=. sa_dir=tests && make CFLAGS="-D DEBUG -D TEST" && make simtest + ./configure sa_lib_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests && make CFLAGS="-D DEBUG -D TEST" && make simtest fi diff --git a/tests/00050 b/tests/00050 new file mode 100644 index 0000000..5b31b38 --- /dev/null +++ b/tests/00050 @@ -0,0 +1 @@ +grep -i FIXME *.c *.h *.in && exit 1 || exit 0 diff --git a/tests/00200 b/tests/00200 new file mode 100644 index 0000000..dea0069 --- /dev/null +++ b/tests/00200 @@ -0,0 +1,13 @@ +rm -f tests/sa18 + +rm -f tests/root +ln -s root1 tests/root +./sa1 --boot --unix_time=1555593609 + +rm -f tests/root +ln -s root2 tests/root +./sa1 --unix_time=1555593629 1 1 + +rm -f tests/root +ln -s root3 tests/root +./sa1 --unix_time=1555593649 1 1 diff --git a/tests/00205 b/tests/00205 new file mode 100644 index 0000000..2ffc1b1 --- /dev/null +++ b/tests/00205 @@ -0,0 +1 @@ +LC_ALL=C TZ=GMT ./sar -f tests/sa18 > tests/out.sa1.tmp diff --git a/tests/00208 b/tests/00208 new file mode 100644 index 0000000..a32373d --- /dev/null +++ b/tests/00208 @@ -0,0 +1 @@ +diff -u tests/out.sa1.tmp tests/expected.sa1 diff --git a/tests/00310 b/tests/00310 index 392d257..3e3683d 100644 --- a/tests/00310 +++ b/tests/00310 @@ -1,3 +1,5 @@ +rm -f tests/root +ln -s root1 tests/root . tests/variables if [ ! -z "$VER_JSON" ]; then ./mpstat -A -o JSON | $VER_JSON >/dev/null; diff --git a/tests/TLIST b/tests/TLIST index 69628d1..96be619 100644 --- a/tests/TLIST +++ b/tests/TLIST @@ -10,6 +10,7 @@ NOTES: 00015 ./pidstat -V >/dev/null 00016 ./tapestat -V >/dev/null 00017 ./cifsiostat -V >/dev/null +00050 grep -i FIXME *.c *.h *.in && exit 1 || exit 0 ===== Creating data.tmp 00100 5 x ./sadc --unix_time=XXXXXXXXX -S XALL,-A_PWR_FAN,-A_PWR_IN,-A_PWR_TEMP,-A_PWR_FREQ tests/data.tmp 1 1 >/dev/null @@ -36,6 +37,11 @@ NOTES: 00164 diff -u tests/out2.sar-u.tmp tests/expected2.sar-u 00166 diff -u tests/out2.sar-all.tmp tests/expected2.sar-all +===== 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 +00208 diff -u tests/out.sa1.tmp tests/expected.sa1 + ===== 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 diff --git a/tests/expected.sa1 b/tests/expected.sa1 new file mode 100644 index 0000000..5740869 --- /dev/null +++ b/tests/expected.sa1 @@ -0,0 +1,7 @@ +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 %user %nice %system %iowait %steal %idle +13:20:49 all 2.28 0.00 1.93 0.50 0.00 95.29 +Average: all 2.28 0.00 1.93 0.50 0.00 95.29