mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-11-13 03:37:15 +00:00
libgpiod: Fix intermittent gpiocli multiple lines monitor ptest failure
test_monitor_multiple_lines_by_name has the same race which was fixed in test_monitor_all_lines_on_request: it toggles line foo twice, with line xyz in between, before reading any event. gpio-sim delivers both changes of foo as one interrupt when they happen before it is handled, so the rising edge is lost: ASSERT: '45056166795 falling "foo" 45056147828 rising "xyz"' did not match '[0-9]+ rising\s+"foo"' Wait for each event before triggering the next one. In a qemux86-64 guest this took the test from 13 of 20 runs failing to none, and ptest-runner libgpiod passed 12 of 12 runs on the rebuilt image. AI-Generated: Uses Claude Code Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
2 files changed
+55
No files matched your search
+54
@@ -0,0 +1,54 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sun, 1 Nov 2026 03:45:13 +0000
|
||||
Subject: [PATCH] dbus: tests: wait for each event in
|
||||
test_monitor_multiple_lines_by_name
|
||||
|
||||
The test pulls line foo up, line xyz up and line foo down again in quick
|
||||
succession and only then reads the monitor output, which is the same
|
||||
race test_monitor_all_lines_on_request had. Two changes of the same line
|
||||
that happen before the gpio-sim interrupt is handled are delivered as
|
||||
one interrupt, and as edge detection is set to both edges the kernel
|
||||
derives the edge type from the line value read in the handler. The
|
||||
rising edge on foo is then lost and only a falling edge is reported,
|
||||
timestamped after the rising edge on xyz:
|
||||
|
||||
ASSERT: '45056166795 falling "foo" 45056147828 rising "xyz"' did not
|
||||
match '[0-9]+ rising\s+"foo"'
|
||||
|
||||
This fails intermittently, in 13 of 20 runs in a qemux86-64 guest.
|
||||
|
||||
Wait for each event before triggering the next one. Matching the next
|
||||
line of output instead of searching all of it also makes the test
|
||||
verify that the change of line bar, which is not monitored, is ignored.
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
|
||||
---
|
||||
dbus/client/gpiocli-test.bash | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dbus/client/gpiocli-test.bash b/dbus/client/gpiocli-test.bash
|
||||
index ede69c9..ebddcbf 100755
|
||||
--- a/dbus/client/gpiocli-test.bash
|
||||
+++ b/dbus/client/gpiocli-test.bash
|
||||
@@ -1376,14 +1376,14 @@ test_monitor_multiple_lines_by_name() {
|
||||
dut_run gpiocli monitor foo xyz
|
||||
|
||||
gpiosim_set_pull sim0 1 pull-up
|
||||
+ dut_regex_match "[0-9]+ rising\\s+\"foo\""
|
||||
+
|
||||
gpiosim_set_pull sim0 5 pull-up # This should be ignored
|
||||
gpiosim_set_pull sim0 11 pull-up
|
||||
- gpiosim_set_pull sim0 1 pull-down
|
||||
+ dut_regex_match "[0-9]+ rising\\s+\"xyz\""
|
||||
|
||||
- dut_read
|
||||
- output_regex_match "[0-9]+ rising\\s+\"foo\""
|
||||
- output_regex_match "[0-9]+ rising\\s+\"xyz\""
|
||||
- output_regex_match "[0-9]+ falling\\s+\"foo\""
|
||||
+ gpiosim_set_pull sim0 1 pull-down
|
||||
+ dut_regex_match "[0-9]+ falling\\s+\"foo\""
|
||||
|
||||
gpiodbus_release_request "$request"
|
||||
}
|
||||
@@ -26,6 +26,7 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}-2.x:"
|
||||
SRC_URI += " \
|
||||
file://gpio-manager.init \
|
||||
file://0001-dbus-tests-wait-for-each-event-in-test_monitor_all_l.patch \
|
||||
file://0002-dbus-tests-wait-for-each-event-in-test_monitor_multi.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "dc48fb87cd72019745acb201599caf559556b5d913844df0ed011067d19e9a6b"
|
||||
|
||||
Reference in new issue
Block a user