All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: joe.slater@windriver.com
Cc: linux-gpio@vger.kernel.org, randy.macleod@windriver.com
Subject: Re: [v3][libgpiod][PATCH 1/1] gpio-tools-test.bats: modify delays in toggle test
Date: Tue, 6 Jun 2023 11:43:00 +0800	[thread overview]
Message-ID: <ZH6rRD5B2hNyXcuV@sol> (raw)
In-Reply-To: <20230605204335.4060789-1-joe.slater@windriver.com>

On Mon, Jun 05, 2023 at 01:43:35PM -0700, joe.slater@windriver.com wrote:
> From: Joe Slater <joe.slater@windriver.com>
> 
> 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.
> 

For future reference, the subject line should've been
"[libgpiod][PATCH v3]".
The version goes within the [PATCH], and 1/1 is optional unless you have
a cover letter.

> Signed-off-by: Joe Slater <joe.slater@windriver.com>
> ---

Here you would normally list the changes between revisions.
So I'm not sure what has actually changed since v1.
The loop limit went from 10 to 15?

>  tools/gpio-tools-test.bats | 24 +++++++++++++++++++-----
>  1 file changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/gpio-tools-test.bats b/tools/gpio-tools-test.bats
> index c83ca7d..05d7138 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,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
> +	#

You said you would get rid of this comment.


The patch works for me, so I'm otherwise fine with it.

Cheers,
Kent.

  reply	other threads:[~2023-06-06  3:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05 20:43 [v3][libgpiod][PATCH 1/1] gpio-tools-test.bats: modify delays in toggle test joe.slater
2023-06-06  3:43 ` Kent Gibson [this message]
2023-06-06 12:32   ` Bartosz Golaszewski
2023-06-06 12:42     ` Kent Gibson
2023-06-06 15:11   ` Slater, Joseph
2023-06-06 15:12     ` Bartosz Golaszewski
2023-06-15  9:54       ` Bartosz Golaszewski
2023-06-06 15:16 ` Bartosz Golaszewski
2023-06-06 15:19   ` Bartosz Golaszewski
2023-06-06 15:31     ` Slater, Joseph

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZH6rRD5B2hNyXcuV@sol \
    --to=warthog618@gmail.com \
    --cc=joe.slater@windriver.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=randy.macleod@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.