All of lore.kernel.org
 help / color / mirror / Atom feed
* [Fuego] [PATCH] busybox: add support for command tail/tar/tee/test/time/touch/tr/true/tty
@ 2018-08-03  1:26 Wang Mingyu
  2018-08-03  1:26 ` [Fuego] [PATCH] busybox: skip the command that is not compiled in busybox Wang Mingyu
  2018-08-30 19:19 ` [Fuego] [PATCH] busybox: add support for command tail/tar/tee/test/time/touch/tr/true/tty Tim Bird
  0 siblings, 2 replies; 4+ messages in thread
From: Wang Mingyu @ 2018-08-03  1:26 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 .../tests/Functional.busybox/tests/busybox_tail.sh | 21 +++++++++++++
 .../tests/Functional.busybox/tests/busybox_tar.sh  | 36 ++++++++++++++++++++++
 .../tests/Functional.busybox/tests/busybox_tee.sh  | 26 ++++++++++++++++
 .../tests/Functional.busybox/tests/busybox_test.sh | 22 +++++++++++++
 .../tests/Functional.busybox/tests/busybox_time.sh | 16 ++++++++++
 .../Functional.busybox/tests/busybox_touch.sh      | 17 ++++++++++
 .../tests/Functional.busybox/tests/busybox_tr.sh   | 13 ++++++++
 .../tests/Functional.busybox/tests/busybox_true.sh | 13 ++++++++
 .../tests/Functional.busybox/tests/busybox_tty.sh  | 13 ++++++++
 9 files changed, 177 insertions(+)
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_tail.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_tar.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_tee.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_test.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_time.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_touch.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_tr.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_true.sh
 create mode 100644 engine/tests/Functional.busybox/tests/busybox_tty.sh

diff --git a/engine/tests/Functional.busybox/tests/busybox_tail.sh b/engine/tests/Functional.busybox/tests/busybox_tail.sh
new file mode 100644
index 0000000..2d40d6f
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_tail.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command tail
+#  1) Option: -n
+
+test="tail"
+
+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 tail -n 2 test_dir/test1 > log
+if [ "$(head -n 1 log)" = "This is the 2nd line." ] && [ "$(tail -n 1 log)" = "This is the 3rd line." ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -rf test_dir;
+rm log;
diff --git a/engine/tests/Functional.busybox/tests/busybox_tar.sh b/engine/tests/Functional.busybox/tests/busybox_tar.sh
new file mode 100644
index 0000000..e747241
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_tar.sh
@@ -0,0 +1,36 @@
+#!/bin/bh
+
+#  The testscript checks the following options of the command tar
+#  1) Option: -cvf -xvf
+
+tar_tst_dir=test/test_dir
+test="tar"
+
+if [ -f $tar_tst_dir ]
+then
+    rm -rf $tar_tst_dir
+fi;
+
+mkdir -p $tar_tst_dir
+mkdir -p $tar_tst_dir/test_dir1
+echo This is a test file to test tar.> $tar_tst_dir/test_dir1/test_tar
+busybox tar -cvf $tar_tst_dir/test.tar $tar_tst_dir/test_dir1
+if [ "$(ls -l $tar_tst_dir | grep ".*test.tar.*")" ]
+then
+    echo " -> $test: tar -cvf executed."
+else
+    echo " -> $test: tar -cvf failed."
+    echo " -> $test: TEST-FAIL"
+    rm -rf $tar_tst_dir
+    exit
+fi;
+
+rm -rf $tar_tst_dir/test_dir1
+busybox tar -xvf $tar_tst_dir/test.tar -C .
+if [ "$(ls -l $tar_tst_dir/test_dir1/test_tar | grep ".*\/test_dir1\/test_tar.*")" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -rf $tar_tst_dir;
diff --git a/engine/tests/Functional.busybox/tests/busybox_tee.sh b/engine/tests/Functional.busybox/tests/busybox_tee.sh
new file mode 100644
index 0000000..0e55c7c
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_tee.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command tee
+#  1) Option: none
+
+test="tee"
+
+rm -rf ./test_dir
+mkdir ./test_dir
+if [ "$(echo "Hello World" | busybox tee ./test_dir/test1)" = "Hello World" ]
+then
+    echo " -> $test: echo "Hello World" | busybox tee ./test_dir/test1 executed."
+else
+    echo " -> $test: echo "Hello World" | busybox tee ./test_dir/test1 failed."
+    echo " -> $test: TEST-FAIL"
+    rm -fr ./test_dir
+    exit
+fi;
+
+if [ "$(cat ./test_dir/test1)" = "Hello World" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -fr ./test_dir
diff --git a/engine/tests/Functional.busybox/tests/busybox_test.sh b/engine/tests/Functional.busybox/tests/busybox_test.sh
new file mode 100644
index 0000000..9d3e873
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_test.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command test
+#  1) Option: none
+
+test="test"
+
+if ! busybox test 1 -eq 2 
+then
+    echo " -> $test: busybox test 1 -eq 2 verification succeeded."
+else
+    echo " -> $test: busybox test 1 -eq 2 verification failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi;
+
+if busybox test 1 -eq 1
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_time.sh b/engine/tests/Functional.busybox/tests/busybox_time.sh
new file mode 100644
index 0000000..a398cb9
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_time.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command tar
+#  1) Option: none
+
+test="time"
+
+busybox time pwd > log 2>&1
+if [ "$(head -n 1 log | grep ".*")" ] && [ "$(head -n 2 log | tail -n 1 | grep "real.*m.*s")" ] \
+&& [ "$(tail -n 2 log | head -n 1 | grep "user.*m.*s")" ] && [ "$(tail -n 1 log | grep "sys.*m.*s")" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm log;
diff --git a/engine/tests/Functional.busybox/tests/busybox_touch.sh b/engine/tests/Functional.busybox/tests/busybox_touch.sh
new file mode 100644
index 0000000..9259201
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_touch.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command touch
+#  1) Option: none
+
+test="touch"
+
+rm -fr test_dir
+mkdir test_dir
+busybox touch ./test_dir/test1
+if [ "$(ls ./test_dir)" = "test1" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -fr test_dir
diff --git a/engine/tests/Functional.busybox/tests/busybox_tr.sh b/engine/tests/Functional.busybox/tests/busybox_tr.sh
new file mode 100644
index 0000000..ccef6de
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_tr.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command tr
+#  1) Option: none
+
+test="tr"
+
+if [ "$(echo "gdkkn vnqkc" | busybox tr [a-y] [b-z])" = "hello world" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_true.sh b/engine/tests/Functional.busybox/tests/busybox_true.sh
new file mode 100644
index 0000000..ccafd65
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_true.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command true
+#  1) Option: none
+
+test="true"
+
+if busybox true
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_tty.sh b/engine/tests/Functional.busybox/tests/busybox_tty.sh
new file mode 100644
index 0000000..8b15535
--- /dev/null
+++ b/engine/tests/Functional.busybox/tests/busybox_tty.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command tty
+#  1) Option: none
+
+test="tty"
+
+if busybox tty
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
-- 
1.8.3.1




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

* [Fuego] [PATCH] busybox: skip the command that is not compiled in busybox
  2018-08-03  1:26 [Fuego] [PATCH] busybox: add support for command tail/tar/tee/test/time/touch/tr/true/tty Wang Mingyu
@ 2018-08-03  1:26 ` Wang Mingyu
  2018-08-30 16:22   ` Tim Bird
  2018-08-30 19:19 ` [Fuego] [PATCH] busybox: add support for command tail/tar/tee/test/time/touch/tr/true/tty Tim Bird
  1 sibling, 1 reply; 4+ messages in thread
From: Wang Mingyu @ 2018-08-03  1:26 UTC (permalink / raw)
  To: fuego

User can specify the command in the board file by using variable BUSYBOX_SKIPLIST.

Example
    BUSYBOX_SKIPLIST="chvt install"

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 engine/tests/Functional.busybox/fuego_test.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/engine/tests/Functional.busybox/fuego_test.sh b/engine/tests/Functional.busybox/fuego_test.sh
index 4ee593c..8bf04e5 100755
--- a/engine/tests/Functional.busybox/fuego_test.sh
+++ b/engine/tests/Functional.busybox/fuego_test.sh
@@ -34,6 +34,18 @@ function skip_if_not_root {
     fi
 }
 
+function skip_if_subcommand_unsupported {
+    set -f
+    local TESTS=($1)
+    set +f
+    
+    local prefix="busybox_"
+    local suffix=".sh"
+    for testname in "${TESTS[@]}"; do
+        skip_tests "${prefix}${testname}${suffix}"
+    done
+}
+
 function test_pre_check {
     is_on_target_path busybox PROGRAM_BUSYBOX
     assert_define PROGRAM_BUSYBOX "Missing 'busybox' program on target board"
@@ -42,6 +54,7 @@ function test_pre_check {
     skip_if_command_unavailable expect "busybox_ash.sh busybox_passwd.sh"
     skip_if_command_unavailable tr "busybox_chgrp1.sh busybox_chgrp2.sh busybox_chmod1.sh busybox_chmod2.sh busybox_chown1.sh busybox_chown2.sh"
     skip_if_not_root "busybox_chgrp1.sh busybox_chgrp2.sh busybox_chown1.sh busybox_chown2.sh busybox_chroot.sh busybox_passwd.sh"
+    skip_if_subcommand_unsupported "$BUSYBOX_SKIPLIST"
 }
 
 function test_deploy {
-- 
1.8.3.1




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

* Re: [Fuego] [PATCH] busybox: skip the command that is not compiled in busybox
  2018-08-03  1:26 ` [Fuego] [PATCH] busybox: skip the command that is not compiled in busybox Wang Mingyu
@ 2018-08-30 16:22   ` Tim Bird
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Bird @ 2018-08-30 16:22 UTC (permalink / raw)
  To: Wang Mingyu; +Cc: fuego

This patch was applied.  Thanks.

I changed the name of the function to skip_if_in_skiplist.  I hope
this is alright.
It works great on my Beaglebone black to skip tests that always fail.
 -- Tim

On Thu, Aug 2, 2018 at 6:27 PM Wang Mingyu <wangmy@cn.fujitsu.com> wrote:
>
> User can specify the command in the board file by using variable BUSYBOX_SKIPLIST.
>
> Example
>     BUSYBOX_SKIPLIST="chvt install"
>
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  engine/tests/Functional.busybox/fuego_test.sh | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/engine/tests/Functional.busybox/fuego_test.sh b/engine/tests/Functional.busybox/fuego_test.sh
> index 4ee593c..8bf04e5 100755
> --- a/engine/tests/Functional.busybox/fuego_test.sh
> +++ b/engine/tests/Functional.busybox/fuego_test.sh
> @@ -34,6 +34,18 @@ function skip_if_not_root {
>      fi
>  }
>
> +function skip_if_subcommand_unsupported {
> +    set -f
> +    local TESTS=($1)
> +    set +f
> +
> +    local prefix="busybox_"
> +    local suffix=".sh"
> +    for testname in "${TESTS[@]}"; do
> +        skip_tests "${prefix}${testname}${suffix}"
> +    done
> +}
> +
>  function test_pre_check {
>      is_on_target_path busybox PROGRAM_BUSYBOX
>      assert_define PROGRAM_BUSYBOX "Missing 'busybox' program on target board"
> @@ -42,6 +54,7 @@ function test_pre_check {
>      skip_if_command_unavailable expect "busybox_ash.sh busybox_passwd.sh"
>      skip_if_command_unavailable tr "busybox_chgrp1.sh busybox_chgrp2.sh busybox_chmod1.sh busybox_chmod2.sh busybox_chown1.sh busybox_chown2.sh"
>      skip_if_not_root "busybox_chgrp1.sh busybox_chgrp2.sh busybox_chown1.sh busybox_chown2.sh busybox_chroot.sh busybox_passwd.sh"
> +    skip_if_subcommand_unsupported "$BUSYBOX_SKIPLIST"
>  }
>
>  function test_deploy {
> --
> 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] 4+ messages in thread

* Re: [Fuego] [PATCH] busybox: add support for command tail/tar/tee/test/time/touch/tr/true/tty
  2018-08-03  1:26 [Fuego] [PATCH] busybox: add support for command tail/tar/tee/test/time/touch/tr/true/tty Wang Mingyu
  2018-08-03  1:26 ` [Fuego] [PATCH] busybox: skip the command that is not compiled in busybox Wang Mingyu
@ 2018-08-30 19:19 ` Tim Bird
  1 sibling, 0 replies; 4+ messages in thread
From: Tim Bird @ 2018-08-30 19:19 UTC (permalink / raw)
  To: Wang Mingyu; +Cc: fuego

On Thu, Aug 2, 2018 at 6:27 PM Wang Mingyu <wangmy@cn.fujitsu.com> wrote:
>
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  .../tests/Functional.busybox/tests/busybox_tail.sh | 21 +++++++++++++
>  .../tests/Functional.busybox/tests/busybox_tar.sh  | 36 ++++++++++++++++++++++
>  .../tests/Functional.busybox/tests/busybox_tee.sh  | 26 ++++++++++++++++
>  .../tests/Functional.busybox/tests/busybox_test.sh | 22 +++++++++++++
>  .../tests/Functional.busybox/tests/busybox_time.sh | 16 ++++++++++
>  .../Functional.busybox/tests/busybox_touch.sh      | 17 ++++++++++
>  .../tests/Functional.busybox/tests/busybox_tr.sh   | 13 ++++++++
>  .../tests/Functional.busybox/tests/busybox_true.sh | 13 ++++++++
>  .../tests/Functional.busybox/tests/busybox_tty.sh  | 13 ++++++++
>  9 files changed, 177 insertions(+)
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_tail.sh
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_tar.sh
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_tee.sh
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_test.sh
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_time.sh
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_touch.sh
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_tr.sh
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_true.sh
>  create mode 100644 engine/tests/Functional.busybox/tests/busybox_tty.sh
>
> diff --git a/engine/tests/Functional.busybox/tests/busybox_tail.sh b/engine/tests/Functional.busybox/tests/busybox_tail.sh
> new file mode 100644
> index 0000000..2d40d6f
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_tail.sh
> @@ -0,0 +1,21 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command tail
> +#  1) Option: -n
> +
> +test="tail"
> +
> +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 tail -n 2 test_dir/test1 > log
> +if [ "$(head -n 1 log)" = "This is the 2nd line." ] && [ "$(tail -n 1 log)" = "This is the 3rd line." ]
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +rm -rf test_dir;
> +rm log;
> diff --git a/engine/tests/Functional.busybox/tests/busybox_tar.sh b/engine/tests/Functional.busybox/tests/busybox_tar.sh
> new file mode 100644
> index 0000000..e747241
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_tar.sh
> @@ -0,0 +1,36 @@
> +#!/bin/bh
> +
> +#  The testscript checks the following options of the command tar
> +#  1) Option: -cvf -xvf
> +
> +tar_tst_dir=test/test_dir
> +test="tar"
> +
> +if [ -f $tar_tst_dir ]
> +then
> +    rm -rf $tar_tst_dir
> +fi;
> +
> +mkdir -p $tar_tst_dir
> +mkdir -p $tar_tst_dir/test_dir1
> +echo This is a test file to test tar.> $tar_tst_dir/test_dir1/test_tar
> +busybox tar -cvf $tar_tst_dir/test.tar $tar_tst_dir/test_dir1
> +if [ "$(ls -l $tar_tst_dir | grep ".*test.tar.*")" ]
> +then
> +    echo " -> $test: tar -cvf executed."
> +else
> +    echo " -> $test: tar -cvf failed."
> +    echo " -> $test: TEST-FAIL"
> +    rm -rf $tar_tst_dir
> +    exit
> +fi;
> +
> +rm -rf $tar_tst_dir/test_dir1
> +busybox tar -xvf $tar_tst_dir/test.tar -C .
> +if [ "$(ls -l $tar_tst_dir/test_dir1/test_tar | grep ".*\/test_dir1\/test_tar.*")" ]
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +rm -rf $tar_tst_dir;
> diff --git a/engine/tests/Functional.busybox/tests/busybox_tee.sh b/engine/tests/Functional.busybox/tests/busybox_tee.sh
> new file mode 100644
> index 0000000..0e55c7c
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_tee.sh
> @@ -0,0 +1,26 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command tee
> +#  1) Option: none
> +
> +test="tee"
> +
> +rm -rf ./test_dir
> +mkdir ./test_dir
> +if [ "$(echo "Hello World" | busybox tee ./test_dir/test1)" = "Hello World" ]
> +then
> +    echo " -> $test: echo "Hello World" | busybox tee ./test_dir/test1 executed."
> +else
> +    echo " -> $test: echo "Hello World" | busybox tee ./test_dir/test1 failed."
> +    echo " -> $test: TEST-FAIL"
> +    rm -fr ./test_dir
> +    exit
> +fi;
> +
> +if [ "$(cat ./test_dir/test1)" = "Hello World" ]
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +rm -fr ./test_dir
> diff --git a/engine/tests/Functional.busybox/tests/busybox_test.sh b/engine/tests/Functional.busybox/tests/busybox_test.sh
> new file mode 100644
> index 0000000..9d3e873
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_test.sh
> @@ -0,0 +1,22 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command test
> +#  1) Option: none
> +
> +test="test"
> +
> +if ! busybox test 1 -eq 2
This line had a trailing space in it.
Please check your lines for whitespace at the end (do something like
'grep " $" *' and
fix any issues, before committing.

> +then
> +    echo " -> $test: busybox test 1 -eq 2 verification succeeded."
> +else
> +    echo " -> $test: busybox test 1 -eq 2 verification failed."
> +    echo " -> $test: TEST-FAIL"
> +    exit
> +fi;
> +
> +if busybox test 1 -eq 1
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> diff --git a/engine/tests/Functional.busybox/tests/busybox_time.sh b/engine/tests/Functional.busybox/tests/busybox_time.sh
> new file mode 100644
> index 0000000..a398cb9
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_time.sh
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command tar
> +#  1) Option: none
> +
> +test="time"
> +
> +busybox time pwd > log 2>&1
> +if [ "$(head -n 1 log | grep ".*")" ] && [ "$(head -n 2 log | tail -n 1 | grep "real.*m.*s")" ] \
> +&& [ "$(tail -n 2 log | head -n 1 | grep "user.*m.*s")" ] && [ "$(tail -n 1 log | grep "sys.*m.*s")" ]
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +rm log;
> diff --git a/engine/tests/Functional.busybox/tests/busybox_touch.sh b/engine/tests/Functional.busybox/tests/busybox_touch.sh
> new file mode 100644
> index 0000000..9259201
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_touch.sh
> @@ -0,0 +1,17 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command touch
> +#  1) Option: none
> +
> +test="touch"
> +
> +rm -fr test_dir
> +mkdir test_dir
> +busybox touch ./test_dir/test1
> +if [ "$(ls ./test_dir)" = "test1" ]
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +rm -fr test_dir
> diff --git a/engine/tests/Functional.busybox/tests/busybox_tr.sh b/engine/tests/Functional.busybox/tests/busybox_tr.sh
> new file mode 100644
> index 0000000..ccef6de
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_tr.sh
> @@ -0,0 +1,13 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command tr
> +#  1) Option: none
> +
> +test="tr"
> +
> +if [ "$(echo "gdkkn vnqkc" | busybox tr [a-y] [b-z])" = "hello world" ]
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> diff --git a/engine/tests/Functional.busybox/tests/busybox_true.sh b/engine/tests/Functional.busybox/tests/busybox_true.sh
> new file mode 100644
> index 0000000..ccafd65
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_true.sh
> @@ -0,0 +1,13 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command true
> +#  1) Option: none
> +
> +test="true"
> +
> +if busybox true
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> diff --git a/engine/tests/Functional.busybox/tests/busybox_tty.sh b/engine/tests/Functional.busybox/tests/busybox_tty.sh
> new file mode 100644
> index 0000000..8b15535
> --- /dev/null
> +++ b/engine/tests/Functional.busybox/tests/busybox_tty.sh
> @@ -0,0 +1,13 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command tty
> +#  1) Option: none
> +
> +test="tty"
> +
> +if busybox tty
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;

This last one doesn't test any actual functionality.  But it's a placeholder
where additional testing can be added in the future, and validates the command
is present, I guess.

> --
> 1.8.3.1

Patch applied.

Thanks,
 -- Tim

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

end of thread, other threads:[~2018-08-30 19:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-03  1:26 [Fuego] [PATCH] busybox: add support for command tail/tar/tee/test/time/touch/tr/true/tty Wang Mingyu
2018-08-03  1:26 ` [Fuego] [PATCH] busybox: skip the command that is not compiled in busybox Wang Mingyu
2018-08-30 16:22   ` Tim Bird
2018-08-30 19:19 ` [Fuego] [PATCH] busybox: add support for command tail/tar/tee/test/time/touch/tr/true/tty 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.