[Fuego] [PATCH] busybox : add support for command sed/sh/sleep/sort/strings/swapoff/swapon/sync
Wang Mingyu
wangmy at cn.fujitsu.com
Tue Jul 31 09:06:03 UTC 2018
Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
.../tests/Functional.busybox/tests/busybox_sed.sh | 13 ++++++++++++
.../tests/Functional.busybox/tests/busybox_sh.sh | 18 ++++++++++++++++
.../Functional.busybox/tests/busybox_sleep.sh | 22 ++++++++++++++++++++
.../tests/Functional.busybox/tests/busybox_sort.sh | 24 ++++++++++++++++++++++
.../Functional.busybox/tests/busybox_strings.sh | 15 ++++++++++++++
.../Functional.busybox/tests/busybox_swapoff.sh | 13 ++++++++++++
.../Functional.busybox/tests/busybox_swapon.sh | 13 ++++++++++++
.../tests/Functional.busybox/tests/busybox_sync.sh | 13 ++++++++++++
8 files changed, 131 insertions(+)
create mode 100644 engine/tests/Functional.busybox/tests/busybox_sed.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_sh.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_sleep.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_sort.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_strings.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_swapoff.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_swapon.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_sync.sh
diff --git a/engine/tests/Functional.busybox/tests/busybox_sed.sh b/engine/tests/Functional.busybox/tests/busybox_sed.sh
new file mode 100644
index 0000000..c5af18f
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_sed.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command sed
+# 1) Option -e
+
+test="sed"
+
+if [ "$(echo "test case" | busybox sed -e 's/case/result/g')" = "test result" ]
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_sh.sh b/engine/tests/Functional.busybox/tests/busybox_sh.sh
new file mode 100644
index 0000000..5d37465
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_sh.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command sh
+# 1) Option none
+
+test="sh"
+
+expect <<-EOF
+spawn busybox sh
+expect "*# "
+send_user " -> $test: Launching sh succeeded.\n"
+send "busybox basename ./test_dir/test1\r"
+expect "test1"
+send_user " -> $test: Issuing basename command succeeded.\n"
+send "exit\r"
+send_user " -> $test: TEST-PASS\n"
+expect eof
+EOF
diff --git a/engine/tests/Functional.busybox/tests/busybox_sleep.sh b/engine/tests/Functional.busybox/tests/busybox_sleep.sh
new file mode 100644
index 0000000..4ddc519
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_sleep.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command sleep
+# 1) Option none
+
+test="sleep"
+
+if sleep 0 | ps aux | grep -v grep | grep "sleep 0"
+then
+ echo " -> $test: sleep 0 failed."
+ echo " -> $test: TEST-FAIL"
+ exit
+else
+ echo " -> $test: sleep 0 successed."
+fi;
+
+if sleep 1 | ps aux | grep -v grep | grep "sleep 1"
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_sort.sh b/engine/tests/Functional.busybox/tests/busybox_sort.sh
new file mode 100644
index 0000000..18ca0e7
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_sort.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command sort
+# 1) Option none
+
+test="sort"
+
+echo "e" > test1
+echo "f" >> test1
+echo "b" >> test1
+echo "d" >> test1
+echo "c" >> test1
+echo "a" >> test1
+
+busybox sort test1 > log
+if [ "$(head -n 1 log)" = "a" ] && [ "$(head -n 2 log | tail -n 1)" = "b" ] && [ "$(head -n 3 log | tail -n 1)" = "c" ] \
+&& [ "$(head -n 4 log | tail -n 1)" = "d" ] && [ "$(head -n 5 log | tail -n 1)" = "e" ] && [ "$(tail -n 1 log)" = "f" ]
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
+rm -rf test1;
+rm log;
diff --git a/engine/tests/Functional.busybox/tests/busybox_strings.sh b/engine/tests/Functional.busybox/tests/busybox_strings.sh
new file mode 100644
index 0000000..2b56322
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_strings.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command strings
+# 1) Option none
+
+test="strings"
+
+echo "hello world" > test1
+if [ "$(busybox strings test1)" = "hello world" ]
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
+rm test1;
diff --git a/engine/tests/Functional.busybox/tests/busybox_swapoff.sh b/engine/tests/Functional.busybox/tests/busybox_swapoff.sh
new file mode 100644
index 0000000..3bc2170
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_swapoff.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command swapoff
+# 1) Option -a
+
+test="swapoff"
+
+if busybox swapoff -a
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_swapon.sh b/engine/tests/Functional.busybox/tests/busybox_swapon.sh
new file mode 100644
index 0000000..6a7ebf2
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_swapon.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command swapon
+# 1) Option -a
+
+test="swapon"
+
+if busybox swapon -a
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_sync.sh b/engine/tests/Functional.busybox/tests/busybox_sync.sh
new file mode 100644
index 0000000..39c269b
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_sync.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command sync
+# 1) Option none
+
+test="sync"
+
+if busybox sync
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
--
1.8.3.1
More information about the Fuego
mailing list