libgpiod: modify test 'gpioset: toggle (continuous)'
PATCH v2 1/1 libgpiod: modify test 'gpioset: toggle (continuous)'
From: Joe Slater <[email protected]>
Look for level transitions when testing toggling
values because using fixed delays to assume value
changes is not reliable.
--- .../gpio-tools-test-bats-modify.patch | 67 +++++++++++++++++++ .../libgpiod/libgpiod_2.0.1.bb | 2 + 2 files changed, 69 insertions(+) create mode 100644 meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-modify.patch
meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-modify.patch new file +67 -0
@@ -0,0 +1,67 @@ +From 4fc48e743de52562cd61de6cd74181392e4e75b7 Mon Sep 17 00:00:00 2001 +From: Joe Slater <[email protected]> +Date: Fri, 19 May 2023 08:46:47 -0700 +Subject: [libgpiod][PATCH v4] gpio-tools-test.bats: 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 <[email protected]> + +Upstream-status: accepted + +Signed-off-by: Joe Slater <[email protected]> +--- + 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 +
meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb +2 -0
@@ -9,6 +9,8 @@ LIC_FILES_CHKSUM = " \ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-2.x:" +SRC_URI += "file://gpio-tools-test-bats-modify.patch" + SRC_URI[sha256sum] = "b5367d28d045b36007a4ffd42cceda4c358737ef4f2ce22b0c1d05ec57a38392" # Enable all project features for ptest
Signature · 1 line
2.25.1
Quoted 104 lines · Joe Slater via lists.openembedded.org
From: Joe Slater <[email protected]>
Look for level transitions when testing toggling
values because using fixed delays to assume value
changes is not reliable.Signed-off-by Joe Slater <[email protected]>--- .../gpio-tools-test-bats-modify.patch | 67 +++++++++++++++++++ .../libgpiod/libgpiod_2.0.1.bb | 2 + 2 files changed, 69 insertions(+) create mode 100644 meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-modify.patchmeta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-modify.patch new file +67
-0@@ -0,0 +1,67 @@ +From 4fc48e743de52562cd61de6cd74181392e4e75b7 Mon Sep 17 00:00:00 2001 +From: Joe Slater <[email protected]> +Date: Fri, 19 May 2023 08:46:47 -0700 +Subject: [libgpiod][PATCH v4] gpio-tools-test.bats: 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 <[email protected]> + +Upstream-status: accepted + +Signed-off-by: Joe Slater <[email protected]> +--- + 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 +meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb +2
-1@@ -9,6 +9,8 @@ LIC_FILES_CHKSUM = " \ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-2.x:" +SRC_URI += "file://gpio-tools-test-bats-modify.patch" + SRC_URI[sha256sum] = "b5367d28d045b36007a4ffd42cceda4c358737ef4f2ce22b0c1d05ec57a38392" # Enable all project features for ptest --2.25.1
Quoted 8 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#103152): https://lists.openembedded.org/g/openembedded-devel/message/103152
Mute This Topic: https://lists.openembedded.org/mt/99368727/3618139
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Can you take the patch as it appears upstream? With tweaked commit message and my SoB?
Bart