[Fuego] [PATCH] Add new test cases of date, dd, deallocvt, df, dirname, dmesg and du to busybox.

Wang Mingyu wangmy at cn.fujitsu.com
Tue Jun 5 08:07:37 UTC 2018


Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 .../tests/Functional.busybox/tests/busybox_date.sh | 14 ++++++++++
 .../tests/Functional.busybox/tests/busybox_dd.sh   | 31 ++++++++++++++++++++++
 .../Functional.busybox/tests/busybox_deallocvt.sh  | 14 ++++++++++
 .../tests/Functional.busybox/tests/busybox_df.sh   | 14 ++++++++++
 .../Functional.busybox/tests/busybox_dirname.sh    | 16 +++++++++++
 .../Functional.busybox/tests/busybox_dmesg.sh      | 13 +++++++++
 .../tests/Functional.busybox/tests/busybox_du.sh   | 17 ++++++++++++
 7 files changed, 119 insertions(+)
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_date.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_dd.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_deallocvt.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_df.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_dirname.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_dmesg.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_du.sh

diff --git a/engine/tests/Functional.busybox/tests/busybox_date.sh b/engine/tests/Functional.busybox/tests/busybox_date.sh
new file mode 100644
index 0000000..7d15131
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_date.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command date
+#  1) Option none
+
+test="date"
+
+busybox date
+if [ $? = 0 ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_dd.sh b/engine/tests/Functional.busybox/tests/busybox_dd.sh
new file mode 100644
index 0000000..d58201b
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_dd.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command dd
+#  1) Option none
+
+test="dd"
+
+sleep 1
+busybox echo "hello world" > test1
+busybox touch test2
+busybox dd if=test1 of=test2 2>>log
+
+if  sed -n '2p' log | grep "0+1\ records\ out" && sed -n '1p' log | grep "0+1\ records\ in"
+then
+    echo " -> $test: grep succeeded."
+else
+    echo " -> $test: TEST-FAIL"
+    busybox rm -fr test1 test2
+    busybox rm log
+    exit
+fi;
+
+if [ "$(busybox more test2)" == "hello world" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+busybox rm -fr test1 test2;
+busybox rm log;
diff --git a/engine/tests/Functional.busybox/tests/busybox_deallocvt.sh b/engine/tests/Functional.busybox/tests/busybox_deallocvt.sh
new file mode 100644
index 0000000..1564122
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_deallocvt.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command deallocvt
+#  1) Option none
+
+test="deallocvt"
+
+busybox deallocvt
+if [ $? = 0 ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_df.sh b/engine/tests/Functional.busybox/tests/busybox_df.sh
new file mode 100644
index 0000000..6ca2bb0
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_df.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command df
+#  1) Option none
+
+test="df"
+
+busybox df
+if [ $? = 0 ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_dirname.sh b/engine/tests/Functional.busybox/tests/busybox_dirname.sh
new file mode 100644
index 0000000..acd09de
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_dirname.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command dirname
+#  1) Option none
+
+test="dirname"
+
+busybox mkdir test_dir
+busybox echo "This is a test file." > ./test_dir/test1
+if [ "$(busybox dirname ./test_dir/test1)" == "./test_dir" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+busybox rm -rf test_dir;
diff --git a/engine/tests/Functional.busybox/tests/busybox_dmesg.sh b/engine/tests/Functional.busybox/tests/busybox_dmesg.sh
new file mode 100644
index 0000000..fdf0546
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_dmesg.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command dmesg
+#  1) Option none
+
+test="dmesg"
+
+if busybox dmesg | grep "Linux version" 
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_du.sh b/engine/tests/Functional.busybox/tests/busybox_du.sh
new file mode 100644
index 0000000..c3d8a7f
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_du.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command du
+#  1) Option: -k
+
+test="du"
+
+busybox mkdir test_dir
+busybox touch ./test_dir/test1
+busybox touch ./test_dir/test2
+if busybox du -k test_dir | grep "0.*test_dir"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+busybox rm -rf test_dir;
-- 
1.8.3.1





More information about the Fuego mailing list