]> granicus.if.org Git - sysstat/commitdiff
simtest: Add more non regression tests
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 28 Sep 2019 13:48:32 +0000 (15:48 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 28 Sep 2019 13:48:32 +0000 (15:48 +0200)
Test sa1 shell script.
Also look for FIXME tags in code.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
.travis.yml
do_test
tests/00050 [new file with mode: 0644]
tests/00200 [new file with mode: 0644]
tests/00205 [new file with mode: 0644]
tests/00208 [new file with mode: 0644]
tests/00310
tests/TLIST
tests/expected.sa1 [new file with mode: 0644]

index e69b5fdeefdbc470347df0f7cecc624acff23eaf..db116a15a1882559958e1805acf65e3505b7fbd2 100644 (file)
@@ -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 d80f805143b1c314ceca6da0272a1c5042ac5115..7b112a9eca55fe8115a6a1375b65bf14ba8e1156 100755 (executable)
--- 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 (file)
index 0000000..5b31b38
--- /dev/null
@@ -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 (file)
index 0000000..dea0069
--- /dev/null
@@ -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 (file)
index 0000000..2ffc1b1
--- /dev/null
@@ -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 (file)
index 0000000..a32373d
--- /dev/null
@@ -0,0 +1 @@
+diff -u tests/out.sa1.tmp tests/expected.sa1
index 392d257256f417ae45ebebcbb1b4503574ee8f57..3e3683dafc053d3db3777602740f66ee45093b0d 100644 (file)
@@ -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;
index 69628d1e34f2da6b4fb9919c578b55ade0c3c595..96be619cae5735c8a287d88f90b18aab206de8e5 100644 (file)
@@ -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 (file)
index 0000000..5740869
--- /dev/null
@@ -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