[Fuego] [PATCH] Add new test cases of echo, egrep, env and expr to busybox.

Wang Mingyu wangmy at cn.fujitsu.com
Tue Jun 5 08:40:14 UTC 2018


Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 .../tests/Functional.busybox/tests/busybox_echo.sh | 13 ++++++++
 .../Functional.busybox/tests/busybox_egrep.sh      | 28 ++++++++++++++++
 .../tests/Functional.busybox/tests/busybox_env.sh  | 39 ++++++++++++++++++++++
 .../tests/Functional.busybox/tests/busybox_expr.sh | 13 ++++++++
 4 files changed, 93 insertions(+)
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_echo.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_egrep.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_env.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_expr.sh

diff --git a/engine/tests/Functional.busybox/tests/busybox_echo.sh b/engine/tests/Functional.busybox/tests/busybox_echo.sh
new file mode 100644
index 0000000..c29ed2f
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_echo.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command echo
+#  1) Option none
+
+test="echo"
+
+if [ "$(busybox echo "hello world")" = "hello world" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_egrep.sh b/engine/tests/Functional.busybox/tests/busybox_egrep.sh
new file mode 100644
index 0000000..278f470
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_egrep.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command egrep
+#  1) Option: -i
+
+test="egrep"
+
+busybox echo -e "test file\nextended grep\nExtended Grep" >test1
+busybox egrep 'test|extended' ./test1 > log1
+if [ "$(sed -n '1p' log1)" = "test file" ] && [ "$(sed -n '2p' log1)" = "extended grep" ]
+then
+    echo " -> $test: Egrep output verification#1 succedded."
+else
+    echo " -> $test: TEST-FAIL"
+    busybox rm log1
+    busybox rm -rf test1
+    exit
+fi;
+
+busybox egrep -i 'test|extended' ./test1 > log2
+if [ "$(sed -n '1p' log2)" = "test file" ] && [ "$(sed -n '2p' log2)" = "extended grep" ] &&  [ "$(sed -n '3p' log2)" = "Extended Grep" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+busybox rm log1 log2;
+busybox rm -rf test1;
diff --git a/engine/tests/Functional.busybox/tests/busybox_env.sh b/engine/tests/Functional.busybox/tests/busybox_env.sh
new file mode 100644
index 0000000..4932c6d
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_env.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command env
+#  1) Option: none
+
+test="env"
+ 
+if [ -f /home/test/test1_env ]
+then 
+    rm -f /home/test/test1_env 
+fi
+
+echo "echo "TEST_ENV = \$TEST_ENV"">/home/test/test1_env
+chmod 777 /home/test/test1_env
+if [ "$(/home/test/test1_env)" = "TEST_ENV =" ]
+then
+    echo " -> $test: chmod 777 /home/test/test1_env executed."
+else
+    echo " -> $test: TEST-FAIL"
+    rm -f /home/test/test1_env
+    exit
+fi;
+
+if [ "$(busybox env TEST_ENV=1 /home/test/test1_env)" = "TEST_ENV = 1" ]
+then
+    echo " -> $test: busybox env TEST_ENV=1 /home/test/test1_env executed."
+else
+    echo " -> $test: TEST-FAIL"
+    rm -f /home/test/test1_env
+    exit
+fi;
+
+if [ "$(busybox env TEST_ENV=2 /home/test/test1_env)" = "TEST_ENV = 2" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -f /home/test/test1_env
diff --git a/engine/tests/Functional.busybox/tests/busybox_expr.sh b/engine/tests/Functional.busybox/tests/busybox_expr.sh
new file mode 100644
index 0000000..fa07462
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_expr.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command expr
+#  1) Option none
+
+test="expr"
+
+if busybox expr 3 \< 5 == 1 && busybox expr 3 \< 2 = 0 && busybox expr length "HELLO WORLD" = 11
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
-- 
1.8.3.1





More information about the Fuego mailing list