[Fuego] [PATCH] busybox: add support for command head/hexdump/hostname/id/ifconfig/install
Wang Mingyu
wangmy at cn.fujitsu.com
Mon Jul 23 05:35:14 UTC 2018
Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
.../tests/Functional.busybox/tests/busybox_head.sh | 22 ++++++++++++++++++++++
.../Functional.busybox/tests/busybox_hexdump.sh | 19 +++++++++++++++++++
.../Functional.busybox/tests/busybox_hostname.sh | 13 +++++++++++++
.../tests/Functional.busybox/tests/busybox_id.sh | 13 +++++++++++++
.../Functional.busybox/tests/busybox_ifconfig.sh | 13 +++++++++++++
.../Functional.busybox/tests/busybox_install.sh | 17 +++++++++++++++++
6 files changed, 97 insertions(+)
create mode 100644 engine/tests/Functional.busybox/tests/busybox_head.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_hexdump.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_hostname.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_id.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_ifconfig.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_install.sh
diff --git a/engine/tests/Functional.busybox/tests/busybox_head.sh b/engine/tests/Functional.busybox/tests/busybox_head.sh
new file mode 100644
index 0000000..be0269e
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_head.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command head
+# 1) Option -n
+
+test="head"
+
+mkdir test_dir
+touch test_dir/test1
+echo "This is the 1st line.">test_dir/test1
+echo "This is the 2nd line.">>test_dir/test1
+echo "This is the 3rd line.">>test_dir/test1
+busybox head -n 2 test_dir/test1 > log
+
+if [ "$(busybox head -n 1 log)" = "This is the 1st line." ] && [ "$(tail -n 1 log)" = "This is the 2nd line." ]
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
+rm log
+rm -rf test_dir
diff --git a/engine/tests/Functional.busybox/tests/busybox_hexdump.sh b/engine/tests/Functional.busybox/tests/busybox_hexdump.sh
new file mode 100644
index 0000000..d598c72
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_hexdump.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command hexdump
+# 1) Option: -c
+
+test="hexdump"
+
+mkdir test_dir
+touch test_dir/test1
+echo "HELLO WORLD">test_dir/test1
+busybox hexdump -c test_dir/test1 > log
+if head -n 1 log | grep "0000000 H E L L O W O R L D \\\n" && [ "$(tail -n 1 log)" = "000000c" ]
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
+rm log
+rm -rf test_dir
diff --git a/engine/tests/Functional.busybox/tests/busybox_hostname.sh b/engine/tests/Functional.busybox/tests/busybox_hostname.sh
new file mode 100644
index 0000000..f854515
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_hostname.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command hostname
+# 1) Option none
+
+test="hostname"
+
+if [ $(busybox hostname) = $(hostname) ]
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_id.sh b/engine/tests/Functional.busybox/tests/busybox_id.sh
new file mode 100644
index 0000000..9f53fcc
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_id.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command id
+# 1) Option none
+
+test="id"
+
+if [ "$(busybox id)" = "$(id)" ]
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_ifconfig.sh b/engine/tests/Functional.busybox/tests/busybox_ifconfig.sh
new file mode 100644
index 0000000..31b07d2
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_ifconfig.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command ifconfig
+# 1) Option none
+
+test="ifconfig"
+
+if busybox ifconfig
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_install.sh b/engine/tests/Functional.busybox/tests/busybox_install.sh
new file mode 100644
index 0000000..a8cba56
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_install.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command install
+# 1) Option none
+
+test="install"
+
+mkdir test_dir test_install_dir
+echo "ls test_install_dir">test_dir/test1
+busybox install test_dir/test1 test_install_dir
+if [ $(./test_install_dir/test1) = test1 ]
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
+rm -rf test_dir test_install_dir;
--
1.8.3.1
More information about the Fuego
mailing list