[Fuego] [PATCH] Add test cases for commands of busybox as follows: ash bunzip2 free wget

Tim.Bird at sony.com Tim.Bird at sony.com
Tue May 22 15:54:47 UTC 2018



> -----Original Message-----
> From: Daniel Sangorrin
> 
> Dear Wang,
> 
> Are you aware that busybox has its own testsuite?
> https://git.busybox.net/busybox/tree/testsuite
> 
> Maybe a better approach is to support that testsuite and
> contribute upstream tests for commands that are not currently
> supported.

When Wang submitted his first round of patches, I took a look
at the testsuite included with busybox.  There are indeed
a lot of useful tests there, that I think it would be valuable to run.
However, there are some difficulties.

The existing busybox unit tests expect to be run inside the build
directory of busybox, with a valid .config file available.  Some tests
use the busybox .config for their own form of configuration option
dependency checking.

Fuego likely will not have access to the .config for busybox
on some arbitrary target.  It might be worth looking at the tests, to
see if either 1) the .config could be made optional to the tests, or
2) you could generate a .config based on testing the binary (a little
bit dangerous, as it convolutes testing with test setup.)

So, there's some work involved in getting those tests running with Fuego.
In the meantime, I'm willing to accept these tests from Wang.

We can ultimately have more than one Fuego test for a component.
If Wang or someone else wants to work on the incorporating the busybox
unit tests into Fuego, as a separate test, that would be great.

I do agree with Daniel, that checking for coverage of the tests would be
a useful activity.
 -- Tim

> > -----Original Message-----
> > From: fuego-bounces at lists.linuxfoundation.org
> > [mailto:fuego-bounces at lists.linuxfoundation.org] On Behalf Of Wang
> Mingyu
> > Sent: Wednesday, May 23, 2018 1:00 AM
> > To: fuego at lists.linuxfoundation.org
> > Subject: [Fuego] [PATCH] Add test cases for commands of busybox as
> follows: ash
> > bunzip2 free wget
> >
> > Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
> > ---
> >  engine/tests/Functional.busybox/busybox_test.sh        |  8 ++++++++
> >  .../tests/Functional.busybox/testsuits/busybox_ash.sh  | 15
> > +++++++++++++++
> >  .../Functional.busybox/testsuits/busybox_bunzip2.sh    | 12
> ++++++++++++
> >  .../tests/Functional.busybox/testsuits/busybox_free.sh | 10 ++++++++++
> >  .../tests/Functional.busybox/testsuits/busybox_wget.sh | 18
> > ++++++++++++++++++
> >  5 files changed, 63 insertions(+)
> >  create mode 100644 engine/tests/Functional.busybox/busybox_test.sh
> >  create mode 100644
> engine/tests/Functional.busybox/testsuits/busybox_ash.sh
> >  create mode 100644
> > engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh
> >  create mode 100644
> engine/tests/Functional.busybox/testsuits/busybox_free.sh
> >  create mode 100644
> engine/tests/Functional.busybox/testsuits/busybox_wget.sh
> >
> > diff --git a/engine/tests/Functional.busybox/busybox_test.sh
> > b/engine/tests/Functional.busybox/busybox_test.sh
> > new file mode 100644
> > index 0000000..d7c74d1
> > --- /dev/null
> > +++ b/engine/tests/Functional.busybox/busybox_test.sh
> > @@ -0,0 +1,8 @@
> > +#!/bin/sh
> > +for i in testsuits/*.sh; do
> > +    if cat ./skiplist.txt | grep ${i##*/}; then
> > +        echo "Skip test specified in SKIPFILE."
> > +        continue
> > +    fi
> > +    sh $i
> > +done
> > diff --git a/engine/tests/Functional.busybox/testsuits/busybox_ash.sh
> > b/engine/tests/Functional.busybox/testsuits/busybox_ash.sh
> > new file mode 100644
> > index 0000000..96550c1
> > --- /dev/null
> > +++ b/engine/tests/Functional.busybox/testsuits/busybox_ash.sh
> > @@ -0,0 +1,15 @@
> > +#!/bin/sh
> > +workdir=$(pwd)
> > +test="ash"
> > +
> > +expect <<-EOF
> > +spawn busybox ash
> > +expect "*# "
> > +send_user " -> $test: Opened ash shell succeeded.\n"
> > +send "busybox pwd\r"
> > +expect "$workdir"
> > +send_user " -> $test: Executed pwd command ash shell succeeded.\n"
> > +send "exit\r"
> > +send_user " -> $test: TEST-PASS\n"
> > +expect eof
> > +EOF
> > diff --git a/engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh
> > b/engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh
> > new file mode 100644
> > index 0000000..599f7ea
> > --- /dev/null
> > +++ b/engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh
> > @@ -0,0 +1,12 @@
> > +#!/bin/sh
> > +test="bunzip2"
> > +
> > +echo "This is a test file">test1
> > +bzip2 test1
> > +if [ "`busybox bunzip2 -c test1.bz2`" == "This is a test file" ]
> > +then
> > +    echo " -> $test: TEST-PASS"
> > +else
> > +    echo " -> $test: TEST-FAIL"
> > +fi;
> > +rm -rf test1.bz2;
> > diff --git a/engine/tests/Functional.busybox/testsuits/busybox_free.sh
> > b/engine/tests/Functional.busybox/testsuits/busybox_free.sh
> > new file mode 100644
> > index 0000000..1e00896
> > --- /dev/null
> > +++ b/engine/tests/Functional.busybox/testsuits/busybox_free.sh
> > @@ -0,0 +1,10 @@
> > +#!/bin/sh
> > +test="free"
> > +
> > +busybox free
> > +if [ `echo $?` == 0 ]
> > +then
> > +    echo " -> $test: TEST-PASS"
> > +else
> > +    echo " -> $test: TEST-FAIL"
> > +fi;
> > diff --git a/engine/tests/Functional.busybox/testsuits/busybox_wget.sh
> > b/engine/tests/Functional.busybox/testsuits/busybox_wget.sh
> > new file mode 100644
> > index 0000000..abf81bc
> > --- /dev/null
> > +++ b/engine/tests/Functional.busybox/testsuits/busybox_wget.sh
> > @@ -0,0 +1,18 @@
> > +#!/bin/sh
> > +test="wget"
> > +
> > +if [ -f ./readme.txt ]; then rm -f ./readme.txt ; fi
> > +busybox wget
> > http://$test_tcpip_host:$test_port_host/fuego/userContent/readme.txt -
> P ./
> > +if ls  ./ | grep ".*readme.*"
> > +then
> > +    echo " -> $test: ls  ./ executed."
> > +else
> > +    echo " -> $test: ls  ./ failed."
> > +fi;
> > +if cat ./readme.txt | grep ".*jenkins.*"
> > +then
> > +    echo " -> $test: TEST-PASS"
> > +else
> > +    echo " -> $test: TEST-FAIL"
> > +fi;
> > +rm ./readme.txt
> > --
> > 1.8.3.1
> >
> >
> >
> > _______________________________________________
> > Fuego mailing list
> > Fuego at lists.linuxfoundation.org
> > https://lists.linuxfoundation.org/mailman/listinfo/fuego
> 
> 
> 
> _______________________________________________
> Fuego mailing list
> Fuego at lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/fuego


More information about the Fuego mailing list