summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorKai Kang <kai.kang@windriver.com>2020-02-03 17:33:11 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-02-04 15:56:29 +0000
commit776eea0691dde919741ae8f836e09b44daf5af7d (patch)
tree8ac2667dbbea3d87d1f6bd9f890a489d71e45fc3 /meta/recipes-core
parentce39a9e35228d2de804e40b1d2b48289df5bf4d2 (diff)
downloadpoky-776eea0691dde919741ae8f836e09b44daf5af7d.tar.gz
ifupdown: add ptest
Add ptest for ifupdown with its own test cases. [Yocto #13736] (From OE-Core rev: 2333ef5bb40132f05f69a5f6abaa3d086ecf9f6c) Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/ifupdown/files/run-ptest4
-rw-r--r--meta/recipes-core/ifupdown/files/tweak-ptest-script.patch49
-rw-r--r--meta/recipes-core/ifupdown/ifupdown_0.8.35.bb10
3 files changed, 62 insertions, 1 deletions
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 @@
1#!/bin/sh
2
3CURDIR=$(dirname `readlink -f $0`)
4cd $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 @@
1Tweak tests of ifupdown to make it work with oe-core ptest framework.
2
3Upstream-Status: Inappropriate [oe-core specific]
4
5Signed-off-by: Kai Kang <kai.kang@windriver.com>
6
7diff --git a/tests/testbuild-linux b/tests/testbuild-linux
8index 1181ea0..d5c1814 100755
9--- a/tests/testbuild-linux
10+++ b/tests/testbuild-linux
11@@ -1,6 +1,7 @@
12 #!/bin/sh -e
13
14-dir=tests/linux
15+curdir=$(dirname `readlink -f $0`)
16+dir=$curdir/linux
17
18 result=true
19 for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
20@@ -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
21 echo "Testcase $test: $args"
22
23 exitcode=0
24- ./ifup -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
25+ ifup -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
26 >$dir/up-res-out.$test 2>$dir/up-res-err.$test || exitcode=$?
27
28 (echo "exit code: $exitcode";
29@@ -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
30 echo "====stderr===="; cat $dir/up-res-err.$test) > $dir/up-res.$test
31
32 exitcode=0
33- ./ifdown -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
34+ ifdown -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
35 >$dir/down-res-out.$test 2>$dir/down-res-err.$test || exitcode=$?
36
37 (echo "exit code: $exitcode";
38@@ -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
39 echo "====stderr===="; cat $dir/down-res-err.$test) > $dir/down-res.$test
40
41 if diff -ub $dir/up.$test $dir/up-res.$test && diff -ub $dir/down.$test $dir/down-res.$test; then
42- echo "(okay)"
43+ echo "PASS: $test"
44 else
45- echo "(failed)"
46+ echo "FAIL: $test"
47 result=false
48 fi
49 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 \
11 file://99_network \ 11 file://99_network \
12 file://0001-Define-FNM_EXTMATCH-for-musl.patch \ 12 file://0001-Define-FNM_EXTMATCH-for-musl.patch \
13 file://0001-Makefile-do-not-use-dpkg-for-determining-OS-type.patch \ 13 file://0001-Makefile-do-not-use-dpkg-for-determining-OS-type.patch \
14 file://run-ptest \
15 ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://tweak-ptest-script.patch', '', d)} \
14 " 16 "
15SRCREV = "4af76318cfc57f8e4a44d357104188666213bd4b" 17SRCREV = "4af76318cfc57f8e4a44d357104188666213bd4b"
16 18
17S = "${WORKDIR}/git" 19S = "${WORKDIR}/git"
18 20
19 21
20inherit update-alternatives 22inherit ptest update-alternatives
21 23
22do_compile () { 24do_compile () {
23 chmod a+rx *.pl *.sh 25 chmod a+rx *.pl *.sh
@@ -40,6 +42,12 @@ do_install () {
40 cd ${D}${mandir}/man8 && ln -s ifup.8 ifdown.8 42 cd ${D}${mandir}/man8 && ln -s ifup.8 ifdown.8
41} 43}
42 44
45do_install_ptest () {
46 install -d ${D}${PTEST_PATH}/tests
47 cp -r ${S}/tests/testbuild-linux ${D}${PTEST_PATH}/tests/
48 cp -r ${S}/tests/linux ${D}${PTEST_PATH}/tests/
49}
50
43ALTERNATIVE_PRIORITY = "100" 51ALTERNATIVE_PRIORITY = "100"
44ALTERNATIVE_${PN} = "ifup ifdown" 52ALTERNATIVE_${PN} = "ifup ifdown"
45 53