libgpiod: modify test 'gpioset: toggle (continuous)'
PATCH 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.
--- ...-ptest-modify-delays-in-toggle-tests.patch | 60 +++++++++++++++++++ .../libgpiod/libgpiod_2.0.1.bb | 2 + 2 files changed, 62 insertions(+) create mode 100644 meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-ptest-modify-delays-in-toggle-tests.patch
meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-ptest-modify-delays-in-toggle-tests.patch new file +60 -0
@@ -0,0 +1,60 @@ +From b73a79245ac0fa36b15bf3308e4ed008793ff15c Mon Sep 17 00:00:00 2001 +From: Joe Slater <[email protected]> +Date: Fri, 19 May 2023 08:46:47 -0700 +Subject: [PATCH] ptest: 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. + +Upstream-Status: pending + +Signed-off-by: Joe Slater <[email protected]> +--- + tools/gpio-tools-test.bats | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- libgpiod-2.0.orig/tools/gpio-tools-test.bats ++++ libgpiod-2.0/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]} ++ ++ for i in {1..10} ; do ++ VAL=$(<$GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/value) ++ [ "$VAL" = "$EXPECTED" ] && return ++ sleep 0.1 ++ done ++ return 1 ++} ++ + gpiosim_cleanup() { + for CHIP in ${!GPIOSIM_CHIP_NAME[@]} + do +@@ -1567,15 +1581,15 @@ request_release_line() { + gpiosim_check_value sim0 4 0 + gpiosim_check_value sim0 7 0 + +- sleep 1 +- +- gpiosim_check_value sim0 1 0 ++ # sleeping fixed amounts can be unreliable, so we ++ # sync to the toggles ++ # ++ 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 + }
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://0001-ptest-modify-delays-in-toggle-tests.patch" + SRC_URI[sha256sum] = "b5367d28d045b36007a4ffd42cceda4c358737ef4f2ce22b0c1d05ec57a38392" # Enable all project features for ptest
Signature · 1 line
2.25.1
Quoted 5 lines · On 2023-05-24 14:11, [email protected] wrote:
From: Joe Slater<[email protected]>
Look for level transitions when testing toggling
values because using fixed delays to assume value
changes is not reliable.
The updated commit log and comment below look good to me.
Please send a patch to upstream and reply to this thread with a link to that or send a commit to update the:
Upstream-Status: pending
tag.
Thanks,
../Randy
Quoted 86 lines
Signed-off-by Joe Slater<[email protected]>--- ...-ptest-modify-delays-in-toggle-tests.patch | 60 +++++++++++++++++++ .../libgpiod/libgpiod_2.0.1.bb | 2 + 2 files changed, 62 insertions(+)create mode 100644
meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-ptest-modify-delays-in-toggle-tests.patchmeta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-ptest-modify-delays-in-toggle-tests.patch new file +60
-0@@ -0,0 +1,60 @@ +From b73a79245ac0fa36b15bf3308e4ed008793ff15c Mon Sep 17 00:00:00 2001 +From: Joe Slater<[email protected]> +Date: Fri, 19 May 2023 08:46:47 -0700 +Subject: [PATCH] ptest: 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. + +Upstream-Status: pending + +Signed-off-by: Joe Slater<[email protected]> +--- + tools/gpio-tools-test.bats | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- libgpiod-2.0.orig/tools/gpio-tools-test.bats ++++ libgpiod-2.0/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]} ++ ++ for i in {1..10} ; do ++ VAL=$(<$GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/value) ++ [ "$VAL" = "$EXPECTED" ] && return ++ sleep 0.1 ++ done ++ return 1 ++} ++ + gpiosim_cleanup() { + for CHIP in ${!GPIOSIM_CHIP_NAME[@]} + do +@@ -1567,15 +1581,15 @@ request_release_line() { + gpiosim_check_value sim0 4 0 + gpiosim_check_value sim0 7 0 + +- sleep 1 +- +- gpiosim_check_value sim0 1 0 ++ # sleeping fixed amounts can be unreliable, so we ++ # sync to the toggles ++ # ++ 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 + }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://0001-ptest-modify-delays-in-toggle-tests.patch" + SRC_URI[sha256sum] = "b5367d28d045b36007a4ffd42cceda4c358737ef4f2ce22b0c1d05ec57a38392" # Enable all project features for ptest
Signature · 2 lines
# Randy MacLeod # Wind River Linux
Quoted 9 lines · Randy MacLeod via lists.openembedded.org
On 2023-05-24 14:11, [email protected] wrote:
From: Joe Slater <[email protected]>
Look for level transitions when testing toggling
values because using fixed delays to assume value
changes is not reliable.
Quoted 8 lines
The updated commit log and comment below look good to me.
Please send a patch to upstream and reply to this thread with a link to that or send a commit to update the:
Upstream-Status: pending
This patch breaks the following test for me:
✗ gpioset: toggle (continuous)
(from function `gpiosim_wait_value' in file/usr/lib/libgpiod/ptest/tests/gpio-tools-test.bats, line 155,
in test file /usr/lib/libgpiod/ptest/tests/gpio-tools-test.bats, line 1587)
`gpiosim_wait_value sim0 1 0' failed
on current master meta-openembedded. Why did this even get here? The patch did not go upstream in this form and needs some more work. Please Cc me on future patches to any of the libgpiod recipes.
In the meantime. Khem: could you please revert this?
Bart
Quoted 107 lines
tag.
Thanks,
../Randy
Signed-off-by Joe Slater <[email protected]>--- ...-ptest-modify-delays-in-toggle-tests.patch | 60 +++++++++++++++++++ .../libgpiod/libgpiod_2.0.1.bb | 2 + 2 files changed, 62 insertions(+) create mode 100644 meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-ptest-modify-delays-in-toggle-tests.patchmeta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-ptest-modify-delays-in-toggle-tests.patch new file +60
-0@@ -0,0 +1,60 @@ +From b73a79245ac0fa36b15bf3308e4ed008793ff15c Mon Sep 17 00:00:00 2001 +From: Joe Slater <[email protected]> +Date: Fri, 19 May 2023 08:46:47 -0700 +Subject: [PATCH] ptest: 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. + +Upstream-Status: pending + +Signed-off-by: Joe Slater <[email protected]> +--- + tools/gpio-tools-test.bats | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- libgpiod-2.0.orig/tools/gpio-tools-test.bats ++++ libgpiod-2.0/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]} ++ ++ for i in {1..10} ; do ++ VAL=$(<$GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/value) ++ [ "$VAL" = "$EXPECTED" ] && return ++ sleep 0.1 ++ done ++ return 1 ++} ++ + gpiosim_cleanup() { + for CHIP in ${!GPIOSIM_CHIP_NAME[@]} + do +@@ -1567,15 +1581,15 @@ request_release_line() { + gpiosim_check_value sim0 4 0 + gpiosim_check_value sim0 7 0 + +- sleep 1 +- +- gpiosim_check_value sim0 1 0 ++ # sleeping fixed amounts can be unreliable, so we ++ # sync to the toggles ++ # ++ 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 + }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://0001-ptest-modify-delays-in-toggle-tests.patch" + SRC_URI[sha256sum] = "b5367d28d045b36007a4ffd42cceda4c358737ef4f2ce22b0c1d05ec57a38392" # Enable all project features for ptest --# Randy MacLeod
# Wind River Linux-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#102793): https://lists.openembedded.org/g/openembedded-devel/message/102793
Mute This Topic: https://lists.openembedded.org/mt/99114621/3618139
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 24 lines · Bartosz Golaszewski
Quoted 9 lines · Randy MacLeod via lists.openembedded.org
On 2023-05-24 14:11, [email protected] wrote:
From: Joe Slater <[email protected]>
Look for level transitions when testing toggling
values because using fixed delays to assume value
changes is not reliable.Quoted 8 lines
The updated commit log and comment below look good to me.
Please send a patch to upstream and reply to this thread with a link to that or send a commit to update the:
Upstream-Status: pending
This patch breaks the following test for me:
Quoted 7 lines
✗ gpioset: toggle (continuous)
(from function `gpiosim_wait_value' in file/usr/lib/libgpiod/ptest/tests/gpio-tools-test.bats, line 155,
in test file/usr/lib/libgpiod/ptest/tests/gpio-tools-test.bats, line 1587)
`gpiosim_wait_value sim0 1 0' failedon current master meta-openembedded. Why did this even get here?
It was reviewed and request to upstream was also made.
We now have ptests runs for meta-oe but on a subset of recipes and they are run regularly as part of testing. So perhaps it will be good to enable ptests for
this and add it to PTESTS_FAST_META_OE in meta-oe/conf/include/ptest-packagelists-meta-oe.inc
currently this recipe is part of PTESTS_PROBLEMS_META_OE which means tests are not ready to be enabled, it will be good to sort this out for future.
The
Quoted 3 lines
patch did not go upstream in this form and needs some more work. Please Cc me on future patches to any of the libgpiod recipes.
Thanks for signing up although I am not sure how to make it visible, perhaps it would be good to
add maintainer info in the recipe header in standard way.
Quoted 2 lines
In the meantime. Khem: could you please revert this?
Yes we can.
Quoted 109 lines
Bart
Quoted 107 lines
tag.
Thanks,
../Randy
Signed-off-by Joe Slater <[email protected]>--- ...-ptest-modify-delays-in-toggle-tests.patch | 60 +++++++++++++++++++ .../libgpiod/libgpiod_2.0.1.bb | 2 + 2 files changed, 62 insertions(+) create mode 100644 meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-ptest-modify-delays-in-toggle-tests.patchmeta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-ptest-modify-delays-in-toggle-tests.patch new file +60
-0@@ -0,0 +1,60 @@ +From b73a79245ac0fa36b15bf3308e4ed008793ff15c Mon Sep 17 00:00:00 2001 +From: Joe Slater <[email protected]> +Date: Fri, 19 May 2023 08:46:47 -0700 +Subject: [PATCH] ptest: 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. + +Upstream-Status: pending + +Signed-off-by: Joe Slater <[email protected]> +--- + tools/gpio-tools-test.bats | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- libgpiod-2.0.orig/tools/gpio-tools-test.bats ++++ libgpiod-2.0/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]} ++ ++ for i in {1..10} ; do ++ VAL=$(<$GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/value) ++ [ "$VAL" = "$EXPECTED" ] && return ++ sleep 0.1 ++ done ++ return 1 ++} ++ + gpiosim_cleanup() { + for CHIP in ${!GPIOSIM_CHIP_NAME[@]} + do +@@ -1567,15 +1581,15 @@ request_release_line() { + gpiosim_check_value sim0 4 0 + gpiosim_check_value sim0 7 0 + +- sleep 1 +- +- gpiosim_check_value sim0 1 0 ++ # sleeping fixed amounts can be unreliable, so we ++ # sync to the toggles ++ # ++ 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 + }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://0001-ptest-modify-delays-in-toggle-tests.patch" + SRC_URI[sha256sum] = "b5367d28d045b36007a4ffd42cceda4c358737ef4f2ce22b0c1d05ec57a38392" # Enable all project features for ptest --# Randy MacLeod
# Wind River Linux-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#102793): https://lists.openembedded.org/g/openembedded-devel/message/102793
Mute This Topic: https://lists.openembedded.org/mt/99114621/3618139
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 36 lines · Khem Raj
Quoted 24 lines · Bartosz Golaszewski
Quoted 9 lines · Randy MacLeod via lists.openembedded.org
On 2023-05-24 14:11, [email protected] wrote:
From: Joe Slater <[email protected]>
Look for level transitions when testing toggling
values because using fixed delays to assume value
changes is not reliable.Quoted 8 lines
The updated commit log and comment below look good to me.
Please send a patch to upstream and reply to this thread with a link to that or send a commit to update the:
Upstream-Status: pending
This patch breaks the following test for me:
Quoted 7 lines
✗ gpioset: toggle (continuous)
(from function `gpiosim_wait_value' in file/usr/lib/libgpiod/ptest/tests/gpio-tools-test.bats, line 155,
in test file/usr/lib/libgpiod/ptest/tests/gpio-tools-test.bats, line 1587)
`gpiosim_wait_value sim0 1 0' failedon current master meta-openembedded. Why did this even get here?
It was reviewed and request to upstream was also made.
Quoted 8 lines
We now have ptests runs for meta-oe but on a subset of recipes and they are run regularly as part of testing. So perhaps it will be good to enable ptests for
this and add it toPTESTS_FAST_META_OEin meta-oe/conf/include/ptest-packagelists-meta-oe.inc
currently this recipe is part ofPTESTS_PROBLEMS_META_OEwhich means tests are not ready to be enabled, it will be good to sort this out for future.
Ptest for libgpiod require a kernel feature (gpio-sim module) to be enabled if using the yocto kernel. Could this pose a problem? I have an automated yocto build that runs the ptests locally but it would be great to have it on official autobuilders too.
Quoted 9 lines
The
Quoted 3 lines
patch did not go upstream in this form and needs some more work. Please Cc me on future patches to any of the libgpiod recipes.
Thanks for signing up although I am not sure how to make it visible, perhaps it would be good to
add maintainer info in the recipe header in standard way.
Will do, thanks.
Quoted 5 lines
Quoted 2 lines
In the meantime. Khem: could you please revert this?
Yes we can.
Thank you.
Bartosz
Quoted 109 lines
Quoted 109 lines
Bart
Quoted 107 lines
tag.
Thanks,
../Randy
Signed-off-by Joe Slater <[email protected]>--- ...-ptest-modify-delays-in-toggle-tests.patch | 60 +++++++++++++++++++ .../libgpiod/libgpiod_2.0.1.bb | 2 + 2 files changed, 62 insertions(+) create mode 100644 meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-ptest-modify-delays-in-toggle-tests.patchmeta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-ptest-modify-delays-in-toggle-tests.patch new file +60
-0@@ -0,0 +1,60 @@ +From b73a79245ac0fa36b15bf3308e4ed008793ff15c Mon Sep 17 00:00:00 2001 +From: Joe Slater <[email protected]> +Date: Fri, 19 May 2023 08:46:47 -0700 +Subject: [PATCH] ptest: 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. + +Upstream-Status: pending + +Signed-off-by: Joe Slater <[email protected]> +--- + tools/gpio-tools-test.bats | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- libgpiod-2.0.orig/tools/gpio-tools-test.bats ++++ libgpiod-2.0/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]} ++ ++ for i in {1..10} ; do ++ VAL=$(<$GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/value) ++ [ "$VAL" = "$EXPECTED" ] && return ++ sleep 0.1 ++ done ++ return 1 ++} ++ + gpiosim_cleanup() { + for CHIP in ${!GPIOSIM_CHIP_NAME[@]} + do +@@ -1567,15 +1581,15 @@ request_release_line() { + gpiosim_check_value sim0 4 0 + gpiosim_check_value sim0 7 0 + +- sleep 1 +- +- gpiosim_check_value sim0 1 0 ++ # sleeping fixed amounts can be unreliable, so we ++ # sync to the toggles ++ # ++ 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 + }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://0001-ptest-modify-delays-in-toggle-tests.patch" + SRC_URI[sha256sum] = "b5367d28d045b36007a4ffd42cceda4c358737ef4f2ce22b0c1d05ec57a38392" # Enable all project features for ptest --# Randy MacLeod
# Wind River Linux-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#102793): https://lists.openembedded.org/g/openembedded-devel/message/102793
Mute This Topic: https://lists.openembedded.org/mt/99114621/3618139
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-