From e52f444b5d64fa994fb654b5a6283537658bdfc3 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Wed, 7 Aug 2019 10:16:40 +0200 Subject: [PATCH] tests: event: fix the active-low switch test case Kernel commit 223ecaf140b1 ("gpiolib: fix incorrect IRQ requesting of an active-low lineevent") fixed an issue with line events not being inverted with the GPIOHANDLE_REQUEST_ACTIVE_LOW flag. This change has now been released in linux v5.2.7 and the relevant test case must be adjusted. Convert the test case to expect a falling edge event. Since the first pull change will be 0->1, it will be interpreted as such when the active-low flag is used. The minimum kernel version to run the core test-suite is now set to v5.2.7. Signed-off-by: Bartosz Golaszewski --- tests/gpiod-test.c | 4 ++-- tests/tests-event.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/gpiod-test.c b/tests/gpiod-test.c index 21e5537..7fc8744 100644 --- a/tests/gpiod-test.c +++ b/tests/gpiod-test.c @@ -16,8 +16,8 @@ #include "gpiod-test.h" #define MIN_KERNEL_MAJOR 5 -#define MIN_KERNEL_MINOR 1 -#define MIN_KERNEL_RELEASE 0 +#define MIN_KERNEL_MINOR 2 +#define MIN_KERNEL_RELEASE 7 #define MIN_KERNEL_VERSION KERNEL_VERSION(MIN_KERNEL_MAJOR, \ MIN_KERNEL_MINOR, \ MIN_KERNEL_RELEASE) diff --git a/tests/tests-event.c b/tests/tests-event.c index 51b2281..9e372cc 100644 --- a/tests/tests-event.c +++ b/tests/tests-event.c @@ -117,7 +117,7 @@ GPIOD_TEST_CASE(rising_edge_ignore_falling, 0, { 8 }) g_assert_cmpint(ev[2].event_type, ==, GPIOD_LINE_EVENT_RISING_EDGE); } -GPIOD_TEST_CASE(rising_edge_active_low, 0, { 8 }) +GPIOD_TEST_CASE(falling_edge_active_low, 0, { 8 }) { g_autoptr(GpiodTestEventThread) ev_thread = NULL; g_autoptr(gpiod_chip_struct) chip = NULL; @@ -134,7 +134,7 @@ GPIOD_TEST_CASE(rising_edge_active_low, 0, { 8 }) g_assert_nonnull(line); gpiod_test_return_if_failed(); - ret = gpiod_line_request_rising_edge_events_flags(line, + ret = gpiod_line_request_falling_edge_events_flags(line, GPIOD_TEST_CONSUMER, GPIOD_LINE_REQUEST_FLAG_ACTIVE_LOW); g_assert_cmpint(ret, ==, 0); @@ -146,7 +146,7 @@ GPIOD_TEST_CASE(rising_edge_active_low, 0, { 8 }) ret = gpiod_line_event_read(line, &ev); g_assert_cmpint(ret, ==, 0); - g_assert_cmpint(ev.event_type, ==, GPIOD_LINE_EVENT_RISING_EDGE); + g_assert_cmpint(ev.event_type, ==, GPIOD_LINE_EVENT_FALLING_EDGE); } GPIOD_TEST_CASE(get_value, 0, { 8 }) -- 2.30.2