All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] staging: comedi: tests: Fix a few more issues
@ 2021-04-07 17:53 Ian Abbott
  2021-04-07 17:53 ` [PATCH 1/6] staging: comedi: tests: ni_routes_test: Reduce stack usage Ian Abbott
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 17:53 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Spencer E . Olson

Fix a few more issues with the "drivers/staging/comedi/drivers/test/"
code, including reducing stack usage, declaring more stuff as 'static'
and adding Kconfig code to allow the unit-test modules to be selected to
be built individually.

1) staging: comedi: tests: ni_routes_test: Reduce stack usage
2) staging: comedi: tests: ni_route_tests: Declare functions static
3) staging: comedi: tests: example_test: Reduce stack usage
4) staging: comedi: tests: example_test: Declare functions static
5) staging: comedi: tests: example_test: Rename to 'comedi_example_test'
6) staging: comedi: Add Kconfig options to build unit test modules

 drivers/staging/comedi/Kconfig                     | 33 ++++++++++++++++++++
 drivers/staging/comedi/drivers/tests/Makefile      |  3 +-
 .../{example_test.c => comedi_example_test.c}      |  8 ++---
 .../staging/comedi/drivers/tests/ni_routes_test.c  | 36 +++++++++++-----------
 4 files changed, 57 insertions(+), 23 deletions(-)


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

* [PATCH 1/6] staging: comedi: tests: ni_routes_test: Reduce stack usage
  2021-04-07 17:53 [PATCH 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
@ 2021-04-07 17:53 ` Ian Abbott
  2021-04-07 17:57   ` Ian Abbott
  2021-04-07 17:53 ` [PATCH 2/6] staging: comedi: tests: ni_route_tests: Declare functions static Ian Abbott
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 17:53 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten,
	Spencer E . Olson, SpencerE.Olsonolsonse

Declare the `unit_tests` array in `ni_routes_unittest()` `static` to
reduce stack usage.

Cc: <Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/drivers/tests/ni_routes_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/tests/ni_routes_test.c b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
index 777d9b5d96d4..cdfbb054d537 100644
--- a/drivers/staging/comedi/drivers/tests/ni_routes_test.c
+++ b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
@@ -577,7 +577,7 @@ void test_ni_get_reg_value(void)
 /* **** BEGIN simple module entry/exit functions **** */
 static int __init ni_routes_unittest(void)
 {
-	const unittest_fptr unit_tests[] = {
+	static const unittest_fptr unit_tests[] = {
 		test_ni_assign_device_routes,
 		test_ni_sort_device_routes,
 		test_ni_find_route_set,
-- 
2.31.0


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

* [PATCH 2/6] staging: comedi: tests: ni_route_tests: Declare functions static
  2021-04-07 17:53 [PATCH 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
  2021-04-07 17:53 ` [PATCH 1/6] staging: comedi: tests: ni_routes_test: Reduce stack usage Ian Abbott
@ 2021-04-07 17:53 ` Ian Abbott
  2021-04-07 17:53 ` [PATCH 3/6] staging: comedi: tests: example_test: Reduce stack usage Ian Abbott
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 17:53 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Spencer E . Olson

The "ni_routes_test" module contains a bunch of functions with external
linkage that are not called externally.  Declare them `static`.

Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 .../comedi/drivers/tests/ni_routes_test.c     | 34 +++++++++----------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/comedi/drivers/tests/ni_routes_test.c b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
index cdfbb054d537..40fe4f180eb9 100644
--- a/drivers/staging/comedi/drivers/tests/ni_routes_test.c
+++ b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
@@ -194,7 +194,7 @@ static bool route_set_dests_in_order(const struct ni_device_routes *devroutes)
 }
 
 /* Tests that all route_set->src are in order of the signal source. */
-bool route_set_sources_in_order(const struct ni_device_routes *devroutes)
+static bool route_set_sources_in_order(const struct ni_device_routes *devroutes)
 {
 	int i;
 
@@ -211,7 +211,7 @@ bool route_set_sources_in_order(const struct ni_device_routes *devroutes)
 	return true;
 }
 
-void test_ni_assign_device_routes(void)
+static void test_ni_assign_device_routes(void)
 {
 	const struct ni_device_routes *devroutes, *olddevroutes;
 	const u8 *table, *oldtable;
@@ -268,7 +268,7 @@ void test_ni_assign_device_routes(void)
 		 "pci-6220 finds m-series route_values table\n");
 }
 
-void test_ni_sort_device_routes(void)
+static void test_ni_sort_device_routes(void)
 {
 	/* We begin by sorting the device routes for use in later tests */
 	ni_sort_device_routes(&DR);
@@ -279,7 +279,7 @@ void test_ni_sort_device_routes(void)
 		 "all route_set->src's of fake data in order of sig. source\n");
 }
 
-void test_ni_find_route_set(void)
+static void test_ni_find_route_set(void)
 {
 	unittest(!ni_find_route_set(bad_dest, &DR),
 		 "check for nonexistent route_set\n");
@@ -295,7 +295,7 @@ void test_ni_find_route_set(void)
 		 "find last route_set\n");
 }
 
-void test_ni_route_set_has_source(void)
+static void test_ni_route_set_has_source(void)
 {
 	unittest(!ni_route_set_has_source(&DR.routes[0], O(0)),
 		 "check for bad source\n");
@@ -307,7 +307,7 @@ void test_ni_route_set_has_source(void)
 		 "find last source\n");
 }
 
-void test_ni_route_to_register(void)
+static void test_ni_route_to_register(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -357,7 +357,7 @@ void test_ni_route_to_register(void)
 		 "validate indirect route through brd3 to TRIGGER_LINE(1)\n");
 }
 
-void test_ni_lookup_route_register(void)
+static void test_ni_lookup_route_register(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -396,7 +396,7 @@ void test_ni_lookup_route_register(void)
 		 "brd0_src1: lookup indirect route register\n");
 }
 
-void test_route_is_valid(void)
+static void test_route_is_valid(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -411,7 +411,7 @@ void test_route_is_valid(void)
 		 "validate last destination\n");
 }
 
-void test_ni_is_cmd_dest(void)
+static void test_ni_is_cmd_dest(void)
 {
 	init_pci_fake();
 	unittest(ni_is_cmd_dest(NI_AI_SampleClock),
@@ -428,7 +428,7 @@ void test_ni_is_cmd_dest(void)
 		 "check that AO/SampleClockTimebase _not_ cmd destination\n");
 }
 
-void test_channel_is_pfi(void)
+static void test_channel_is_pfi(void)
 {
 	init_pci_fake();
 	unittest(channel_is_pfi(NI_PFI(0)), "check First pfi channel\n");
@@ -438,7 +438,7 @@ void test_channel_is_pfi(void)
 		 "check first non pfi channel\n");
 }
 
-void test_channel_is_rtsi(void)
+static void test_channel_is_rtsi(void)
 {
 	init_pci_fake();
 	unittest(channel_is_rtsi(TRIGGER_LINE(0)),
@@ -451,7 +451,7 @@ void test_channel_is_rtsi(void)
 		 "check first non rtsi channel\n");
 }
 
-void test_ni_count_valid_routes(void)
+static void test_ni_count_valid_routes(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -459,7 +459,7 @@ void test_ni_count_valid_routes(void)
 	unittest(ni_count_valid_routes(T) == 57, "count all valid routes\n");
 }
 
-void test_ni_get_valid_routes(void)
+static void test_ni_get_valid_routes(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 	unsigned int pair_data[2];
@@ -476,7 +476,7 @@ void test_ni_get_valid_routes(void)
 		 "destination of first valid pair from ni_get_valid_routes\n");
 }
 
-void test_ni_find_route_source(void)
+static void test_ni_find_route_source(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -493,7 +493,7 @@ void test_ni_find_route_source(void)
 		 "find invalid source (without checking device routes)\n");
 }
 
-void test_route_register_is_valid(void)
+static void test_route_register_is_valid(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -508,7 +508,7 @@ void test_route_register_is_valid(void)
 		 "find last source");
 }
 
-void test_ni_check_trigger_arg(void)
+static void test_ni_check_trigger_arg(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -541,7 +541,7 @@ void test_ni_check_trigger_arg(void)
 		 "check trigger arg for last src->dest\n");
 }
 
-void test_ni_get_reg_value(void)
+static void test_ni_get_reg_value(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
-- 
2.31.0


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

* [PATCH 3/6] staging: comedi: tests: example_test: Reduce stack usage
  2021-04-07 17:53 [PATCH 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
  2021-04-07 17:53 ` [PATCH 1/6] staging: comedi: tests: ni_routes_test: Reduce stack usage Ian Abbott
  2021-04-07 17:53 ` [PATCH 2/6] staging: comedi: tests: ni_route_tests: Declare functions static Ian Abbott
@ 2021-04-07 17:53 ` Ian Abbott
  2021-04-07 17:56   ` Ian Abbott
  2021-04-07 17:53 ` [PATCH 4/6] staging: comedi: tests: example_test: Declare functions static Ian Abbott
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 17:53 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten,
	Spencer E . Olson, SpencerE.Olsonolsonse

Declare the `unit_tests` array in `unittest_enter()` `static` to reduce
stack usage a bit.

Cc: <Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/drivers/tests/example_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/tests/example_test.c b/drivers/staging/comedi/drivers/tests/example_test.c
index 4d1ab130339d..550784fdac2f 100644
--- a/drivers/staging/comedi/drivers/tests/example_test.c
+++ b/drivers/staging/comedi/drivers/tests/example_test.c
@@ -52,7 +52,7 @@ void test0(void)
 /* **** BEGIN simple module entry/exit functions **** */
 static int __init unittest_enter(void)
 {
-	const unittest_fptr unit_tests[] = {
+	static const unittest_fptr unit_tests[] = {
 		test0,
 		NULL,
 	};
-- 
2.31.0


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

* [PATCH 4/6] staging: comedi: tests: example_test: Declare functions static
  2021-04-07 17:53 [PATCH 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
                   ` (2 preceding siblings ...)
  2021-04-07 17:53 ` [PATCH 3/6] staging: comedi: tests: example_test: Reduce stack usage Ian Abbott
@ 2021-04-07 17:53 ` Ian Abbott
  2021-04-07 17:53 ` [PATCH 5/6] staging: comedi: tests: example_test: Rename to 'comedi_example_test' Ian Abbott
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 17:53 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Spencer E . Olson

The "example_test" module contains a couple of functions with external
linkage that are not called externally.  Declare them `static`.

Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/drivers/tests/example_test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/tests/example_test.c b/drivers/staging/comedi/drivers/tests/example_test.c
index 550784fdac2f..7010f6ef322d 100644
--- a/drivers/staging/comedi/drivers/tests/example_test.c
+++ b/drivers/staging/comedi/drivers/tests/example_test.c
@@ -35,14 +35,14 @@ static struct comedi_device dev = {
 /* *** END fake board data *** */
 
 /* *** BEGIN fake data init *** */
-void init_fake(void)
+static void init_fake(void)
 {
 	dev.item = 10;
 }
 
 /* *** END fake data init *** */
 
-void test0(void)
+static void test0(void)
 {
 	init_fake();
 	unittest(dev.item != 11, "negative result\n");
-- 
2.31.0


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

* [PATCH 5/6] staging: comedi: tests: example_test: Rename to 'comedi_example_test'
  2021-04-07 17:53 [PATCH 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
                   ` (3 preceding siblings ...)
  2021-04-07 17:53 ` [PATCH 4/6] staging: comedi: tests: example_test: Declare functions static Ian Abbott
@ 2021-04-07 17:53 ` Ian Abbott
  2021-04-07 17:53 ` [PATCH 6/6] staging: comedi: Add Kconfig options to build unit test modules Ian Abbott
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 17:53 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Spencer E . Olson

Rename the "example_test" module to "comedi_example_test" to make the
name more relevant to Comedi.

Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/drivers/tests/Makefile                  | 3 ++-
 .../drivers/tests/{example_test.c => comedi_example_test.c}    | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
 rename drivers/staging/comedi/drivers/tests/{example_test.c => comedi_example_test.c} (97%)

diff --git a/drivers/staging/comedi/drivers/tests/Makefile b/drivers/staging/comedi/drivers/tests/Makefile
index b5d8e13d4162..a7883e406c43 100644
--- a/drivers/staging/comedi/drivers/tests/Makefile
+++ b/drivers/staging/comedi/drivers/tests/Makefile
@@ -3,5 +3,6 @@
 #
 ccflags-$(CONFIG_COMEDI_DEBUG)		:= -DDEBUG
 
-obj-$(CONFIG_COMEDI_TESTS)		+= example_test.o ni_routes_test.o
+obj-$(CONFIG_COMEDI_TESTS)		+= comedi_example_test.o
+obj-$(CONFIG_COMEDI_TESTS)		+= ni_routes_test.o
 CFLAGS_ni_routes_test.o			:= -DDEBUG
diff --git a/drivers/staging/comedi/drivers/tests/example_test.c b/drivers/staging/comedi/drivers/tests/comedi_example_test.c
similarity index 97%
rename from drivers/staging/comedi/drivers/tests/example_test.c
rename to drivers/staging/comedi/drivers/tests/comedi_example_test.c
index 7010f6ef322d..e5aaaeab7bdd 100644
--- a/drivers/staging/comedi/drivers/tests/example_test.c
+++ b/drivers/staging/comedi/drivers/tests/comedi_example_test.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /* vim: set ts=8 sw=8 noet tw=80 nowrap: */
 /*
- *  comedi/drivers/tests/example_test.c
+ *  comedi/drivers/tests/comedi_example_test.c
  *  Example set of unit tests.
  *
  *  COMEDI - Linux Control and Measurement Device Interface
-- 
2.31.0


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

* [PATCH 6/6] staging: comedi: Add Kconfig options to build unit test modules
  2021-04-07 17:53 [PATCH 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
                   ` (4 preceding siblings ...)
  2021-04-07 17:53 ` [PATCH 5/6] staging: comedi: tests: example_test: Rename to 'comedi_example_test' Ian Abbott
@ 2021-04-07 17:53 ` Ian Abbott
  2021-04-07 18:13 ` [PATCH v2 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
  2021-04-07 18:14 ` [PATCH 0/6] staging: comedi: tests: Fix a few more issues Spencer Olson
  7 siblings, 0 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 17:53 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Spencer E . Olson

The comedi unit-test modules in "drivers/staging/comedi/drivers/tests/"
are built if the `CONFIG_COMEDI_TESTS` option is enabled, but the comedi
Kconfig file contains no code to enable the option.  Add config options
to allow each of the unit-test modules to be enabled individually.  The
"ni_route_tests" module depends on the "ni_routing" module, so select it
if the "ni_route_tests" module is configured to be built.

Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/Kconfig                | 33 +++++++++++++++++++
 drivers/staging/comedi/drivers/tests/Makefile |  4 +--
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index 049b659fa6ad..1fbc517f4276 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -1319,4 +1319,37 @@ config COMEDI_NI_TIO
 config COMEDI_NI_ROUTING
 	tristate
 
+config COMEDI_TESTS
+	tristate "Comedi unit tests"
+	help
+	  Enable comedi unit-test modules to be built.
+
+	  Note that the answer to this question won't directly affect the
+	  kernel: saying N will just cause the configurator to skip all
+	  the questions about comedi unit-test modules.
+
+if COMEDI_TESTS
+
+config COMEDI_TESTS_EXAMPLE
+	tristate "Comedi example unit-test module"
+	help
+	  Enable support for an example unit-test module.  This is just a
+	  silly example to be used as a basis for writing other unit-test
+	  modules.
+
+	  To compile this as a module, choose M here: the module will be called
+	  comedi_example_test.
+
+config COMEDI_TESTS_NI_ROUTES
+	tristate "NI routing unit-test module"
+	select NI_ROUTING
+	help
+	  Enable support for a unit-test module to test the signal routing
+	  code used by comedi drivers for various National Instruments cards.
+
+	  To compile this as a module, choose M here: the module will be called
+	  ni_routes_test.
+
+endif # COMEDI_TESTS
+
 endif # COMEDI
diff --git a/drivers/staging/comedi/drivers/tests/Makefile b/drivers/staging/comedi/drivers/tests/Makefile
index a7883e406c43..5ff7cdc32a32 100644
--- a/drivers/staging/comedi/drivers/tests/Makefile
+++ b/drivers/staging/comedi/drivers/tests/Makefile
@@ -3,6 +3,6 @@
 #
 ccflags-$(CONFIG_COMEDI_DEBUG)		:= -DDEBUG
 
-obj-$(CONFIG_COMEDI_TESTS)		+= comedi_example_test.o
-obj-$(CONFIG_COMEDI_TESTS)		+= ni_routes_test.o
+obj-$(CONFIG_COMEDI_TESTS_EXAMPLE)	+= comedi_example_test.o
+obj-$(CONFIG_COMEDI_TESTS_NI_ROUTES)	+= ni_routes_test.o
 CFLAGS_ni_routes_test.o			:= -DDEBUG
-- 
2.31.0


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

* Re: [PATCH 3/6] staging: comedi: tests: example_test: Reduce stack usage
  2021-04-07 17:53 ` [PATCH 3/6] staging: comedi: tests: example_test: Reduce stack usage Ian Abbott
@ 2021-04-07 17:56   ` Ian Abbott
  0 siblings, 0 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 17:56 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, H Hartley Sweeten, Spencer E . Olson,
	SpencerE.Olsonolsonse

On 07/04/2021 18:53, Ian Abbott wrote:
> Declare the `unit_tests` array in `unittest_enter()` `static` to reduce
> stack usage a bit.
> 
> Cc: <Spencer E. Olson <olsonse@umich.edu>

Oops, I messed that one up.  That stray '<' shouldn't be there!

> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> ---
>   drivers/staging/comedi/drivers/tests/example_test.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/comedi/drivers/tests/example_test.c b/drivers/staging/comedi/drivers/tests/example_test.c
> index 4d1ab130339d..550784fdac2f 100644
> --- a/drivers/staging/comedi/drivers/tests/example_test.c
> +++ b/drivers/staging/comedi/drivers/tests/example_test.c
> @@ -52,7 +52,7 @@ void test0(void)
>   /* **** BEGIN simple module entry/exit functions **** */
>   static int __init unittest_enter(void)
>   {
> -	const unittest_fptr unit_tests[] = {
> +	static const unittest_fptr unit_tests[] = {
>   		test0,
>   		NULL,
>   	};
> 


-- 
-=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-

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

* Re: [PATCH 1/6] staging: comedi: tests: ni_routes_test: Reduce stack usage
  2021-04-07 17:53 ` [PATCH 1/6] staging: comedi: tests: ni_routes_test: Reduce stack usage Ian Abbott
@ 2021-04-07 17:57   ` Ian Abbott
  0 siblings, 0 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 17:57 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, H Hartley Sweeten, Spencer E . Olson,
	SpencerE.Olsonolsonse

On 07/04/2021 18:53, Ian Abbott wrote:
> Declare the `unit_tests` array in `ni_routes_unittest()` `static` to
> reduce stack usage.
> 
> Cc: <Spencer E. Olson <olsonse@umich.edu>

I messed that one up too.  I'd better fix up and resend the series.

> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> ---
>   drivers/staging/comedi/drivers/tests/ni_routes_test.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/comedi/drivers/tests/ni_routes_test.c b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
> index 777d9b5d96d4..cdfbb054d537 100644
> --- a/drivers/staging/comedi/drivers/tests/ni_routes_test.c
> +++ b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
> @@ -577,7 +577,7 @@ void test_ni_get_reg_value(void)
>   /* **** BEGIN simple module entry/exit functions **** */
>   static int __init ni_routes_unittest(void)
>   {
> -	const unittest_fptr unit_tests[] = {
> +	static const unittest_fptr unit_tests[] = {
>   		test_ni_assign_device_routes,
>   		test_ni_sort_device_routes,
>   		test_ni_find_route_set,
> 


-- 
-=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-

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

* [PATCH v2 0/6] staging: comedi: tests: Fix a few more issues
  2021-04-07 17:53 [PATCH 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
                   ` (5 preceding siblings ...)
  2021-04-07 17:53 ` [PATCH 6/6] staging: comedi: Add Kconfig options to build unit test modules Ian Abbott
@ 2021-04-07 18:13 ` Ian Abbott
  2021-04-07 18:13   ` [PATCH v2 1/6] staging: comedi: tests: ni_routes_test: Reduce stack usage Ian Abbott
                     ` (5 more replies)
  2021-04-07 18:14 ` [PATCH 0/6] staging: comedi: tests: Fix a few more issues Spencer Olson
  7 siblings, 6 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 18:13 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Spencer E . Olson

Fix a few more issues with the "drivers/staging/comedi/drivers/test/"
code, including reducing stack usage, declaring more stuff as 'static'
and adding Kconfig code to allow the unit-test modules to be selected to
be built individually.

v2: Correct faulty Cc: lines in patches 1 and 3.

1) staging: comedi: tests: ni_routes_test: Reduce stack usage
2) staging: comedi: tests: ni_route_tests: Declare functions static
3) staging: comedi: tests: example_test: Reduce stack usage
4) staging: comedi: tests: example_test: Declare functions static
5) staging: comedi: tests: example_test: Rename to 'comedi_example_test'
6) staging: comedi: Add Kconfig options to build unit test modules

 drivers/staging/comedi/Kconfig                     | 33 ++++++++++++++++++++
 drivers/staging/comedi/drivers/tests/Makefile      |  3 +-
 .../{example_test.c => comedi_example_test.c}      |  8 ++---
 .../staging/comedi/drivers/tests/ni_routes_test.c  | 36 +++++++++++-----------
 4 files changed, 57 insertions(+), 23 deletions(-)


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

* [PATCH v2 1/6] staging: comedi: tests: ni_routes_test: Reduce stack usage
  2021-04-07 18:13 ` [PATCH v2 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
@ 2021-04-07 18:13   ` Ian Abbott
  2021-04-07 18:13   ` [PATCH v2 2/6] staging: comedi: tests: ni_route_tests: Declare functions static Ian Abbott
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 18:13 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Spencer E . Olson

Declare the `unit_tests` array in `ni_routes_unittest()` `static` to
reduce stack usage.

Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
v2: Fix email address in Cc: line
---
 drivers/staging/comedi/drivers/tests/ni_routes_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/tests/ni_routes_test.c b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
index 777d9b5d96d4..cdfbb054d537 100644
--- a/drivers/staging/comedi/drivers/tests/ni_routes_test.c
+++ b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
@@ -577,7 +577,7 @@ void test_ni_get_reg_value(void)
 /* **** BEGIN simple module entry/exit functions **** */
 static int __init ni_routes_unittest(void)
 {
-	const unittest_fptr unit_tests[] = {
+	static const unittest_fptr unit_tests[] = {
 		test_ni_assign_device_routes,
 		test_ni_sort_device_routes,
 		test_ni_find_route_set,
-- 
2.31.0


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

* [PATCH v2 2/6] staging: comedi: tests: ni_route_tests: Declare functions static
  2021-04-07 18:13 ` [PATCH v2 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
  2021-04-07 18:13   ` [PATCH v2 1/6] staging: comedi: tests: ni_routes_test: Reduce stack usage Ian Abbott
@ 2021-04-07 18:13   ` Ian Abbott
  2021-04-07 18:13   ` [PATCH v2 3/6] staging: comedi: tests: example_test: Reduce stack usage Ian Abbott
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 18:13 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Spencer E . Olson

The "ni_routes_test" module contains a bunch of functions with external
linkage that are not called externally.  Declare them `static`.

Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
v2: Unchanged
---
 .../comedi/drivers/tests/ni_routes_test.c     | 34 +++++++++----------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/comedi/drivers/tests/ni_routes_test.c b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
index cdfbb054d537..40fe4f180eb9 100644
--- a/drivers/staging/comedi/drivers/tests/ni_routes_test.c
+++ b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
@@ -194,7 +194,7 @@ static bool route_set_dests_in_order(const struct ni_device_routes *devroutes)
 }
 
 /* Tests that all route_set->src are in order of the signal source. */
-bool route_set_sources_in_order(const struct ni_device_routes *devroutes)
+static bool route_set_sources_in_order(const struct ni_device_routes *devroutes)
 {
 	int i;
 
@@ -211,7 +211,7 @@ bool route_set_sources_in_order(const struct ni_device_routes *devroutes)
 	return true;
 }
 
-void test_ni_assign_device_routes(void)
+static void test_ni_assign_device_routes(void)
 {
 	const struct ni_device_routes *devroutes, *olddevroutes;
 	const u8 *table, *oldtable;
@@ -268,7 +268,7 @@ void test_ni_assign_device_routes(void)
 		 "pci-6220 finds m-series route_values table\n");
 }
 
-void test_ni_sort_device_routes(void)
+static void test_ni_sort_device_routes(void)
 {
 	/* We begin by sorting the device routes for use in later tests */
 	ni_sort_device_routes(&DR);
@@ -279,7 +279,7 @@ void test_ni_sort_device_routes(void)
 		 "all route_set->src's of fake data in order of sig. source\n");
 }
 
-void test_ni_find_route_set(void)
+static void test_ni_find_route_set(void)
 {
 	unittest(!ni_find_route_set(bad_dest, &DR),
 		 "check for nonexistent route_set\n");
@@ -295,7 +295,7 @@ void test_ni_find_route_set(void)
 		 "find last route_set\n");
 }
 
-void test_ni_route_set_has_source(void)
+static void test_ni_route_set_has_source(void)
 {
 	unittest(!ni_route_set_has_source(&DR.routes[0], O(0)),
 		 "check for bad source\n");
@@ -307,7 +307,7 @@ void test_ni_route_set_has_source(void)
 		 "find last source\n");
 }
 
-void test_ni_route_to_register(void)
+static void test_ni_route_to_register(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -357,7 +357,7 @@ void test_ni_route_to_register(void)
 		 "validate indirect route through brd3 to TRIGGER_LINE(1)\n");
 }
 
-void test_ni_lookup_route_register(void)
+static void test_ni_lookup_route_register(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -396,7 +396,7 @@ void test_ni_lookup_route_register(void)
 		 "brd0_src1: lookup indirect route register\n");
 }
 
-void test_route_is_valid(void)
+static void test_route_is_valid(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -411,7 +411,7 @@ void test_route_is_valid(void)
 		 "validate last destination\n");
 }
 
-void test_ni_is_cmd_dest(void)
+static void test_ni_is_cmd_dest(void)
 {
 	init_pci_fake();
 	unittest(ni_is_cmd_dest(NI_AI_SampleClock),
@@ -428,7 +428,7 @@ void test_ni_is_cmd_dest(void)
 		 "check that AO/SampleClockTimebase _not_ cmd destination\n");
 }
 
-void test_channel_is_pfi(void)
+static void test_channel_is_pfi(void)
 {
 	init_pci_fake();
 	unittest(channel_is_pfi(NI_PFI(0)), "check First pfi channel\n");
@@ -438,7 +438,7 @@ void test_channel_is_pfi(void)
 		 "check first non pfi channel\n");
 }
 
-void test_channel_is_rtsi(void)
+static void test_channel_is_rtsi(void)
 {
 	init_pci_fake();
 	unittest(channel_is_rtsi(TRIGGER_LINE(0)),
@@ -451,7 +451,7 @@ void test_channel_is_rtsi(void)
 		 "check first non rtsi channel\n");
 }
 
-void test_ni_count_valid_routes(void)
+static void test_ni_count_valid_routes(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -459,7 +459,7 @@ void test_ni_count_valid_routes(void)
 	unittest(ni_count_valid_routes(T) == 57, "count all valid routes\n");
 }
 
-void test_ni_get_valid_routes(void)
+static void test_ni_get_valid_routes(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 	unsigned int pair_data[2];
@@ -476,7 +476,7 @@ void test_ni_get_valid_routes(void)
 		 "destination of first valid pair from ni_get_valid_routes\n");
 }
 
-void test_ni_find_route_source(void)
+static void test_ni_find_route_source(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -493,7 +493,7 @@ void test_ni_find_route_source(void)
 		 "find invalid source (without checking device routes)\n");
 }
 
-void test_route_register_is_valid(void)
+static void test_route_register_is_valid(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -508,7 +508,7 @@ void test_route_register_is_valid(void)
 		 "find last source");
 }
 
-void test_ni_check_trigger_arg(void)
+static void test_ni_check_trigger_arg(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
@@ -541,7 +541,7 @@ void test_ni_check_trigger_arg(void)
 		 "check trigger arg for last src->dest\n");
 }
 
-void test_ni_get_reg_value(void)
+static void test_ni_get_reg_value(void)
 {
 	const struct ni_route_tables *T = &private.routing_tables;
 
-- 
2.31.0


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

* [PATCH v2 3/6] staging: comedi: tests: example_test: Reduce stack usage
  2021-04-07 18:13 ` [PATCH v2 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
  2021-04-07 18:13   ` [PATCH v2 1/6] staging: comedi: tests: ni_routes_test: Reduce stack usage Ian Abbott
  2021-04-07 18:13   ` [PATCH v2 2/6] staging: comedi: tests: ni_route_tests: Declare functions static Ian Abbott
@ 2021-04-07 18:13   ` Ian Abbott
  2021-04-07 18:13   ` [PATCH v2 4/6] staging: comedi: tests: example_test: Declare functions static Ian Abbott
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 18:13 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Spencer E . Olson

Declare the `unit_tests` array in `unittest_enter()` `static` to reduce
stack usage a bit.

Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
v2: Fix email address in Cc: line
---
 drivers/staging/comedi/drivers/tests/example_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/tests/example_test.c b/drivers/staging/comedi/drivers/tests/example_test.c
index 4d1ab130339d..550784fdac2f 100644
--- a/drivers/staging/comedi/drivers/tests/example_test.c
+++ b/drivers/staging/comedi/drivers/tests/example_test.c
@@ -52,7 +52,7 @@ void test0(void)
 /* **** BEGIN simple module entry/exit functions **** */
 static int __init unittest_enter(void)
 {
-	const unittest_fptr unit_tests[] = {
+	static const unittest_fptr unit_tests[] = {
 		test0,
 		NULL,
 	};
-- 
2.31.0


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

* [PATCH v2 4/6] staging: comedi: tests: example_test: Declare functions static
  2021-04-07 18:13 ` [PATCH v2 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
                     ` (2 preceding siblings ...)
  2021-04-07 18:13   ` [PATCH v2 3/6] staging: comedi: tests: example_test: Reduce stack usage Ian Abbott
@ 2021-04-07 18:13   ` Ian Abbott
  2021-04-07 18:13   ` [PATCH v2 5/6] staging: comedi: tests: example_test: Rename to 'comedi_example_test' Ian Abbott
  2021-04-07 18:13   ` [PATCH v2 6/6] staging: comedi: Add Kconfig options to build unit test modules Ian Abbott
  5 siblings, 0 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 18:13 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Spencer E . Olson

The "example_test" module contains a couple of functions with external
linkage that are not called externally.  Declare them `static`.

Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
v2: Unchanged
---
 drivers/staging/comedi/drivers/tests/example_test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/tests/example_test.c b/drivers/staging/comedi/drivers/tests/example_test.c
index 550784fdac2f..7010f6ef322d 100644
--- a/drivers/staging/comedi/drivers/tests/example_test.c
+++ b/drivers/staging/comedi/drivers/tests/example_test.c
@@ -35,14 +35,14 @@ static struct comedi_device dev = {
 /* *** END fake board data *** */
 
 /* *** BEGIN fake data init *** */
-void init_fake(void)
+static void init_fake(void)
 {
 	dev.item = 10;
 }
 
 /* *** END fake data init *** */
 
-void test0(void)
+static void test0(void)
 {
 	init_fake();
 	unittest(dev.item != 11, "negative result\n");
-- 
2.31.0


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

* [PATCH v2 5/6] staging: comedi: tests: example_test: Rename to 'comedi_example_test'
  2021-04-07 18:13 ` [PATCH v2 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
                     ` (3 preceding siblings ...)
  2021-04-07 18:13   ` [PATCH v2 4/6] staging: comedi: tests: example_test: Declare functions static Ian Abbott
@ 2021-04-07 18:13   ` Ian Abbott
  2021-04-07 18:13   ` [PATCH v2 6/6] staging: comedi: Add Kconfig options to build unit test modules Ian Abbott
  5 siblings, 0 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 18:13 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Spencer E . Olson

Rename the "example_test" module to "comedi_example_test" to make the
name more relevant to Comedi.

Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
v2: Unchanged
---
 drivers/staging/comedi/drivers/tests/Makefile                  | 3 ++-
 .../drivers/tests/{example_test.c => comedi_example_test.c}    | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
 rename drivers/staging/comedi/drivers/tests/{example_test.c => comedi_example_test.c} (97%)

diff --git a/drivers/staging/comedi/drivers/tests/Makefile b/drivers/staging/comedi/drivers/tests/Makefile
index b5d8e13d4162..a7883e406c43 100644
--- a/drivers/staging/comedi/drivers/tests/Makefile
+++ b/drivers/staging/comedi/drivers/tests/Makefile
@@ -3,5 +3,6 @@
 #
 ccflags-$(CONFIG_COMEDI_DEBUG)		:= -DDEBUG
 
-obj-$(CONFIG_COMEDI_TESTS)		+= example_test.o ni_routes_test.o
+obj-$(CONFIG_COMEDI_TESTS)		+= comedi_example_test.o
+obj-$(CONFIG_COMEDI_TESTS)		+= ni_routes_test.o
 CFLAGS_ni_routes_test.o			:= -DDEBUG
diff --git a/drivers/staging/comedi/drivers/tests/example_test.c b/drivers/staging/comedi/drivers/tests/comedi_example_test.c
similarity index 97%
rename from drivers/staging/comedi/drivers/tests/example_test.c
rename to drivers/staging/comedi/drivers/tests/comedi_example_test.c
index 7010f6ef322d..e5aaaeab7bdd 100644
--- a/drivers/staging/comedi/drivers/tests/example_test.c
+++ b/drivers/staging/comedi/drivers/tests/comedi_example_test.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /* vim: set ts=8 sw=8 noet tw=80 nowrap: */
 /*
- *  comedi/drivers/tests/example_test.c
+ *  comedi/drivers/tests/comedi_example_test.c
  *  Example set of unit tests.
  *
  *  COMEDI - Linux Control and Measurement Device Interface
-- 
2.31.0


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

* [PATCH v2 6/6] staging: comedi: Add Kconfig options to build unit test modules
  2021-04-07 18:13 ` [PATCH v2 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
                     ` (4 preceding siblings ...)
  2021-04-07 18:13   ` [PATCH v2 5/6] staging: comedi: tests: example_test: Rename to 'comedi_example_test' Ian Abbott
@ 2021-04-07 18:13   ` Ian Abbott
  5 siblings, 0 replies; 17+ messages in thread
From: Ian Abbott @ 2021-04-07 18:13 UTC (permalink / raw)
  To: linux-staging
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Spencer E . Olson

The comedi unit-test modules in "drivers/staging/comedi/drivers/tests/"
are built if the `CONFIG_COMEDI_TESTS` option is enabled, but the comedi
Kconfig file contains no code to enable the option.  Add config options
to allow each of the unit-test modules to be enabled individually.  The
"ni_route_tests" module depends on the "ni_routing" module, so select it
if the "ni_route_tests" module is configured to be built.

Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
v2: Unchanged
---
 drivers/staging/comedi/Kconfig                | 33 +++++++++++++++++++
 drivers/staging/comedi/drivers/tests/Makefile |  4 +--
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index 049b659fa6ad..1fbc517f4276 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -1319,4 +1319,37 @@ config COMEDI_NI_TIO
 config COMEDI_NI_ROUTING
 	tristate
 
+config COMEDI_TESTS
+	tristate "Comedi unit tests"
+	help
+	  Enable comedi unit-test modules to be built.
+
+	  Note that the answer to this question won't directly affect the
+	  kernel: saying N will just cause the configurator to skip all
+	  the questions about comedi unit-test modules.
+
+if COMEDI_TESTS
+
+config COMEDI_TESTS_EXAMPLE
+	tristate "Comedi example unit-test module"
+	help
+	  Enable support for an example unit-test module.  This is just a
+	  silly example to be used as a basis for writing other unit-test
+	  modules.
+
+	  To compile this as a module, choose M here: the module will be called
+	  comedi_example_test.
+
+config COMEDI_TESTS_NI_ROUTES
+	tristate "NI routing unit-test module"
+	select NI_ROUTING
+	help
+	  Enable support for a unit-test module to test the signal routing
+	  code used by comedi drivers for various National Instruments cards.
+
+	  To compile this as a module, choose M here: the module will be called
+	  ni_routes_test.
+
+endif # COMEDI_TESTS
+
 endif # COMEDI
diff --git a/drivers/staging/comedi/drivers/tests/Makefile b/drivers/staging/comedi/drivers/tests/Makefile
index a7883e406c43..5ff7cdc32a32 100644
--- a/drivers/staging/comedi/drivers/tests/Makefile
+++ b/drivers/staging/comedi/drivers/tests/Makefile
@@ -3,6 +3,6 @@
 #
 ccflags-$(CONFIG_COMEDI_DEBUG)		:= -DDEBUG
 
-obj-$(CONFIG_COMEDI_TESTS)		+= comedi_example_test.o
-obj-$(CONFIG_COMEDI_TESTS)		+= ni_routes_test.o
+obj-$(CONFIG_COMEDI_TESTS_EXAMPLE)	+= comedi_example_test.o
+obj-$(CONFIG_COMEDI_TESTS_NI_ROUTES)	+= ni_routes_test.o
 CFLAGS_ni_routes_test.o			:= -DDEBUG
-- 
2.31.0


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

* Re: [PATCH 0/6] staging: comedi: tests: Fix a few more issues
  2021-04-07 17:53 [PATCH 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
                   ` (6 preceding siblings ...)
  2021-04-07 18:13 ` [PATCH v2 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
@ 2021-04-07 18:14 ` Spencer Olson
  7 siblings, 0 replies; 17+ messages in thread
From: Spencer Olson @ 2021-04-07 18:14 UTC (permalink / raw)
  To: Ian Abbott; +Cc: linux-staging, Greg Kroah-Hartman, H Hartley Sweeten

On Wed, Apr 7, 2021 at 12:01 PM Ian Abbott <abbotti@mev.co.uk> wrote:
>
> Fix a few more issues with the "drivers/staging/comedi/drivers/test/"
> code, including reducing stack usage, declaring more stuff as 'static'
> and adding Kconfig code to allow the unit-test modules to be selected to
> be built individually.
>
> 1) staging: comedi: tests: ni_routes_test: Reduce stack usage
> 2) staging: comedi: tests: ni_route_tests: Declare functions static
> 3) staging: comedi: tests: example_test: Reduce stack usage
> 4) staging: comedi: tests: example_test: Declare functions static
> 5) staging: comedi: tests: example_test: Rename to 'comedi_example_test'
> 6) staging: comedi: Add Kconfig options to build unit test modules
>
>  drivers/staging/comedi/Kconfig                     | 33 ++++++++++++++++++++
>  drivers/staging/comedi/drivers/tests/Makefile      |  3 +-
>  .../{example_test.c => comedi_example_test.c}      |  8 ++---
>  .../staging/comedi/drivers/tests/ni_routes_test.c  | 36 +++++++++++-----------
>  4 files changed, 57 insertions(+), 23 deletions(-)
>

I am not in a position to compile and run the unit test code at the
moment, but otherwise looks good to me.
Reviewed-by: Spencer E. Olson <olsonse@umich.edu>

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

end of thread, other threads:[~2021-04-07 18:36 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 17:53 [PATCH 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
2021-04-07 17:53 ` [PATCH 1/6] staging: comedi: tests: ni_routes_test: Reduce stack usage Ian Abbott
2021-04-07 17:57   ` Ian Abbott
2021-04-07 17:53 ` [PATCH 2/6] staging: comedi: tests: ni_route_tests: Declare functions static Ian Abbott
2021-04-07 17:53 ` [PATCH 3/6] staging: comedi: tests: example_test: Reduce stack usage Ian Abbott
2021-04-07 17:56   ` Ian Abbott
2021-04-07 17:53 ` [PATCH 4/6] staging: comedi: tests: example_test: Declare functions static Ian Abbott
2021-04-07 17:53 ` [PATCH 5/6] staging: comedi: tests: example_test: Rename to 'comedi_example_test' Ian Abbott
2021-04-07 17:53 ` [PATCH 6/6] staging: comedi: Add Kconfig options to build unit test modules Ian Abbott
2021-04-07 18:13 ` [PATCH v2 0/6] staging: comedi: tests: Fix a few more issues Ian Abbott
2021-04-07 18:13   ` [PATCH v2 1/6] staging: comedi: tests: ni_routes_test: Reduce stack usage Ian Abbott
2021-04-07 18:13   ` [PATCH v2 2/6] staging: comedi: tests: ni_route_tests: Declare functions static Ian Abbott
2021-04-07 18:13   ` [PATCH v2 3/6] staging: comedi: tests: example_test: Reduce stack usage Ian Abbott
2021-04-07 18:13   ` [PATCH v2 4/6] staging: comedi: tests: example_test: Declare functions static Ian Abbott
2021-04-07 18:13   ` [PATCH v2 5/6] staging: comedi: tests: example_test: Rename to 'comedi_example_test' Ian Abbott
2021-04-07 18:13   ` [PATCH v2 6/6] staging: comedi: Add Kconfig options to build unit test modules Ian Abbott
2021-04-07 18:14 ` [PATCH 0/6] staging: comedi: tests: Fix a few more issues Spencer Olson

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.