From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
LKML <linux-kernel@vger.kernel.org>,
linux-gpio@vger.kernel.org
Subject: Re: selftests/gpio: gpio-sim.sh: BUG: test FAILED due to recent change in sh source
Date: Tue, 11 Apr 2023 16:37:30 +0300 [thread overview]
Message-ID: <ZDVimnlgMYmeOj5L@smile.fi.intel.com> (raw)
In-Reply-To: <fe030b8e-0573-93de-88ae-38ee48d6c89f@alu.unizg.hr>
On Mon, Feb 27, 2023 at 06:51:09PM +0100, Mirsad Todorovac wrote:
> Hi,
>
> The gpio-sim.sh test appears to FAIL in a wrong way due to missing initialisation
> of shell variables:
>
> $ sudo gpio-sim.sh
> .
> .
> .
> 4. Simulated GPIO chips are functional
> 4.1. Values can be read from sysfs
> 4.2. Bias settings work correctly
> cat: /sys/devices/platform/gpio-sim.0/gpiochip18/sim_gpio0/value: No such file or directory
> ./gpio-sim.sh: line 393: test: =: unary operator expected
> bias setting does not work
> GPIO gpio-sim test FAIL
> $
>
> This patch fixed the issue:
>
> diff --git a/tools/testing/selftests/gpio/gpio-sim.sh b/tools/testing/selftests/gpio/gpio-sim.sh
> index 9f539d454ee4..fa2ce2b9dd5f 100755
> --- a/tools/testing/selftests/gpio/gpio-sim.sh
> +++ b/tools/testing/selftests/gpio/gpio-sim.sh
> @@ -389,6 +389,9 @@ create_chip chip
> create_bank chip bank
> set_num_lines chip bank 8
> enable_chip chip
> +DEVNAME=`configfs_dev_name chip`
> +CHIPNAME=`configfs_chip_name chip bank`
> +SYSFS_PATH="/sys/devices/platform/$DEVNAME/$CHIPNAME/sim_gpio0/value"
> $BASE_DIR/gpio-mockup-cdev -b pull-up /dev/`configfs_chip_name chip bank` 0
> test `cat $SYSFS_PATH` = "1" || fail "bias setting does not work"
> remove_chip chip
>
> ... after which the test passed:
>
> 4. Simulated GPIO chips are functional
> 4.1. Values can be read from sysfs
> 4.2. Bias settings work correctly
> GPIO gpio-sim test PASS
>
> Which I believe proves that the bug was in the script and not in the gpio-sim driver.
I agree with the analysis. Bart, seems to me that it might be the case, but
I want to amend the fix a bit.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2023-04-11 13:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-27 17:51 selftests/gpio: gpio-sim.sh: BUG: test FAILED due to recent change in sh source Mirsad Todorovac
2023-04-11 13:37 ` Andy Shevchenko [this message]
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=ZDVimnlgMYmeOj5L@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=brgl@bgdev.pl \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mirsad.todorovac@alu.unizg.hr \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox