[Spice-devel] [vdagent-linux PATCH v1] Makefile.am: define check_PROGRAMS once

Frediano Ziglio fziglio at redhat.com
Tue Feb 19 17:39:23 UTC 2019


> 
> Also define TESTS once
> 
> autoreconf complains when there are multiple definitions of
> a variable. In this case (partial error message follows):
>     warning: check_PROGRAMS multiply defined
> 
> Signed-off-by: Uri Lublin <uril at redhat.com>
> ---
>  Makefile.am | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index c2e9668..d1afae2 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -3,7 +3,12 @@ NULL =
>  
>  bin_PROGRAMS = src/spice-vdagent
>  sbin_PROGRAMS = src/spice-vdagentd
> -check_PROGRAMS = tests/test-file-xfers
> +
> +check_PROGRAMS = 				\
> +	tests/test-file-xfers			\
> +	tests/test-device-info			\
> +	$(NULL)
> +

Why instead using += on the others so to keep the future changes
together? See below

>  TESTS = $(check_PROGRAMS)
>  
>  common_sources =				\
> @@ -167,9 +172,3 @@ DISTCHECK_CONFIGURE_FLAGS =			\
>  tests_test_device_info_LDADD = $(src_spice_vdagent_LDADD)
>  tests_test_device_info_CFLAGS = $(src_spice_vdagent_CFLAGS)
>  
> -check_PROGRAMS = 					\
> -	tests/test-device-info			\
> -	$(NULL)

Here it would be just

check_PROGRAMS += tests/test-device-info

> -
> -TESTS = $(check_PROGRAMS)

Surely this must go, no reason to define it again

This has the advantage that to add a test you just need to
add some lines like:

tests_test_xxx_LDADD = $(src_spice_vdagent_LDADD)
tests_test_xxx_CFLAGS = $(src_spice_vdagent_CFLAGS)
check_PROGRAMS += tests/test-xxx

The difference is that this change is contained in one
diff hunk while having to add the test on the top
check_PROGRAMS macro would need 2 hunks

Frediano


More information about the Spice-devel mailing list