diff options
| -rw-r--r-- | meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-tools-test-bats-modify.patch | 67 | ||||
| -rw-r--r-- | meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb | 2 |
2 files changed, 69 insertions, 0 deletions
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 @@ | |||
| 1 | From 53f9670d6af1bd0745c1df9c469b269c72607b23 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Joe Slater <joe.slater@windriver.com> | ||
| 3 | Date: Tue, 6 Jun 2023 08:04:27 -0700 | ||
| 4 | Subject: [PATCH] tools: tests: modify delays in toggle test | ||
| 5 | |||
| 6 | The test "gpioset: toggle (continuous)" uses fixed delays to test | ||
| 7 | toggling values. This is not reliable, so we switch to looking | ||
| 8 | for transitions from one value to another. | ||
| 9 | |||
| 10 | We wait for a transition up to 1.5 seconds. | ||
| 11 | |||
| 12 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | ||
| 13 | Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | ||
| 14 | |||
| 15 | Upstream-status: accepted | ||
| 16 | |||
| 17 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | ||
| 18 | --- | ||
| 19 | tools/gpio-tools-test.bats | 21 ++++++++++++++++----- | ||
| 20 | 1 file changed, 16 insertions(+), 5 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/tools/gpio-tools-test.bats b/tools/gpio-tools-test.bats | ||
| 23 | index c83ca7d..929c35a 100755 | ||
| 24 | --- a/tools/gpio-tools-test.bats | ||
| 25 | +++ b/tools/gpio-tools-test.bats | ||
| 26 | @@ -141,6 +141,20 @@ gpiosim_check_value() { | ||
| 27 | [ "$VAL" = "$EXPECTED" ] | ||
| 28 | } | ||
| 29 | |||
| 30 | +gpiosim_wait_value() { | ||
| 31 | + local OFFSET=$2 | ||
| 32 | + local EXPECTED=$3 | ||
| 33 | + local DEVNAME=${GPIOSIM_DEV_NAME[$1]} | ||
| 34 | + local CHIPNAME=${GPIOSIM_CHIP_NAME[$1]} | ||
| 35 | + local PORT=$GPIOSIM_SYSFS/$DEVNAME/$CHIPNAME/sim_gpio$OFFSET/value | ||
| 36 | + | ||
| 37 | + for i in {1..15}; do | ||
| 38 | + [ "$(<$PORT)" = "$EXPECTED" ] && return | ||
| 39 | + sleep 0.1 | ||
| 40 | + done | ||
| 41 | + return 1 | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | gpiosim_cleanup() { | ||
| 45 | for CHIP in ${!GPIOSIM_CHIP_NAME[@]} | ||
| 46 | do | ||
| 47 | @@ -1567,15 +1581,12 @@ request_release_line() { | ||
| 48 | gpiosim_check_value sim0 4 0 | ||
| 49 | gpiosim_check_value sim0 7 0 | ||
| 50 | |||
| 51 | - sleep 1 | ||
| 52 | - | ||
| 53 | - gpiosim_check_value sim0 1 0 | ||
| 54 | + gpiosim_wait_value sim0 1 0 | ||
| 55 | gpiosim_check_value sim0 4 1 | ||
| 56 | gpiosim_check_value sim0 7 1 | ||
| 57 | |||
| 58 | - sleep 1 | ||
| 59 | |||
| 60 | - gpiosim_check_value sim0 1 1 | ||
| 61 | + gpiosim_wait_value sim0 1 1 | ||
| 62 | gpiosim_check_value sim0 4 0 | ||
| 63 | gpiosim_check_value sim0 7 0 | ||
| 64 | } | ||
| 65 | -- | ||
| 66 | 2.25.1 | ||
| 67 | |||
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 = " \ | |||
| 9 | 9 | ||
| 10 | FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-2.x:" | 10 | FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-2.x:" |
| 11 | 11 | ||
| 12 | SRC_URI += "file://gpio-tools-test-bats-modify.patch" | ||
| 13 | |||
| 12 | SRC_URI[sha256sum] = "b5367d28d045b36007a4ffd42cceda4c358737ef4f2ce22b0c1d05ec57a38392" | 14 | SRC_URI[sha256sum] = "b5367d28d045b36007a4ffd42cceda4c358737ef4f2ce22b0c1d05ec57a38392" |
| 13 | 15 | ||
| 14 | # Enable all project features for ptest | 16 | # Enable all project features for ptest |
