All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ifupdown: add ptest
@ 2020-02-03  9:14 kai.kang
  2020-02-03 12:50 ` Alexander Kanavin
  0 siblings, 1 reply; 6+ messages in thread
From: kai.kang @ 2020-02-03  9:14 UTC (permalink / raw)
  To: openembedded-core

From: Kai Kang <kai.kang@windriver.com>

Add ptest for ifupdown with its own test cases.

[Yocto #13736]

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 meta/recipes-core/ifupdown/files/run-ptest    |  4 ++
 .../ifupdown/files/tweak-ptest-script.patch   | 49 +++++++++++++++++++
 meta/recipes-core/ifupdown/ifupdown_0.8.35.bb | 10 +++-
 3 files changed, 62 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-core/ifupdown/files/run-ptest
 create mode 100644 meta/recipes-core/ifupdown/files/tweak-ptest-script.patch

diff --git a/meta/recipes-core/ifupdown/files/run-ptest b/meta/recipes-core/ifupdown/files/run-ptest
new file mode 100644
index 0000000000..8694042392
--- /dev/null
+++ b/meta/recipes-core/ifupdown/files/run-ptest
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+CURDIR=$(dirname `readlink -f $0`)
+cd $CURDIR/tests && ./testbuild-linux
diff --git a/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch b/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
new file mode 100644
index 0000000000..d7600cf243
--- /dev/null
+++ b/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
@@ -0,0 +1,49 @@
+Tweak tests of ifupdown to make it work with oe-core ptest framework.
+
+Upstream-Status: Inappropriate [oe-core specific]
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+
+diff --git a/tests/testbuild-linux b/tests/testbuild-linux
+index 1181ea0..d5c1814 100755
+--- a/tests/testbuild-linux
++++ b/tests/testbuild-linux
+@@ -1,6 +1,7 @@
+ #!/bin/sh -e
+ 
+-dir=tests/linux
++curdir=$(dirname `readlink -f $0`)
++dir=$curdir/linux
+ 
+ result=true
+ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
+@@ -12,7 +13,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
+         echo "Testcase $test: $args"
+ 
+ 	exitcode=0
+-        ./ifup -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
++        ifup -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
+                 >$dir/up-res-out.$test 2>$dir/up-res-err.$test || exitcode=$?
+ 
+         (echo "exit code: $exitcode";
+@@ -20,7 +21,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
+          echo "====stderr===="; cat $dir/up-res-err.$test) > $dir/up-res.$test
+ 
+ 	exitcode=0
+-        ./ifdown -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
++        ifdown -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
+                >$dir/down-res-out.$test 2>$dir/down-res-err.$test || exitcode=$?
+ 
+         (echo "exit code: $exitcode";
+@@ -28,9 +29,9 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
+          echo "====stderr===="; cat $dir/down-res-err.$test) > $dir/down-res.$test
+ 
+         if diff -ub $dir/up.$test $dir/up-res.$test && diff -ub $dir/down.$test $dir/down-res.$test; then
+-                echo "(okay)"
++                echo "PASS: $test"
+         else
+-                echo "(failed)"
++                echo "FAIL: $test"
+                 result=false
+         fi
+         echo "=========="
diff --git a/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb b/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
index 0de97fe372..53cb971d33 100644
--- a/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
+++ b/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
@@ -11,13 +11,15 @@ SRC_URI = "git://salsa.debian.org/debian/ifupdown.git;protocol=https \
            file://99_network \
            file://0001-Define-FNM_EXTMATCH-for-musl.patch \
            file://0001-Makefile-do-not-use-dpkg-for-determining-OS-type.patch \
+           file://run-ptest \
+           ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://tweak-ptest-script.patch', '', d)} \
            "
 SRCREV = "4af76318cfc57f8e4a44d357104188666213bd4b"
 
 S = "${WORKDIR}/git"
 
 
-inherit update-alternatives
+inherit ptest update-alternatives
 
 do_compile () {
 	chmod a+rx *.pl *.sh
@@ -40,6 +42,12 @@ do_install () {
 	cd ${D}${mandir}/man8 && ln -s ifup.8 ifdown.8
 }
 
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/tests
+    cp -r ${S}/tests/testbuild-linux ${D}${PTEST_PATH}/tests/
+    cp -r ${S}/tests/linux ${D}${PTEST_PATH}/tests/
+}
+
 ALTERNATIVE_PRIORITY = "100"
 ALTERNATIVE_${PN} = "ifup ifdown"
 
-- 
2.17.1



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

* Re: [PATCH] ifupdown: add ptest
  2020-02-03  9:14 [PATCH] ifupdown: add ptest kai.kang
@ 2020-02-03 12:50 ` Alexander Kanavin
  2020-02-04  9:24   ` Kang Kai
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Kanavin @ 2020-02-03 12:50 UTC (permalink / raw)
  To: kai.kang; +Cc: openembedded-core

I think a build configuration for this also needs to be enabled and tested as explained in the email thread from the bug (in magefeatures.py from selftest I think). Otherwise this wouldn’t be built or checked anywhere.

Alex

> On 3 Feb 2020, at 10.14, <kai.kang@windriver.com> <kai.kang@windriver.com> wrote:
> 
> From: Kai Kang <kai.kang@windriver.com>
> 
> Add ptest for ifupdown with its own test cases.
> 
> [Yocto #13736]
> 
> Signed-off-by: Kai Kang <kai.kang@windriver.com>
> ---
> meta/recipes-core/ifupdown/files/run-ptest    |  4 ++
> .../ifupdown/files/tweak-ptest-script.patch   | 49 +++++++++++++++++++
> meta/recipes-core/ifupdown/ifupdown_0.8.35.bb | 10 +++-
> 3 files changed, 62 insertions(+), 1 deletion(-)
> create mode 100644 meta/recipes-core/ifupdown/files/run-ptest
> create mode 100644 meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
> 
> diff --git a/meta/recipes-core/ifupdown/files/run-ptest b/meta/recipes-core/ifupdown/files/run-ptest
> new file mode 100644
> index 0000000000..8694042392
> --- /dev/null
> +++ b/meta/recipes-core/ifupdown/files/run-ptest
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +
> +CURDIR=$(dirname `readlink -f $0`)
> +cd $CURDIR/tests && ./testbuild-linux
> diff --git a/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch b/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
> new file mode 100644
> index 0000000000..d7600cf243
> --- /dev/null
> +++ b/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
> @@ -0,0 +1,49 @@
> +Tweak tests of ifupdown to make it work with oe-core ptest framework.
> +
> +Upstream-Status: Inappropriate [oe-core specific]
> +
> +Signed-off-by: Kai Kang <kai.kang@windriver.com>
> +
> +diff --git a/tests/testbuild-linux b/tests/testbuild-linux
> +index 1181ea0..d5c1814 100755
> +--- a/tests/testbuild-linux
> ++++ b/tests/testbuild-linux
> +@@ -1,6 +1,7 @@
> + #!/bin/sh -e
> + 
> +-dir=tests/linux
> ++curdir=$(dirname `readlink -f $0`)
> ++dir=$curdir/linux
> + 
> + result=true
> + for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
> +@@ -12,7 +13,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
> +         echo "Testcase $test: $args"
> + 
> +    exitcode=0
> +-        ./ifup -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
> ++        ifup -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
> +                 >$dir/up-res-out.$test 2>$dir/up-res-err.$test || exitcode=$?
> + 
> +         (echo "exit code: $exitcode";
> +@@ -20,7 +21,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
> +          echo "====stderr===="; cat $dir/up-res-err.$test) > $dir/up-res.$test
> + 
> +    exitcode=0
> +-        ./ifdown -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
> ++        ifdown -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
> +                >$dir/down-res-out.$test 2>$dir/down-res-err.$test || exitcode=$?
> + 
> +         (echo "exit code: $exitcode";
> +@@ -28,9 +29,9 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
> +          echo "====stderr===="; cat $dir/down-res-err.$test) > $dir/down-res.$test
> + 
> +         if diff -ub $dir/up.$test $dir/up-res.$test && diff -ub $dir/down.$test $dir/down-res.$test; then
> +-                echo "(okay)"
> ++                echo "PASS: $test"
> +         else
> +-                echo "(failed)"
> ++                echo "FAIL: $test"
> +                 result=false
> +         fi
> +         echo "=========="
> diff --git a/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb b/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
> index 0de97fe372..53cb971d33 100644
> --- a/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
> +++ b/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
> @@ -11,13 +11,15 @@ SRC_URI = "git://salsa.debian.org/debian/ifupdown.git;protocol=https \
>            file://99_network \
>            file://0001-Define-FNM_EXTMATCH-for-musl.patch \
>            file://0001-Makefile-do-not-use-dpkg-for-determining-OS-type.patch \
> +           file://run-ptest \
> +           ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://tweak-ptest-script.patch', '', d)} \
>            "
> SRCREV = "4af76318cfc57f8e4a44d357104188666213bd4b"
> 
> S = "${WORKDIR}/git"
> 
> 
> -inherit update-alternatives
> +inherit ptest update-alternatives
> 
> do_compile () {
>    chmod a+rx *.pl *.sh
> @@ -40,6 +42,12 @@ do_install () {
>    cd ${D}${mandir}/man8 && ln -s ifup.8 ifdown.8
> }
> 
> +do_install_ptest () {
> +    install -d ${D}${PTEST_PATH}/tests
> +    cp -r ${S}/tests/testbuild-linux ${D}${PTEST_PATH}/tests/
> +    cp -r ${S}/tests/linux ${D}${PTEST_PATH}/tests/
> +}
> +
> ALTERNATIVE_PRIORITY = "100"
> ALTERNATIVE_${PN} = "ifup ifdown"
> 
> -- 
> 2.17.1
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [PATCH] ifupdown: add ptest
  2020-02-03 12:50 ` Alexander Kanavin
@ 2020-02-04  9:24   ` Kang Kai
  2020-02-04 20:50     ` Alexander Kanavin
  0 siblings, 1 reply; 6+ messages in thread
From: Kang Kai @ 2020-02-04  9:24 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: openembedded-core

On 2020/2/3 下午8:50, Alexander Kanavin wrote:
> I think a build configuration for this also needs to be enabled and tested as explained in the email thread from the bug (in magefeatures.py from selftest I think). Otherwise this wouldn’t be built or checked anywhere.

Hi Alex,

In imagefeatures.py, it just run 'bitbake -g core-image-sato' and 
doesn't really build and test RDEPENDS packages of 
packagegroup-core-base-utils.

So for the packages in the RDEPENDS packages of 
packagegroup-core-base-utils but not in any image, they all are not be 
tested.

I didn't find a proper recipe to place these recipes. Maybe a new image 
recipe need to be created.

Regards,
Kai



>
> Alex
>
>> On 3 Feb 2020, at 10.14, <kai.kang@windriver.com> <kai.kang@windriver.com> wrote:
>>
>> From: Kai Kang <kai.kang@windriver.com>
>>
>> Add ptest for ifupdown with its own test cases.
>>
>> [Yocto #13736]
>>
>> Signed-off-by: Kai Kang <kai.kang@windriver.com>
>> ---
>> meta/recipes-core/ifupdown/files/run-ptest    |  4 ++
>> .../ifupdown/files/tweak-ptest-script.patch   | 49 +++++++++++++++++++
>> meta/recipes-core/ifupdown/ifupdown_0.8.35.bb | 10 +++-
>> 3 files changed, 62 insertions(+), 1 deletion(-)
>> create mode 100644 meta/recipes-core/ifupdown/files/run-ptest
>> create mode 100644 meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
>>
>> diff --git a/meta/recipes-core/ifupdown/files/run-ptest b/meta/recipes-core/ifupdown/files/run-ptest
>> new file mode 100644
>> index 0000000000..8694042392
>> --- /dev/null
>> +++ b/meta/recipes-core/ifupdown/files/run-ptest
>> @@ -0,0 +1,4 @@
>> +#!/bin/sh
>> +
>> +CURDIR=$(dirname `readlink -f $0`)
>> +cd $CURDIR/tests && ./testbuild-linux
>> diff --git a/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch b/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
>> new file mode 100644
>> index 0000000000..d7600cf243
>> --- /dev/null
>> +++ b/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
>> @@ -0,0 +1,49 @@
>> +Tweak tests of ifupdown to make it work with oe-core ptest framework.
>> +
>> +Upstream-Status: Inappropriate [oe-core specific]
>> +
>> +Signed-off-by: Kai Kang <kai.kang@windriver.com>
>> +
>> +diff --git a/tests/testbuild-linux b/tests/testbuild-linux
>> +index 1181ea0..d5c1814 100755
>> +--- a/tests/testbuild-linux
>> ++++ b/tests/testbuild-linux
>> +@@ -1,6 +1,7 @@
>> + #!/bin/sh -e
>> +
>> +-dir=tests/linux
>> ++curdir=$(dirname `readlink -f $0`)
>> ++dir=$curdir/linux
>> +
>> + result=true
>> + for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
>> +@@ -12,7 +13,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
>> +         echo "Testcase $test: $args"
>> +
>> +    exitcode=0
>> +-        ./ifup -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
>> ++        ifup -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
>> +                 >$dir/up-res-out.$test 2>$dir/up-res-err.$test || exitcode=$?
>> +
>> +         (echo "exit code: $exitcode";
>> +@@ -20,7 +21,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
>> +          echo "====stderr===="; cat $dir/up-res-err.$test) > $dir/up-res.$test
>> +
>> +    exitcode=0
>> +-        ./ifdown -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
>> ++        ifdown -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
>> +                >$dir/down-res-out.$test 2>$dir/down-res-err.$test || exitcode=$?
>> +
>> +         (echo "exit code: $exitcode";
>> +@@ -28,9 +29,9 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
>> +          echo "====stderr===="; cat $dir/down-res-err.$test) > $dir/down-res.$test
>> +
>> +         if diff -ub $dir/up.$test $dir/up-res.$test && diff -ub $dir/down.$test $dir/down-res.$test; then
>> +-                echo "(okay)"
>> ++                echo "PASS: $test"
>> +         else
>> +-                echo "(failed)"
>> ++                echo "FAIL: $test"
>> +                 result=false
>> +         fi
>> +         echo "=========="
>> diff --git a/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb b/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
>> index 0de97fe372..53cb971d33 100644
>> --- a/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
>> +++ b/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
>> @@ -11,13 +11,15 @@ SRC_URI = "git://salsa.debian.org/debian/ifupdown.git;protocol=https \
>>             file://99_network \
>>             file://0001-Define-FNM_EXTMATCH-for-musl.patch \
>>             file://0001-Makefile-do-not-use-dpkg-for-determining-OS-type.patch \
>> +           file://run-ptest \
>> +           ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://tweak-ptest-script.patch', '', d)} \
>>             "
>> SRCREV = "4af76318cfc57f8e4a44d357104188666213bd4b"
>>
>> S = "${WORKDIR}/git"
>>
>>
>> -inherit update-alternatives
>> +inherit ptest update-alternatives
>>
>> do_compile () {
>>     chmod a+rx *.pl *.sh
>> @@ -40,6 +42,12 @@ do_install () {
>>     cd ${D}${mandir}/man8 && ln -s ifup.8 ifdown.8
>> }
>>
>> +do_install_ptest () {
>> +    install -d ${D}${PTEST_PATH}/tests
>> +    cp -r ${S}/tests/testbuild-linux ${D}${PTEST_PATH}/tests/
>> +    cp -r ${S}/tests/linux ${D}${PTEST_PATH}/tests/
>> +}
>> +
>> ALTERNATIVE_PRIORITY = "100"
>> ALTERNATIVE_${PN} = "ifup ifdown"
>>
>> -- 
>> 2.17.1
>>
>> -- 
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core


-- 
Kai Kang



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

* Re: [PATCH] ifupdown: add ptest
  2020-02-04  9:24   ` Kang Kai
@ 2020-02-04 20:50     ` Alexander Kanavin
  2020-02-04 21:29       ` Richard Purdie
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Kanavin @ 2020-02-04 20:50 UTC (permalink / raw)
  To: Kang Kai; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 6462 bytes --]

imagefeatures.py does set:

PREFERRED_PROVIDER_virtual/base-utils = "packagegroup-core-base-utils"
VIRTUAL-RUNTIME_base-utils = "packagegroup-core-base-utils"

which I believe does actually replace replace busybox with that
packagegroup in any image, as packagegroup-core-boot RDEPENDS on
VIRTUAL-RUNTIME_base-utils.

I'm not sure why imagefeatures.py only does 'bitbake("--graphviz
core-image-sato")' instead of building and booting that image properly, but
this is exactly the place where it should happen.

Alex

On Tue, 4 Feb 2020 at 10:25, Kang Kai <Kai.Kang@windriver.com> wrote:

> In imagefeatures.py, it just run 'bitbake -g core-image-sato' and
> doesn't really build and test RDEPENDS packages of
> packagegroup-core-base-utils.
>
> So for the packages in the RDEPENDS packages of
> packagegroup-core-base-utils but not in any image, they all are not be
> tested.
>
> I didn't find a proper recipe to place these recipes. Maybe a new image
> recipe need to be created.
>
> Regards,
> Kai
>
>
>
> >
> > Alex
> >
> >> On 3 Feb 2020, at 10.14, <kai.kang@windriver.com> <
> kai.kang@windriver.com> wrote:
> >>
> >> From: Kai Kang <kai.kang@windriver.com>
> >>
> >> Add ptest for ifupdown with its own test cases.
> >>
> >> [Yocto #13736]
> >>
> >> Signed-off-by: Kai Kang <kai.kang@windriver.com>
> >> ---
> >> meta/recipes-core/ifupdown/files/run-ptest    |  4 ++
> >> .../ifupdown/files/tweak-ptest-script.patch   | 49 +++++++++++++++++++
> >> meta/recipes-core/ifupdown/ifupdown_0.8.35.bb | 10 +++-
> >> 3 files changed, 62 insertions(+), 1 deletion(-)
> >> create mode 100644 meta/recipes-core/ifupdown/files/run-ptest
> >> create mode 100644
> meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
> >>
> >> diff --git a/meta/recipes-core/ifupdown/files/run-ptest
> b/meta/recipes-core/ifupdown/files/run-ptest
> >> new file mode 100644
> >> index 0000000000..8694042392
> >> --- /dev/null
> >> +++ b/meta/recipes-core/ifupdown/files/run-ptest
> >> @@ -0,0 +1,4 @@
> >> +#!/bin/sh
> >> +
> >> +CURDIR=$(dirname `readlink -f $0`)
> >> +cd $CURDIR/tests && ./testbuild-linux
> >> diff --git a/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
> b/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
> >> new file mode 100644
> >> index 0000000000..d7600cf243
> >> --- /dev/null
> >> +++ b/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
> >> @@ -0,0 +1,49 @@
> >> +Tweak tests of ifupdown to make it work with oe-core ptest framework.
> >> +
> >> +Upstream-Status: Inappropriate [oe-core specific]
> >> +
> >> +Signed-off-by: Kai Kang <kai.kang@windriver.com>
> >> +
> >> +diff --git a/tests/testbuild-linux b/tests/testbuild-linux
> >> +index 1181ea0..d5c1814 100755
> >> +--- a/tests/testbuild-linux
> >> ++++ b/tests/testbuild-linux
> >> +@@ -1,6 +1,7 @@
> >> + #!/bin/sh -e
> >> +
> >> +-dir=tests/linux
> >> ++curdir=$(dirname `readlink -f $0`)
> >> ++dir=$curdir/linux
> >> +
> >> + result=true
> >> + for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
> >> +@@ -12,7 +13,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
> 17 18; do
> >> +         echo "Testcase $test: $args"
> >> +
> >> +    exitcode=0
> >> +-        ./ifup -v --no-act-commands --force -i $dir/testcase.$test
> --state-dir=$dir/state.$test $args \
> >> ++        ifup -v --no-act-commands --force -i $dir/testcase.$test
> --state-dir=$dir/state.$test $args \
> >> +                 >$dir/up-res-out.$test 2>$dir/up-res-err.$test ||
> exitcode=$?
> >> +
> >> +         (echo "exit code: $exitcode";
> >> +@@ -20,7 +21,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
> 17 18; do
> >> +          echo "====stderr===="; cat $dir/up-res-err.$test) >
> $dir/up-res.$test
> >> +
> >> +    exitcode=0
> >> +-        ./ifdown -v --no-act-commands --force -i $dir/testcase.$test
> --state-dir=$dir/state.$test $args \
> >> ++        ifdown -v --no-act-commands --force -i $dir/testcase.$test
> --state-dir=$dir/state.$test $args \
> >> +                >$dir/down-res-out.$test 2>$dir/down-res-err.$test ||
> exitcode=$?
> >> +
> >> +         (echo "exit code: $exitcode";
> >> +@@ -28,9 +29,9 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
> 17 18; do
> >> +          echo "====stderr===="; cat $dir/down-res-err.$test) >
> $dir/down-res.$test
> >> +
> >> +         if diff -ub $dir/up.$test $dir/up-res.$test && diff -ub
> $dir/down.$test $dir/down-res.$test; then
> >> +-                echo "(okay)"
> >> ++                echo "PASS: $test"
> >> +         else
> >> +-                echo "(failed)"
> >> ++                echo "FAIL: $test"
> >> +                 result=false
> >> +         fi
> >> +         echo "=========="
> >> diff --git a/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
> b/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
> >> index 0de97fe372..53cb971d33 100644
> >> --- a/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
> >> +++ b/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
> >> @@ -11,13 +11,15 @@ SRC_URI = "git://
> salsa.debian.org/debian/ifupdown.git;protocol=https \
> >>             file://99_network \
> >>             file://0001-Define-FNM_EXTMATCH-for-musl.patch \
> >>
>  file://0001-Makefile-do-not-use-dpkg-for-determining-OS-type.patch \
> >> +           file://run-ptest \
> >> +           ${@bb.utils.contains('DISTRO_FEATURES', 'ptest',
> 'file://tweak-ptest-script.patch', '', d)} \
> >>             "
> >> SRCREV = "4af76318cfc57f8e4a44d357104188666213bd4b"
> >>
> >> S = "${WORKDIR}/git"
> >>
> >>
> >> -inherit update-alternatives
> >> +inherit ptest update-alternatives
> >>
> >> do_compile () {
> >>     chmod a+rx *.pl *.sh
> >> @@ -40,6 +42,12 @@ do_install () {
> >>     cd ${D}${mandir}/man8 && ln -s ifup.8 ifdown.8
> >> }
> >>
> >> +do_install_ptest () {
> >> +    install -d ${D}${PTEST_PATH}/tests
> >> +    cp -r ${S}/tests/testbuild-linux ${D}${PTEST_PATH}/tests/
> >> +    cp -r ${S}/tests/linux ${D}${PTEST_PATH}/tests/
> >> +}
> >> +
> >> ALTERNATIVE_PRIORITY = "100"
> >> ALTERNATIVE_${PN} = "ifup ifdown"
> >>
> >> --
> >> 2.17.1
> >>
> >> --
> >> _______________________________________________
> >> Openembedded-core mailing list
> >> Openembedded-core@lists.openembedded.org
> >> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>
> --
> Kai Kang
>
>

[-- Attachment #2: Type: text/html, Size: 9517 bytes --]

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

* Re: [PATCH] ifupdown: add ptest
  2020-02-04 20:50     ` Alexander Kanavin
@ 2020-02-04 21:29       ` Richard Purdie
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2020-02-04 21:29 UTC (permalink / raw)
  To: Alexander Kanavin, Kang Kai; +Cc: OE-core

On Tue, 2020-02-04 at 21:50 +0100, Alexander Kanavin wrote:
> imagefeatures.py does set:
> 
> PREFERRED_PROVIDER_virtual/base-utils = "packagegroup-core-base-
> utils"
> VIRTUAL-RUNTIME_base-utils = "packagegroup-core-base-utils"
> 
> which I believe does actually replace replace busybox with that
> packagegroup in any image, as packagegroup-core-boot RDEPENDS on
> VIRTUAL-RUNTIME_base-utils.
> 
> I'm not sure why imagefeatures.py only does 'bitbake("--graphviz
> core-image-sato")' instead of building and booting that image
> properly, but this is exactly the place where it should happen.

I suspect it dates from a time where booting and testing the image
likely wouldn't have worked. It sounds like there would be a lot more
value in that now.

I merged this patch on the basis it was a good step forwards on the
issue in case that wasn't clear.

Cheers,

Richard



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

* [PATCH] ifupdown: add ptest
@ 2020-02-03  9:33 kai.kang
  0 siblings, 0 replies; 6+ messages in thread
From: kai.kang @ 2020-02-03  9:33 UTC (permalink / raw)
  To: openembedded-core

From: Kai Kang <kai.kang@windriver.com>

Add ptest for ifupdown with its own test cases.

[Yocto #13736]

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 meta/recipes-core/ifupdown/files/run-ptest    |  4 ++
 .../ifupdown/files/tweak-ptest-script.patch   | 49 +++++++++++++++++++
 meta/recipes-core/ifupdown/ifupdown_0.8.35.bb | 10 +++-
 3 files changed, 62 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-core/ifupdown/files/run-ptest
 create mode 100644 meta/recipes-core/ifupdown/files/tweak-ptest-script.patch

diff --git a/meta/recipes-core/ifupdown/files/run-ptest b/meta/recipes-core/ifupdown/files/run-ptest
new file mode 100644
index 0000000000..8694042392
--- /dev/null
+++ b/meta/recipes-core/ifupdown/files/run-ptest
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+CURDIR=$(dirname `readlink -f $0`)
+cd $CURDIR/tests && ./testbuild-linux
diff --git a/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch b/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
new file mode 100644
index 0000000000..d7600cf243
--- /dev/null
+++ b/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
@@ -0,0 +1,49 @@
+Tweak tests of ifupdown to make it work with oe-core ptest framework.
+
+Upstream-Status: Inappropriate [oe-core specific]
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+
+diff --git a/tests/testbuild-linux b/tests/testbuild-linux
+index 1181ea0..d5c1814 100755
+--- a/tests/testbuild-linux
++++ b/tests/testbuild-linux
+@@ -1,6 +1,7 @@
+ #!/bin/sh -e
+ 
+-dir=tests/linux
++curdir=$(dirname `readlink -f $0`)
++dir=$curdir/linux
+ 
+ result=true
+ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
+@@ -12,7 +13,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
+         echo "Testcase $test: $args"
+ 
+ 	exitcode=0
+-        ./ifup -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
++        ifup -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
+                 >$dir/up-res-out.$test 2>$dir/up-res-err.$test || exitcode=$?
+ 
+         (echo "exit code: $exitcode";
+@@ -20,7 +21,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
+          echo "====stderr===="; cat $dir/up-res-err.$test) > $dir/up-res.$test
+ 
+ 	exitcode=0
+-        ./ifdown -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
++        ifdown -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
+                >$dir/down-res-out.$test 2>$dir/down-res-err.$test || exitcode=$?
+ 
+         (echo "exit code: $exitcode";
+@@ -28,9 +29,9 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
+          echo "====stderr===="; cat $dir/down-res-err.$test) > $dir/down-res.$test
+ 
+         if diff -ub $dir/up.$test $dir/up-res.$test && diff -ub $dir/down.$test $dir/down-res.$test; then
+-                echo "(okay)"
++                echo "PASS: $test"
+         else
+-                echo "(failed)"
++                echo "FAIL: $test"
+                 result=false
+         fi
+         echo "=========="
diff --git a/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb b/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
index 0de97fe372..53cb971d33 100644
--- a/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
+++ b/meta/recipes-core/ifupdown/ifupdown_0.8.35.bb
@@ -11,13 +11,15 @@ SRC_URI = "git://salsa.debian.org/debian/ifupdown.git;protocol=https \
            file://99_network \
            file://0001-Define-FNM_EXTMATCH-for-musl.patch \
            file://0001-Makefile-do-not-use-dpkg-for-determining-OS-type.patch \
+           file://run-ptest \
+           ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://tweak-ptest-script.patch', '', d)} \
            "
 SRCREV = "4af76318cfc57f8e4a44d357104188666213bd4b"
 
 S = "${WORKDIR}/git"
 
 
-inherit update-alternatives
+inherit ptest update-alternatives
 
 do_compile () {
 	chmod a+rx *.pl *.sh
@@ -40,6 +42,12 @@ do_install () {
 	cd ${D}${mandir}/man8 && ln -s ifup.8 ifdown.8
 }
 
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/tests
+    cp -r ${S}/tests/testbuild-linux ${D}${PTEST_PATH}/tests/
+    cp -r ${S}/tests/linux ${D}${PTEST_PATH}/tests/
+}
+
 ALTERNATIVE_PRIORITY = "100"
 ALTERNATIVE_${PN} = "ifup ifdown"
 
-- 
2.17.1



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

end of thread, other threads:[~2020-02-04 21:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-03  9:14 [PATCH] ifupdown: add ptest kai.kang
2020-02-03 12:50 ` Alexander Kanavin
2020-02-04  9:24   ` Kang Kai
2020-02-04 20:50     ` Alexander Kanavin
2020-02-04 21:29       ` Richard Purdie
2020-02-03  9:33 kai.kang

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.