added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,19 @@
#!/bin/sh
testbins="gpiod-test gpio-tools-test gpiod-cxx-test gpiod_py_test.py"
ptestdir=$(dirname "$(readlink -f "$0")")
cd $ptestdir/tests
for testbin in $testbins; do
if test -e ./$testbin; then
./$testbin > ./$testbin.out 2>&1
if [ $? -ne 0 ]; then
echo "FAIL: $testbin"
else
echo "PASS: $testbin"
fi
else
echo "SKIP: $testbin"
fi
done

View File

@@ -0,0 +1,67 @@
From 53f9670d6af1bd0745c1df9c469b269c72607b23 Mon Sep 17 00:00:00 2001
From: Joe Slater <joe.slater@windriver.com>
Date: Tue, 6 Jun 2023 08:04:27 -0700
Subject: [PATCH] tools: tests: modify delays in toggle test
The test "gpioset: toggle (continuous)" uses fixed delays to test
toggling values. This is not reliable, so we switch to looking
for transitions from one value to another.
We wait for a transition up to 1.5 seconds.
Signed-off-by: Joe Slater <joe.slater@windriver.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Upstream-status: accepted
Signed-off-by: Joe Slater <joe.slater@windriver.com>
---
tools/gpio-tools-test.bats | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/tools/gpio-tools-test.bats b/tools/gpio-tools-test.bats
index c83ca7d..929c35a 100755
--- a/tools/gpio-tools-test.bats
+++ b/tools/gpio-tools-test.bats
@@ -141,6 +141,20 @@ gpiosim_check_value() {
[ "$VAL" = "$EXPECTED" ]
}
+gpiosim_wait_value() {
+ local OFFSET=$2
+ local EXPECTED=$3
+ local DEVNAME=${GPIOSIM_DEV_NAME[$1]}
+ local CHIPNAME=${GPIOSIM_CHIP_NAME[$1]}
+ local PORT=$GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/value
+
+ for i in {1..15}; do
+ [ "$(<$PORT)" = "$EXPECTED" ] && return
+ sleep 0.1
+ done
+ return 1
+}
+
gpiosim_cleanup() {
for CHIP in ${!GPIOSIM_CHIP_NAME[@]}
do
@@ -1567,15 +1581,12 @@ request_release_line() {
gpiosim_check_value sim0 4 0
gpiosim_check_value sim0 7 0
- sleep 1
-
- gpiosim_check_value sim0 1 0
+ gpiosim_wait_value sim0 1 0
gpiosim_check_value sim0 4 1
gpiosim_check_value sim0 7 1
- sleep 1
- gpiosim_check_value sim0 1 1
+ gpiosim_wait_value sim0 1 1
gpiosim_check_value sim0 4 0
gpiosim_check_value sim0 7 0
}
--
2.25.1

View File

@@ -0,0 +1,24 @@
#!/bin/sh
testbins="gpiod-test gpio-tools-test gpiod-cxx-test"
ptestdir=$(dirname "$(readlink -f "$0")")
cd $ptestdir/tests
# libgpiod v2 uses gpio-sim - a configfs-based testing module. We need to
# make sure configfs is mounted before running any tests.
modprobe configfs
mountpoint /sys/kernel/config > /dev/null || mount -t configfs configfs /sys/kernel/config
for testbin in $testbins; do
if test -e ./$testbin; then
./$testbin > ./$testbin.out 2>&1
if [ $? -ne 0 ]; then
echo "FAIL: $testbin"
else
echo "PASS: $testbin"
fi
else
echo "SKIP: $testbin"
fi
done

View File

@@ -0,0 +1 @@
SRC_URI += "https://www.kernel.org/pub/software/libs/libgpiod/libgpiod-${PV}.tar.xz"

View File

@@ -0,0 +1,61 @@
SUMMARY = "C library and tools for interacting with the linux GPIO character device"
AUTHOR = "Bartosz Golaszewski <brgl@bgdev.pl>"
require libgpiod-src.inc
inherit autotools pkgconfig ptest
SRC_URI += "file://run-ptest"
PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx"
# Enable cxx bindings by default.
PACKAGECONFIG ?= " \
cxx \
${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \
"
# Always build tools - they don't have any additional
# requirements over the library.
EXTRA_OECONF = "--enable-tools"
DEPENDS += "autoconf-archive-native"
PACKAGES =+ "${PN}-tools libgpiodcxx"
FILES:${PN}-tools += " \
${bindir}/gpiodetect \
${bindir}/gpioinfo \
${bindir}/gpioget \
${bindir}/gpioset \
${bindir}/gpiomon \
"
FILES:${PN}-ptest += " \
${bindir}/gpiod-test \
${bindir}/gpio-tools-test \
${bindir}/gpio-tools-test.bats \
${bindir}/gpiod-cxx-test \
"
FILES:libgpiodcxx = "${libdir}/libgpiodcxx.so.*"
RRECOMMENDS:${PN}-ptest += "coreutils"
RDEPENDS:${PN}-ptest += "${@bb.utils.contains('PTEST_ENABLED', '1', 'bats', '', d)}"
do_install_ptest() {
install -d ${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
}

View File

@@ -0,0 +1,37 @@
require libgpiod.inc
LICENSE = "LGPL-2.1-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=2caced0b25dfefd4c601d92bd15116de"
SRC_URI[sha256sum] = "7b146e12f28fbca3df7557f176eb778c5ccf952ca464698dba8a61b2e1e3f9b5"
inherit python3native
PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,kmod udev glib-2.0 catch2"
PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3"
# Always build tools - they don't have any additional
# requirements over the library.
EXTRA_OECONF = "--enable-tools"
PACKAGES =+ "${PN}-python"
FILES:${PN}-tools += "${bindir}/gpiofind"
FILES:${PN}-ptest += " \
${bindir}/gpiod_py_test.py \
${libdir}/libgpiomockup.so.* \
"
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-module-gpio-mockup \
${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3-unittest', '', d)} \
"
RDEPENDS:${PN}-ptest += "python3-packaging"
do_install_ptest:append() {
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
}

View File

@@ -0,0 +1,29 @@
require libgpiod.inc
LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & CC-BY-SA-4.0"
LIC_FILES_CHKSUM = " \
file://LICENSES/GPL-2.0-or-later.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
file://LICENSES/LGPL-2.1-or-later.txt;md5=4b54a1fd55a448865a0b32d41598759d \
file://LICENSES/CC-BY-SA-4.0.txt;md5=fba3b94d88bfb9b81369b869a1e9a20f \
"
SRC_URI[sha256sum] = "f74cbf82038b3cb98ebeb25bce55ee2553be28194002d2a9889b9268cce2dd07"
S = "${WORKDIR}/libgpiod-2.0"
SRC_URI += "file://gpio-tools-test-bats-modify.patch"
# We must enable gpioset-interactive for all gpio-tools tests to pass
PACKAGECONFIG[tests] = "--enable-tests --enable-gpioset-interactive,--disable-tests,kmod util-linux glib-2.0 catch2 libedit"
PACKAGECONFIG[gpioset-interactive] = "--enable-gpioset-interactive,--disable-gpioset-interactive,libedit"
PACKAGES =+ "${PN}-ptest-dev"
FILES:${PN}-tools += "${bindir}/gpionotify"
FILES:${PN}-ptest += "${libdir}/libgpiosim.so.*"
FILES:${PN}-ptest-dev += "${includedir}/gpiosim.h"
RRECOMMENDS:${PN}-ptest += "kernel-module-gpio-sim"
do_install_ptest:append() {
install -m 0644 ${S}/tests/gpiosim/gpiosim.h ${D}${includedir}/gpiosim.h
}