On Wed, 29 Jul 2026 09:25:34 +0100 Rodrigo Alencar via B4 Relay <[email protected]> wrote:
> From: Rodrigo Alencar <[email protected]> > > Add a KUnit test suite covering __iio_chan_prefix_emit(), the helper > that builds IIO sysfs attribute name prefixes from an iio_chan_spec. > The suite groups cases by the enum iio_shared_by mode it exercises: > > - IIO_SHARED_BY_ALL: produces an empty prefix. > - IIO_SHARED_BY_DIR: emits direction only ("in" / "out"). > - IIO_SHARED_BY_TYPE: emits "<dir>_<type>" and the differential > "<dir>_<type>-<type>" variant. > - IIO_SEPARATE: covers the full matrix of indexed, differential, > modified, output and extend_name combinations, plus the two > documented error paths (differential without indexed, differential > with modifier). > > A final case exercises the seq_buf overflow path by passing an > undersized buffer and expects -EOVERFLOW. > > Also, an entry is created under MAINTAINERS dedicated to tests for IIO > core helpers. > > Signed-off-by: Rodrigo Alencar <[email protected]> > * iio_device_id() - query the unique ID for the device > diff --git a/drivers/iio/test/Kconfig b/drivers/iio/test/Kconfig > index 4fc17dd0dcd7..7d2c29cc583b 100644 > --- a/drivers/iio/test/Kconfig > +++ b/drivers/iio/test/Kconfig > @@ -4,6 +4,20 @@ > # Keep in alphabetical order > +config IIO_CHANNEL_PREFIX_KUNIT_TEST > + tristate "Test IIO channel prefix" if !KUNIT_ALL_TESTS > + depends on KUNIT && IIO > + default KUNIT_ALL_TESTS > + help > + Build unit tests for __iio_chan_prefix_emit(), the helper that > + builds IIO sysfs attribute name prefixes from an iio_chan_spec. > + The tests are compiled into the IIO core module. Sashiko picked up on this being stale as now they are built as separate module. If nothing comes up I'll just delete this line whilst applying. > + > + For more information on KUnit and unit tests in general, please refer > + to the KUnit documentation in Documentation/dev-tools/kunit/. > + > + If unsure, say N. > + > config IIO_GTS_KUNIT_TEST > tristate "Test IIO gain-time-scale helpers" if !KUNIT_ALL_TESTS > depends on KUNIT

