Message ID | 20240923182550.3724996-1-vfazio@xes-inc.com |
---|---|
State | New |
Headers | show |
Series | [libgpiod] bindings: python: tests: skip some reconfigure tests on older kernels | expand |
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
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)
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(-)