[Fuego] [PATCH] dstat: Add test cases of command dstat.

Yuan Chao yuanc.fnst at cn.fujitsu.com
Wed Jun 12 00:55:56 UTC 2019


This is a simple test to check the follow option:
    aio/all/cpu/debug/disk/filesystem/help/interrupt/io/ipc/list/load/lock/memory/net/process/raw/socket/swap/system/time/unix/version/vm
    of command dstat.

Signed-off-by: Yuan Chao <yuanc.fnst at cn.fujitsu.com>
---
 tests/Functional.dstat/dstat_test.sh             |  4 ++++
 tests/Functional.dstat/fuego_test.sh             | 17 +++++++++++++++++
 tests/Functional.dstat/parser.py                 | 20 ++++++++++++++++++++
 tests/Functional.dstat/spec.json                 |  6 ++++++
 tests/Functional.dstat/test.yaml                 | 21 +++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_aio.sh        | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_all.sh        | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_cpu.sh        | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_debug.sh      | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_disk.sh       | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_filesystem.sh | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_help.sh       | 13 +++++++++++++
 tests/Functional.dstat/tests/dstat_interrupt.sh  | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_io.sh         | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_ipc.sh        | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_list.sh       | 13 +++++++++++++
 tests/Functional.dstat/tests/dstat_load.sh       | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_lock.sh       | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_memory.sh     | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_net.sh        | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_process.sh    | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_raw.sh        | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_socket.sh     | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_swap.sh       | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_system.sh     | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_time.sh       | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_unix.sh       | 20 ++++++++++++++++++++
 tests/Functional.dstat/tests/dstat_version.sh    | 13 +++++++++++++
 tests/Functional.dstat/tests/dstat_vm.sh         | 20 ++++++++++++++++++++
 29 files changed, 527 insertions(+)
 create mode 100644 tests/Functional.dstat/dstat_test.sh
 create mode 100644 tests/Functional.dstat/fuego_test.sh
 create mode 100644 tests/Functional.dstat/parser.py
 create mode 100644 tests/Functional.dstat/spec.json
 create mode 100644 tests/Functional.dstat/test.yaml
 create mode 100644 tests/Functional.dstat/tests/dstat_aio.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_all.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_cpu.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_debug.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_disk.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_filesystem.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_help.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_interrupt.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_io.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_ipc.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_list.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_load.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_lock.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_memory.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_net.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_process.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_raw.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_socket.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_swap.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_system.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_time.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_unix.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_version.sh
 create mode 100644 tests/Functional.dstat/tests/dstat_vm.sh

diff --git a/tests/Functional.dstat/dstat_test.sh b/tests/Functional.dstat/dstat_test.sh
new file mode 100644
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.dstat/dstat_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/tests/Functional.dstat/fuego_test.sh b/tests/Functional.dstat/fuego_test.sh
new file mode 100644
index 0000000..e8e9a37
--- /dev/null
+++ b/tests/Functional.dstat/fuego_test.sh
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program dstat
+}
+
+function test_deploy {
+    put $TEST_HOME/dstat_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./dstat_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.dstat/parser.py b/tests/Functional.dstat/parser.py
new file mode 100644
index 0000000..f25a608
--- /dev/null
+++ b/tests/Functional.dstat/parser.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/tests/Functional.dstat/spec.json b/tests/Functional.dstat/spec.json
new file mode 100644
index 0000000..dbaba3a
--- /dev/null
+++ b/tests/Functional.dstat/spec.json
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.dstat",
+    "specs": {
+        "default": {}
+    }
+}
diff --git a/tests/Functional.dstat/test.yaml b/tests/Functional.dstat/test.yaml
new file mode 100644
index 0000000..f052b0a
--- /dev/null
+++ b/tests/Functional.dstat/test.yaml
@@ -0,0 +1,21 @@
+fuego_package_version: 1
+name: Functional.dstat
+description: |
+        Dstat a tool for generating system resource statistics.
+        This is a simple test to check the follow option:
+        aio/all/cpu/debug/disk/filesystem/help/interrupt/io/ipc/list/load/lock/memory/net/process/raw/socket/swap/system/time/unix/version/vm
+        of command dstat.
+license: BSD-3-Clause
+author: Yuan Chao <yuanc.fnst at cn.fujitsu.com>
+maintainer: Wang Mingyu <wangmy at cn.fujitsu.com>
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['bmap']
+data_files:
+ - dstat_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - tests
diff --git a/tests/Functional.dstat/tests/dstat_aio.sh b/tests/Functional.dstat/tests/dstat_aio.sh
new file mode 100644
index 0000000..91d1ca9
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_aio.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of --aio option print asynchronous I/O status.
+#  1) Option: --aio
+
+test="dstat"
+test_file="dstat.txt"
+dstat --aio > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "async"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_all.sh b/tests/Functional.dstat/tests/dstat_all.sh
new file mode 100644
index 0000000..cd1236a
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_all.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of -a option is equal to -cdngy option.
+#  1) Option: -a
+
+test="dstat"
+test_file="dstat.txt"
+dstat -a > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep ".*cpu.*dsk.*net.*paging.*system.*"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_cpu.sh b/tests/Functional.dstat/tests/dstat_cpu.sh
new file mode 100644
index 0000000..715cbe8
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_cpu.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of -c option print cpu stats.
+#  1) Option: -c
+
+test="dstat"
+test_file="dstat.txt"
+dstat -c > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "cpu"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_debug.sh b/tests/Functional.dstat/tests/dstat_debug.sh
new file mode 100644
index 0000000..fe3e726
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_debug.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check dstat's behaviour and the system impact of dstat.
+#  1) Option: --debug
+
+test="dstat"
+test_file="dstat.txt"
+dstat -cd --debug > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "Plugins"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_disk.sh b/tests/Functional.dstat/tests/dstat_disk.sh
new file mode 100644
index 0000000..78d7576
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_disk.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of -d option print disk stats.
+#  1) Option: -d
+
+test="dstat"
+test_file="dstat.txt"
+dstat -d > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "dsk"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_filesystem.sh b/tests/Functional.dstat/tests/dstat_filesystem.sh
new file mode 100644
index 0000000..c669187
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_filesystem.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of --fs option print filesystem status.
+#  1) Option: --fs
+
+test="dstat"
+test_file="dstat.txt"
+dstat --fs > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "filesystem"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_help.sh b/tests/Functional.dstat/tests/dstat_help.sh
new file mode 100644
index 0000000..14f35e6
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_help.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if help option can execute.
+#  1) Option: -h
+
+test="dstat"
+
+if dstat -h | grep "[uU]sage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/tests/Functional.dstat/tests/dstat_interrupt.sh b/tests/Functional.dstat/tests/dstat_interrupt.sh
new file mode 100644
index 0000000..6b6737a
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_interrupt.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of -i option print interrupt stats.
+#  1) Option: -i
+
+test="dstat"
+test_file="dstat.txt"
+dstat -i > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "interrupt"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_io.sh b/tests/Functional.dstat/tests/dstat_io.sh
new file mode 100644
index 0000000..8fcef8b
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_io.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of -r option print I/O request stats.
+#  1) Option: -r
+
+test="dstat"
+test_file="dstat.txt"
+dstat -r > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "io"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_ipc.sh b/tests/Functional.dstat/tests/dstat_ipc.sh
new file mode 100644
index 0000000..c518176
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_ipc.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of --ipc option print ipc status.
+#  1) Option: --fs
+
+test="dstat"
+test_file="dstat.txt"
+dstat --ipc > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "ipc"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_list.sh b/tests/Functional.dstat/tests/dstat_list.sh
new file mode 100644
index 0000000..409cfff
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_list.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if list option can list all available plugins.
+#  1) Option: --list
+
+test="dstat"
+
+if dstat --list | grep "internal:"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/tests/Functional.dstat/tests/dstat_load.sh b/tests/Functional.dstat/tests/dstat_load.sh
new file mode 100644
index 0000000..ae657a9
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_load.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of -l option print load average stats.
+#  1) Option: -l
+
+test="dstat"
+test_file="dstat.txt"
+dstat -l > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "load"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_lock.sh b/tests/Functional.dstat/tests/dstat_lock.sh
new file mode 100644
index 0000000..7c4a811
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_lock.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of --lock option print file lock status.
+#  1) Option: --lock
+
+test="dstat"
+test_file="dstat.txt"
+dstat --lock > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "lock"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_memory.sh b/tests/Functional.dstat/tests/dstat_memory.sh
new file mode 100644
index 0000000..2967f2a
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_memory.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of -m option print memory stats.
+#  1) Option: -m
+
+test="dstat"
+test_file="dstat.txt"
+dstat -m > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "memory"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_net.sh b/tests/Functional.dstat/tests/dstat_net.sh
new file mode 100644
index 0000000..b3bef1c
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_net.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of -n option print net stats.
+#  1) Option: -n
+
+test="dstat"
+test_file="dstat.txt"
+dstat -n > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "net"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_process.sh b/tests/Functional.dstat/tests/dstat_process.sh
new file mode 100644
index 0000000..345f519
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_process.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of -p option print process stats.
+#  1) Option: -p
+
+test="dstat"
+test_file="dstat.txt"
+dstat -p > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "procs"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_raw.sh b/tests/Functional.dstat/tests/dstat_raw.sh
new file mode 100644
index 0000000..49170f8
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_raw.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of --raw option print raw status.
+#  1) Option: --raw
+
+test="dstat"
+test_file="dstat.txt"
+dstat --raw > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "raw"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_socket.sh b/tests/Functional.dstat/tests/dstat_socket.sh
new file mode 100644
index 0000000..0521242
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_socket.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of --socket option print socket status.
+#  1) Option: --socket
+
+test="dstat"
+test_file="dstat.txt"
+dstat --socket > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "socket"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_swap.sh b/tests/Functional.dstat/tests/dstat_swap.sh
new file mode 100644
index 0000000..5adb446
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_swap.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of -s option print swap stats.
+#  1) Option: -s
+
+test="dstat"
+test_file="dstat.txt"
+dstat -s > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "swap"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_system.sh b/tests/Functional.dstat/tests/dstat_system.sh
new file mode 100644
index 0000000..8e5d9a3
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_system.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of -y option print system status.
+#  1) Option: -y
+
+test="dstat"
+test_file="dstat.txt"
+dstat -y > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "system"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_time.sh b/tests/Functional.dstat/tests/dstat_time.sh
new file mode 100644
index 0000000..e5a23b0
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_time.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of -t option print time/date information.
+#  1) Option: -t
+
+test="dstat"
+test_file="dstat.txt"
+dstat -t > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "time"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_unix.sh b/tests/Functional.dstat/tests/dstat_unix.sh
new file mode 100644
index 0000000..18e2742
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_unix.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of --unix option print unix status.
+#  1) Option: --unix
+
+test="dstat"
+test_file="dstat.txt"
+dstat --unix > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "unix"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
diff --git a/tests/Functional.dstat/tests/dstat_version.sh b/tests/Functional.dstat/tests/dstat_version.sh
new file mode 100644
index 0000000..fcda771
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_version.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if version option can execute.
+#  1) Option: -V
+
+test="dstat"
+
+if dstat -V | grep "Dstat"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/tests/Functional.dstat/tests/dstat_vm.sh b/tests/Functional.dstat/tests/dstat_vm.sh
new file mode 100644
index 0000000..0504af1
--- /dev/null
+++ b/tests/Functional.dstat/tests/dstat_vm.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run command dstat, and check if output of --vm option print virtual memory status.
+#  1) Option: --vm
+
+test="dstat"
+test_file="dstat.txt"
+dstat --vm > $test_file &
+sleep 1
+dstat_pid=$(ps -aux | grep /usr/bin/dstat | head -1 | sed -e 's/^[a-zA-Z0-9]\+ \+\([0-9]\+\).*/\1/')
+kill $dstat_pid
+sleep 2
+
+if cat $test_file | grep "virtual-memory"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file
-- 
1.8.3.1





More information about the Fuego mailing list