mbox series

[v2,0/7] selftests: gpio: rework and port to GPIO uAPI v2

Message ID 20210107025731.226017-1-warthog618@gmail.com
Headers show
Series selftests: gpio: rework and port to GPIO uAPI v2 | expand

Message

Kent Gibson Jan. 7, 2021, 2:57 a.m. UTC
Initially I just wanted to port the selftests to the latest GPIO uAPI,
but on finding that, due to dependency issues, the selftests are not built
for the buildroot environments that I do most of my GPIO testing in, I
decided to take a closer look.

The first patch is essentially a rewrite of the exising test suite.
It uses a simplified abstraction of the uAPI interfaces to allow a common
test suite to test the gpio-mockup using either of the uAPI interfaces.
The simplified cdev interface is implemented in gpio-mockup.sh, with the
actual driving of the uAPI implemented in gpio-mockup-cdev.c.
The simplified sysfs interface replaces gpio-mockup-sysfs.sh and is
loaded over the cdev implementation when selected.

The new tests should also be simpler to extend to cover new mockup
interfaces, such as the one Bart has been working on.

I have dropped support for testing modules other than gpio-mockup from
the command line options, as the tests are very gpio-mockup specific so
I didn't see any calling for it.

I have also tried to emphasise in the test output that the tests are
covering the gpio-mockup itself.  They do perform some implicit testing
of gpiolib and the uAPI interfaces, and so can be useful as smoke tests
for those, but their primary focus is the gpio-mockup.

Patches 2 through 5 do some cleaning up that is now possible with the
new implementation, including enabling building in buildroot environments.
Patch 4 doesn't strictly clean up all the old gpio references that it
could - the gpio was the only Level 1 test, so the Level 1 tests could
potentially be removed, but I was unsure if there may be other
implications to removing a whole test level, or that it may be useful
as a placeholder in case other static LDLIBS tests are added in
the future??

Patch 6 finally gets around to porting the tests to the latest GPIO uAPI.

And Patch 7 updates the config to set the CONFIG_GPIO_CDEV option that
was added in v5.10.

Cheers,
Kent.

Changes v1 -> v2 (all in patch 1 and gpio-mockup.sh unless stated
 otherwise):
 - reorder includes in gpio-mockup-cdev.c
 - a multitude of improvements to gpio-mockup.sh and gpio-mockup-sysfs.sh
   based on Andy's review comments
 - improved cleanup to ensure all child processes are killed on exit
 - added race condition prevention or mitigation including the wait in
   release_line, the retries in assert_mock, the assert_mock in set_mock,
   and the sleep in set_line

Kent Gibson (7):
  selftests: gpio: rework and simplify test implementation
  selftests: gpio: remove obsolete gpio-mockup-chardev.c
  selftests: remove obsolete build restriction for gpio
  selftests: remove obsolete gpio references from kselftest_deps.sh
  tools: gpio: remove uAPI v1 code no longer used by selftests
  selftests: gpio: port to GPIO uAPI v2
  selftests: gpio: add CONFIG_GPIO_CDEV to config

 tools/gpio/gpio-utils.c                       |  89 ----
 tools/gpio/gpio-utils.h                       |   6 -
 tools/testing/selftests/Makefile              |   9 -
 tools/testing/selftests/gpio/Makefile         |  26 +-
 tools/testing/selftests/gpio/config           |   1 +
 .../testing/selftests/gpio/gpio-mockup-cdev.c | 198 +++++++
 .../selftests/gpio/gpio-mockup-chardev.c      | 323 ------------
 .../selftests/gpio/gpio-mockup-sysfs.sh       | 168 ++----
 tools/testing/selftests/gpio/gpio-mockup.sh   | 497 ++++++++++++------
 tools/testing/selftests/kselftest_deps.sh     |   4 +-
 10 files changed, 603 insertions(+), 718 deletions(-)
 create mode 100644 tools/testing/selftests/gpio/gpio-mockup-cdev.c
 delete mode 100644 tools/testing/selftests/gpio/gpio-mockup-chardev.c

Comments

Linus Walleij Jan. 18, 2021, 3:04 p.m. UTC | #1
On Thu, Jan 7, 2021 at 3:58 AM Kent Gibson <warthog618@gmail.com> wrote:

>   selftests: gpio: rework and simplify test implementation

>   selftests: gpio: remove obsolete gpio-mockup-chardev.c

>   selftests: remove obsolete build restriction for gpio

>   selftests: remove obsolete gpio references from kselftest_deps.sh

>   tools: gpio: remove uAPI v1 code no longer used by selftests

>   selftests: gpio: port to GPIO uAPI v2

>   selftests: gpio: add CONFIG_GPIO_CDEV to config


Bartosz I think you can just merge these patches into the GPIO tree, at least
I think that is what I have done in the past.

Yours,
Linus Walleij
Kent Gibson Jan. 19, 2021, 12:34 a.m. UTC | #2
On Mon, Jan 18, 2021 at 04:04:51PM +0100, Linus Walleij wrote:
> On Thu, Jan 7, 2021 at 3:58 AM Kent Gibson <warthog618@gmail.com> wrote:

> 

> >   selftests: gpio: rework and simplify test implementation

> >   selftests: gpio: remove obsolete gpio-mockup-chardev.c

> >   selftests: remove obsolete build restriction for gpio

> >   selftests: remove obsolete gpio references from kselftest_deps.sh

> >   tools: gpio: remove uAPI v1 code no longer used by selftests

> >   selftests: gpio: port to GPIO uAPI v2

> >   selftests: gpio: add CONFIG_GPIO_CDEV to config

> 

> Bartosz I think you can just merge these patches into the GPIO tree, at least

> I think that is what I have done in the past.

> 


Could you touch up that Fixes tag in patch 1 if you merge v2?

Thanks,
Kent.
Bartosz Golaszewski Jan. 19, 2021, 10:37 a.m. UTC | #3
On Tue, Jan 19, 2021 at 1:35 AM Kent Gibson <warthog618@gmail.com> wrote:
>

> On Mon, Jan 18, 2021 at 04:04:51PM +0100, Linus Walleij wrote:

> > On Thu, Jan 7, 2021 at 3:58 AM Kent Gibson <warthog618@gmail.com> wrote:

> >

> > >   selftests: gpio: rework and simplify test implementation

> > >   selftests: gpio: remove obsolete gpio-mockup-chardev.c

> > >   selftests: remove obsolete build restriction for gpio

> > >   selftests: remove obsolete gpio references from kselftest_deps.sh

> > >   tools: gpio: remove uAPI v1 code no longer used by selftests

> > >   selftests: gpio: port to GPIO uAPI v2

> > >   selftests: gpio: add CONFIG_GPIO_CDEV to config

> >

> > Bartosz I think you can just merge these patches into the GPIO tree, at least

> > I think that is what I have done in the past.

> >

>

> Could you touch up that Fixes tag in patch 1 if you merge v2?

>

> Thanks,

> Kent.


Kent,

This doesn't apply to my for-next branch - there's a conflict in
tools/testing/selftests/gpio/Makefile, could you take a look?

Bartosz
Kent Gibson Jan. 19, 2021, 10:59 a.m. UTC | #4
On Tue, Jan 19, 2021 at 11:37:46AM +0100, Bartosz Golaszewski wrote:
> On Tue, Jan 19, 2021 at 1:35 AM Kent Gibson <warthog618@gmail.com> wrote:

> >

> > On Mon, Jan 18, 2021 at 04:04:51PM +0100, Linus Walleij wrote:

> > > On Thu, Jan 7, 2021 at 3:58 AM Kent Gibson <warthog618@gmail.com> wrote:

> > >

> > > >   selftests: gpio: rework and simplify test implementation

> > > >   selftests: gpio: remove obsolete gpio-mockup-chardev.c

> > > >   selftests: remove obsolete build restriction for gpio

> > > >   selftests: remove obsolete gpio references from kselftest_deps.sh

> > > >   tools: gpio: remove uAPI v1 code no longer used by selftests

> > > >   selftests: gpio: port to GPIO uAPI v2

> > > >   selftests: gpio: add CONFIG_GPIO_CDEV to config

> > >

> > > Bartosz I think you can just merge these patches into the GPIO tree, at least

> > > I think that is what I have done in the past.

> > >

> >

> > Could you touch up that Fixes tag in patch 1 if you merge v2?

> >

> > Thanks,

> > Kent.

> 

> Kent,

> 

> This doesn't apply to my for-next branch - there's a conflict in

> tools/testing/selftests/gpio/Makefile, could you take a look?

> 


Which is your for-next branch?

The patch set is based on and applies cleanly to gpio/for-next 7ac554888233,
so I'm not sure which branch you are targetting.

Cheers,
Kent.
Bartosz Golaszewski Jan. 19, 2021, 11:02 a.m. UTC | #5
On Tue, Jan 19, 2021 at 11:59 AM Kent Gibson <warthog618@gmail.com> wrote:
>

> On Tue, Jan 19, 2021 at 11:37:46AM +0100, Bartosz Golaszewski wrote:

> > On Tue, Jan 19, 2021 at 1:35 AM Kent Gibson <warthog618@gmail.com> wrote:

> > >

> > > On Mon, Jan 18, 2021 at 04:04:51PM +0100, Linus Walleij wrote:

> > > > On Thu, Jan 7, 2021 at 3:58 AM Kent Gibson <warthog618@gmail.com> wrote:

> > > >

> > > > >   selftests: gpio: rework and simplify test implementation

> > > > >   selftests: gpio: remove obsolete gpio-mockup-chardev.c

> > > > >   selftests: remove obsolete build restriction for gpio

> > > > >   selftests: remove obsolete gpio references from kselftest_deps.sh

> > > > >   tools: gpio: remove uAPI v1 code no longer used by selftests

> > > > >   selftests: gpio: port to GPIO uAPI v2

> > > > >   selftests: gpio: add CONFIG_GPIO_CDEV to config

> > > >

> > > > Bartosz I think you can just merge these patches into the GPIO tree, at least

> > > > I think that is what I have done in the past.

> > > >

> > >

> > > Could you touch up that Fixes tag in patch 1 if you merge v2?

> > >

> > > Thanks,

> > > Kent.

> >

> > Kent,

> >

> > This doesn't apply to my for-next branch - there's a conflict in

> > tools/testing/selftests/gpio/Makefile, could you take a look?

> >

>

> Which is your for-next branch?

>

> The patch set is based on and applies cleanly to gpio/for-next 7ac554888233,

> so I'm not sure which branch you are targetting.

>

> Cheers,

> Kent.


Linus W is not picking up patches this release - everything goes through:

    git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next

Sorry for the confusion.

Bartosz