[Fuego] [PATCH] Add command echo, egrep, env and expr to the testset.
Wang Mingyu
wangmy at cn.fujitsu.com
Fri Jun 8 15:14:44 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 | 42 ++++++++++++++++++++++
.../tests/Functional.busybox/tests/busybox_expr.sh | 13 +++++++
4 files changed, 96 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..9b4e8a4
--- /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"
+
+echo -e "test file\nextended grep\nExtended Grep" >test1
+busybox egrep 'test|extended' ./test1 > log1
+if [ "$(head -n 1 log1)" = "test file" ] && [ "$(tail -n 1 log1)" = "extended grep" ]
+then
+ echo " -> $test: Egrep output verification#1 succeeded."
+else
+ echo " -> $test: TEST-FAIL"
+ rm log1
+ rm -rf test1
+ exit
+fi;
+
+busybox egrep -i 'test|extended' ./test1 > log2
+if [ "$(head -n 1 log2)" = "test file" ] && [ "$(head -n 2 log2 | tail -n 1)" = "extended grep" ] && [ "$(tail -n 1 log2)" = "Extended Grep" ]
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
+rm log1 log2;
+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..604d910
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_env.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command env
+# 1) Option: none
+
+test="env"
+
+test_dir="$(pwd)"
+if [ -f $test_dir/test1_env ]
+then
+ rm -f $test_dir/test1_env
+fi
+
+test_string="TEST_ENV=\$TEST_ENV"
+echo \#\!/bin/sh>$test_dir/test1_env
+echo "echo $test_string">> $test_dir/test1_env
+chmod 777 $test_dir/test1_env
+if [ "$($test_dir/test1_env)" = "TEST_ENV=" ]
+then
+ echo " -> $test: chmod 777 $test_dir/test1_env executed."
+else
+ echo " -> $test: TEST-FAIL"
+ rm -f $test_dir/test1_env
+ exit
+fi;
+
+if [ "$(busybox env TEST_ENV=1 $test_dir/test1_env)" = "TEST_ENV=1" ]
+then
+ echo " -> $test: busybox env TEST_ENV=1 $test_dir/test1_env executed."
+else
+ echo " -> $test: TEST-FAIL"
+ rm -f $test_dir/test1_env
+ exit
+fi;
+
+if [ "$(busybox env TEST_ENV=2 $test_dir/test1_env)" = "TEST_ENV=2" ]
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
+rm -f $test_dir/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