From: Sebastien GODARD Date: Fri, 6 Dec 2019 10:49:46 +0000 (+0100) Subject: cifsiostat: Add non regression tests X-Git-Tag: v12.3.1~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa59ad2e96e511539c49583dd3f3e919cb40c9f0;p=sysstat cifsiostat: Add non regression tests Add non regression tests for cifsiostat command. These tests are intended to be run in sysstat's simulation test environment (use do_test script). Signed-off-by: Sebastien GODARD --- diff --git a/cifsiostat.c b/cifsiostat.c index 936f95c..674f580 100644 --- a/cifsiostat.c +++ b/cifsiostat.c @@ -571,7 +571,7 @@ void rw_io_stat_loop(long int count, struct tm *rectime) if (count) { curr ^= 1; - pause(); + __pause(); } } while (count); diff --git a/cifsiostat.h b/cifsiostat.h index 98eb93e..b4c60a9 100644 --- a/cifsiostat.h +++ b/cifsiostat.h @@ -9,9 +9,9 @@ #include "common.h" -#define CIFSSTATS "/proc/fs/cifs/Stats" +#define CIFSSTATS PRE "/proc/fs/cifs/Stats" -/* I_: iostat - D_: Display - F_: Flag */ +/* I_: cifsiostat - D_: Display - F_: Flag */ #define I_D_TIMESTAMP 0x001 #define I_D_KILOBYTES 0x002 #define I_D_MEGABYTES 0x004 diff --git a/tests/04500 b/tests/04500 new file mode 100644 index 0000000..f703084 --- /dev/null +++ b/tests/04500 @@ -0,0 +1,3 @@ +rm -f tests/root +ln -s root1 tests/root +LC_ALL=C TZ=GMT ./cifsiostat > tests/out.cifsiostat.tmp diff --git a/tests/04505 b/tests/04505 new file mode 100644 index 0000000..78059bd --- /dev/null +++ b/tests/04505 @@ -0,0 +1 @@ +diff -u tests/out.cifsiostat.tmp tests/expected.cifsiostat diff --git a/tests/04510 b/tests/04510 new file mode 100644 index 0000000..ee2f228 --- /dev/null +++ b/tests/04510 @@ -0,0 +1,3 @@ +rm -f tests/root +ln -s root1 tests/root +LC_ALL=C TZ=GMT ./cifsiostat -k 1 3 > tests/out.cifsiostat-k.tmp diff --git a/tests/04515 b/tests/04515 new file mode 100644 index 0000000..c7a4897 --- /dev/null +++ b/tests/04515 @@ -0,0 +1 @@ +diff -u tests/out.cifsiostat-k.tmp tests/expected.cifsiostat-k diff --git a/tests/04520 b/tests/04520 new file mode 100644 index 0000000..d971ba4 --- /dev/null +++ b/tests/04520 @@ -0,0 +1,3 @@ +rm -f tests/root +ln -s root1 tests/root +LC_ALL=C TZ=GMT ./cifsiostat -t --human 1 3 > tests/out.cifsiostat-t-human.tmp diff --git a/tests/04525 b/tests/04525 new file mode 100644 index 0000000..92b7e43 --- /dev/null +++ b/tests/04525 @@ -0,0 +1 @@ +diff -u tests/out.cifsiostat-t-human.tmp tests/expected.cifsiostat-t-human diff --git a/tests/04530 b/tests/04530 new file mode 100644 index 0000000..5c5ddf5 --- /dev/null +++ b/tests/04530 @@ -0,0 +1,3 @@ +rm -f tests/root +ln -s root1 tests/root +LC_ALL=C TZ=GMT ./cifsiostat -h 2 3 > tests/out.cifsiostat-h.tmp diff --git a/tests/04535 b/tests/04535 new file mode 100644 index 0000000..6effd0c --- /dev/null +++ b/tests/04535 @@ -0,0 +1 @@ +diff -u tests/out.cifsiostat-h.tmp tests/expected.cifsiostat-h diff --git a/tests/04540 b/tests/04540 new file mode 100644 index 0000000..e6c1c1f --- /dev/null +++ b/tests/04540 @@ -0,0 +1,3 @@ +rm -f tests/root +ln -s root1 tests/root +LC_ALL=C TZ=GMT ./cifsiostat --dec=0 1 3 > tests/out.cifsiostat-dec.tmp diff --git a/tests/04545 b/tests/04545 new file mode 100644 index 0000000..91b635a --- /dev/null +++ b/tests/04545 @@ -0,0 +1 @@ +diff -u tests/out.cifsiostat-dec.tmp tests/expected.cifsiostat-dec diff --git a/tests/04600 b/tests/04600 new file mode 100644 index 0000000..da3967c --- /dev/null +++ b/tests/04600 @@ -0,0 +1 @@ +LC_ALL=C ./cifsiostat -1 2>&1 | grep "Usage:" >/dev/null diff --git a/tests/04605 b/tests/04605 new file mode 100644 index 0000000..61d0e23 --- /dev/null +++ b/tests/04605 @@ -0,0 +1 @@ +LC_ALL=C ./cifsiostat 0 0 2>&1 | grep "Usage:" >/dev/null diff --git a/tests/04610 b/tests/04610 new file mode 100644 index 0000000..cb3252d --- /dev/null +++ b/tests/04610 @@ -0,0 +1 @@ +LC_ALL=C ./cifsiostat 0 2 2>&1 | grep "Usage:" >/dev/null diff --git a/tests/04615 b/tests/04615 new file mode 100644 index 0000000..6c798cf --- /dev/null +++ b/tests/04615 @@ -0,0 +1 @@ +LC_ALL=C ./cifsiostat 2 0 2>&1 | grep "Usage:" >/dev/null diff --git a/tests/04620 b/tests/04620 new file mode 100644 index 0000000..879961c --- /dev/null +++ b/tests/04620 @@ -0,0 +1 @@ +LC_ALL=C ./cifsiostat 2 2 2 2>&1 | grep "Usage:" >/dev/null diff --git a/tests/TLIST b/tests/TLIST index 222f4bc..82be645 100644 --- a/tests/TLIST +++ b/tests/TLIST @@ -473,5 +473,24 @@ NOTES: 04115 LC_ALL=C ./tapestat 2 0 2>&1 | grep "Usage:" >/dev/null 04120 LC_ALL=C ./tapestat 2 2 2 2>&1 | grep "Usage:" >/dev/null +===== cifsiostat: Basic tests +04500 LC_ALL=C TZ=GMT ./cifsiostat > tests/out.cifsiostat.tmp +04505 diff -u tests/out.cifsiostat.tmp tests/expected.cifsiostat +04510 LC_ALL=C TZ=GMT ./cifsiostat -k 1 3 > tests/out.cifsiostat-k.tmp +04515 diff -u tests/out.cifsiostat-k.tmp tests/expected.cifsiostat-k +04520 LC_ALL=C TZ=GMT ./cifsiostat -t --human 1 3 > tests/out.cifsiostat-t-human.tmp +04525 diff -u tests/out.cifsiostat-t-human.tmp tests/expected.cifsiostat-t-human +04530 LC_ALL=C TZ=GMT ./cifsiostat -h 2 3 > tests/out.cifsiostat-h.tmp +04535 diff -u tests/out.cifsiostat-h.tmp tests/expected.cifsiostat-h +04540 LC_ALL=C TZ=GMT ./cifsiostat --dec=0 1 3 > tests/out.cifsiostat-dec.tmp +04545 diff -u tests/out.cifsiostat-dec.tmp tests/expected.cifsiostat-dec + +===== Test cifsiostat error cases +04600 LC_ALL=C ./cifsiostat -1 2>&1 | grep "Usage:" >/dev/null +04605 LC_ALL=C ./cifsiostat 0 0 2>&1 | grep "Usage:" >/dev/null +04610 LC_ALL=C ./cifsiostat 0 2 2>&1 | grep "Usage:" >/dev/null +04615 LC_ALL=C ./cifsiostat 2 0 2>&1 | grep "Usage:" >/dev/null +04620 LC_ALL=C ./cifsiostat 2 2 2 2>&1 | grep "Usage:" >/dev/null + ===== Tests to be done at the very end 09900 grep -i FIXME *.c *.h *.in && exit 1 || exit 0 diff --git a/tests/expected.cifsiostat b/tests/expected.cifsiostat new file mode 100644 index 0000000..283fc0c --- /dev/null +++ b/tests/expected.cifsiostat @@ -0,0 +1,5 @@ +Linux 1.2.3-TEST (SYSSTAT.TEST) 01/01/70 _x86_64_ (8 CPU) + +Filesystem rB/s wB/s rops/s wops/s fo/s fc/s fd/s +\\addr\SHARED 0.03 0.00 0.00 0.00 0.00 0.00 0.00 + diff --git a/tests/expected.cifsiostat-dec b/tests/expected.cifsiostat-dec new file mode 100644 index 0000000..2e64a7b --- /dev/null +++ b/tests/expected.cifsiostat-dec @@ -0,0 +1,13 @@ +Linux 1.2.3-TEST (SYSSTAT.TEST) 01/01/70 _x86_64_ (8 CPU) + +Filesystem rB/s wB/s rops/s wops/s fo/s fc/s fd/s +\\addr\SHARED 0 0 0 0 0 0 0 + +Filesystem rB/s wB/s rops/s wops/s fo/s fc/s fd/s +\\addr\SHARED 23 4 0 0 0 0 0 +\\server\share1 3 3 0 0 0 0 0 + +Filesystem rB/s wB/s rops/s wops/s fo/s fc/s fd/s +\\addr\SHARED 0 0 0 0 0 0 0 +\\server\share1 26 22 0 0 0 0 0 + diff --git a/tests/expected.cifsiostat-h b/tests/expected.cifsiostat-h new file mode 100644 index 0000000..85d791c --- /dev/null +++ b/tests/expected.cifsiostat-h @@ -0,0 +1,13 @@ +Linux 1.2.3-TEST (SYSSTAT.TEST) 01/01/70 _x86_64_ (8 CPU) + + rB/s wB/s rops/s wops/s fo/s fc/s fd/s Filesystem + 0.0B 0.0B 0.00 0.00 0.00 0.00 0.00 \\addr\SHARED + + rB/s wB/s rops/s wops/s fo/s fc/s fd/s Filesystem + 23.1B 3.9B 0.19 0.10 0.00 0.00 0.00 \\addr\SHARED + 2.9B 3.3B 0.16 0.06 0.16 0.06 0.03 \\server\share1 + + rB/s wB/s rops/s wops/s fo/s fc/s fd/s Filesystem + 0.0B 0.0B 0.00 0.00 0.10 0.19 0.16 \\addr\SHARED + 25.9B 22.4B 0.29 0.38 0.32 0.32 0.32 \\server\share1 + diff --git a/tests/expected.cifsiostat-k b/tests/expected.cifsiostat-k new file mode 100644 index 0000000..ec799cf --- /dev/null +++ b/tests/expected.cifsiostat-k @@ -0,0 +1,13 @@ +Linux 1.2.3-TEST (SYSSTAT.TEST) 01/01/70 _x86_64_ (8 CPU) + +Filesystem rkB/s wkB/s rops/s wops/s fo/s fc/s fd/s +\\addr\SHARED 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + +Filesystem rkB/s wkB/s rops/s wops/s fo/s fc/s fd/s +\\addr\SHARED 0.02 0.00 0.19 0.10 0.00 0.00 0.00 +\\server\share1 0.00 0.00 0.16 0.06 0.16 0.06 0.03 + +Filesystem rkB/s wkB/s rops/s wops/s fo/s fc/s fd/s +\\addr\SHARED 0.00 0.00 0.00 0.00 0.10 0.19 0.16 +\\server\share1 0.03 0.02 0.29 0.38 0.32 0.32 0.32 + diff --git a/tests/expected.cifsiostat-t-human b/tests/expected.cifsiostat-t-human new file mode 100644 index 0000000..87bec81 --- /dev/null +++ b/tests/expected.cifsiostat-t-human @@ -0,0 +1,16 @@ +Linux 1.2.3-TEST (SYSSTAT.TEST) 01/01/70 _x86_64_ (8 CPU) + +01/01/70 00:00:00 +Filesystem rB/s wB/s rops/s wops/s fo/s fc/s fd/s +\\addr\SHARED 0.0B 0.0B 0.00 0.00 0.00 0.00 0.00 + +01/01/70 00:00:01 +Filesystem rB/s wB/s rops/s wops/s fo/s fc/s fd/s +\\addr\SHARED 23.1B 3.9B 0.19 0.10 0.00 0.00 0.00 +\\server\share1 2.9B 3.3B 0.16 0.06 0.16 0.06 0.03 + +01/01/70 00:00:02 +Filesystem rB/s wB/s rops/s wops/s fo/s fc/s fd/s +\\addr\SHARED 0.0B 0.0B 0.00 0.00 0.10 0.19 0.16 +\\server\share1 25.9B 22.4B 0.29 0.38 0.32 0.32 0.32 + diff --git a/tests/root.README b/tests/root.README index 4d95641..616cf0d 100644 --- a/tests/root.README +++ b/tests/root.README @@ -2,7 +2,12 @@ /proc/diskstats dm-2 virtual device present +tape statistics available +CIFS SMB1 statistics available + ==========root2: +tape statistics available +CIFS SMB1 statistics available. New share added. ==========root3: /proc/stat @@ -20,6 +25,8 @@ enp6s0: unregistered then registered again sdf,sdg: registered sdh: autofs, registered +CIFS SMB1 statistics available + ==========root4: /proc/stat CPU#6: offline diff --git a/tests/root1/proc/fs/cifs/Stats b/tests/root1/proc/fs/cifs/Stats new file mode 100644 index 0000000..8c23661 --- /dev/null +++ b/tests/root1/proc/fs/cifs/Stats @@ -0,0 +1,20 @@ +Resources in use +CIFS Session: 1 +Share (unique mount targets): 1 +SMB Request/Response Buffer: 1 Pool size: 5 +SMB Small Req/Resp Buffer: 1 Pool size: 30 +Operations (MIDs): 0 + +75 session 1 share reconnects +Total vfs operations: 85 maximum at one time: 2 + +1) \\addr\SHARED +SMBs: 40 Oplock Breaks: 0 +Reads: 2 Bytes: 196 +Writes: 0 Bytes: 0 +Flushes: 0 +Locks: 0 HardLinks: 0 Symlinks: 0 +Opens: 6 Closes: 6Deletes: 0 +Mkdirs: 0 Rmdirs: 0 +Renames: 0 T2 Renames 0 +FindFirst: 5 FNext 0 FClose 0 diff --git a/tests/root2/proc/fs/cifs/Stats b/tests/root2/proc/fs/cifs/Stats new file mode 100644 index 0000000..4438b7c --- /dev/null +++ b/tests/root2/proc/fs/cifs/Stats @@ -0,0 +1,31 @@ +Resources in use +CIFS Session: 1 +Share (unique mount targets): 1 +SMB Request/Response Buffer: 1 Pool size: 5 +SMB Small Req/Resp Buffer: 1 Pool size: 30 +Operations (MIDs): 0 + +75 session 1 share reconnects +Total vfs operations: 85 maximum at one time: 2 + +1) \\addr\SHARED +SMBs: 40 Oplock Breaks: 0 +Reads: 8 Bytes: 916 +Writes: 3 Bytes: 123 +Flushes: 0 +Locks: 0 HardLinks: 0 Symlinks: 0 +Opens: 6 Closes: 6 Deletes: 0 +Mkdirs: 0 Rmdirs: 0 +Renames: 0 T2 Renames 0 +FindFirst: 5 FNext 0 FClose 0 +2) \\server\share1 +SMBs: 40 Oplock Breaks: 0 +Reads: 5 Bytes: 91 +Writes: 2 Bytes: 103 +Flushes: 0 +Locks: 0 HardLinks: 0 Symlinks: 0 +Opens: 5 Closes: 2 Deletes: 1 +Mkdirs: 0 Rmdirs: 0 +Renames: 0 T2 Renames 0 +FindFirst: 5 FNext 0 FClose 0 + diff --git a/tests/root3/proc/fs/cifs/Stats b/tests/root3/proc/fs/cifs/Stats new file mode 100644 index 0000000..8ede255 --- /dev/null +++ b/tests/root3/proc/fs/cifs/Stats @@ -0,0 +1,30 @@ +Resources in use +CIFS Session: 1 +Share (unique mount targets): 1 +SMB Request/Response Buffer: 1 Pool size: 5 +SMB Small Req/Resp Buffer: 1 Pool size: 30 +Operations (MIDs): 0 + +75 session 1 share reconnects +Total vfs operations: 85 maximum at one time: 2 + +1) \\addr\SHARED +SMBs: 40 Oplock Breaks: 0 +Reads: 8 Bytes: 916 +Writes: 3 Bytes: 123 +Flushes: 0 +Locks: 0 HardLinks: 0 Symlinks: 0 +Opens: 9 Closes: 12 Deletes: 5 +Mkdirs: 0 Rmdirs: 0 +Renames: 0 T2 Renames 0 +FindFirst: 5 FNext 0 FClose 0 +2) \\server\share1 +SMBs: 40 Oplock Breaks: 0 +Reads: 14 Bytes: 901 +Writes: 14 Bytes: 803 +Flushes: 0 +Locks: 0 HardLinks: 0 Symlinks: 0 +Opens: 15 Closes: 12 Deletes: 11 +Mkdirs: 0 Rmdirs: 0 +Renames: 0 T2 Renames 0 +FindFirst: 5 FNext 0 FClose 0