[Fuego] [PATCH] busybox: add support for command umount/uname/uniq/uptime/usleep
Wang Mingyu
wangmy at cn.fujitsu.com
Mon Aug 6 01:39:43 UTC 2018
Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
.../Functional.busybox/tests/busybox_umount.sh | 25 ++++++++++++++++++++++
.../Functional.busybox/tests/busybox_uname.sh | 14 ++++++++++++
.../tests/Functional.busybox/tests/busybox_uniq.sh | 23 ++++++++++++++++++++
.../Functional.busybox/tests/busybox_uptime.sh | 13 +++++++++++
.../Functional.busybox/tests/busybox_usleep.sh | 22 +++++++++++++++++++
5 files changed, 97 insertions(+)
create mode 100644 engine/tests/Functional.busybox/tests/busybox_umount.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_uname.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_uniq.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_uptime.sh
create mode 100644 engine/tests/Functional.busybox/tests/busybox_usleep.sh
diff --git a/engine/tests/Functional.busybox/tests/busybox_umount.sh b/engine/tests/Functional.busybox/tests/busybox_umount.sh
new file mode 100644
index 0000000..5e3a951
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_umount.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command umount
+# 1) Option none
+
+test="umount"
+
+mount -n -t tmpfs none /dev/shm
+
+if mount | grep "none on /dev/shm"
+then
+ echo " -> $test: mount successed."
+else
+ echo " -> $test: mount failed."
+ echo " -> $test: TEST-FAIL"
+ exit
+fi;
+
+busybox umount /dev/shm
+if mount | grep "none on /dev/shm"
+then
+ echo " -> $test: TEST-FAIL"
+else
+ echo " -> $test: TEST-PASS"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_uname.sh b/engine/tests/Functional.busybox/tests/busybox_uname.sh
new file mode 100644
index 0000000..e640a0f
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_uname.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command uname
+# 1) Option: -r
+
+test="uname"
+
+if cat /proc/version | grep "$(busybox uname -r)"
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+ exit
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_uniq.sh b/engine/tests/Functional.busybox/tests/busybox_uniq.sh
new file mode 100644
index 0000000..66b90e7
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_uniq.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command uniq
+# 1) Option none
+
+test="uniq"
+
+echo "a" > test1
+echo "a" >> test1
+echo "b" >> test1
+echo "c" >> test1
+echo "c" >> test1
+echo "a" >> test1
+sort test1 | busybox uniq > log
+
+if [ "$(head -n 1 log)" = "a" ] && [ "$(head -n 2 log | tail -n 1)" = "b" ] && [ "$(tail -n 1 log)" = "c" ]
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
+rm test1;
+rm log;
diff --git a/engine/tests/Functional.busybox/tests/busybox_uptime.sh b/engine/tests/Functional.busybox/tests/busybox_uptime.sh
new file mode 100644
index 0000000..aa44d24
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_uptime.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command uptime
+# 1) Option none
+
+test="uptime"
+
+if [ "$(busybox uptime | grep ".*average.*")" ]
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_usleep.sh b/engine/tests/Functional.busybox/tests/busybox_usleep.sh
new file mode 100644
index 0000000..344a45e
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_usleep.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# The testscript checks the following options of the command usleep
+# 1) Option none
+
+test="usleep"
+
+if busybox usleep 0 | ps aux | grep "[b]usybox usleep 0"
+then
+ echo " -> $test: sleep 0 failed."
+ echo " -> $test: TEST-FAIL"
+ exit
+else
+ echo " -> $test: sleep 0 successed."
+fi;
+
+if busybox usleep 1000000 | ps aux | grep "[b]usybox usleep 1000000"
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
--
1.8.3.1
More information about the Fuego
mailing list