[Fuego] [PATCH] busybox: add support for command wc/whoami/xargs/zcat

Wang Mingyu wangmy at cn.fujitsu.com
Mon Aug 6 01:39:44 UTC 2018


Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 .../tests/Functional.busybox/tests/busybox_wc.sh   | 13 +++++++++++
 .../Functional.busybox/tests/busybox_whoami.sh     | 13 +++++++++++
 .../Functional.busybox/tests/busybox_xargs.sh      | 25 ++++++++++++++++++++++
 .../tests/Functional.busybox/tests/busybox_zcat.sh | 18 ++++++++++++++++
 4 files changed, 69 insertions(+)
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_wc.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_whoami.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_xargs.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_zcat.sh

diff --git a/engine/tests/Functional.busybox/tests/busybox_wc.sh b/engine/tests/Functional.busybox/tests/busybox_wc.sh
new file mode 100644
index 0000000..ceedf52
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_wc.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command wc
+#  1) Option none
+
+test="wc"
+
+if [ "$(echo 'HELLO WORLD' | busybox wc | grep ".*1         2        12.*")" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_whoami.sh b/engine/tests/Functional.busybox/tests/busybox_whoami.sh
new file mode 100644
index 0000000..54ed0a8
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_whoami.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command whoami
+#  1) Option none
+
+test="whoami"
+
+if [ "$(busybox whoami)" = "$(id -un)" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_xargs.sh b/engine/tests/Functional.busybox/tests/busybox_xargs.sh
new file mode 100644
index 0000000..929a914
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_xargs.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command xargs
+#  1) Option none
+
+test="xargs"
+
+mkdir test_dir
+echo test1 > ./test_dir/test1
+echo test11 > ./test_dir/test2
+echo test111 > ./test_dir/test3
+echo "./test_dir/test1" > testfile
+echo "./test_dir/test2" >> testfile
+echo "./test_dir/test3" >> testfile
+cat testfile | busybox xargs wc > log
+
+if [ "$(head -n 1 log)" = " 1  1  6 ./test_dir/test1" ] && [ "$(head -n 2 log | tail -n 1)" = " 1  1  7 ./test_dir/test2" ] \
+&& [ "$(tail -n 2 log | head -n 1)" = " 1  1  8 ./test_dir/test3" ] && [ "$(tail -n 1 log)" = " 3  3 21 total" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -fr test_dir
+
diff --git a/engine/tests/Functional.busybox/tests/busybox_zcat.sh b/engine/tests/Functional.busybox/tests/busybox_zcat.sh
new file mode 100644
index 0000000..1ebfcd4
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_zcat.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command zcat
+#  1) Option none
+
+test="zcat"
+
+rm -fr test_dir
+mkdir test_dir
+echo "This is a file to test zcat." > ./test_dir/test1
+gzip ./test_dir/test1
+if [ "$(busybox zcat ./test_dir/test1.gz)" = "This is a file to test zcat." ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -fr test_dir
-- 
1.8.3.1





More information about the Fuego mailing list