Skip to contentSkip to conversation

Add test cases to some of the commands commonly used by Linux.

PATCH New Wang Mingyu 1 participant 34 messages May 8, 2019

lore
Share & tools
lore
#0 lore raw

cover Add test cases to some of the commands commonly used by Linux.

Wang Mingyu (33):
Add test script for commands of misc.
Add test case of command nslookup to query Internet domain name
server.
Add test case of command bzip2.
Add test case of service saslauthd.
Add test case of command dbus-cleanup-sockets.
Add test case of command dumpe2fs.
Add test case of command su.
Add test case of command gawk to scan and process "hello world". Add test case of command gdb.
Add test case of command gettext.
Add test case of command grep.
Add test case of command ip to display device attributes. Add test case of command iptables to list all chains. Add test case of command ping.
Add test case of command mktemp.
Add test case of command clear.
Add test case of service snmpd to check if it can start and stop
normally.
Add test case of command nfsstat.
Add test case of command ssh-agent.
Add test case of service sshd.
Add test case of command openssl.
Add test cases of command perl.
Add test case of pm-powersave to put computer into low power mode. Add test case of command uptime.
Add test case of command rpm to show all installed packages. Add test case to check if the passwd file is present. Add test case of command useradd.
Add test case of command strace.
Add test case of command try-from.
Add test case to check if telnet is exist or not.
Add test case of service tftpd-hpa to check the process of it. Add test case of service vsftpd to check the process of it. Add test case of xinetd to check the status of it.

 tests/Functional.misc/data/tst-float.pl            |  5 ++
 tests/Functional.misc/fuego_test.sh                | 54 ++++++++++++++++++++++
 tests/Functional.misc/misc_test.sh                 |  4 ++
 tests/Functional.misc/parser.py                    | 20 ++++++++
 tests/Functional.misc/spec.json                    |  6 +++
 tests/Functional.misc/test.yaml                    | 28 +++++++++++
 tests/Functional.misc/tests/bind-utils_nslookup.sh | 16 +++++++
 tests/Functional.misc/tests/bzip2.sh               | 17 +++++++
 .../Functional.misc/tests/cyrus-sasl_saslauthd.sh  | 33 +++++++++++++
 .../tests/dbus_dbus-cleanup-sockets.sh             | 12 +++++
 tests/Functional.misc/tests/e2fsprogs_dumpe2fs.sh  | 25 ++++++++++
 tests/Functional.misc/tests/fjelinux_su.sh         | 21 +++++++++
 tests/Functional.misc/tests/gawk.sh                | 12 +++++
 tests/Functional.misc/tests/gdb.sh                 | 15 ++++++
 tests/Functional.misc/tests/gettext.sh             | 15 ++++++
 tests/Functional.misc/tests/grep.sh                | 17 +++++++
 tests/Functional.misc/tests/iproute_ip.sh          | 12 +++++
 tests/Functional.misc/tests/iptables.sh            | 12 +++++
 tests/Functional.misc/tests/iputils_ping.sh        | 12 +++++
 tests/Functional.misc/tests/mktemp.sh              | 26 +++++++++++
 tests/Functional.misc/tests/ncurses_clear.sh       | 12 +++++
 tests/Functional.misc/tests/net-snmp_snmpd.sh      | 40 ++++++++++++++++
 tests/Functional.misc/tests/nfs-utils_nfsstat.sh   | 12 +++++
 .../tests/openssh-clients_ssh-agent.sh             | 12 +++++
 tests/Functional.misc/tests/openssh-server_sshd.sh | 46 ++++++++++++++++++
 tests/Functional.misc/tests/openssl.sh             | 15 ++++++
 tests/Functional.misc/tests/perl.sh                | 12 +++++
 tests/Functional.misc/tests/perl_tst-float.sh      | 17 +++++++
 .../Functional.misc/tests/pm-utils_pm-powersave.sh | 12 +++++
 tests/Functional.misc/tests/procps_uptime.sh       | 12 +++++
 tests/Functional.misc/tests/rpm.sh                 | 12 +++++
 tests/Functional.misc/tests/setup.sh               | 12 +++++
 .../Functional.misc/tests/shadow-utils_useradd.sh  | 20 ++++++++
 tests/Functional.misc/tests/strace.sh              | 12 +++++
 .../Functional.misc/tests/tcp_wrappers_try-from.sh | 12 +++++
 tests/Functional.misc/tests/telnetd.sh             | 12 +++++
 .../tests/tftp-server_in.tftpd-hpa.sh              | 36 +++++++++++++++
 tests/Functional.misc/tests/vsftpd.sh              | 33 +++++++++++++
 tests/Functional.misc/tests/xinetd.sh              | 25 ++++++++++
 39 files changed, 726 insertions(+)
 create mode 100644 tests/Functional.misc/data/tst-float.pl
 create mode 100644 tests/Functional.misc/fuego_test.sh
 create mode 100644 tests/Functional.misc/misc_test.sh
 create mode 100644 tests/Functional.misc/parser.py
 create mode 100644 tests/Functional.misc/spec.json
 create mode 100644 tests/Functional.misc/test.yaml
 create mode 100644 tests/Functional.misc/tests/bind-utils_nslookup.sh
 create mode 100644 tests/Functional.misc/tests/bzip2.sh
 create mode 100644 tests/Functional.misc/tests/cyrus-sasl_saslauthd.sh
 create mode 100644 tests/Functional.misc/tests/dbus_dbus-cleanup-sockets.sh
 create mode 100644 tests/Functional.misc/tests/e2fsprogs_dumpe2fs.sh
 create mode 100644 tests/Functional.misc/tests/fjelinux_su.sh
 create mode 100644 tests/Functional.misc/tests/gawk.sh
 create mode 100644 tests/Functional.misc/tests/gdb.sh
 create mode 100644 tests/Functional.misc/tests/gettext.sh
 create mode 100644 tests/Functional.misc/tests/grep.sh
 create mode 100644 tests/Functional.misc/tests/iproute_ip.sh
 create mode 100644 tests/Functional.misc/tests/iptables.sh
 create mode 100644 tests/Functional.misc/tests/iputils_ping.sh
 create mode 100644 tests/Functional.misc/tests/mktemp.sh
 create mode 100644 tests/Functional.misc/tests/ncurses_clear.sh
 create mode 100644 tests/Functional.misc/tests/net-snmp_snmpd.sh
 create mode 100644 tests/Functional.misc/tests/nfs-utils_nfsstat.sh
 create mode 100644 tests/Functional.misc/tests/openssh-clients_ssh-agent.sh
 create mode 100644 tests/Functional.misc/tests/openssh-server_sshd.sh
 create mode 100644 tests/Functional.misc/tests/openssl.sh
 create mode 100644 tests/Functional.misc/tests/perl.sh
 create mode 100644 tests/Functional.misc/tests/perl_tst-float.sh
 create mode 100644 tests/Functional.misc/tests/pm-utils_pm-powersave.sh
 create mode 100644 tests/Functional.misc/tests/procps_uptime.sh
 create mode 100644 tests/Functional.misc/tests/rpm.sh
 create mode 100644 tests/Functional.misc/tests/setup.sh
 create mode 100644 tests/Functional.misc/tests/shadow-utils_useradd.sh
 create mode 100644 tests/Functional.misc/tests/strace.sh
 create mode 100644 tests/Functional.misc/tests/tcp_wrappers_try-from.sh
 create mode 100644 tests/Functional.misc/tests/telnetd.sh
 create mode 100644 tests/Functional.misc/tests/tftp-server_in.tftpd-hpa.sh
 create mode 100644 tests/Functional.misc/tests/vsftpd.sh
 create mode 100644 tests/Functional.misc/tests/xinetd.sh
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/33 Add test script for commands of misc.

---
 tests/Functional.misc/data/tst-float.pl |  5 +++
 tests/Functional.misc/fuego_test.sh     | 55 +++++++++++++++++++++++++++++++++
 tests/Functional.misc/misc_test.sh      |  4 +++
 tests/Functional.misc/parser.py         | 20 ++++++++++++
 tests/Functional.misc/spec.json         |  6 ++++
 tests/Functional.misc/test.yaml         | 28 +++++++++++++++++
 6 files changed, 118 insertions(+)
 create mode 100644 tests/Functional.misc/data/tst-float.pl
 create mode 100644 tests/Functional.misc/fuego_test.sh
 create mode 100644 tests/Functional.misc/misc_test.sh
 create mode 100644 tests/Functional.misc/parser.py
 create mode 100644 tests/Functional.misc/spec.json
 create mode 100644 tests/Functional.misc/test.yaml
tests/Functional.misc/data/tst-float.pl new file +5 -0
new file mode 100644
index 0000000..89709d5
@@ -0,0 +1,5 @@
+#!/usr/bin/perl
+
+use Env;
+$float_val=1.0/2;
+print "test:$float_val\n";
tests/Functional.misc/fuego_test.sh new file +55 -0

55 lines not on this page · raw message

tests/Functional.misc/misc_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.misc/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -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))
tests/Functional.misc/spec.json new file +6 -0
new file mode 100644
index 0000000..a4ebdd3
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.misc",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.misc/test.yaml new file +28 -0
new file mode 100644
index 0000000..bcc9019
@@ -0,0 +1,28 @@
+fuego_package_version: 1
+name: Functional.misc
+description: |
+      This is a simple test to check the following commands:
+        nslookup/bzip2/saslauthd/dbus-cleanup-sockets/dumpe2fs/su/gawk/gdb/gettext/grep/
+        ip/iptables/ping/mktemp/clear/snmpd/nfsstat/ssh-agent/sshd/openssl/perl/pm-powersave/
+        uptime/rpm/useradd/strace/try-from/in.tftpd-hpa/vsftpd/xinetd
+license: BSD-3-Clause
+author: Wang Mingyu <[email protected]>
+maintainer: Wang Mingyu <[email protected]>
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['misc']
+params:
+      DISK_DEV="the disk device in your target board" Defined in board file
+      SRV_IP="the IP address of host" Defined in board file
+      CONTAINER_TERM="the TERM environment variable of docker" Defined in board file
+      IPADDR="the IP address of board" Defined in board file
+      PASSWORD=="the passwd to login to target" Defined in board file
+data_files:
+ - misc_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - data
+ - tests
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/33 Add test case of command nslookup to query Internet domain name server.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/bind-utils_nslookup.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 tests/Functional.misc/tests/bind-utils_nslookup.sh
tests/Functional.misc/tests/bind-utils_nslookup.sh new file +16 -0
new file mode 100644
index 0000000..d966656
@@ -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
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/33 Add test case of command bzip2.

In reply to Wang Mingyu

This test case is used to compress files by bzip2 and decompress it to stdout.

---
 tests/Functional.misc/tests/bzip2.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 tests/Functional.misc/tests/bzip2.sh
tests/Functional.misc/tests/bzip2.sh new file +17 -0
new file mode 100644
index 0000000..b9f49c5
@@ -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
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 4/33 Add test case of service saslauthd.

In reply to Wang Mingyu

This test case is used to check if the service saslauthd can start and stop normally.

---
 .../Functional.misc/tests/cyrus-sasl_saslauthd.sh  | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 tests/Functional.misc/tests/cyrus-sasl_saslauthd.sh
tests/Functional.misc/tests/cyrus-sasl_saslauthd.sh new file +33 -0
new file mode 100644
index 0000000..f78cfcb
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+#  In target, run comannd saslauthd.
+
+test="saslauthd"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+service_status=$(get_service_status saslauthd)
+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
+if [ "$service_status" = "inactive" ]
+then
+    exec_service_on_target saslauthd stop
+fi
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH 5/33 Add test case of command dbus-cleanup-sockets.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/dbus_dbus-cleanup-sockets.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/dbus_dbus-cleanup-sockets.sh
tests/Functional.misc/tests/dbus_dbus-cleanup-sockets.sh new file +12 -0
new file mode 100644
index 0000000..27e88ad
@@ -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
Signature · 1 line
1.8.3.1
#6 lore raw

PATCH 6/33 Add test case of command dumpe2fs.

In reply to Wang Mingyu

This test case is used to dump filesystem information of specified disk.

---
 tests/Functional.misc/tests/e2fsprogs_dumpe2fs.sh | 25 +++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 tests/Functional.misc/tests/e2fsprogs_dumpe2fs.sh
tests/Functional.misc/tests/e2fsprogs_dumpe2fs.sh new file +25 -0
new file mode 100644
index 0000000..fd4f8ac
@@ -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
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH 7/33 Add test case of command su.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/fjelinux_su.sh | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 tests/Functional.misc/tests/fjelinux_su.sh
tests/Functional.misc/tests/fjelinux_su.sh new file +21 -0
new file mode 100644
index 0000000..c6424db
@@ -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/
Signature · 1 line
1.8.3.1
#8 lore raw

PATCH 8/33 Add test case of command gawk to scan and process "hello world".

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/gawk.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/gawk.sh
tests/Functional.misc/tests/gawk.sh new file +12 -0
new file mode 100644
index 0000000..450545e
@@ -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
Signature · 1 line
1.8.3.1
#9 lore raw

PATCH 9/33 Add test case of command gdb.

In reply to Wang Mingyu

This test case is used to check if the 'gdb' prompt can be outputed after the version information is displayed.

---
 tests/Functional.misc/tests/gdb.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 tests/Functional.misc/tests/gdb.sh
tests/Functional.misc/tests/gdb.sh new file +15 -0
new file mode 100644
index 0000000..2db77f4
@@ -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
Signature · 1 line
1.8.3.1
#10 lore raw

PATCH 10/33 Add test case of command gettext.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/gettext.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 tests/Functional.misc/tests/gettext.sh
tests/Functional.misc/tests/gettext.sh new file +15 -0
new file mode 100644
index 0000000..ca0970f
@@ -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
Signature · 1 line
1.8.3.1
#11 lore raw

PATCH 11/33 Add test case of command grep.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/grep.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 tests/Functional.misc/tests/grep.sh
tests/Functional.misc/tests/grep.sh new file +17 -0
new file mode 100644
index 0000000..d8c7c26
@@ -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
+
Signature · 1 line
1.8.3.1
#12 lore raw

PATCH 12/33 Add test case of command ip to display device attributes.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/iproute_ip.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/iproute_ip.sh
tests/Functional.misc/tests/iproute_ip.sh new file +12 -0
new file mode 100644
index 0000000..1b77132
@@ -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
Signature · 1 line
1.8.3.1
#13 lore raw

PATCH 13/33 Add test case of command iptables to list all chains.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/iptables.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/iptables.sh
tests/Functional.misc/tests/iptables.sh new file +12 -0
new file mode 100644
index 0000000..ea33910
@@ -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
Signature · 1 line
1.8.3.1
#14 lore raw

PATCH 14/33 Add test case of command ping.

In reply to Wang Mingyu

This test case is used to ping the host and stop after sending count 2 packets.

---
 tests/Functional.misc/tests/iputils_ping.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/iputils_ping.sh
tests/Functional.misc/tests/iputils_ping.sh new file +12 -0
new file mode 100644
index 0000000..b879aa9
@@ -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
Signature · 1 line
1.8.3.1
#15 lore raw

PATCH 15/33 Add test case of command mktemp.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/mktemp.sh | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 tests/Functional.misc/tests/mktemp.sh
tests/Functional.misc/tests/mktemp.sh new file +26 -0
new file mode 100644
index 0000000..239d014
@@ -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
Signature · 1 line
1.8.3.1
#16 lore raw

PATCH 16/33 Add test case of command clear.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/ncurses_clear.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/ncurses_clear.sh
tests/Functional.misc/tests/ncurses_clear.sh new file +12 -0
new file mode 100644
index 0000000..902eaf3
@@ -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
Signature · 1 line
1.8.3.1
#17 lore raw

PATCH 17/33 Add test case of service snmpd to check if it can start and stop normally.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/net-snmp_snmpd.sh | 40 +++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 tests/Functional.misc/tests/net-snmp_snmpd.sh
tests/Functional.misc/tests/net-snmp_snmpd.sh new file +40 -0
new file mode 100644
index 0000000..da68cf0
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+#  In target, run comannd snmpd.
+
+test="snmpd"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+service_status=$(get_service_status snmpd)
+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
+if [ "$service_status" = "inactive" ]
+then
+    exec_service_on_target snmpd stop
+fi
Signature · 1 line
1.8.3.1
#18 lore raw

PATCH 18/33 Add test case of command nfsstat.

In reply to Wang Mingyu

The nfsstat displays statistics kept about NFS client and server activity.

---
 tests/Functional.misc/tests/nfs-utils_nfsstat.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/nfs-utils_nfsstat.sh
tests/Functional.misc/tests/nfs-utils_nfsstat.sh new file +12 -0
new file mode 100644
index 0000000..08bef45
@@ -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
Signature · 1 line
1.8.3.1
#19 lore raw

PATCH 19/33 Add test case of command ssh-agent.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/openssh-clients_ssh-agent.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/openssh-clients_ssh-agent.sh
tests/Functional.misc/tests/openssh-clients_ssh-agent.sh new file +12 -0
new file mode 100644
index 0000000..4270336
@@ -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
Signature · 1 line
1.8.3.1
#20 lore raw

PATCH 20/33 Add test case of service sshd.

In reply to Wang Mingyu

This test case is used to check if the process can be generated after starting the service sshd.

---
 tests/Functional.misc/tests/openssh-server_sshd.sh | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 tests/Functional.misc/tests/openssh-server_sshd.sh
tests/Functional.misc/tests/openssh-server_sshd.sh new file +46 -0
new file mode 100644
index 0000000..f63e2f5
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+#  In target, run comannd sshd.
+
+test="sshd"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+service_status=$(get_service_status sshd)
+
+exec_service_on_target sshd stop
+if ps aux | grep "[s]shd"
+then
+    echo " -> stop sshd failed."
+    echo " -> $test: TEST-FAIL"
+    if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+    then
+        exec_service_on_target sshd start
+    fi
+    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 "[s]shd"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+if [ "$service_status" = "inactive" ]
+then
+    exec_service_on_target sshd stop
+fi
Signature · 1 line
1.8.3.1
#21 lore raw

PATCH 21/33 Add test case of command openssl.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/openssl.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 tests/Functional.misc/tests/openssl.sh
tests/Functional.misc/tests/openssl.sh new file +15 -0
new file mode 100644
index 0000000..c74c2e9
@@ -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
Signature · 1 line
1.8.3.1
#22 lore raw

PATCH 22/33 Add test cases of command perl.

In reply to Wang Mingyu

This test set is used to report the message of echo and file by perl.

---
 tests/Functional.misc/tests/perl.sh           | 12 ++++++++++++
 tests/Functional.misc/tests/perl_tst-float.sh | 17 +++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 tests/Functional.misc/tests/perl.sh
 create mode 100644 tests/Functional.misc/tests/perl_tst-float.sh
tests/Functional.misc/tests/perl.sh new file +12 -0
new file mode 100644
index 0000000..3adefc1
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd perl.
+
+test="perl"
+
+if echo "print \"hello world\n\"" | perl | grep "hello world"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.misc/tests/perl_tst-float.sh new file +17 -0
new file mode 100644
index 0000000..3c0018d
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  In target, run comannd tst-float.
+
+test="tst-float"
+
+mkdir test_dir_for_fuego
+
+cp data/tst-float.pl test_dir_for_fuego/
+
+if perl test_dir_for_fuego/tst-float.pl | grep "test:0.5"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -fr test_dir_for_fuego
Signature · 1 line
1.8.3.1
#23 lore raw

PATCH 23/33 Add test case of pm-powersave to put computer into low power mode.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/pm-utils_pm-powersave.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/pm-utils_pm-powersave.sh
tests/Functional.misc/tests/pm-utils_pm-powersave.sh new file +12 -0
new file mode 100644
index 0000000..3c107c8
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd pm-powersave.
+
+test="pm-powersave"
+
+if pm-powersave true
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#24 lore raw

PATCH 24/33 Add test case of command uptime.

In reply to Wang Mingyu

This test case is used to show the current time, how long the system has been running, how many users are currently logged on, and the system load averages.

---
 tests/Functional.misc/tests/procps_uptime.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/procps_uptime.sh
tests/Functional.misc/tests/procps_uptime.sh new file +12 -0
new file mode 100644
index 0000000..9a0fcde
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd uptime.
+
+test="uptime"
+
+if uptime | grep "up.*user.*load.*average"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#25 lore raw

PATCH 25/33 Add test case of command rpm to show all installed packages.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/rpm.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/rpm.sh
tests/Functional.misc/tests/rpm.sh new file +12 -0
new file mode 100644
index 0000000..ec878d4
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd rpm.
+
+test="rpm"
+
+if rpm -qa > /dev/null
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#26 lore raw

PATCH 26/33 Add test case to check if the passwd file is present.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/setup.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/setup.sh
tests/Functional.misc/tests/setup.sh new file +12 -0
new file mode 100644
index 0000000..869050f
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd setup.
+
+test="setup"
+
+if [ -s /etc/passwd ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#27 lore raw

PATCH 27/33 Add test case of command useradd.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/shadow-utils_useradd.sh | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 tests/Functional.misc/tests/shadow-utils_useradd.sh
tests/Functional.misc/tests/shadow-utils_useradd.sh new file +20 -0
new file mode 100644
index 0000000..e3809d1
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  In target, run comannd useradd.
+
+test="useradd"
+
+if ! id test_for_fuego | grep "No such user"
+then
+    userdel test_for_fuego
+    rm -fr /home/test_for_fuego/
+fi
+
+if useradd test_for_fuego
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+userdel test_for_fuego
+rm -fr /home/test_for_fuego/
Signature · 1 line
1.8.3.1
#28 lore raw

PATCH 28/33 Add test case of command strace.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/strace.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/strace.sh
tests/Functional.misc/tests/strace.sh new file +12 -0
new file mode 100644
index 0000000..659f47c
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd strace.
+
+test="strace"
+
+if strace -V | grep "strace.*version"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#29 lore raw

PATCH 29/33 Add test case of command try-from.

In reply to Wang Mingyu

This test case is used to test program for the tcp_wrapper.

---
 tests/Functional.misc/tests/tcp_wrappers_try-from.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/tcp_wrappers_try-from.sh
tests/Functional.misc/tests/tcp_wrappers_try-from.sh new file +12 -0
new file mode 100644
index 0000000..f307e68
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd try-from.
+
+test="try-from"
+
+if try-from | grep -E "client address|client hostname|client username|client info|server address|server hostname|server process|server info"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#30 lore raw

PATCH 30/33 Add test case to check if telnet is exist or not.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/telnetd.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/Functional.misc/tests/telnetd.sh
tests/Functional.misc/tests/telnetd.sh new file +12 -0
new file mode 100644
index 0000000..acd325a
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, check if telnetd is exist.
+
+test="telnetd"
+
+if [ -f /etc/xinetd.d/telnet ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#31 lore raw

PATCH 31/33 Add test case of service tftpd-hpa to check the process of it.

In reply to Wang Mingyu
---
 .../tests/tftp-server_in.tftpd-hpa.sh              | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 tests/Functional.misc/tests/tftp-server_in.tftpd-hpa.sh
tests/Functional.misc/tests/tftp-server_in.tftpd-hpa.sh new file +36 -0
new file mode 100644
index 0000000..4dfc802
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+#  In target, run comannd in.tftpd-hpa.
+
+test="in.tftpd-hpa"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+service_status=$(get_service_status tftpd-hpa)
+
+exec_service_on_target tftpd-hpa stop
+if exec_service_on_target tftpd-hpa start
+then
+    echo " -> start of tftpd-hpa succeeded."
+else
+    echo " -> start of tftpd-hpa failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+sleep 5
+
+if ps aux | grep "[/]usr/sbin/in.tftpd-hpa"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+killall in.tftpd-hpa
+if [ "$service_status" = "inactive" ]
+then
+    exec_service_on_target tftpd-hpa stop
+fi
Signature · 1 line
1.8.3.1
#32 lore raw

PATCH 32/33 Add test case of service vsftpd to check the process of it.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/vsftpd.sh | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 tests/Functional.misc/tests/vsftpd.sh
tests/Functional.misc/tests/vsftpd.sh new file +33 -0
new file mode 100644
index 0000000..315e3aa
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+#  In target, run comannd vsftpd.
+
+test="vsftpd"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+service_status=$(get_service_status vsftpd)
+exec_service_on_target vsftpd stop
+if exec_service_on_target vsftpd start
+then
+    echo " -> start of vsftpd succeeded."
+else
+    echo " -> start of vsftpd failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+sleep 3
+
+if ps aux | grep "[/]usr/sbin/vsftpd"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+if [ "$service_status" = "inactive" ]
+then
+    exec_service_on_target vsftpd stop
+fi
Signature · 1 line
1.8.3.1
#33 lore raw

PATCH 33/33 Add test case of xinetd to check the status of it.

In reply to Wang Mingyu
---
 tests/Functional.misc/tests/xinetd.sh | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 tests/Functional.misc/tests/xinetd.sh
tests/Functional.misc/tests/xinetd.sh new file +25 -0
new file mode 100644
index 0000000..37e5d0f
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+#  In target, run comannd in.xinetd.
+
+test="xinetd"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+if exec_service_on_target xinetd is-active
+then
+    echo " -> start of xinetd succeeded."
+else
+    echo " -> start of xinetd failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if ps aux | grep "[/]usr/sbin/xinetd"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1