From c83573ba313815d005aeebb333c5bda08a55dabe Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Thu, 29 Aug 2019 09:41:37 +0200 Subject: [PATCH] treewide: tests: uncomment previously failing test assertions Mainline commit 2c60e6b5c924 ("gpiolib: never report open-drain/source lines as 'input' to user-space") in the linux kernel has now been backported to v5.2 stable branch and released in linux v5.2.11. We can now enable back the assertions that were previously failed in test suites (core, C++ and python). The required kernel versions must be updated as well. Signed-off-by: Bartosz Golaszewski --- bindings/cxx/tests/gpiod-cxx-test.cpp | 2 +- bindings/cxx/tests/tests-line.cpp | 3 +-- bindings/python/tests/gpiod_py_test.py | 5 ++--- tests/gpiod-test.c | 2 +- tests/tests-line.c | 12 ------------ 5 files changed, 5 insertions(+), 19 deletions(-) diff --git a/bindings/cxx/tests/gpiod-cxx-test.cpp b/bindings/cxx/tests/gpiod-cxx-test.cpp index e110a3c..11c895e 100644 --- a/bindings/cxx/tests/gpiod-cxx-test.cpp +++ b/bindings/cxx/tests/gpiod-cxx-test.cpp @@ -54,6 +54,6 @@ public: kernel_checker& operator=(kernel_checker&& other) = delete; }; -kernel_checker require_kernel(5, 2, 7); +kernel_checker require_kernel(5, 2, 11); } /* namespace */ diff --git a/bindings/cxx/tests/tests-line.cpp b/bindings/cxx/tests/tests-line.cpp index 9e7e1b0..b008c30 100644 --- a/bindings/cxx/tests/tests-line.cpp +++ b/bindings/cxx/tests/tests-line.cpp @@ -82,8 +82,7 @@ TEST_CASE("Line information can be correctly retrieved", "[line]") REQUIRE(line.offset() == 4); REQUIRE(line.name() == "gpio-mockup-A-4"); - /* FIXME Uncomment the line below once this issue is fixed in the kernel. */ - //REQUIRE(line.direction() == ::gpiod::line::DIRECTION_OUTPUT); + REQUIRE(line.direction() == ::gpiod::line::DIRECTION_OUTPUT); REQUIRE(line.active_state() == ::gpiod::line::ACTIVE_LOW); REQUIRE(line.is_requested()); REQUIRE(line.is_used()); diff --git a/bindings/python/tests/gpiod_py_test.py b/bindings/python/tests/gpiod_py_test.py index a66a227..9cc15af 100755 --- a/bindings/python/tests/gpiod_py_test.py +++ b/bindings/python/tests/gpiod_py_test.py @@ -299,8 +299,7 @@ class LineInfo(MockupTestCase): flags=flags) self.assertEqual(line.offset(), 4) self.assertEqual(line.name(), 'gpio-mockup-A-4') - # FIXME Uncomment the line below once this issue is fixed in the kernel. - #self.assertEqual(line.direction(), gpiod.Line.DIRECTION_OUTPUT) + self.assertEqual(line.direction(), gpiod.Line.DIRECTION_OUTPUT) self.assertEqual(line.active_state(), gpiod.Line.ACTIVE_LOW) self.assertEqual(line.consumer(), default_consumer) self.assertTrue(line.is_used()) @@ -655,6 +654,6 @@ class EventFileDescriptor(MockupTestCase): # if __name__ == '__main__': - check_kernel(5, 2, 7) + check_kernel(5, 2, 11) mockup = gpiomockup.Mockup() unittest.main() diff --git a/tests/gpiod-test.c b/tests/gpiod-test.c index 1d962aa..c970cfd 100644 --- a/tests/gpiod-test.c +++ b/tests/gpiod-test.c @@ -17,7 +17,7 @@ #define MIN_KERNEL_MAJOR 5 #define MIN_KERNEL_MINOR 2 -#define MIN_KERNEL_RELEASE 7 +#define MIN_KERNEL_RELEASE 11 #define MIN_KERNEL_VERSION KERNEL_VERSION(MIN_KERNEL_MAJOR, \ MIN_KERNEL_MINOR, \ MIN_KERNEL_RELEASE) diff --git a/tests/tests-line.c b/tests/tests-line.c index 7458992..4792211 100644 --- a/tests/tests-line.c +++ b/tests/tests-line.c @@ -475,14 +475,8 @@ GPIOD_TEST_CASE(misc_flags, 0, { 8 }) g_assert_true(gpiod_line_is_used(line)); g_assert_false(gpiod_line_is_open_drain(line)); g_assert_true(gpiod_line_is_open_source(line)); - /* - * FIXME Enable the line below once the open-source/drain issue is - * fixed in the kernel. - */ -/* g_assert_cmpint(gpiod_line_direction(line), ==, GPIOD_LINE_DIRECTION_OUTPUT); -*/ } GPIOD_TEST_CASE(misc_flags_work_together, 0, { 8 }) @@ -518,14 +512,8 @@ GPIOD_TEST_CASE(misc_flags_work_together, 0, { 8 }) g_assert_false(gpiod_line_is_open_source(line)); g_assert_cmpint(gpiod_line_active_state(line), ==, GPIOD_LINE_ACTIVE_STATE_LOW); - /* - * FIXME Enable the line below once the open-source/drain issue is - * fixed in the kernel. - */ -/* g_assert_cmpint(gpiod_line_direction(line), ==, GPIOD_LINE_DIRECTION_OUTPUT); -*/ gpiod_line_release(line); -- 2.30.2