All of lore.kernel.org
 help / color / mirror / Atom feed
* [Fuego] [PATCH] busybox : add support for command readlink/reset/rm/rmdir/route
@ 2018-07-31  9:06 Wang Mingyu
  2018-07-31  9:06 ` [Fuego] [PATCH] busybox : add support for command sed/sh/sleep/sort/strings/swapoff/swapon/sync Wang Mingyu
  2018-08-18  4:57 ` [Fuego] [PATCH] busybox : add support for command readlink/reset/rm/rmdir/route Tim Bird
  0 siblings, 2 replies; 6+ messages in thread
From: Wang Mingyu @ 2018-07-31  9:06 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 .../Functional.busybox/tests/busybox_readlink.sh   | 17 +++++++++
 .../Functional.busybox/tests/busybox_reset.sh      | 13 +++++++
 .../tests/Functional.busybox/tests/busybox_rm.sh   | 41 ++++++++++++++++++++++
 .../Functional.busybox/tests/busybox_rmdir.sh      | 24 +++++++++++++
 .../Functional.busybox/tests/busybox_route.sh      | 25 +++++++++++++
 5 files changed, 120 insertions(+)
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_readlink.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_reset.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_rm.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_rmdir.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_route.sh

diff --git a/engine/tests/Functional.busybox/tests/busybox_readlink.sh b/engine/tests/Functional.busybox/tests/busybox_readlink.sh
new file mode 100644
index 0000000..bd34bc8
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_readlink.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command readlink
+#  1) Option none
+
+test="readlink"
+
+mkdir test_dir1 test_dir2
+touch test_dir1/test1
+ln -s test_dir1/test1 test_dir2/test2
+if [ "$(busybox readlink test_dir2/test2)" = "test_dir1/test1" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -rf test_dir1 test_dir2;
diff --git a/engine/tests/Functional.busybox/tests/busybox_reset.sh b/engine/tests/Functional.busybox/tests/busybox_reset.sh
new file mode 100644
index 0000000..6126ed7
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_reset.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command reset
+#  1) Option none
+
+test="reset"
+
+if busybox reset 
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_rm.sh b/engine/tests/Functional.busybox/tests/busybox_rm.sh
new file mode 100644
index 0000000..38fd865
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_rm.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command rm
+#  1) Option: -r -f
+
+test="rm"
+
+mkdir -p test_dir/test_dir1
+touch test_dir/test1
+ls -l test_dir > log
+if head -n 2 log | head -n 2 | grep "\-rw.*test1" && tail -n 1 log | grep "d.*test_dir1"
+then
+    echo " -> $test: mkdir test_dir verification succeeded."
+else
+    echo " -> $test: mkdir test_dir verification failed."
+    echo " -> $test: TEST-FAIL"
+    rm -rf test_dir
+    rm log
+    exit
+fi;
+
+busybox rm -f test_dir/test1
+if ls -l test_dir | grep "d.*test_dir1"
+then
+    echo " -> &test: rm verification#2 succeeded."
+else
+    echo " -> &test: rm verification#2 failed."
+    echo " -> &test: TEST-FAIL"
+    rm -rf test_dir
+    rm log
+    exit
+fi;
+
+busybox rm -rf test_dir
+if [ "$(ls -l | grep test_dir)" = "" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm log
diff --git a/engine/tests/Functional.busybox/tests/busybox_rmdir.sh b/engine/tests/Functional.busybox/tests/busybox_rmdir.sh
new file mode 100644
index 0000000..857288f
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_rmdir.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command rmdir
+#  1) Option none
+
+test="rmdir"
+
+mkdir test_dir
+if ls -l | grep test_dir
+then
+    echo " -> $test: mkdir test_dir verification succeeded."
+else
+    echo " -> $test: mkdir test_dir verification failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi;
+
+busybox rmdir test_dir
+if [ "$(ls -l | grep test_dir)" = "" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_route.sh b/engine/tests/Functional.busybox/tests/busybox_route.sh
new file mode 100644
index 0000000..c3b64b5
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_route.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command route
+
+test="route"
+
+busybox route add -net 22.0.0.0 netmask 255.0.0.0 reject
+
+if busybox route | grep 22.0.0.0
+then
+    echo " -> $test: busybox route add succedded."
+else
+    echo " -> $test: busybox route add failed."
+    echo " -> $test: TEST-FAIL"
+fi;
+
+busybox route del -net 22.0.0.0 netmask 255.0.0.0 reject
+
+if ! busybox route | grep 22.0.0.0
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: busybox route del failed."
+    echo " -> $test: TEST-FAIL"
+fi;
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Fuego] [PATCH] busybox : add support for command sed/sh/sleep/sort/strings/swapoff/swapon/sync
  2018-07-31  9:06 [Fuego] [PATCH] busybox : add support for command readlink/reset/rm/rmdir/route Wang Mingyu
@ 2018-07-31  9:06 ` Wang Mingyu
  2018-08-07  1:11   ` Tim.Bird
  2018-08-18  4:57 ` [Fuego] [PATCH] busybox : add support for command readlink/reset/rm/rmdir/route Tim Bird
  1 sibling, 1 reply; 6+ messages in thread
From: Wang Mingyu @ 2018-07-31  9:06 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@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




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Fuego] [PATCH] busybox : add support for command sed/sh/sleep/sort/strings/swapoff/swapon/sync
  2018-07-31  9:06 ` [Fuego] [PATCH] busybox : add support for command sed/sh/sleep/sort/strings/swapoff/swapon/sync Wang Mingyu
@ 2018-08-07  1:11   ` Tim.Bird
  2018-08-07  9:41     ` Wang, Mingyu
  0 siblings, 1 reply; 6+ messages in thread
From: Tim.Bird @ 2018-08-07  1:11 UTC (permalink / raw)
  To: wangmy, fuego

See comments inline below.

> -----Original Message-----
> From: Wang Mingyu
> 
> Signed-off-by: Wang Mingyu <wangmy@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;
Look OK.

> 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

I don't see how failure is reported for this test.  Please explain.

> 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"
Please use "grep [s]leep 0", rather than using "grep -v grep" in the
pipeline.

> +then
> +    echo " -> $test: sleep 0 failed."
> +    echo " -> $test: TEST-FAIL"
> +    exit
> +else
> +    echo " -> $test: sleep 0 successed."
Please change "successed" to "succeeded"

> +fi;
> +
> +if sleep 1 | ps aux | grep -v grep | grep "sleep 1"
Please use "grep [s]leep 0", rather than using "grep -v grep" in the
pipeline.

> +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;
Looks OK.

> 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
Would be nice to add some non-text data to test1 here,
to validate that it is not returned by busybox strings.

You can use 'printf' to do this (echo -e is problematical for a few reasons discussed
previously).  Note that you could prepare a test file in advance, with non-string
data, or possibly embed it into the script.

> +if [ "$(busybox strings test1)" = "hello world" ]
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +rm test1;
Script is basically OK as is, but could be improved with testing
more of what 'busybox strings' does.  (We know it finds strings, but
it should also ignore non-text data).

> 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;
OK - would be nice to check /proc/swap before and after to see if the command had
any effect.

> 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;

Would be nice to check /proc/swaps before and after to see if the command
had any effect.

> 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;
This is OK, but doesn't test much.  A proper test of sync would
be to validate that data was flushed to disk.  However, that's
outside the scope of these simple command-line tests.

> --
> 1.8.3.1


Thanks - can you please address my comments and re-submit.  In cases
where I've suggested enhancements, if you don't have time to make
them please just do what you can.

 -- Tim


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Fuego] [PATCH] busybox : add support for command sed/sh/sleep/sort/strings/swapoff/swapon/sync
  2018-08-07  1:11   ` Tim.Bird
@ 2018-08-07  9:41     ` Wang, Mingyu
  2018-08-07 12:56       ` Tim.Bird
  0 siblings, 1 reply; 6+ messages in thread
From: Wang, Mingyu @ 2018-08-07  9:41 UTC (permalink / raw)
  To: Tim.Bird, fuego

Hi Tim:

Most of the comment has been confirmed. 
There are two points to be confirmed with you.

1. swapoff/swapon
These two commands, individually written into scripts, will have effect to the environment.
Maybe should put these two commands in one script and used in pairs.
Then verify the contents of / proc / swaps at the beginning and end of the script to ensure that the test suite does not affect the environment.

2.string
Prepare a text with non-text data, and in the test script of the command, use the busybox string command to view the file content to ensure that the command can correctly output the string and ignore non-text data. Is that right?
  
by Wangmy

-----Original Message-----
From: Tim.Bird@sony.com [mailto:Tim.Bird@sony.com] 
Sent: Tuesday, August 07, 2018 9:12 AM
To: Wang, Mingyu/王 鸣瑜 <wangmy@cn.fujitsu.com>; fuego@lists.linuxfoundation.org
Subject: RE: [Fuego] [PATCH] busybox : add support for command sed/sh/sleep/sort/strings/swapoff/swapon/sync

See comments inline below.

> -----Original Message-----
> From: Wang Mingyu
> 
> Signed-off-by: Wang Mingyu <wangmy@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;
Look OK.

> 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

I don't see how failure is reported for this test.  Please explain.

> 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"
Please use "grep [s]leep 0", rather than using "grep -v grep" in the pipeline.

> +then
> +    echo " -> $test: sleep 0 failed."
> +    echo " -> $test: TEST-FAIL"
> +    exit
> +else
> +    echo " -> $test: sleep 0 successed."
Please change "successed" to "succeeded"

> +fi;
> +
> +if sleep 1 | ps aux | grep -v grep | grep "sleep 1"
Please use "grep [s]leep 0", rather than using "grep -v grep" in the pipeline.

> +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;
Looks OK.

> 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
Would be nice to add some non-text data to test1 here, to validate that it is not returned by busybox strings.

You can use 'printf' to do this (echo -e is problematical for a few reasons discussed previously).  Note that you could prepare a test file in advance, with non-string data, or possibly embed it into the script.

> +if [ "$(busybox strings test1)" = "hello world" ] then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +rm test1;
Script is basically OK as is, but could be improved with testing more of what 'busybox strings' does.  (We know it finds strings, but it should also ignore non-text data).

> 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;
OK - would be nice to check /proc/swap before and after to see if the command had any effect.

> 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;

Would be nice to check /proc/swaps before and after to see if the command had any effect.

> 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;
This is OK, but doesn't test much.  A proper test of sync would be to validate that data was flushed to disk.  However, that's outside the scope of these simple command-line tests.

> --
> 1.8.3.1


Thanks - can you please address my comments and re-submit.  In cases where I've suggested enhancements, if you don't have time to make them please just do what you can.

 -- Tim






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Fuego] [PATCH] busybox : add support for command sed/sh/sleep/sort/strings/swapoff/swapon/sync
  2018-08-07  9:41     ` Wang, Mingyu
@ 2018-08-07 12:56       ` Tim.Bird
  0 siblings, 0 replies; 6+ messages in thread
From: Tim.Bird @ 2018-08-07 12:56 UTC (permalink / raw)
  To: wangmy, fuego

> -----Original Message-----
> From: Wang, Mingyu 
> Hi Tim:
> 
> Most of the comment has been confirmed.
> There are two points to be confirmed with you.
> 
> 1. swapoff/swapon
> These two commands, individually written into scripts, will have effect to the
> environment.
> Maybe should put these two commands in one script and used in pairs.
> Then verify the contents of / proc / swaps at the beginning and end of the
> script to ensure that the test suite does not affect the environment.

Yes!  I didn't mention this, but this is important.  Thank you
for catching this and thinking about it!.  If the system normally has swap turned
on, then it would be a big problem if for some reason the busybox_swapoff test
ran and the busybox_swapon test did not run, leaving the system in a different
state.  Given the current structure of the overall test, it is hard to imagine this happening.
However, to be consistent each individual script should leave the system
in the same condition it found it in, as you say.

For many desktop systems, the swap is not that relevant anymore and turning 
it off for a test is not a big deal.  However, there are some embedded systems
where the memory allocated by the system is larger than the physical RAM.
These systems rely on swap for correct operation of the software (by ensuring
that the working set is smaller than physical RAM).
For a system like this, I'm unsure what the effect would be of turning off swap.
Probably the system will crash.  For those systems, it would be nice to be able
to skip the swapoff test.  So having something like a board-specific skiplist
would be good.  I can add this if you'd like.

> 
> 2.string
> Prepare a text with non-text data, and in the test script of the command, use
> the busybox string command to view the file content to ensure that the
> command can correctly output the string and ignore non-text data. Is that
> right?
Yes - that's right.

> 
> by Wangmy
> 
> -----Original Message-----
> From: Tim.Bird@sony.com [mailto:Tim.Bird@sony.com]
> Sent: Tuesday, August 07, 2018 9:12 AM
> To: Wang, Mingyu/王 鸣瑜 <wangmy@cn.fujitsu.com>;
> fuego@lists.linuxfoundation.org
> Subject: RE: [Fuego] [PATCH] busybox : add support for command
> sed/sh/sleep/sort/strings/swapoff/swapon/sync
> 
> See comments inline below.
> 
> > -----Original Message-----
> > From: Wang Mingyu
> >
> > Signed-off-by: Wang Mingyu <wangmy@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;
> Look OK.
> 
> > 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
> 
> I don't see how failure is reported for this test.  Please explain.
> 
> > 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"
> Please use "grep [s]leep 0", rather than using "grep -v grep" in the pipeline.
> 
> > +then
> > +    echo " -> $test: sleep 0 failed."
> > +    echo " -> $test: TEST-FAIL"
> > +    exit
> > +else
> > +    echo " -> $test: sleep 0 successed."
> Please change "successed" to "succeeded"
> 
> > +fi;
> > +
> > +if sleep 1 | ps aux | grep -v grep | grep "sleep 1"
> Please use "grep [s]leep 0", rather than using "grep -v grep" in the pipeline.
> 
> > +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;
> Looks OK.
> 
> > 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
> Would be nice to add some non-text data to test1 here, to validate that it is
> not returned by busybox strings.
> 
> You can use 'printf' to do this (echo -e is problematical for a few reasons
> discussed previously).  Note that you could prepare a test file in advance,
> with non-string data, or possibly embed it into the script.
> 
> > +if [ "$(busybox strings test1)" = "hello world" ] then
> > +    echo " -> $test: TEST-PASS"
> > +else
> > +    echo " -> $test: TEST-FAIL"
> > +fi;
> > +rm test1;
> Script is basically OK as is, but could be improved with testing more of what
> 'busybox strings' does.  (We know it finds strings, but it should also ignore
> non-text data).
> 
> > 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;
> OK - would be nice to check /proc/swap before and after to see if the
> command had any effect.
> 
> > 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;
> 
> Would be nice to check /proc/swaps before and after to see if the command
> had any effect.
> 
> > 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;
> This is OK, but doesn't test much.  A proper test of sync would be to validate
> that data was flushed to disk.  However, that's outside the scope of these
> simple command-line tests.
> 
> > --
> > 1.8.3.1
> 
> 
> Thanks - can you please address my comments and re-submit.  In cases
> where I've suggested enhancements, if you don't have time to make them
> please just do what you can.
> 
>  -- Tim
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Fuego] [PATCH] busybox : add support for command readlink/reset/rm/rmdir/route
  2018-07-31  9:06 [Fuego] [PATCH] busybox : add support for command readlink/reset/rm/rmdir/route Wang Mingyu
  2018-07-31  9:06 ` [Fuego] [PATCH] busybox : add support for command sed/sh/sleep/sort/strings/swapoff/swapon/sync Wang Mingyu
@ 2018-08-18  4:57 ` Tim Bird
  1 sibling, 0 replies; 6+ messages in thread
From: Tim Bird @ 2018-08-18  4:57 UTC (permalink / raw)
  To: Wang Mingyu; +Cc: fuego

Looks OK - I basically accepted it as is.

Thanks. Applied.
 -- Tim

On Tue, Jul 31, 2018 at 2:06 AM, Wang Mingyu <wangmy@cn.fujitsu.com> wrote:
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  .../Functional.busybox/tests/busybox_readlink.sh   | 17 +++++++++
>  .../Functional.busybox/tests/busybox_reset.sh      | 13 +++++++
>  .../tests/Functional.busybox/tests/busybox_rm.sh   | 41 ++++++++++++++++++++++
>  .../Functional.busybox/tests/busybox_rmdir.sh      | 24 +++++++++++++
>  .../Functional.busybox/tests/busybox_route.sh      | 25 +++++++++++++
>  5 files changed, 120 insertions(+)
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_readlink.sh
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_reset.sh
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_rm.sh
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_rmdir.sh
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_route.sh
>
> diff --git a/engine/tests/Functional.busybox/tests/busybox_readlink.sh b/engine/tests/Functional.busybox/tests/busybox_readlink.sh
> new file mode 100644
> index 0000000..bd34bc8
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_readlink.sh
> @@ -0,0 +1,17 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command readlink
> +#  1) Option none
> +
> +test="readlink"
> +
> +mkdir test_dir1 test_dir2
> +touch test_dir1/test1
> +ln -s test_dir1/test1 test_dir2/test2
> +if [ "$(busybox readlink test_dir2/test2)" = "test_dir1/test1" ]
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +rm -rf test_dir1 test_dir2;
> diff --git a/engine/tests/Functional.busybox/tests/busybox_reset.sh b/engine/tests/Functional.busybox/tests/busybox_reset.sh
> new file mode 100644
> index 0000000..6126ed7
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_reset.sh
> @@ -0,0 +1,13 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command reset
> +#  1) Option none
> +
> +test="reset"
> +
> +if busybox reset
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> diff --git a/engine/tests/Functional.busybox/tests/busybox_rm.sh b/engine/tests/Functional.busybox/tests/busybox_rm.sh
> new file mode 100644
> index 0000000..38fd865
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_rm.sh
> @@ -0,0 +1,41 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command rm
> +#  1) Option: -r -f
> +
> +test="rm"
> +
> +mkdir -p test_dir/test_dir1
> +touch test_dir/test1
> +ls -l test_dir > log
> +if head -n 2 log | head -n 2 | grep "\-rw.*test1" && tail -n 1 log | grep "d.*test_dir1"
> +then
> +    echo " -> $test: mkdir test_dir verification succeeded."
> +else
> +    echo " -> $test: mkdir test_dir verification failed."
> +    echo " -> $test: TEST-FAIL"
> +    rm -rf test_dir
> +    rm log
> +    exit
> +fi;
> +
> +busybox rm -f test_dir/test1
> +if ls -l test_dir | grep "d.*test_dir1"
> +then
> +    echo " -> &test: rm verification#2 succeeded."
> +else
> +    echo " -> &test: rm verification#2 failed."
> +    echo " -> &test: TEST-FAIL"
> +    rm -rf test_dir
> +    rm log
> +    exit
> +fi;
> +
> +busybox rm -rf test_dir
> +if [ "$(ls -l | grep test_dir)" = "" ]
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +rm log
> diff --git a/engine/tests/Functional.busybox/tests/busybox_rmdir.sh b/engine/tests/Functional.busybox/tests/busybox_rmdir.sh
> new file mode 100644
> index 0000000..857288f
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_rmdir.sh
> @@ -0,0 +1,24 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command rmdir
> +#  1) Option none
> +
> +test="rmdir"
> +
> +mkdir test_dir
> +if ls -l | grep test_dir
> +then
> +    echo " -> $test: mkdir test_dir verification succeeded."
> +else
> +    echo " -> $test: mkdir test_dir verification failed."
> +    echo " -> $test: TEST-FAIL"
> +    exit
> +fi;
> +
> +busybox rmdir test_dir
> +if [ "$(ls -l | grep test_dir)" = "" ]
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> diff --git a/engine/tests/Functional.busybox/tests/busybox_route.sh b/engine/tests/Functional.busybox/tests/busybox_route.sh
> new file mode 100644
> index 0000000..c3b64b5
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_route.sh
> @@ -0,0 +1,25 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command route
> +
> +test="route"
> +
> +busybox route add -net 22.0.0.0 netmask 255.0.0.0 reject
> +
> +if busybox route | grep 22.0.0.0
> +then
> +    echo " -> $test: busybox route add succedded."
> +else
> +    echo " -> $test: busybox route add failed."
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +
> +busybox route del -net 22.0.0.0 netmask 255.0.0.0 reject
> +
> +if ! busybox route | grep 22.0.0.0
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: busybox route del failed."
> +    echo " -> $test: TEST-FAIL"
> +fi;
> --
> 1.8.3.1
>
>
>
> _______________________________________________
> Fuego mailing list
> Fuego@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/fuego



-- 
 -- Tim Bird
Senior Staff Software Engineer, Sony Corporation
Architecture Group Chair, Core Embedded Linux Project, Linux Foundation

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-08-18  4:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31  9:06 [Fuego] [PATCH] busybox : add support for command readlink/reset/rm/rmdir/route Wang Mingyu
2018-07-31  9:06 ` [Fuego] [PATCH] busybox : add support for command sed/sh/sleep/sort/strings/swapoff/swapon/sync Wang Mingyu
2018-08-07  1:11   ` Tim.Bird
2018-08-07  9:41     ` Wang, Mingyu
2018-08-07 12:56       ` Tim.Bird
2018-08-18  4:57 ` [Fuego] [PATCH] busybox : add support for command readlink/reset/rm/rmdir/route Tim Bird

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.