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 <sysstat@users.noreply.github.com>
if (count) {
curr ^= 1;
- pause();
+ __pause();
}
}
while (count);
#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
--- /dev/null
+rm -f tests/root
+ln -s root1 tests/root
+LC_ALL=C TZ=GMT ./cifsiostat > tests/out.cifsiostat.tmp
--- /dev/null
+diff -u tests/out.cifsiostat.tmp tests/expected.cifsiostat
--- /dev/null
+rm -f tests/root
+ln -s root1 tests/root
+LC_ALL=C TZ=GMT ./cifsiostat -k 1 3 > tests/out.cifsiostat-k.tmp
--- /dev/null
+diff -u tests/out.cifsiostat-k.tmp tests/expected.cifsiostat-k
--- /dev/null
+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
--- /dev/null
+diff -u tests/out.cifsiostat-t-human.tmp tests/expected.cifsiostat-t-human
--- /dev/null
+rm -f tests/root
+ln -s root1 tests/root
+LC_ALL=C TZ=GMT ./cifsiostat -h 2 3 > tests/out.cifsiostat-h.tmp
--- /dev/null
+diff -u tests/out.cifsiostat-h.tmp tests/expected.cifsiostat-h
--- /dev/null
+rm -f tests/root
+ln -s root1 tests/root
+LC_ALL=C TZ=GMT ./cifsiostat --dec=0 1 3 > tests/out.cifsiostat-dec.tmp
--- /dev/null
+diff -u tests/out.cifsiostat-dec.tmp tests/expected.cifsiostat-dec
--- /dev/null
+LC_ALL=C ./cifsiostat -1 2>&1 | grep "Usage:" >/dev/null
--- /dev/null
+LC_ALL=C ./cifsiostat 0 0 2>&1 | grep "Usage:" >/dev/null
--- /dev/null
+LC_ALL=C ./cifsiostat 0 2 2>&1 | grep "Usage:" >/dev/null
--- /dev/null
+LC_ALL=C ./cifsiostat 2 0 2>&1 | grep "Usage:" >/dev/null
--- /dev/null
+LC_ALL=C ./cifsiostat 2 2 2 2>&1 | grep "Usage:" >/dev/null
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
--- /dev/null
+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
+
--- /dev/null
+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
+
--- /dev/null
+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
+
--- /dev/null
+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
+
--- /dev/null
+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
+
/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
sdf,sdg: registered
sdh: autofs, registered
+CIFS SMB1 statistics available
+
==========root4:
/proc/stat
CPU#6: offline
--- /dev/null
+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
--- /dev/null
+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
+
--- /dev/null
+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