[Fuego] [PATCH] Add test cases for commands of busybox as follows: ash bunzip2 free wget

Wang Mingyu wangmy at cn.fujitsu.com
Tue May 22 15:59:41 UTC 2018


Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 engine/tests/Functional.busybox/busybox_test.sh        |  8 ++++++++
 .../tests/Functional.busybox/testsuits/busybox_ash.sh  | 15 +++++++++++++++
 .../Functional.busybox/testsuits/busybox_bunzip2.sh    | 12 ++++++++++++
 .../tests/Functional.busybox/testsuits/busybox_free.sh | 10 ++++++++++
 .../tests/Functional.busybox/testsuits/busybox_wget.sh | 18 ++++++++++++++++++
 5 files changed, 63 insertions(+)
 create mode 100644 engine/tests/Functional.busybox/busybox_test.sh
 create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_ash.sh
 create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh
 create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_free.sh
 create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_wget.sh

diff --git a/engine/tests/Functional.busybox/busybox_test.sh b/engine/tests/Functional.busybox/busybox_test.sh
new file mode 100644
index 0000000..d7c74d1
--- /dev/null
+++ b/engine/tests/Functional.busybox/busybox_test.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+for i in testsuits/*.sh; do
+    if cat ./skiplist.txt | grep ${i##*/}; then
+        echo "Skip test specified in SKIPFILE."
+        continue
+    fi
+    sh $i
+done
diff --git a/engine/tests/Functional.busybox/testsuits/busybox_ash.sh b/engine/tests/Functional.busybox/testsuits/busybox_ash.sh
new file mode 100644
index 0000000..96550c1
--- /dev/null
+++ b/engine/tests/Functional.busybox/testsuits/busybox_ash.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+workdir=$(pwd)
+test="ash"
+
+expect <<-EOF
+spawn busybox ash
+expect "*# "
+send_user " -> $test: Opened ash shell succeeded.\n"
+send "busybox pwd\r"
+expect "$workdir"
+send_user " -> $test: Executed pwd command ash shell succeeded.\n"
+send "exit\r"
+send_user " -> $test: TEST-PASS\n"
+expect eof
+EOF
diff --git a/engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh b/engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh
new file mode 100644
index 0000000..599f7ea
--- /dev/null
+++ b/engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+test="bunzip2"
+
+echo "This is a test file">test1
+bzip2 test1
+if [ "`busybox bunzip2 -c test1.bz2`" == "This is a test file" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -rf test1.bz2;
diff --git a/engine/tests/Functional.busybox/testsuits/busybox_free.sh b/engine/tests/Functional.busybox/testsuits/busybox_free.sh
new file mode 100644
index 0000000..1e00896
--- /dev/null
+++ b/engine/tests/Functional.busybox/testsuits/busybox_free.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+test="free"
+
+busybox free
+if [ `echo $?` == 0 ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/testsuits/busybox_wget.sh b/engine/tests/Functional.busybox/testsuits/busybox_wget.sh
new file mode 100644
index 0000000..abf81bc
--- /dev/null
+++ b/engine/tests/Functional.busybox/testsuits/busybox_wget.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+test="wget"
+
+if [ -f ./readme.txt ]; then rm -f ./readme.txt ; fi
+busybox wget http://$test_tcpip_host:$test_port_host/fuego/userContent/readme.txt -P ./
+if ls  ./ | grep ".*readme.*"
+then
+    echo " -> $test: ls  ./ executed."
+else
+    echo " -> $test: ls  ./ failed."
+fi;
+if cat ./readme.txt | grep ".*jenkins.*"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm ./readme.txt
-- 
1.8.3.1





More information about the Fuego mailing list