diff mbox series

[v3,meta-oe,1/1] libgpiod: modify test 'gpioset: toggle (continuous)'

Message ID 20230614140611.2415960-1-joe.slater@windriver.com
State Under Review
Headers show
Series [v3,meta-oe,1/1] libgpiod: modify test 'gpioset: toggle (continuous)' | expand

Commit Message

Slater, Joseph June 14, 2023, 2:06 p.m. UTC
From: Joe Slater <joe.slater@windriver.com>

Look for level transitions when testing toggling
values because using fixed delays to assume value
changes is not reliable.

Signed-off-by: Joe Slater <joe.slater@windriver.com>
---
 .../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

Comments

Bartosz Golaszewski June 14, 2023, 3:13 p.m. UTC | #1
On Wed, Jun 14, 2023 at 4:06 PM <joe.slater@windriver.com> wrote:
>
> From: Joe Slater <joe.slater@windriver.com>
>
> Look for level transitions when testing toggling
> values because using fixed delays to assume value
> changes is not reliable.
>
> Signed-off-by: Joe Slater <joe.slater@windriver.com>
> ---
>  .../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
>
> diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-modify.patch b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-modify.patch
> new file mode 100644
> index 0000000000..4d49467968
> --- /dev/null
> +++ b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-modify.patch
> @@ -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
> +
> diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb b/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> index 337554cd89..6958f2d841 100644
> --- a/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> +++ b/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> @@ -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
>
Reluctant:

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Although, I'm asking myself - why do you need this? Have you seen any
failures with ptest? Can this wait for a full release?

Bart
Slater, Joseph June 14, 2023, 3:41 p.m. UTC | #2
> -----Original Message-----
> From: Bartosz Golaszewski <brgl@bgdev.pl>
> Sent: Wednesday, June 14, 2023 8:13 AM
> To: Slater, Joseph <joe.slater@windriver.com>
> Cc: openembedded-devel@lists.openembedded.org; MacLeod, Randy
> <Randy.MacLeod@windriver.com>
> Subject: Re: [v3][meta-oe][PATCH 1/1] libgpiod: modify test 'gpioset: toggle
> (continuous)'
> 
> On Wed, Jun 14, 2023 at 4:06 PM <joe.slater@windriver.com> wrote:
> >
> > From: Joe Slater <joe.slater@windriver.com>
> >
> > Look for level transitions when testing toggling values because using
> > fixed delays to assume value changes is not reliable.
> >
> > Signed-off-by: Joe Slater <joe.slater@windriver.com>
> > ---
> >  .../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-mod
> > ify.patch
> >
> > diff --git
> > a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-m
> > odify.patch
> > b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-m
> > odify.patch
> > new file mode 100644
> > index 0000000000..4d49467968
> > --- /dev/null
> > +++ b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-ba
> > +++ ts-modify.patch
> > @@ -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
> > +
> > diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> > b/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> > index 337554cd89..6958f2d841 100644
> > --- a/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> > +++ b/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> > @@ -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
> >
> Reluctant:
> 
> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> Although, I'm asking myself - why do you need this? Have you seen any failures
> with ptest? Can this wait for a full release?

[Slater, Joseph] 
Yes, we have seen failures.  It is not my call as to when they need to be fixed.  I can understand meta-oe wanting to wait for a release.  If that is the case, I'll have to see what people want to do locally as a temporary fix.

Joe

> 
> Bart
Bartosz Golaszewski June 15, 2023, 7:35 a.m. UTC | #3
On Wed, Jun 14, 2023 at 5:41 PM Slater, Joseph <joe.slater@windriver.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Bartosz Golaszewski <brgl@bgdev.pl>
> > Sent: Wednesday, June 14, 2023 8:13 AM
> > To: Slater, Joseph <joe.slater@windriver.com>
> > Cc: openembedded-devel@lists.openembedded.org; MacLeod, Randy
> > <Randy.MacLeod@windriver.com>
> > Subject: Re: [v3][meta-oe][PATCH 1/1] libgpiod: modify test 'gpioset: toggle
> > (continuous)'
> >
> > On Wed, Jun 14, 2023 at 4:06 PM <joe.slater@windriver.com> wrote:
> > >
> > > From: Joe Slater <joe.slater@windriver.com>
> > >
> > > Look for level transitions when testing toggling values because using
> > > fixed delays to assume value changes is not reliable.
> > >
> > > Signed-off-by: Joe Slater <joe.slater@windriver.com>
> > > ---
> > >  .../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-mod
> > > ify.patch
> > >
> > > diff --git
> > > a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-m
> > > odify.patch
> > > b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-m
> > > odify.patch
> > > new file mode 100644
> > > index 0000000000..4d49467968
> > > --- /dev/null
> > > +++ b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-ba
> > > +++ ts-modify.patch
> > > @@ -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
> > > +
> > > diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> > > b/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> > > index 337554cd89..6958f2d841 100644
> > > --- a/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> > > +++ b/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> > > @@ -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
> > >
> > Reluctant:
> >
> > Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > Although, I'm asking myself - why do you need this? Have you seen any failures
> > with ptest? Can this wait for a full release?
>
> [Slater, Joseph]
> Yes, we have seen failures.  It is not my call as to when they need to be fixed.  I can understand meta-oe wanting to wait for a release.  If that is the case, I'll have to see what people want to do locally as a temporary fix.
>

Ok, let's take it and I'll backport it to v2.0.x.

Thanks,
Bartosz
Khem Raj June 15, 2023, 2:42 p.m. UTC | #4
On Thu, Jun 15, 2023 at 12:35 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> On Wed, Jun 14, 2023 at 5:41 PM Slater, Joseph <joe.slater@windriver.com> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Bartosz Golaszewski <brgl@bgdev.pl>
> > > Sent: Wednesday, June 14, 2023 8:13 AM
> > > To: Slater, Joseph <joe.slater@windriver.com>
> > > Cc: openembedded-devel@lists.openembedded.org; MacLeod, Randy
> > > <Randy.MacLeod@windriver.com>
> > > Subject: Re: [v3][meta-oe][PATCH 1/1] libgpiod: modify test 'gpioset: toggle
> > > (continuous)'
> > >
> > > On Wed, Jun 14, 2023 at 4:06 PM <joe.slater@windriver.com> wrote:
> > > >
> > > > From: Joe Slater <joe.slater@windriver.com>
> > > >
> > > > Look for level transitions when testing toggling values because using
> > > > fixed delays to assume value changes is not reliable.
> > > >
> > > > Signed-off-by: Joe Slater <joe.slater@windriver.com>
> > > > ---
> > > >  .../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-mod
> > > > ify.patch
> > > >
> > > > diff --git
> > > > a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-m
> > > > odify.patch
> > > > b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-m
> > > > odify.patch
> > > > new file mode 100644
> > > > index 0000000000..4d49467968
> > > > --- /dev/null
> > > > +++ b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-ba
> > > > +++ ts-modify.patch
> > > > @@ -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
> > > > +
> > > > diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> > > > b/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> > > > index 337554cd89..6958f2d841 100644
> > > > --- a/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> > > > +++ b/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
> > > > @@ -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
> > > >
> > > Reluctant:
> > >
> > > Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > >
> > > Although, I'm asking myself - why do you need this? Have you seen any failures
> > > with ptest? Can this wait for a full release?
> >
> > [Slater, Joseph]
> > Yes, we have seen failures.  It is not my call as to when they need to be fixed.  I can understand meta-oe wanting to wait for a release.  If that is the case, I'll have to see what people want to do locally as a temporary fix.
> >
>
> Ok, let's take it and I'll backport it to v2.0.x.
>

thanks it is in master now

> Thanks,
> Bartosz
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#103291): https://lists.openembedded.org/g/openembedded-devel/message/103291
> Mute This Topic: https://lists.openembedded.org/mt/99528223/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-modify.patch b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-modify.patch
new file mode 100644
index 0000000000..4d49467968
--- /dev/null
+++ b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-modify.patch
@@ -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
+
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb b/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
index 337554cd89..6958f2d841 100644
--- a/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
+++ b/meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb
@@ -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