]> granicus.if.org Git - sysstat/commitdiff
cifsiostat: Add non regression tests
authorSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 6 Dec 2019 10:49:46 +0000 (11:49 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 6 Dec 2019 10:49:46 +0000 (11:49 +0100)
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>
27 files changed:
cifsiostat.c
cifsiostat.h
tests/04500 [new file with mode: 0644]
tests/04505 [new file with mode: 0644]
tests/04510 [new file with mode: 0644]
tests/04515 [new file with mode: 0644]
tests/04520 [new file with mode: 0644]
tests/04525 [new file with mode: 0644]
tests/04530 [new file with mode: 0644]
tests/04535 [new file with mode: 0644]
tests/04540 [new file with mode: 0644]
tests/04545 [new file with mode: 0644]
tests/04600 [new file with mode: 0644]
tests/04605 [new file with mode: 0644]
tests/04610 [new file with mode: 0644]
tests/04615 [new file with mode: 0644]
tests/04620 [new file with mode: 0644]
tests/TLIST
tests/expected.cifsiostat [new file with mode: 0644]
tests/expected.cifsiostat-dec [new file with mode: 0644]
tests/expected.cifsiostat-h [new file with mode: 0644]
tests/expected.cifsiostat-k [new file with mode: 0644]
tests/expected.cifsiostat-t-human [new file with mode: 0644]
tests/root.README
tests/root1/proc/fs/cifs/Stats [new file with mode: 0644]
tests/root2/proc/fs/cifs/Stats [new file with mode: 0644]
tests/root3/proc/fs/cifs/Stats [new file with mode: 0644]

index 936f95c83ead90e68a571cdbd9a1c6209dc8f059..674f58090cdaa7e03ccf783421f5474cade27487 100644 (file)
@@ -571,7 +571,7 @@ void rw_io_stat_loop(long int count, struct tm *rectime)
 
                if (count) {
                        curr ^= 1;
-                       pause();
+                       __pause();
                }
        }
        while (count);
index 98eb93e512bf2c64609bc19c85a74865db64a3c4..b4c60a9d8270fc62430a9a9480264270169db0af 100644 (file)
@@ -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 (file)
index 0000000..f703084
--- /dev/null
@@ -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 (file)
index 0000000..78059bd
--- /dev/null
@@ -0,0 +1 @@
+diff -u tests/out.cifsiostat.tmp tests/expected.cifsiostat
diff --git a/tests/04510 b/tests/04510
new file mode 100644 (file)
index 0000000..ee2f228
--- /dev/null
@@ -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 (file)
index 0000000..c7a4897
--- /dev/null
@@ -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 (file)
index 0000000..d971ba4
--- /dev/null
@@ -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 (file)
index 0000000..92b7e43
--- /dev/null
@@ -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 (file)
index 0000000..5c5ddf5
--- /dev/null
@@ -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 (file)
index 0000000..6effd0c
--- /dev/null
@@ -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 (file)
index 0000000..e6c1c1f
--- /dev/null
@@ -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 (file)
index 0000000..91b635a
--- /dev/null
@@ -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 (file)
index 0000000..da3967c
--- /dev/null
@@ -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 (file)
index 0000000..61d0e23
--- /dev/null
@@ -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 (file)
index 0000000..cb3252d
--- /dev/null
@@ -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 (file)
index 0000000..6c798cf
--- /dev/null
@@ -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 (file)
index 0000000..879961c
--- /dev/null
@@ -0,0 +1 @@
+LC_ALL=C ./cifsiostat 2 2 2 2>&1 | grep "Usage:" >/dev/null
index 222f4bcfd18dd5c7f43cb95973c4ed34d178058d..82be645ebc37419cd50bc424692e40c1d6eff6c5 100644 (file)
@@ -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 (file)
index 0000000..283fc0c
--- /dev/null
@@ -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 (file)
index 0000000..2e64a7b
--- /dev/null
@@ -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 (file)
index 0000000..85d791c
--- /dev/null
@@ -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 (file)
index 0000000..ec799cf
--- /dev/null
@@ -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 (file)
index 0000000..87bec81
--- /dev/null
@@ -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
+
index 4d9564162c07a58c3a96361c9779f0b5a51e1c79..616cf0d45f0a100c893b52561f0fad098a68190a 100644 (file)
@@ -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 (file)
index 0000000..8c23661
--- /dev/null
@@ -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 (file)
index 0000000..4438b7c
--- /dev/null
@@ -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 (file)
index 0000000..8ede255
--- /dev/null
@@ -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