All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/5] Add module build support for KUnit IIO tests
@ 2022-07-10  1:31 Liam Beguin
  2022-07-10  1:31 ` [PATCH v1 1/5] iio: test: rescale: add MODULE_* information Liam Beguin
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Liam Beguin @ 2022-07-10  1:31 UTC (permalink / raw
  To: liambeguin, jic23, geert; +Cc: peda, linux-iio, linux-kernel

KUnit tests can be built as modules allowing to execute them at runtime
by simply loading the modules.

Module build support is added with the following steps:
 - add MODULE_* in the KUnit test drivers,
 - export namespace symbols from the iio-rescale, and
 - drop Kconfig built-in only constraints,

Along with the module build changes, this series also addresses
minor touch ups such as:
 - rename IIO_TEST_FORMAT Kconfig to match naming conventions,
 - use tabs to indent the IIO_FORMAT_KUNIT_TEST Kconfig,
 - drop ARCH=um mention from the IIO_RESCALE_KUNIT_TEST Kconfig help
   section,
 - add IIO_FORMAT_KUNIT_TEST Kconfig help section,
 - update dependency on KUNIT_ALL_TESTS to match the documentation.

All these are done in commit 05/05. I could rework the commit, but given
that these changes are pretty minor, it seemed okay to do it all at
once.

Cheers,
Liam

Liam Beguin (5):
  iio: test: rescale: add MODULE_* information
  iio: test: format: add MODULE_* information
  iio: test: format: follow CONFIG_ naming convention
  iio: afe: rescale: export symbols used during testing
  iio: test: rework Kconfig to support modules

 drivers/iio/afe/iio-rescale.c       |  2 ++
 drivers/iio/test/Kconfig            | 26 ++++++++++++++++++--------
 drivers/iio/test/Makefile           |  2 +-
 drivers/iio/test/iio-test-format.c  |  4 ++++
 drivers/iio/test/iio-test-rescale.c |  5 +++++
 5 files changed, 30 insertions(+), 9 deletions(-)


base-commit: b1c428b6c3684ee8ddf4137d68b3e8d51d2a700f
-- 
2.35.1.4.g5d01301f2b86


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 1/5] iio: test: rescale: add MODULE_* information
  2022-07-10  1:31 [PATCH v1 0/5] Add module build support for KUnit IIO tests Liam Beguin
@ 2022-07-10  1:31 ` Liam Beguin
  2022-07-10  1:31 ` [PATCH v1 2/5] iio: test: format: " Liam Beguin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Liam Beguin @ 2022-07-10  1:31 UTC (permalink / raw
  To: liambeguin, jic23, geert; +Cc: peda, linux-iio, linux-kernel

In preparation for module support, add missing MODULE_* information.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
---
 drivers/iio/test/iio-test-rescale.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/iio/test/iio-test-rescale.c b/drivers/iio/test/iio-test-rescale.c
index 0b6699bfd553..735e2f97af18 100644
--- a/drivers/iio/test/iio-test-rescale.c
+++ b/drivers/iio/test/iio-test-rescale.c
@@ -708,3 +708,7 @@ static struct kunit_suite iio_rescale_test_suite = {
 	.test_cases = iio_rescale_test_cases,
 };
 kunit_test_suite(iio_rescale_test_suite);
+
+MODULE_AUTHOR("Liam Beguin <liambeguin@gmail.com>");
+MODULE_DESCRIPTION("Test IIO rescale conversion functions");
+MODULE_LICENSE("GPL v2");
-- 
2.35.1.4.g5d01301f2b86


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 2/5] iio: test: format: add MODULE_* information
  2022-07-10  1:31 [PATCH v1 0/5] Add module build support for KUnit IIO tests Liam Beguin
  2022-07-10  1:31 ` [PATCH v1 1/5] iio: test: rescale: add MODULE_* information Liam Beguin
@ 2022-07-10  1:31 ` Liam Beguin
  2022-07-10  1:31 ` [PATCH v1 3/5] iio: test: format: follow CONFIG_ naming convention Liam Beguin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Liam Beguin @ 2022-07-10  1:31 UTC (permalink / raw
  To: liambeguin, jic23, geert; +Cc: peda, linux-iio, linux-kernel

In preparation for module support, add missing MODULE_* information.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
---
 drivers/iio/test/iio-test-format.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/iio/test/iio-test-format.c b/drivers/iio/test/iio-test-format.c
index 237321436b83..fc67e6b73df7 100644
--- a/drivers/iio/test/iio-test-format.c
+++ b/drivers/iio/test/iio-test-format.c
@@ -265,3 +265,7 @@ static struct kunit_suite iio_format_test_suite = {
 	.test_cases = iio_format_test_cases,
 };
 kunit_test_suite(iio_format_test_suite);
+
+MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
+MODULE_DESCRIPTION("Test IIO formatting functions");
+MODULE_LICENSE("GPL v2");
-- 
2.35.1.4.g5d01301f2b86


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 3/5] iio: test: format: follow CONFIG_ naming convention
  2022-07-10  1:31 [PATCH v1 0/5] Add module build support for KUnit IIO tests Liam Beguin
  2022-07-10  1:31 ` [PATCH v1 1/5] iio: test: rescale: add MODULE_* information Liam Beguin
  2022-07-10  1:31 ` [PATCH v1 2/5] iio: test: format: " Liam Beguin
@ 2022-07-10  1:31 ` Liam Beguin
  2022-07-10  1:31 ` [PATCH v1 4/5] iio: afe: rescale: export symbols used during testing Liam Beguin
  2022-07-10  1:31 ` [PATCH v1 5/5] iio: test: rework Kconfig to support modules Liam Beguin
  4 siblings, 0 replies; 7+ messages in thread
From: Liam Beguin @ 2022-07-10  1:31 UTC (permalink / raw
  To: liambeguin, jic23, geert; +Cc: peda, linux-iio, linux-kernel

The KUnit documentation indicates that all KUnit Kconfig entries must
match CONFIG_<name>_KUNIT_TEST: where <name> is the name of the test
suite. Rename the IIO_TEST_FORMAT configuration accordingly.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
---
 drivers/iio/test/Kconfig  | 2 +-
 drivers/iio/test/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/test/Kconfig b/drivers/iio/test/Kconfig
index 4c66c3f18c34..7dbf51bc4934 100644
--- a/drivers/iio/test/Kconfig
+++ b/drivers/iio/test/Kconfig
@@ -14,6 +14,6 @@ config IIO_RESCALE_KUNIT_TEST
 	  This takes advantage of ARCH=um to run tests and should be used by
 	  developers to tests their changes to the rescaling logic.
 
-config IIO_TEST_FORMAT
+config IIO_FORMAT_KUNIT_TEST
         bool "Test IIO formatting functions"
         depends on KUNIT=y
diff --git a/drivers/iio/test/Makefile b/drivers/iio/test/Makefile
index 880360f8d02c..d76eaf36da82 100644
--- a/drivers/iio/test/Makefile
+++ b/drivers/iio/test/Makefile
@@ -5,5 +5,5 @@
 
 # Keep in alphabetical order
 obj-$(CONFIG_IIO_RESCALE_KUNIT_TEST) += iio-test-rescale.o
-obj-$(CONFIG_IIO_TEST_FORMAT) += iio-test-format.o
+obj-$(CONFIG_IIO_FORMAT_KUNIT_TEST) += iio-test-format.o
 CFLAGS_iio-test-format.o += $(DISABLE_STRUCTLEAK_PLUGIN)
-- 
2.35.1.4.g5d01301f2b86


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 4/5] iio: afe: rescale: export symbols used during testing
  2022-07-10  1:31 [PATCH v1 0/5] Add module build support for KUnit IIO tests Liam Beguin
                   ` (2 preceding siblings ...)
  2022-07-10  1:31 ` [PATCH v1 3/5] iio: test: format: follow CONFIG_ naming convention Liam Beguin
@ 2022-07-10  1:31 ` Liam Beguin
  2022-07-10  1:31 ` [PATCH v1 5/5] iio: test: rework Kconfig to support modules Liam Beguin
  4 siblings, 0 replies; 7+ messages in thread
From: Liam Beguin @ 2022-07-10  1:31 UTC (permalink / raw
  To: liambeguin, jic23, geert; +Cc: peda, linux-iio, linux-kernel

In preparation for module support, export symbols use during testing.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
---
 drivers/iio/afe/iio-rescale.c       | 2 ++
 drivers/iio/test/iio-test-rescale.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c
index 6949d2151025..1f280c360701 100644
--- a/drivers/iio/afe/iio-rescale.c
+++ b/drivers/iio/afe/iio-rescale.c
@@ -107,6 +107,7 @@ int rescale_process_scale(struct rescale *rescale, int scale_type,
 		return -EOPNOTSUPP;
 	}
 }
+EXPORT_SYMBOL_NS_GPL(rescale_process_scale, IIO_RESCALE);
 
 int rescale_process_offset(struct rescale *rescale, int scale_type,
 			   int scale, int scale2, int schan_off,
@@ -140,6 +141,7 @@ int rescale_process_offset(struct rescale *rescale, int scale_type,
 		return -EOPNOTSUPP;
 	}
 }
+EXPORT_SYMBOL_NS_GPL(rescale_process_offset, IIO_RESCALE);
 
 static int rescale_read_raw(struct iio_dev *indio_dev,
 			    struct iio_chan_spec const *chan,
diff --git a/drivers/iio/test/iio-test-rescale.c b/drivers/iio/test/iio-test-rescale.c
index 735e2f97af18..cc782ccff880 100644
--- a/drivers/iio/test/iio-test-rescale.c
+++ b/drivers/iio/test/iio-test-rescale.c
@@ -712,3 +712,4 @@ kunit_test_suite(iio_rescale_test_suite);
 MODULE_AUTHOR("Liam Beguin <liambeguin@gmail.com>");
 MODULE_DESCRIPTION("Test IIO rescale conversion functions");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(IIO_RESCALE);
-- 
2.35.1.4.g5d01301f2b86


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 5/5] iio: test: rework Kconfig to support modules
  2022-07-10  1:31 [PATCH v1 0/5] Add module build support for KUnit IIO tests Liam Beguin
                   ` (3 preceding siblings ...)
  2022-07-10  1:31 ` [PATCH v1 4/5] iio: afe: rescale: export symbols used during testing Liam Beguin
@ 2022-07-10  1:31 ` Liam Beguin
  2022-07-16 18:03   ` Jonathan Cameron
  4 siblings, 1 reply; 7+ messages in thread
From: Liam Beguin @ 2022-07-10  1:31 UTC (permalink / raw
  To: liambeguin, jic23, geert; +Cc: peda, linux-iio, linux-kernel

Rework the IIO test Kconfig to support building KUnit tests as modules.
This lets users execute tests at runtime in addition to the usual
tools/testing/kunit/kunit.py script.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
---
 drivers/iio/test/Kconfig | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/test/Kconfig b/drivers/iio/test/Kconfig
index 7dbf51bc4934..82924727b2cc 100644
--- a/drivers/iio/test/Kconfig
+++ b/drivers/iio/test/Kconfig
@@ -5,15 +5,25 @@
 
 # Keep in alphabetical order
 config IIO_RESCALE_KUNIT_TEST
-	bool "Test IIO rescale conversion functions"
-	depends on KUNIT=y && IIO_RESCALE=y
+	tristate "Test IIO rescale conversion functions" if !KUNIT_ALL_TESTS
+	depends on KUNIT && IIO_RESCALE
 	default KUNIT_ALL_TESTS
 	help
-	  If you want to run tests on the iio-rescale code say Y here.
+	  build unit tests for the iio-rescale code.
 
-	  This takes advantage of ARCH=um to run tests and should be used by
-	  developers to tests their changes to the rescaling logic.
+	  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_FORMAT_KUNIT_TEST
-        bool "Test IIO formatting functions"
-        depends on KUNIT=y
+	tristate "Test IIO formatting functions" if !KUNIT_ALL_TESTS
+	depends on KUNIT
+	default KUNIT_ALL_TESTS
+	help
+	  build unit tests for the IIO formatting functions.
+
+	  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.
-- 
2.35.1.4.g5d01301f2b86


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 5/5] iio: test: rework Kconfig to support modules
  2022-07-10  1:31 ` [PATCH v1 5/5] iio: test: rework Kconfig to support modules Liam Beguin
@ 2022-07-16 18:03   ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2022-07-16 18:03 UTC (permalink / raw
  To: Liam Beguin; +Cc: geert, peda, linux-iio, linux-kernel

On Sat,  9 Jul 2022 21:31:09 -0400
Liam Beguin <liambeguin@gmail.com> wrote:

> Rework the IIO test Kconfig to support building KUnit tests as modules.
> This lets users execute tests at runtime in addition to the usual
> tools/testing/kunit/kunit.py script.
> 
> Signed-off-by: Liam Beguin <liambeguin@gmail.com>
One trivial comment inline.  Fixed that up and applied to the togreg branch
of iio.git. Not I'll only push out as testing for now as will be rebasing
the tree after rc1.

Jonathan


> ---
>  drivers/iio/test/Kconfig | 24 +++++++++++++++++-------
>  1 file changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/test/Kconfig b/drivers/iio/test/Kconfig
> index 7dbf51bc4934..82924727b2cc 100644
> --- a/drivers/iio/test/Kconfig
> +++ b/drivers/iio/test/Kconfig
> @@ -5,15 +5,25 @@
>  
>  # Keep in alphabetical order
>  config IIO_RESCALE_KUNIT_TEST
> -	bool "Test IIO rescale conversion functions"
> -	depends on KUNIT=y && IIO_RESCALE=y
> +	tristate "Test IIO rescale conversion functions" if !KUNIT_ALL_TESTS
> +	depends on KUNIT && IIO_RESCALE
>  	default KUNIT_ALL_TESTS
>  	help
> -	  If you want to run tests on the iio-rescale code say Y here.
> +	  build unit tests for the iio-rescale code.

Build

>  
> -	  This takes advantage of ARCH=um to run tests and should be used by
> -	  developers to tests their changes to the rescaling logic.
> +	  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_FORMAT_KUNIT_TEST
> -        bool "Test IIO formatting functions"
> -        depends on KUNIT=y
> +	tristate "Test IIO formatting functions" if !KUNIT_ALL_TESTS
> +	depends on KUNIT
> +	default KUNIT_ALL_TESTS
> +	help
> +	  build unit tests for the IIO formatting functions.
> +
> +	  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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-07-16 17:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-10  1:31 [PATCH v1 0/5] Add module build support for KUnit IIO tests Liam Beguin
2022-07-10  1:31 ` [PATCH v1 1/5] iio: test: rescale: add MODULE_* information Liam Beguin
2022-07-10  1:31 ` [PATCH v1 2/5] iio: test: format: " Liam Beguin
2022-07-10  1:31 ` [PATCH v1 3/5] iio: test: format: follow CONFIG_ naming convention Liam Beguin
2022-07-10  1:31 ` [PATCH v1 4/5] iio: afe: rescale: export symbols used during testing Liam Beguin
2022-07-10  1:31 ` [PATCH v1 5/5] iio: test: rework Kconfig to support modules Liam Beguin
2022-07-16 18:03   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.