[Fuego] [PATCH 4/6] Add test cases of command mktemp/clear/snmpd/nfsstat/ssh-agent/sshd/openssl.

Wang Mingyu wangmy at cn.fujitsu.com
Tue Nov 6 13:56:45 UTC 2018


Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 engine/tests/Functional.misc/tests/mktemp.sh       | 26 ++++++++++++++++
 .../tests/Functional.misc/tests/ncurses_clear.sh   | 12 ++++++++
 .../tests/Functional.misc/tests/net-snmp_snmpd.sh  | 35 ++++++++++++++++++++++
 .../Functional.misc/tests/nfs-utils_nfsstat.sh     | 12 ++++++++
 .../tests/openssh-clients_ssh-agent.sh             | 12 ++++++++
 .../Functional.misc/tests/openssh-server_sshd.sh   | 35 ++++++++++++++++++++++
 engine/tests/Functional.misc/tests/openssl.sh      | 15 ++++++++++
 7 files changed, 147 insertions(+)
 create mode 100644 engine/tests/Functional.misc/tests/mktemp.sh
 create mode 100644 engine/tests/Functional.misc/tests/ncurses_clear.sh
 create mode 100644 engine/tests/Functional.misc/tests/net-snmp_snmpd.sh
 create mode 100644 engine/tests/Functional.misc/tests/nfs-utils_nfsstat.sh
 create mode 100644 engine/tests/Functional.misc/tests/openssh-clients_ssh-agent.sh
 create mode 100644 engine/tests/Functional.misc/tests/openssh-server_sshd.sh
 create mode 100644 engine/tests/Functional.misc/tests/openssl.sh

diff --git a/engine/tests/Functional.misc/tests/mktemp.sh b/engine/tests/Functional.misc/tests/mktemp.sh
new file mode 100644
index 0000000..239d014
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/mktemp.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+#  In target, run comannd mktemp.
+
+test="mktemp"
+
+mkdir test_dir_for_fuego
+
+if mktemp test_dir_for_fuego/test_file.XXXXXX | grep "test_dir_for_fuego/test_file"
+then
+    echo " ->  mktemp test_dir_for_fuego/test_file.XXXXXX succeeded."
+else
+    echo " ->  mktemp test_dir_for_fuego/test_file.XXXXXX failed."
+    echo " -> $test: TEST-FAIL"
+    rm -fr test_dir_for_fuego
+    exit
+fi
+
+if ls -l test_dir_for_fuego | tr -s ' ' | cut -d' ' -f1,9 | grep "\-rw\-\-\-\-\-\-\- test_file"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm -fr test_dir_for_fuego
diff --git a/engine/tests/Functional.misc/tests/ncurses_clear.sh b/engine/tests/Functional.misc/tests/ncurses_clear.sh
new file mode 100644
index 0000000..902eaf3
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/ncurses_clear.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd clear.
+
+test="clear"
+
+if clear
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.misc/tests/net-snmp_snmpd.sh b/engine/tests/Functional.misc/tests/net-snmp_snmpd.sh
new file mode 100644
index 0000000..bcb593b
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/net-snmp_snmpd.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+#  In target, run comannd snmpd.
+
+test="snmpd"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target snmpd stop
+if ps aux | grep "[/]usr/sbin/snmpd"
+then
+    echo " -> stop snmpd failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+else
+    echo " -> stop snmpd succeeded."
+fi
+
+if exec_service_on_target snmpd start
+then
+    echo " -> start of snmpd succeeded."
+else
+    echo " -> start of snmpd failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if ps aux | grep "[/]usr/sbin/snmpd"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.misc/tests/nfs-utils_nfsstat.sh b/engine/tests/Functional.misc/tests/nfs-utils_nfsstat.sh
new file mode 100644
index 0000000..08bef45
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/nfs-utils_nfsstat.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd nfsstat.
+
+test="nfsstat"
+
+if nfsstat | grep "rmdir"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.misc/tests/openssh-clients_ssh-agent.sh b/engine/tests/Functional.misc/tests/openssh-clients_ssh-agent.sh
new file mode 100644
index 0000000..4270336
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/openssh-clients_ssh-agent.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd ssh-agent.
+
+test="ssh-agent"
+
+if ssh-agent | grep -E "SSH_AUTH_SOCK|SSH_AGENT_PID"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.misc/tests/openssh-server_sshd.sh b/engine/tests/Functional.misc/tests/openssh-server_sshd.sh
new file mode 100644
index 0000000..a8d85d2
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/openssh-server_sshd.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+#  In target, run comannd sshd.
+
+test="sshd"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target sshd stop
+if ps aux | grep "[/]usr/sbin/sshd"
+then
+    echo " -> stop sshd failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+else
+    echo " -> stop sshd succeeded."
+fi
+
+if exec_service_on_target sshd start
+then
+    echo " -> start of sshd succeeded."
+else
+    echo " -> start of sshd failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if ps aux | grep "[/]usr/sbin/sshd"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.misc/tests/openssl.sh b/engine/tests/Functional.misc/tests/openssl.sh
new file mode 100644
index 0000000..c74c2e9
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/openssl.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run comannd openssl.
+
+test="openssl"
+
+expect <<-EOF
+spawn openssl
+expect {
+ "OpenSSL> " {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" } }
+send "exit\r"
+EOF
-- 
1.8.3.1





More information about the Fuego mailing list