[Fuego] [PATCH] Add clear cmp cp and cut to busybox

Wang Mingyu wangmy at cn.fujitsu.com
Thu May 31 09:31:35 UTC 2018


Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 .../Functional.busybox/tests/busybox_clear.sh      | 14 ++++++++++
 .../tests/Functional.busybox/tests/busybox_cmp.sh  | 17 ++++++++++++
 .../tests/Functional.busybox/tests/busybox_cp.sh   | 31 ++++++++++++++++++++++
 .../tests/Functional.busybox/tests/busybox_cut.sh  | 13 +++++++++
 4 files changed, 75 insertions(+)
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_clear.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_cmp.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_cp.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_cut.sh

diff --git a/engine/tests/Functional.busybox/tests/busybox_clear.sh b/engine/tests/Functional.busybox/tests/busybox_clear.sh
new file mode 100644
index 0000000..aaa1d06
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_clear.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command clear
+#  1) Option none
+
+test="clear"
+
+busybox clear
+if [ $? = 0 ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_cmp.sh b/engine/tests/Functional.busybox/tests/busybox_cmp.sh
new file mode 100644
index 0000000..919c03c
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_cmp.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command cmp
+#  1) Option: -l -s
+
+test="cmp"
+
+busybox mkdir test_dir
+busybox echo "This is test file 1." > ./test_dir/test1
+busybox echo "This is test file 2." > ./test_dir/test2
+if [ "$(busybox cmp ./test_dir/test1 ./test_dir/test2)" = "./test_dir/test1 ./test_dir/test2 differ: char 19, line 1" ] && [ "$(busybox cmp -l ./test_dir/test1 ./test_dir/test2)" = "19  61  62" ] && [ "$(busybox cmp -s ./test_dir/test1 ./test_dir/test2)" = "" ]
+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_cp.sh b/engine/tests/Functional.busybox/tests/busybox_cp.sh
new file mode 100644
index 0000000..5f85e49
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_cp.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command cp
+#  1) Option: -i
+
+test="cp"
+
+mkdir test_dir_src
+mkdir test_dir_dest
+echo "cp test" > test_dir_src/test1
+busybox cp test_dir_src/test1 test_dir_dest/
+if [ "$(cat test_dir_dest/test1)" = "cp test" ]
+then
+    echo " -> $test: cp succeed."
+else
+    echo " -> &test: TEST-FAIL"
+    rm -rf test_dir_src
+    rm -rf test_dir_dest
+    exit
+fi;
+
+expect <<-EOF
+spawn busybox cp -i test_dir_dest/test1 test_dir_src/
+expect "cp: overwrite 'test_dir_src/test1'?"
+send_user " -> $test: overwite succeeded.\n"
+send "exit\r"
+send_user " -> $test: TEST-PASS\n"
+expect eof
+EOF
+rm -rf test_dir_src;
+rm -rf test_dir_dest;
diff --git a/engine/tests/Functional.busybox/tests/busybox_cut.sh b/engine/tests/Functional.busybox/tests/busybox_cut.sh
new file mode 100644
index 0000000..a732521
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_cut.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command cut
+#  1) Option: -f -d
+
+test="cut"
+
+if [ "$(busybox echo "Hello world" | /bin/busybox cut -f 1 -d ' ')" = "Hello" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
-- 
1.8.3.1





More information about the Fuego mailing list