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