diff mbox series

[libgpiod,2/2] tests: add check of event offset to wait_multiple

Message ID 20201014034758.19427-3-warthog618@gmail.com
State New
Headers show
Series tests: improve wait_multiple coverage | expand

Commit Message

Kent Gibson Oct. 14, 2020, 3:47 a.m. UTC
The offset field is added for uAPI v2, so extend the test to check that
the value returned is correct.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
---
 tests/tests-event.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Bartosz Golaszewski Oct. 14, 2020, 8:50 a.m. UTC | #1
On Wed, Oct 14, 2020 at 5:48 AM Kent Gibson <warthog618@gmail.com> wrote:
>
> The offset field is added for uAPI v2, so extend the test to check that
> the value returned is correct.
>
> Signed-off-by: Kent Gibson <warthog618@gmail.com>
> ---
>  tests/tests-event.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tests/tests-event.c b/tests/tests-event.c
> index a43f865..0e5effe 100644
> --- a/tests/tests-event.c
> +++ b/tests/tests-event.c
> @@ -570,6 +570,7 @@ GPIOD_TEST_CASE(wait_multiple, 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.offset, ==, 4);
>  }
>
>  GPIOD_TEST_CASE(get_fd_when_values_requested, 0, { 8 })
> --
> 2.28.0
>

This one relies on your v2 port but since it breaks tests, I can't
apply it to master and same for this patch. We'll have to revisit this
once we figure out the new API for the library.

Bartosz
Bartosz Golaszewski Oct. 14, 2020, 1:56 p.m. UTC | #2
On Wed, Oct 14, 2020 at 5:48 AM Kent Gibson <warthog618@gmail.com> wrote:
>

> The offset field is added for uAPI v2, so extend the test to check that

> the value returned is correct.

>

> Signed-off-by: Kent Gibson <warthog618@gmail.com>

> ---

>  tests/tests-event.c | 1 +

>  1 file changed, 1 insertion(+)

>

> diff --git a/tests/tests-event.c b/tests/tests-event.c

> index a43f865..0e5effe 100644

> --- a/tests/tests-event.c

> +++ b/tests/tests-event.c

> @@ -570,6 +570,7 @@ GPIOD_TEST_CASE(wait_multiple, 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.offset, ==, 4);

>  }

>

>  GPIOD_TEST_CASE(get_fd_when_values_requested, 0, { 8 })

> --

> 2.28.0

>


Now applied to branch for-linux-v5.10-rc1. Thanks!

Bartosz
diff mbox series

Patch

diff --git a/tests/tests-event.c b/tests/tests-event.c
index a43f865..0e5effe 100644
--- a/tests/tests-event.c
+++ b/tests/tests-event.c
@@ -570,6 +570,7 @@  GPIOD_TEST_CASE(wait_multiple, 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.offset, ==, 4);
 }
 
 GPIOD_TEST_CASE(get_fd_when_values_requested, 0, { 8 })