selftests: gpio: rework and simplify test implementation
authorKent Gibson <warthog618@gmail.com>
Tue, 19 Jan 2021 12:30:53 +0000 (20:30 +0800)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 15 Feb 2021 10:43:28 +0000 (11:43 +0100)
commit8bc395a6a2e24bfae934e43c7f968b23f9b9b55f
tree1429dd13492751fb44f0d1b5c634d6c2dd8b5081
parent27f8feea4091a733b8f6ddfe8090c8b3d7a45a15
selftests: gpio: rework and simplify test implementation

The GPIO mockup selftests are overly complicated with separate
implementations of the tests for sysfs and cdev uAPI, and with the cdev
implementation being dependent on tools/gpio and libmount.

Rework the test implementation to provide a common test suite with a
simplified pluggable uAPI interface.  The cdev implementation utilises
the GPIO uAPI directly to remove the dependence on tools/gpio.
The simplified uAPI interface removes the need for any file system mount
checks in C, and so removes the dependence on libmount.

The rework also fixes the sysfs test implementation which has been broken
since the device created in the multiple gpiochip case was split into
separate devices.

Fixes: 8a39f597bcfd ("gpio: mockup: rework device probing")
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
tools/testing/selftests/gpio/Makefile
tools/testing/selftests/gpio/gpio-mockup-cdev.c [new file with mode: 0644]
tools/testing/selftests/gpio/gpio-mockup-sysfs.sh
tools/testing/selftests/gpio/gpio-mockup.sh