linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [libgpiod][PATCH] bindings: python: tests: skip some reconfigure tests on older kernels
@ 2024-09-23 18:25 Vincent Fazio
  2024-09-27  8:03 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Vincent Fazio @ 2024-09-23 18:25 UTC (permalink / raw)
  To: linux-gpio; +Cc: vfazio, Vincent Fazio

Commit 40db20e added tests to ensure that lines that were either missing
from a reconfigure call or were included but had no LineSettings defined
would _not_ change configuration.

However, this functionality requires the changes from kernel commit
b44039638 to work as expected. This commit exists in the 6.10 kernel and
was backported to 6.9.8 [0].

Now, these tests are skipped if the kernel version is older than 6.9.8.

[0]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=d972e7b24a50d1f89967d5bffc3147810af9222d
Fixes: 40db20eec045 ("bindings: python: tests: extend reconfiguration tests")
Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
---
 bindings/python/tests/tests_line_request.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/bindings/python/tests/tests_line_request.py b/bindings/python/tests/tests_line_request.py
index 285c9f1..5c42676 100644
--- a/bindings/python/tests/tests_line_request.py
+++ b/bindings/python/tests/tests_line_request.py
@@ -4,9 +4,9 @@
 import errno
 import gpiod
 
-from . import gpiosim
+from . import gpiosim, current_version as linux_kernel_version
 from gpiod.line import Clock, Direction, Drive, Edge, Value
-from unittest import TestCase
+from unittest import TestCase, skipIf
 
 Pull = gpiosim.Chip.Pull
 SimVal = gpiosim.Chip.Value
@@ -549,6 +549,7 @@ class ReconfigureRequestedLines(TestCase):
         info = self.chip.get_line_info(2)
         self.assertEqual(info.direction, Direction.INPUT)
 
+    @skipIf(linux_kernel_version < "6.9.8", "Requires kernel commit b44039638 to pass properly")
     def test_reconfigure_with_default(self):
         info = self.chip.get_line_info(2)
         self.assertEqual(info.direction, Direction.OUTPUT)
@@ -568,6 +569,7 @@ class ReconfigureRequestedLines(TestCase):
         self.assertTrue(info.active_low)
         self.assertEqual(info.drive, Drive.OPEN_DRAIN)
 
+    @skipIf(linux_kernel_version < "6.9.8", "Requires kernel commit b44039638 to pass properly")
     def test_reconfigure_missing_offsets(self):
         info = self.chip.get_line_info(2)
         self.assertEqual(info.direction, Direction.OUTPUT)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [libgpiod][PATCH] bindings: python: tests: skip some reconfigure tests on older kernels
  2024-09-23 18:25 [libgpiod][PATCH] bindings: python: tests: skip some reconfigure tests on older kernels Vincent Fazio
@ 2024-09-27  8:03 ` Bartosz Golaszewski
  0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2024-09-27  8:03 UTC (permalink / raw)
  To: Vincent Fazio; +Cc: linux-gpio, Vincent Fazio

On Mon, Sep 23, 2024 at 8:27 PM Vincent Fazio <vfazio@gmail.com> wrote:
>
> Commit 40db20e added tests to ensure that lines that were either missing
> from a reconfigure call or were included but had no LineSettings defined
> would _not_ change configuration.
>
> However, this functionality requires the changes from kernel commit
> b44039638 to work as expected. This commit exists in the 6.10 kernel and
> was backported to 6.9.8 [0].
>
> Now, these tests are skipped if the kernel version is older than 6.9.8.
>
> [0]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=d972e7b24a50d1f89967d5bffc3147810af9222d
> Fixes: 40db20eec045 ("bindings: python: tests: extend reconfiguration tests")
> Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
> ---

As discussed on github: I prefer the older stable kernel branches to
have the relevant patch from Kent backported than to start adding this
kind of unmaintainable ifdiffery to tests. I see Greg already started
picking up the backports so let's drop this for now.

Bart

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-09-27  8:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23 18:25 [libgpiod][PATCH] bindings: python: tests: skip some reconfigure tests on older kernels Vincent Fazio
2024-09-27  8:03 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).