[Fuego] [PATCH 3/6] Add test cases of command gawk/gdb/gettext/grep/ip/iptables/ping.

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


Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 engine/tests/Functional.misc/tests/gawk.sh         | 12 ++++++++++++
 engine/tests/Functional.misc/tests/gdb.sh          | 15 +++++++++++++++
 engine/tests/Functional.misc/tests/gettext.sh      | 15 +++++++++++++++
 engine/tests/Functional.misc/tests/grep.sh         | 17 +++++++++++++++++
 engine/tests/Functional.misc/tests/iproute_ip.sh   | 12 ++++++++++++
 engine/tests/Functional.misc/tests/iptables.sh     | 12 ++++++++++++
 engine/tests/Functional.misc/tests/iputils_ping.sh | 12 ++++++++++++
 7 files changed, 95 insertions(+)
 create mode 100644 engine/tests/Functional.misc/tests/gawk.sh
 create mode 100644 engine/tests/Functional.misc/tests/gdb.sh
 create mode 100644 engine/tests/Functional.misc/tests/gettext.sh
 create mode 100644 engine/tests/Functional.misc/tests/grep.sh
 create mode 100644 engine/tests/Functional.misc/tests/iproute_ip.sh
 create mode 100644 engine/tests/Functional.misc/tests/iptables.sh
 create mode 100644 engine/tests/Functional.misc/tests/iputils_ping.sh

diff --git a/engine/tests/Functional.misc/tests/gawk.sh b/engine/tests/Functional.misc/tests/gawk.sh
new file mode 100644
index 0000000..450545e
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/gawk.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd gawk.
+
+test="gawk"
+
+if echo "hello world" | gawk '{print $1}' | grep "hello"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.misc/tests/gdb.sh b/engine/tests/Functional.misc/tests/gdb.sh
new file mode 100644
index 0000000..2db77f4
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/gdb.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run comannd gdb.
+
+test="gdb"
+
+expect <<-EOF
+spawn gdb
+expect {
+ ".*(gdb) " {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" } }
+send "quit\r"
+EOF
diff --git a/engine/tests/Functional.misc/tests/gettext.sh b/engine/tests/Functional.misc/tests/gettext.sh
new file mode 100644
index 0000000..ca0970f
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/gettext.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run comannd gettext.
+
+test="gettext"
+
+gettext -se "hello\\nworld" > fuego_log
+
+if head -n 1 fuego_log | grep "hello" && tail -n 1 fuego_log | grep "world"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm fuego_log
diff --git a/engine/tests/Functional.misc/tests/grep.sh b/engine/tests/Functional.misc/tests/grep.sh
new file mode 100644
index 0000000..d8c7c26
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/grep.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  In target, run comannd grep.
+
+test="grep"
+
+echo -e "test String\ntest pattern\nFor grep" > test_for_fuego
+
+grep -e 'test' ./test_for_fuego > fuego_log
+
+if [ "$(head -n 1 fuego_log)" = "test String" ] && [ "$(tail -n 1 fuego_log)" = "test pattern" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
diff --git a/engine/tests/Functional.misc/tests/iproute_ip.sh b/engine/tests/Functional.misc/tests/iproute_ip.sh
new file mode 100644
index 0000000..1b77132
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/iproute_ip.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd ip.
+
+test="ip"
+
+if ip link show lo | grep "LOOPBACK,UP"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.misc/tests/iptables.sh b/engine/tests/Functional.misc/tests/iptables.sh
new file mode 100644
index 0000000..ea33910
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/iptables.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd iptables.
+
+test="iptables"
+
+if iptables --list | grep -E "Chain INPUT|Chain FORWARD|Chain OUTPUT"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.misc/tests/iputils_ping.sh b/engine/tests/Functional.misc/tests/iputils_ping.sh
new file mode 100644
index 0000000..b879aa9
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/iputils_ping.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd ping.
+
+test="ping"
+
+if ping -c 2 $test_tcpip_host | grep -E "PING|icmp_seq=1|icmp_seq=2"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
-- 
1.8.3.1





More information about the Fuego mailing list