aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Gibson <warthog618@gmail.com>2023-06-12 10:56:41 +0800
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2023-06-12 20:53:35 +0200
commit6e1d44723805850395c80e2b1aed7c8840451209 (patch)
tree327407198351bbcdcc565424240311be7a118edb
parentf3ea2a6809fb7c7e35e17d8d27ae25484fc8f7b2 (diff)
downloadlibgpiod-6e1d44723805850395c80e2b1aed7c8840451209.tar.gz
tools: tests: speed up continuous toggle test
The continuous toggle test was recently changed to poll the line to check for toggles, and so increase test reliability. Tighten up the test timings so the test can now also run in a significantly shorter time. And, as it is now faster, add an extra edge just to be sure. Note that the test does not need to catch every edge, it only has to check that the line is in fact toggling. Signed-off-by: Kent Gibson <warthog618@gmail.com> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-rwxr-xr-xtools/gpio-tools-test.bats10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/gpio-tools-test.bats b/tools/gpio-tools-test.bats
index a1100ec6..cc28f1ba 100755
--- a/tools/gpio-tools-test.bats
+++ b/tools/gpio-tools-test.bats
@@ -148,9 +148,9 @@ gpiosim_wait_value() {
local CHIPNAME=${GPIOSIM_CHIP_NAME[$1]}
local PORT=$GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/value
- for i in {1..15}; do
+ for i in {1..30}; do
[ "$(<$PORT)" = "$EXPECTED" ] && return
- sleep 0.1
+ sleep 0.01
done
return 1
}
@@ -1575,7 +1575,7 @@ request_release_line() {
gpiosim_set_pull sim0 4 pull-up
gpiosim_set_pull sim0 7 pull-up
- dut_run gpioset --banner --toggle 1s foo=1 bar=0 baz=0
+ dut_run gpioset --banner --toggle 100ms foo=1 bar=0 baz=0
gpiosim_check_value sim0 1 1
gpiosim_check_value sim0 4 0
@@ -1589,6 +1589,10 @@ request_release_line() {
gpiosim_wait_value sim0 1 1
gpiosim_check_value sim0 4 0
gpiosim_check_value sim0 7 0
+
+ gpiosim_wait_value sim0 1 0
+ gpiosim_check_value sim0 4 1
+ gpiosim_check_value sim0 7 1
}
@test "gpioset: toggle (terminated)" {