Skip to contentSkip to conversation

libgpiod: ptest improvements

PATCH In review Bartosz Golaszewski 2 participants 22 messages Jun 2, 2021 – Jun 9, 2021 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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
index d9c251705..f51906a43 100644
@@ -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
#2 lore raw

PATCH 2/9 libgpiod: list all packages in a single assignment

In reply to Bartosz Golaszewski

Don'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
index f51906a43..e1c0e8922 100644
@@ -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
#3 lore raw

PATCH 3/9 libgpiod: fix RRECOMMENDS for python bindings

In reply to Bartosz Golaszewski

RRECOMMENDS 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
index e1c0e8922..43264782e 100644
@@ -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
#4 lore raw

PATCH 4/9 libgpiod: correctly split output files into packages

In reply to Bartosz Golaszewski

Currently, 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
index 43264782e..9e4bef7b4 100644
@@ -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
#5 lore raw

PATCH 5/9 libgpiod: add RDEPENDS for tests

In reply to Bartosz Golaszewski

The 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
index 9e4bef7b4..c0ebb8aa5 100644
@@ -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
#6 lore raw

PATCH 6/9 libgpiod: redirect stdout from the ptest executable to a file

In reply to Bartosz Golaszewski

Most 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
index 4cda05d44..3ad737dfc 100644
@@ -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
#7 lore raw

PATCH 7/9 libgpiod: ptest: run all test-suites if possible

In reply to Bartosz Golaszewski

We 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
index 3ad737dfc..60c661fc1 100644
@@ -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
index c0ebb8aa5..874453fbd 100644
@@ -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
#8 lore raw

PATCH 8/9 libgpiod: ptest: warn if the gpio-mockup kernel module is not selected

In reply to 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_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
index 874453fbd..febf625a6 100644
@@ -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
#16 lore raw

PATCH 9/9 libgpiod: ptest: add kernel-modules to RRECOMMENDS

In reply to Bartosz Golaszewski

libgpiod 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
index febf625a6..8dda8a2a6 100644
@@ -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
#19 lore raw
In reply to Bartosz Golaszewski

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

#20 lore raw
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-mockup

Can 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

#22 lore raw
In reply to a message not in the archive
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-mockup

Can 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

#17 lore raw

Re: [meta-oe][PATCH 9/9] libgpiod: ptest: add kernel-modules to RRECOMMENDS

In reply to Bartosz Golaszewski
Quoted 14 lines · Bartosz Golaszewski

libgpiod 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 +0 -0
index febf625a6..8dda8a2a6 100644

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 -1
 PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}"
 
--

2.30.1

#18 lore raw

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.

---
 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
index febf625a6..8dda8a2a6 100644
@@ -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 -0
 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 ?

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

#9 lore raw

Re: [meta-oe][PATCH 8/9] libgpiod: ptest: warn if the gpio-mockup kernel module is not selected

In reply to Bartosz Golaszewski
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_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 +0 -0
index 874453fbd..febf625a6 100644

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 -1
     install -d ${D}${PTEST_PATH}/tests
 
     # These are the core C library tests
--

2.30.1

#10 lore raw

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_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 +0 -0
index 874453fbd..febf625a6 100644
@@ -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 -0
 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

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

#11 lore raw

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_FEATURE and warn if not.

---
 meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb | 7 +++++++
 1 file changed, 7 insertions(+)
(quoted diff) +0 -0

b/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..febf625a6 100644

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

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 -0
 PACKAGECONFIG_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 -0
 do_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

http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-kernel/libbpf/libbpf_0.3.bb?h=master

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

#12 lore raw

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_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 +0 -0
index 874453fbd..febf625a6 100644

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 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

#13 lore raw

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_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 +0 -0
index 874453fbd..febf625a6 100644
@@ -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 -0
 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

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.

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

#14 lore raw

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_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 +0 -0
index 874453fbd..febf625a6 100644

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 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

#15 lore raw

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_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 +0 -0
index 874453fbd..febf625a6 100644

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 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=""
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