[Fuego] [PATCH 2/6] Add test cases of command nslookup/bzip2/saslauthd/dbus-cleanup-sockets/dumpe2fs/filesystem/su.

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


Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 .../Functional.misc/tests/bind-utils_nslookup.sh   | 16 +++++++++++++
 engine/tests/Functional.misc/tests/bzip2.sh        | 17 +++++++++++++
 .../Functional.misc/tests/cyrus-sasl_saslauthd.sh  | 28 ++++++++++++++++++++++
 .../tests/dbus_dbus-cleanup-sockets.sh             | 12 ++++++++++
 .../Functional.misc/tests/e2fsprogs_dumpe2fs.sh    | 25 +++++++++++++++++++
 engine/tests/Functional.misc/tests/filesystem.sh   | 12 ++++++++++
 engine/tests/Functional.misc/tests/fjelinux_su.sh  | 21 ++++++++++++++++
 7 files changed, 131 insertions(+)
 create mode 100644 engine/tests/Functional.misc/tests/bind-utils_nslookup.sh
 create mode 100644 engine/tests/Functional.misc/tests/bzip2.sh
 create mode 100644 engine/tests/Functional.misc/tests/cyrus-sasl_saslauthd.sh
 create mode 100644 engine/tests/Functional.misc/tests/dbus_dbus-cleanup-sockets.sh
 create mode 100644 engine/tests/Functional.misc/tests/e2fsprogs_dumpe2fs.sh
 create mode 100644 engine/tests/Functional.misc/tests/filesystem.sh
 create mode 100644 engine/tests/Functional.misc/tests/fjelinux_su.sh

diff --git a/engine/tests/Functional.misc/tests/bind-utils_nslookup.sh b/engine/tests/Functional.misc/tests/bind-utils_nslookup.sh
new file mode 100644
index 0000000..d966656
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/bind-utils_nslookup.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In target, run comannd nslookup.
+
+test="nslookup"
+
+mv /etc/resolv.conf /etc/resolv.conf_bak
+
+if nslookup server | grep "127.0.0.1"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+mv /etc/resolv.conf_bak /etc/resolv.conf
diff --git a/engine/tests/Functional.misc/tests/bzip2.sh b/engine/tests/Functional.misc/tests/bzip2.sh
new file mode 100644
index 0000000..b9f49c5
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/bzip2.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  In target, run comannd bzip2.
+
+test="bzip2"
+
+echo "This is a test file" > test_for_fuego
+
+bzip2 test_for_fuego
+
+if bzcat test_for_fuego.bz2 | grep "This is a test file"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -fr test_for_fuego.bz2
diff --git a/engine/tests/Functional.misc/tests/cyrus-sasl_saslauthd.sh b/engine/tests/Functional.misc/tests/cyrus-sasl_saslauthd.sh
new file mode 100644
index 0000000..60ae2ed
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/cyrus-sasl_saslauthd.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+#  In target, run comannd saslauthd.
+
+test="saslauthd"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target saslauthd stop
+
+if exec_service_on_target saslauthd start
+then
+    echo " -> start of saslauthd succeeded."
+else
+    echo " -> start of saslauthd failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if ps aux | grep "[/]usr/sbin/saslauthd"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> can't get the pid of saslauthd."
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.misc/tests/dbus_dbus-cleanup-sockets.sh b/engine/tests/Functional.misc/tests/dbus_dbus-cleanup-sockets.sh
new file mode 100644
index 0000000..27e88ad
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/dbus_dbus-cleanup-sockets.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd dbus-cleanup-sockets.
+
+test="dbus-cleanup-sockets"
+
+if dbus-cleanup-sockets | grep "Cleaned up 0 sockets in /tmp; 0 sockets are still in use; 0 in unknown state"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.misc/tests/e2fsprogs_dumpe2fs.sh b/engine/tests/Functional.misc/tests/e2fsprogs_dumpe2fs.sh
new file mode 100644
index 0000000..fd4f8ac
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/e2fsprogs_dumpe2fs.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+#  In target, run comannd dumpe2fs.
+
+test="dumpe2fs"
+
+modprobe brd
+
+if yes | mke2fs -v $ramdiskdev | grep "OS type: Linux"
+then
+    echo " -> $test: mke2fs -v $ramdiskdev succeeded."
+else
+    echo " -> $test: mke2fs -v $ramdiskdev faiaed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+sleep 5
+
+if dumpe2fs $ramdiskdev | grep "Filesystem OS type:       Linux"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.misc/tests/filesystem.sh b/engine/tests/Functional.misc/tests/filesystem.sh
new file mode 100644
index 0000000..ab38b4e
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/filesystem.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd filesystem.
+
+test="filesystem"
+
+if ls /
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.misc/tests/fjelinux_su.sh b/engine/tests/Functional.misc/tests/fjelinux_su.sh
new file mode 100644
index 0000000..c6424db
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/fjelinux_su.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+#  In target, run comannd su.
+
+test="su"
+
+useradd test_for_fuego
+
+expect <<-EOF
+spawn su test_for_fuego
+send "whoami\r"
+expect {
+ "test_for_fuego" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" } }
+send "exit\r"
+EOF
+
+userdel test_for_fuego
+rm -fr /home/test_for_fuego/
-- 
1.8.3.1





More information about the Fuego mailing list