public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* selftests/gpio: gpio-sim.sh: BUG: test FAILED due to recent change in sh source
@ 2023-02-27 17:51 Mirsad Todorovac
  2023-04-11 13:37 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Mirsad Todorovac @ 2023-02-27 17:51 UTC (permalink / raw)
  To: Bartosz Golaszewski; +Cc: Andy Shevchenko, LKML, linux-gpio

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.
Or I am doing something very wrong, but I got the above error on AlmaLinux 8.7
on my Lenovo desktop box with the 6.2+ latest pull Linux kernel:

[marvin@pc-mtodorov linux_torvalds]$ uname -rms
Linux 6.2.0-mglru-kmlk-andy-09238-gd2980d8d8265 x86_64

Regards,
Mirsad

-- 
Mirsad Goran Todorovac
Sistem inženjer
Grafički fakultet | Akademija likovnih umjetnosti
Sveučilište u Zagrebu

System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb, Republic of Croatia

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-11 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox