[Fuego] [PATCH 5/6] Add test cases of command perl/tst-float/pm-powersave/uptime/rpm/setup/useradd/strace.

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


Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 engine/tests/Functional.misc/tests/perl.sh           | 12 ++++++++++++
 engine/tests/Functional.misc/tests/perl_tst-float.sh | 17 +++++++++++++++++
 .../Functional.misc/tests/pm-utils_pm-powersave.sh   | 12 ++++++++++++
 engine/tests/Functional.misc/tests/procps_uptime.sh  | 12 ++++++++++++
 engine/tests/Functional.misc/tests/rpm.sh            | 12 ++++++++++++
 engine/tests/Functional.misc/tests/setup.sh          | 12 ++++++++++++
 .../Functional.misc/tests/shadow-utils_useradd.sh    | 20 ++++++++++++++++++++
 engine/tests/Functional.misc/tests/strace.sh         | 12 ++++++++++++
 8 files changed, 109 insertions(+)
 create mode 100644 engine/tests/Functional.misc/tests/perl.sh
 create mode 100644 engine/tests/Functional.misc/tests/perl_tst-float.sh
 create mode 100644 engine/tests/Functional.misc/tests/pm-utils_pm-powersave.sh
 create mode 100644 engine/tests/Functional.misc/tests/procps_uptime.sh
 create mode 100644 engine/tests/Functional.misc/tests/rpm.sh
 create mode 100644 engine/tests/Functional.misc/tests/setup.sh
 create mode 100644 engine/tests/Functional.misc/tests/shadow-utils_useradd.sh
 create mode 100644 engine/tests/Functional.misc/tests/strace.sh

diff --git a/engine/tests/Functional.misc/tests/perl.sh b/engine/tests/Functional.misc/tests/perl.sh
new file mode 100644
index 0000000..3adefc1
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/perl.sh
@@ -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
diff --git a/engine/tests/Functional.misc/tests/perl_tst-float.sh b/engine/tests/Functional.misc/tests/perl_tst-float.sh
new file mode 100644
index 0000000..3c0018d
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/perl_tst-float.sh
@@ -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
diff --git a/engine/tests/Functional.misc/tests/pm-utils_pm-powersave.sh b/engine/tests/Functional.misc/tests/pm-utils_pm-powersave.sh
new file mode 100644
index 0000000..3c107c8
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/pm-utils_pm-powersave.sh
@@ -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
diff --git a/engine/tests/Functional.misc/tests/procps_uptime.sh b/engine/tests/Functional.misc/tests/procps_uptime.sh
new file mode 100644
index 0000000..9a0fcde
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/procps_uptime.sh
@@ -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
diff --git a/engine/tests/Functional.misc/tests/rpm.sh b/engine/tests/Functional.misc/tests/rpm.sh
new file mode 100644
index 0000000..ec878d4
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/rpm.sh
@@ -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
diff --git a/engine/tests/Functional.misc/tests/setup.sh b/engine/tests/Functional.misc/tests/setup.sh
new file mode 100644
index 0000000..0b85507
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/setup.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In target, run comannd setup.
+
+test="setup"
+
+if [ $(ls -l /etc/passwd | wc -l) = 1 ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.misc/tests/shadow-utils_useradd.sh b/engine/tests/Functional.misc/tests/shadow-utils_useradd.sh
new file mode 100644
index 0000000..e3809d1
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/shadow-utils_useradd.sh
@@ -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/
diff --git a/engine/tests/Functional.misc/tests/strace.sh b/engine/tests/Functional.misc/tests/strace.sh
new file mode 100644
index 0000000..659f47c
--- /dev/null
+++ b/engine/tests/Functional.misc/tests/strace.sh
@@ -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
-- 
1.8.3.1





More information about the Fuego mailing list