[Fuego] [PATCH] Add command date , dd, deallocvt, df, dirname, dmesg and du to the testset.

Wang Mingyu wangmy at cn.fujitsu.com
Fri Jun 8 15:14:45 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   | 30 ++++++++++++++++++++++
 .../Functional.busybox/tests/busybox_deallocvt.sh  | 16 ++++++++++++
 .../tests/Functional.busybox/tests/busybox_df.sh   | 13 ++++++++++
 .../Functional.busybox/tests/busybox_dirname.sh    | 13 ++++++++++
 .../Functional.busybox/tests/busybox_dmesg.sh      | 13 ++++++++++
 .../tests/Functional.busybox/tests/busybox_du.sh   | 17 ++++++++++++
 7 files changed, 116 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..412890e
--- /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"
+
+TZ="UTC" 
+if busybox date -d "@1" | grep "Thu Jan  1 00:00:01 UTC 1970"
+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..2aa89b4
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_dd.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command dd
+#  1) Option none
+
+test="dd"
+
+echo "hello world" > test1
+touch test2
+busybox dd if=test1 of=test2 2>>log
+
+if  tail -n 1 log | grep "0+1\ records\ out" && head -n 1 log | grep "0+1\ records\ in"
+then
+    echo " -> $test: grep succeeded."
+else
+    echo " -> $test: TEST-FAIL"
+    rm -fr test1 test2
+    rm log
+    exit
+fi;
+
+if [ "$(busybox more test2)" = "hello world" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+rm -fr test1 test2;
+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..88941cc
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_deallocvt.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command deallocvt
+#  1) Option none
+
+test="deallocvt"
+
+openvt -f -c 4 ls
+sleep 1
+busybox deallocvt 4
+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..5eff7ca
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_df.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command df
+#  1) Option none
+
+test="df"
+
+if busybox df | head -n 1 | grep 1K-blocks 
+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..a3b6d2c
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_dirname.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command dirname
+#  1) Option none
+
+test="dirname"
+
+if [ "$(busybox dirname ./test_dir/test1)" = "./test_dir" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
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..332322c
--- /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"
+
+mkdir test_dir
+touch ./test_dir/test1
+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;
+rm -rf test_dir;
-- 
1.8.3.1





More information about the Fuego mailing list