libgpiod: ptest improvements
cover libgpiod: ptest improvements
From: Bartosz Golaszewski <[email protected]>
This series improves the recipe for libgpiod with primary focus on ptest parts. We bring in support for all test-suites available in the package. We also tweak the recipe in other places to make it more readable and robust in general.
Bartosz Golaszewski (9):
libgpiod: coding style fixes
libgpiod: list all packages in a single assignment
libgpiod: fix RRECOMMENDS for python bindings
libgpiod: correctly split output files into packages
libgpiod: add RDEPENDS for tests
libgpiod: redirect stdout from the ptest executable to a file
libgpiod: ptest: run all test-suites if possible
libgpiod: ptest: warn if the gpio-mockup kernel module is not selected
libgpiod: ptest: add kernel-modules to RRECOMMENDS
.../recipes-support/libgpiod/files/run-ptest | 21 ++++--- .../libgpiod/libgpiod_1.6.3.bb | 61 +++++++++++++++---- 2 files changed, 64 insertions(+), 18 deletions(-)
Signature · 1 line
2.30.1
PATCH 1/9 libgpiod: coding style fixes
The recipe is getting bigger so try to keep a consistent coding style. Use four spaces instead of tabs and use the common way of splitting multi-line strings for minimum git diff lines at modification.
--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +5 -4
@@ -4,8 +4,9 @@ AUTHOR = "Bartosz Golaszewski <[email protected]>" LICENSE = "LGPLv2.1+" LIC_FILES_CHKSUM = "file://COPYING;md5=2caced0b25dfefd4c601d92bd15116de" -SRC_URI = "https://www.kernel.org/pub/software/libs/${BPN}/${BP}.tar.xz \ - file://run-ptest \ +SRC_URI = " \ + https://www.kernel.org/pub/software/libs/${BPN}/${BP}.tar.xz \ + file://run-ptest \ " SRC_URI[md5sum] = "28e79f6f70fee1da9079558d8b7b3736"
@@ -39,6 +40,6 @@ RRECOMMENDS_${PN}-python += "${RRECOMMENDS_PYTHON}" PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}" do_install_ptest() { - install -d ${D}${PTEST_PATH}/tests - cp ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/ + install -d ${D}${PTEST_PATH}/tests + cp ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/ }
Signature · 1 line
2.30.1
PATCH 2/9 libgpiod: list all packages in a single assignment
In reply to Bartosz GolaszewskiDon't have assignments to PACKAGES scattered across the recipe - use a single place for that before assigning FILES.
--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +1 -3
@@ -27,11 +27,9 @@ EXTRA_OECONF = "--enable-tools" DEPENDS += "autoconf-archive-native" -PACKAGES =+ "${PN}-tools libgpiodcxx" +PACKAGES =+ "${PN}-tools libgpiodcxx ${PN}-python" FILES_${PN}-tools = "${bindir}/*" FILES_libgpiodcxx = "${libdir}/libgpiodcxx.so.*" - -PACKAGES =+ "${PN}-python" FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so" FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" RRECOMMENDS_PYTHON = "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '',d)}"
Signature · 1 line
2.30.1
PATCH 3/9 libgpiod: fix RRECOMMENDS for python bindings
In reply to Bartosz GolaszewskiRRECOMMENDS for the python module doesn't work because it specifies the module itself as its own RRECOMMENDS. Fix it to recommend the python package if python3 is in PACKAGECONFIG for the main package.
--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +2 -2
@@ -32,8 +32,8 @@ FILES_${PN}-tools = "${bindir}/*" FILES_libgpiodcxx = "${libdir}/libgpiodcxx.so.*" FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so" FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" -RRECOMMENDS_PYTHON = "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '',d)}" -RRECOMMENDS_${PN}-python += "${RRECOMMENDS_PYTHON}" + +RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '', d)}" PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}"
Signature · 1 line
2.30.1
PATCH 4/9 libgpiod: correctly split output files into packages
In reply to Bartosz GolaszewskiCurrently, the files that should go into libgpiod-ptest are part of either the main library package of libgpiod-tools. Use more fine-grained values for package files variables.
--- .../recipes-support/libgpiod/libgpiod_1.6.3.bb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +15 -1
@@ -28,7 +28,21 @@ EXTRA_OECONF = "--enable-tools" DEPENDS += "autoconf-archive-native" PACKAGES =+ "${PN}-tools libgpiodcxx ${PN}-python" -FILES_${PN}-tools = "${bindir}/*" +FILES_${PN}-tools = " \ + ${bindir}/gpiodetect \ + ${bindir}/gpioinfo \ + ${bindir}/gpioget \ + ${bindir}/gpioset \ + ${bindir}/gpiofind \ + ${bindir}/gpiomon \ +" +FILES_${PN}-ptest += " \ + ${bindir}/gpiod-test \ + ${bindir}/gpio-tools-test \ + ${bindir}/gpio-tools-test.bats \ + ${bindir}/gpiod-cxx-test \ + ${libdir}/libgpiomockup.so.* \ +" FILES_libgpiodcxx = "${libdir}/libgpiodcxx.so.*" FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so" FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
Signature · 1 line
2.30.1
PATCH 5/9 libgpiod: add RDEPENDS for tests
In reply to Bartosz GolaszewskiThe libgpiod-tools test-suite requires bats at run-time. The python test-suite needs the packaging module. Add both to the RDEPENDS in the tests PACKAGECONFIG option
--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +1 -1
@@ -14,7 +14,7 @@ SRC_URI[sha256sum] = "841be9d788f00bab08ef22c4be5c39866f0e46cb100a3ae49ed816ac9c inherit autotools pkgconfig python3native ptest -PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,kmod udev glib-2.0 catch2" +PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,kmod udev glib-2.0 catch2,bats python3-packaging" PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx" PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3"
Signature · 1 line
2.30.1
PATCH 6/9 libgpiod: redirect stdout from the ptest executable to a file
In reply to Bartosz GolaszewskiMost tests redirect their standard output to a file. Let's make libgpiod consistent with this pattern.
--- meta-oe/recipes-support/libgpiod/files/run-ptest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta-oe/recipes-support/libgpiod/files/run-ptest +1 -1
@@ -4,7 +4,7 @@ testbin="gpiod-test" ptestdir=$(dirname "$(readlink -f "$0")") cd $ptestdir/tests -./$testbin +./$testbin > ./$testbin.out if [ $? -ne 0 ]; then echo "FAIL: $testbin" else
Signature · 1 line
2.30.1
PATCH 7/9 libgpiod: ptest: run all test-suites if possible
In reply to Bartosz GolaszewskiWe have four test-suites total in libgpiod: for the core C library, gpio-tools and for C++ and Python bindings. Modify the recipe to install all of them depending on build settings and make run-ptest execute them if available.
--- .../recipes-support/libgpiod/files/run-ptest | 21 ++++++++++++------- .../libgpiod/libgpiod_1.6.3.bb | 20 +++++++++++++++++- 2 files changed, 33 insertions(+), 8 deletions(-)
meta-oe/recipes-support/libgpiod/files/run-ptest +14 -7
@@ -1,12 +1,19 @@ #!/bin/sh -testbin="gpiod-test" +testbins="gpiod-test gpio-tools-test gpiod-cxx-test gpiod_py_test.py" + ptestdir=$(dirname "$(readlink -f "$0")") cd $ptestdir/tests -./$testbin > ./$testbin.out -if [ $? -ne 0 ]; then - echo "FAIL: $testbin" -else - echo "PASS: $testbin" -fi +for testbin in $testbins; do + if test -e ./$testbin; then + ./$testbin > ./$testbin.out + if [ $? -ne 0 ]; then + echo "FAIL: $testbin" + else + echo "PASS: $testbin" + fi + else + echo "SKIP: $testbin" + fi +done
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +19 -1
@@ -53,5 +53,23 @@ PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests do_install_ptest() { install -d ${D}${PTEST_PATH}/tests - cp ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/ + + # These are the core C library tests + install -m 0755 ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/ + + # Tools are always built so let's always install them for ptest even if + # we're not selecting libgpiod-tools. + install -m 0755 ${S}/tools/gpio-tools-test ${D}${PTEST_PATH}/tests/ + install -m 0755 ${S}/tools/gpio-tools-test.bats ${D}${PTEST_PATH}/tests/ + for tool in ${FILES_${PN}-tools}; do + install ${B}/tools/.libs/$(basename $tool) ${D}${PTEST_PATH}/tests/ + done + + if ${@bb.utils.contains('PACKAGECONFIG', 'cxx', 'true', 'false', d)}; then + install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/ + fi + + if ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'true', 'false', d)}; then + install -m 0755 ${S}/bindings/python/tests/gpiod_py_test.py ${D}${PTEST_PATH}/tests/ + fi }
Signature · 1 line
2.30.1
PATCH 8/9 libgpiod: ptest: warn if the gpio-mockup kernel module is not selected
In reply to Bartosz Golaszewskilibgpiod test-suites work with the gpio-mockup kernel module. When using linux-yocto, it's enabled using the gpio/mockup.scc kernel feature. Check if this feature is present in KERNEL_FEATURE and warn if not.
--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 7 +++++++ 1 file changed, 7 insertions(+)
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +7 -0
@@ -52,6 +52,13 @@ RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}" do_install_ptest() { + if [ "${PREFERRED_PROVIDER_virtual/kernel}" = "linux-yocto" ] && \ + ${@bb.utils.contains('KERNEL_FEATURES', 'features/gpio/mockup.scc', 'false', 'true',d)}; then + bbwarn "libgpiod test-suites need the gpio-mockup +module and will not work without it. Consider adding +'features/gpio/mockup.scc' to KERNEL_FEATURES" + fi + install -d ${D}${PTEST_PATH}/tests # These are the core C library tests
Signature · 1 line
2.30.1
Re: [meta-oe][PATCH 8/9] libgpiod: ptest: warn if the gpio-mockup kernel module is not selected
Quoted 15 lines · Bartosz Golaszewski
libgpiod test-suites work with the gpio-mockup kernel module. When using linux-yocto, it's enabled using the gpio/mockup.scc kernel feature. Check if this feature is present in
KERNEL_FEATUREand warn if not.Signed-off-by Bartosz Golaszewski <[email protected]>--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +0
-0
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py · line 61
Quoted 10 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +7
-0@@ -52,6 +52,13 @@ RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}" do_install_ptest() { + if [ "${PREFERRED_PROVIDER_virtual/kernel}" = "linux-yocto" ] && \ + ${@bb.utils.contains('KERNEL_FEATURES', 'features/gpio/mockup.scc', 'false', 'true',d)}; then + bbwarn "libgpiod test-suites need the gpio-mockup +module and will not work without it. Consider adding +'features/gpio/mockup.scc' to KERNEL_FEATURES" + fi +
perhaps turn this into a bbnote something like what libbpf is doing see
http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-kernel/libbpf/libbpf_0.3.bb?h=master
Quoted 6 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +0
-1install -d ${D}${PTEST_PATH}/tests # These are the core C library tests --2.30.1
Re: [meta-oe][PATCH 8/9] libgpiod: ptest: warn if the gpio-mockup kernel module is not selected
Quoted 19 lines · Khem Raj
Quoted 17 lines · Bartosz Golaszewski
libgpiod test-suites work with the gpio-mockup kernel module. When using linux-yocto, it's enabled using the gpio/mockup.scc kernel feature. Check if this feature is present in
KERNEL_FEATUREand warn if not.Signed-off-by Bartosz Golaszewski <[email protected]>--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +0
-0@@ -52,6 +52,13 @@ RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}"
Quoted 12 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py · line 61
Quoted 8 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +7
-0do_install_ptest() { + if [ "${PREFERRED_PROVIDER_virtual/kernel}" = "linux-yocto" ] && \ + ${@bb.utils.contains('KERNEL_FEATURES', 'features/gpio/mockup.scc', 'false', 'true',d)}; then + bbwarn "libgpiod test-suites need the gpio-mockup +module and will not work without it. Consider adding +'features/gpio/mockup.scc' to KERNEL_FEATURES" + fi +perhaps turn this into a bbnote something like what libbpf is doing see
http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-kernel/libbpf/libbpf_0.3.bb?h=master
I really think that a warning is in order here. The ptests won't work without this module. At the same time we can't really skip the package altogether because the build may be using a different kernel recipe with its own defconfig - this is why we first check if we're using linux-yocto.
Bart
Re: [meta-oe][PATCH 8/9] libgpiod: ptest: warn if the gpio-mockup kernel module is not selected
Quoted 38 lines · Bartosz Golaszewski
Quoted 2 lines · Khem Raj
On Wed, Jun 2, 2021 at 7:15 AM Bartosz Golaszewski <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
libgpiod test-suites work with the gpio-mockup kernel module. When
using
Quoted 1 line
Quoted 1 line
linux-yocto, it's enabled using the gpio/mockup.scc kernel feature.
Check
Quoted 8 lines
Review
Quoted 8 lines
if this feature is present in
KERNEL_FEATUREand warn if not.Signed-off-by Bartosz Golaszewski <[email protected]>--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 7 +++++++ 1 file changed, 7 insertions(+)(quoted diff) +0
-0b/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb
Quoted 4 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb RRECOMMENDS_${PN} +=
Quoted 4 lines
index
874453fbd..febf625a6100644meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +0
-0@@ -52,6 +52,13 @@ RRECOMMENDS_${PN} +="${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py
Quoted 1 line
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb RRECOMMENDS_${PN} += · line 52
Quoted 1 line
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +0
-0PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES','ptest', 'tests', '', d)}"
Quoted 4 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py
Quoted 4 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +2
-0do_install_ptest() { + if [ "${PREFERRED_PROVIDER_virtual/kernel}" = "linux-yocto" ] && \ + ${@bb.utils.contains('KERNEL_FEATURES','features/gpio/mockup.scc', 'false', 'true',d)}; then
Quoted 8 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py · line 61
Quoted 5 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +5
-0+ bbwarn "libgpiod test-suites need the gpio-mockup +module and will not work without it. Consider adding +'features/gpio/mockup.scc' to KERNEL_FEATURES" + fi +perhaps turn this into a bbnote something like what libbpf is doing see
Quoted 8 lines
Quoted 1 line
I really think that a warning is in order here. The ptests won't work without this module. At the same time we can't really skip the package altogether because the build may be using a different kernel recipe with its own defconfig - this is why we first check if we're using linux-yocto.
It should check for module being built in kernel irrespective of Linux yocto that is right but we perhaps need a logic to consider the case where I might have a kernel without this option and distro is using ptest feature
Quoted 4 lines
Bart
Re: [meta-oe][PATCH 8/9] libgpiod: ptest: warn if the gpio-mockup kernel module is not selected
Quoted 38 lines · Khem Raj
Quoted 34 lines · Bartosz Golaszewski
Quoted 31 lines · Khem Raj
Quoted 15 lines · Bartosz Golaszewski
libgpiod test-suites work with the gpio-mockup kernel module. When using linux-yocto, it's enabled using the gpio/mockup.scc kernel feature. Check if this feature is present in
KERNEL_FEATUREand warn if not.Signed-off-by Bartosz Golaszewski <[email protected]>--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +0
-0meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py · line 61
Quoted 10 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +7
-0@@ -52,6 +52,13 @@ RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}" do_install_ptest() { + if [ "${PREFERRED_PROVIDER_virtual/kernel}" = "linux-yocto" ] && \ + ${@bb.utils.contains('KERNEL_FEATURES', 'features/gpio/mockup.scc', 'false', 'true',d)}; then + bbwarn "libgpiod test-suites need the gpio-mockup +module and will not work without it. Consider adding +'features/gpio/mockup.scc' to KERNEL_FEATURES" + fi +perhaps turn this into a bbnote something like what libbpf is doing see
http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-kernel/libbpf/libbpf_0.3.bb?h=master
Quoted 8 lines
Quoted 5 lines
I really think that a warning is in order here. The ptests won't work without this module. At the same time we can't really skip the package altogether because the build may be using a different kernel recipe with its own defconfig - this is why we first check if we're using linux-yocto.
It should check for module being built in kernel irrespective of Linux yocto that is right but we perhaps need a logic to consider the case where I might have a kernel without this option and distro is using ptest feature
No, we should not check for the module if we're not using linux-yocto because in this case we most likely won't be using yocto-linux-cache.
For the second part - a warning doesn't really stop the build - do you really think it's too much? I mean, I can change it into a bbnote but I don't see why.
Bart
Re: [meta-oe][PATCH 8/9] libgpiod: ptest: warn if the gpio-mockup kernel module is not selected
Quoted 47 lines · Bartosz Golaszewski
Quoted 45 lines · Khem Raj
Quoted 39 lines · Bartosz Golaszewski
Quoted 19 lines · Khem Raj
Quoted 17 lines · Bartosz Golaszewski
libgpiod test-suites work with the gpio-mockup kernel module. When using linux-yocto, it's enabled using the gpio/mockup.scc kernel feature. Check if this feature is present in
KERNEL_FEATUREand warn if not.Signed-off-by Bartosz Golaszewski <[email protected]>--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +0
-0@@ -52,6 +52,13 @@ RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}"Quoted 12 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py · line 61
Quoted 8 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +7
-0do_install_ptest() { + if [ "${PREFERRED_PROVIDER_virtual/kernel}" = "linux-yocto" ] && \ + ${@bb.utils.contains('KERNEL_FEATURES', 'features/gpio/mockup.scc', 'false', 'true',d)}; then + bbwarn "libgpiod test-suites need the gpio-mockup +module and will not work without it. Consider adding +'features/gpio/mockup.scc' to KERNEL_FEATURES" + fi +perhaps turn this into a bbnote something like what libbpf is doing see
http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-kernel/libbpf/libbpf_0.3.bb?h=masterI really think that a warning is in order here. The ptests won't work without this module. At the same time we can't really skip the package altogether because the build may be using a different kernel recipe with its own defconfig - this is why we first check if we're using linux-yocto.
Quoted 8 lines
Quoted 1 line
It should check for module being built in kernel irrespective of Linux yocto that is right but we perhaps need a logic to consider the case where I might have a kernel without this option and distro is using ptest feature
No, we should not check for the module if we're not using linux-yocto because in this case we most likely won't be using yocto-linux-cache.
For the second part - a warning doesn't really stop the build - do you really think it's too much? I mean, I can change it into a bbnote but I don't see why.
I don't like warnings they mean same as errors in some ways, So either have linux-yocto enable this module or turn it into a note
see AB https://autobuilder.yoctoproject.org/typhoon/#/builders/88/builds/1309
it should be green :)
Quoted 2 lines
Bart
Re: [meta-oe][PATCH 8/9] libgpiod: ptest: warn if the gpio-mockup kernel module is not selected
Quoted 54 lines · Khem Raj
Quoted 52 lines · Bartosz Golaszewski
Quoted 38 lines · Khem Raj
Quoted 34 lines · Bartosz Golaszewski
Quoted 31 lines · Khem Raj
Quoted 15 lines · Bartosz Golaszewski
libgpiod test-suites work with the gpio-mockup kernel module. When using linux-yocto, it's enabled using the gpio/mockup.scc kernel feature. Check if this feature is present in
KERNEL_FEATUREand warn if not.Signed-off-by Bartosz Golaszewski <[email protected]>--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +0
-0meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py · line 61
Quoted 10 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +7
-0@@ -52,6 +52,13 @@ RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}" do_install_ptest() { + if [ "${PREFERRED_PROVIDER_virtual/kernel}" = "linux-yocto" ] && \ + ${@bb.utils.contains('KERNEL_FEATURES', 'features/gpio/mockup.scc', 'false', 'true',d)}; then + bbwarn "libgpiod test-suites need the gpio-mockup +module and will not work without it. Consider adding +'features/gpio/mockup.scc' to KERNEL_FEATURES" + fi +perhaps turn this into a bbnote something like what libbpf is doing see
http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-kernel/libbpf/libbpf_0.3.bb?h=masterQuoted 8 lines
Quoted 5 lines
I really think that a warning is in order here. The ptests won't work without this module. At the same time we can't really skip the package altogether because the build may be using a different kernel recipe with its own defconfig - this is why we first check if we're using linux-yocto.
It should check for module being built in kernel irrespective of Linux yocto that is right but we perhaps need a logic to consider the case where I might have a kernel without this option and distro is using ptest feature
No, we should not check for the module if we're not using linux-yocto because in this case we most likely won't be using yocto-linux-cache.
Quoted 9 lines
Quoted 3 lines
For the second part - a warning doesn't really stop the build - do you really think it's too much? I mean, I can change it into a bbnote but I don't see why.
I don't like warnings they mean same as errors in some ways, So either have linux-yocto enable this module or turn it into a note
see AB https://autobuilder.yoctoproject.org/typhoon/#/builders/88/builds/1309
it should be green :)
So I went on to add it to OE-core and noticed this:
4e03f041396121f6143fd81bf5e429015146bfdc
Author: Sakib Sajal <[email protected]> Date: Wed Jan 27 13:03:32 2021 -0500
linux-yocto*: add features/gpio/mockup.scc to KERNEL_FEATURES
add features/gpio/mockup.scc to KERNEL_FEATURES when ptest is enabled as it is required for testing libgpiod.
(From OE-Core rev: 906cde06bee319e788c76abb8f8295ed9921ccb1)
So I wonder - why do I see my warning if I don't add gpio-mockup to kernel features myself? A quick check shows this:
$ bitbake -e core-image-minimal | grep ^DISTRO_FEATURES= DISTRO_FEATURES="acl alsa argp bluetooth debuginfod ext2 ipv4 ipv6 largefile pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g nfc x11 vfat seccomp largefile opengl ptest multiarch wayland vulkan systemd pam pulseaudio gobject-introspection-data ldconfig" $ bitbake -e core-image-minimal | grep ^KERNEL_FEATURES= KERNEL_FEATURES=""
I don't have the time to debug this today but it looks like a bug - the feature should actually be pulled in automatically.
Bart
Re: [meta-oe][PATCH 8/9] libgpiod: ptest: warn if the gpio-mockup kernel module is not selected
Quoted 93 lines · Bartosz Golaszewski
Quoted 54 lines · Khem Raj
Quoted 52 lines · Bartosz Golaszewski
Quoted 38 lines · Khem Raj
Quoted 34 lines · Bartosz Golaszewski
Quoted 31 lines · Khem Raj
Quoted 15 lines · Bartosz Golaszewski
libgpiod test-suites work with the gpio-mockup kernel module. When using linux-yocto, it's enabled using the gpio/mockup.scc kernel feature. Check if this feature is present in
KERNEL_FEATUREand warn if not.Signed-off-by Bartosz Golaszewski <[email protected]>--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +0
-0meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py · line 61
Quoted 10 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +7
-0@@ -52,6 +52,13 @@ RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-py PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}" do_install_ptest() { + if [ "${PREFERRED_PROVIDER_virtual/kernel}" = "linux-yocto" ] && \ + ${@bb.utils.contains('KERNEL_FEATURES', 'features/gpio/mockup.scc', 'false', 'true',d)}; then + bbwarn "libgpiod test-suites need the gpio-mockup +module and will not work without it. Consider adding +'features/gpio/mockup.scc' to KERNEL_FEATURES" + fi +perhaps turn this into a bbnote something like what libbpf is doing see
http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-kernel/libbpf/libbpf_0.3.bb?h=masterQuoted 8 lines
Quoted 5 lines
I really think that a warning is in order here. The ptests won't work without this module. At the same time we can't really skip the package altogether because the build may be using a different kernel recipe with its own defconfig - this is why we first check if we're using linux-yocto.
It should check for module being built in kernel irrespective of Linux yocto that is right but we perhaps need a logic to consider the case where I might have a kernel without this option and distro is using ptest feature
No, we should not check for the module if we're not using linux-yocto because in this case we most likely won't be using yocto-linux-cache.
Quoted 9 lines
Quoted 3 lines
For the second part - a warning doesn't really stop the build - do you really think it's too much? I mean, I can change it into a bbnote but I don't see why.
I don't like warnings they mean same as errors in some ways, So either have linux-yocto enable this module or turn it into a note
see AB https://autobuilder.yoctoproject.org/typhoon/#/builders/88/builds/1309
it should be green :)So I went on to add it to OE-core and noticed this:
4e03f041396121f6143fd81bf5e429015146bfdcAuthor: Sakib Sajal <[email protected]> Date: Wed Jan 27 13:03:32 2021 -0500linux-yocto*: add features/gpio/mockup.scc to
KERNEL_FEATURESadd features/gpio/mockup.scc to
KERNEL_FEATURESwhen ptest is enabled as it is required for testing libgpiod.(From OE-Core rev:
906cde06bee319e788c76abb8f8295ed9921ccb1)Signed-off-by Sakib Sajal <[email protected]>Signed-off-by Richard Purdie <[email protected]>So I wonder - why do I see my warning if I don't add gpio-mockup to kernel features myself? A quick check shows this:
$ bitbake -e core-image-minimal | grep ^DISTRO_FEATURES= DISTRO_FEATURES="acl alsa argp bluetooth debuginfod ext2 ipv4 ipv6 largefile pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g nfc x11 vfat seccomp largefile opengl ptest multiarch wayland vulkan systemd pam pulseaudio gobject-introspection-data ldconfig" $ bitbake -e core-image-minimal | grep ^KERNEL_FEATURES= KERNEL_FEATURES=""
Quoted 4 lines
I don't have the time to debug this today but it looks like a bug - the feature should actually be pulled in automatically.
Bart
Ok I see now. libgpiod recipe sees the global KERNEL_FEATURES as set in local.conf and distro/machine config files, meanwhile linux-yocto gets the global value and extends it with ptest features but only locally, so libgpiod never sees those features even though they are indeed included. In that case I suppose it's fine to revert this change, I'll send a patch.
Bartosz
PATCH 9/9 libgpiod: ptest: add kernel-modules to RRECOMMENDS
In reply to Bartosz Golaszewskilibgpiod needs the gpio-mockup kernel module to be loadable (not built-in). Add kernel-modules to RRECOMMENDS.
--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 1 + 1 file changed, 1 insertion(+)
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +1 -0
@@ -48,6 +48,7 @@ FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so" FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '', d)}" +RRECOMMENDS_${PN}-ptest += "kernel-modules" PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}"
Signature · 1 line
2.30.1
Re: [meta-oe][PATCH 9/9] libgpiod: ptest: add kernel-modules to RRECOMMENDS
Quoted 14 lines · Bartosz Golaszewski
libgpiod needs the gpio-mockup kernel module to be loadable (not built-in). Add kernel-modules to RRECOMMENDS.
Signed-off-by Bartosz Golaszewski <[email protected]>--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 1 + 1 file changed, 1 insertion(+)meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +0
-0
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so" · line 52
Quoted 5 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +1
-0@@ -48,6 +48,7 @@ FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so" FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '', d)}" +RRECOMMENDS_${PN}-ptest += "kernel-modules"
do we need full swath of modules ? or can we be surgical ?
Quoted 5 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +0
-1PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}" --2.30.1
Re: [meta-oe][PATCH 9/9] libgpiod: ptest: add kernel-modules to RRECOMMENDS
Quoted 18 lines · Khem Raj
Quoted 16 lines · Bartosz Golaszewski
libgpiod needs the gpio-mockup kernel module to be loadable (not built-in). Add kernel-modules to RRECOMMENDS.
Signed-off-by Bartosz Golaszewski <[email protected]>--- meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 1 + 1 file changed, 1 insertion(+)meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +0
-0@@ -48,6 +48,7 @@ FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so" FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
Quoted 6 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so" · line 52
Quoted 3 lines
meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +1
-0RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '', d)}" +RRECOMMENDS_${PN}-ptest += "kernel-modules"do we need full swath of modules ? or can we be surgical ?
No, we don't - all we need is kernel-module-gpio-mockup. I wasn't aware that each module is packaged separately. I will send a follow-up just for this patch.
Bart
Hi Bartosz
I am seeing this warning on AB
stdio: WARNING: libgpiod-1.6.3-r0 do_install_ptest_base: libgpiod test-suites need the gpio-mockup
Can you look further into this please ?
Quoted 26 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
This series improves the recipe for libgpiod with primary focus on ptest parts. We bring in support for all test-suites available in the package. We also tweak the recipe in other places to make it more readable and robust in general.
Bartosz Golaszewski (9):
libgpiod: coding style fixes
libgpiod: list all packages in a single assignment
libgpiod: fix RRECOMMENDS for python bindings
libgpiod: correctly split output files into packages
libgpiod: add RDEPENDS for tests
libgpiod: redirect stdout from the ptest executable to a file
libgpiod: ptest: run all test-suites if possible
libgpiod: ptest: warn if the gpio-mockup kernel module is not selected
libgpiod: ptest: add kernel-modules to RRECOMMENDS.../recipes-support/libgpiod/files/run-ptest | 21 ++++--- .../libgpiod/libgpiod_1.6.3.bb | 61 +++++++++++++++---- 2 files changed, 64 insertions(+), 18 deletions(-)--
2.30.1
Quoted 10 lines · Khem Raj
Hi Bartosz
I am seeing this warning on AB
stdio: WARNING: libgpiod-1.6.3-r0
do_install_ptest_base: libgpiod test-suites need the gpio-mockupCan you look further into this please ?
I don't have to look into it - this is the behavior introduced by patch 8/9. If using linux-yocto, building the ptest package for libgpiod doesn't make sense without including feature/gpio/mockup.scc in KERNEL_FEATURES. The test-suites simply won't work. I don't see any way for implicitly pulling in kernel features so I thought that the second best option is to warn if we don't detect it as already configured.
Bart
A message that is not in the archive (sent off-list or not yet received): CAMpxmJXBzL8QaAoLAB6cD8W8_mbBhjJ+d=gM8CGvQkBSPLDPtw@mail.gmail.com
Quoted 12 lines · Bartosz Golaszewski
Quoted 10 lines · Khem Raj
Hi Bartosz
I am seeing this warning on AB
stdio: WARNING: libgpiod-1.6.3-r0
do_install_ptest_base: libgpiod test-suites need the gpio-mockupCan you look further into this please ?
Quoted 7 lines
I don't have to look into it - this is the behavior introduced by patch 8/9. If using linux-yocto, building the ptest package for libgpiod doesn't make sense without including feature/gpio/mockup.scc in
KERNEL_FEATURES. The test-suites simply won't work. I don't see any way for implicitly pulling in kernel features so I thought that the second best option is to warn if we don't detect it as already configured.
Right some way to inform user would be improvement
Quoted 4 lines
Bart