[v2] configure: add option to disable tests

Submitted by Yann E. MORIN on March 8, 2017, 5:25 p.m.

Details

Message ID 1488993903-14733-1-git-send-email-yann.morin.1998@free.fr
State New
Headers show
Series "configure: add option to disable tests" ( rev: 2 ) in Wayland

Not browsing as part of any series.

Commit Message

Yann E. MORIN March 8, 2017, 5:25 p.m.
When building for a product, tests are not needed.

Besides, one test requires a C++ compiler, which is not always
available.

So, add an option to configure to disable building tests altogether.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Tested-by: Eric Engestrom <eric.engestrom@imgtec.com>

---
Changes v1 -> v2:
  - fix typo in yes-check  (Eric)
---
 Makefile.am  | 3 ++-
 configure.ac | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/Makefile.am b/Makefile.am
index d0c8bd3..9c2541d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -143,7 +143,7 @@  libwayland_cursor_la_CFLAGS =			\
 	-I$(top_srcdir)/src			\
 	-DICONDIR=\"$(ICONDIR)\"
 
-
+if ENABLE_TESTS
 built_test_programs =				\
 	array-test				\
 	client-test				\
@@ -258,6 +258,7 @@  os_wrappers_test_LDADD = libtest-runner.la
 
 exec_fd_leak_checker_SOURCES = tests/exec-fd-leak-checker.c
 exec_fd_leak_checker_LDADD = libtest-runner.la
+endif
 
 EXTRA_DIST += tests/scanner-test.sh			\
 	tests/data/example.xml				\
diff --git a/configure.ac b/configure.ac
index fc87429..8b022c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,10 +87,18 @@  AC_ARG_ENABLE([dtd-validation],
 	      [],
 	      [enable_dtd_validation=yes])
 
+AC_ARG_ENABLE([tests],
+	      [AC_HELP_STRING([--disable-tests],
+			      [Disable compilation of test programs])],
+	      [],
+	      [enable_tests=yes])
+
 AM_CONDITIONAL(USE_HOST_SCANNER, test "x$with_host_scanner" = xyes)
 
 AM_CONDITIONAL(ENABLE_LIBRARIES, test "x$enable_libraries" = xyes)
 
+AM_CONDITIONAL(ENABLE_TESTS, test "x$enable_tests" = xyes)
+
 AC_ARG_WITH(icondir, [  --with-icondir=<dir>    Look for cursor icons here],
 		     [  ICONDIR=$withval],
 		     [  ICONDIR=${datadir}/icons])

Comments

Hello,

On 2017-03-08 18:25 +0100, Yann E. MORIN spake thusly:
> When building for a product, tests are not needed.
> 
> Besides, one test requires a C++ compiler, which is not always
> available.
> 
> So, add an option to configure to disable building tests altogether.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
> Tested-by: Eric Engestrom <eric.engestrom@imgtec.com>

Ping? ;-)

Regards,
Yann E. MORIN.

> ---
> Changes v1 -> v2:
>   - fix typo in yes-check  (Eric)
> ---
>  Makefile.am  | 3 ++-
>  configure.ac | 8 ++++++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index d0c8bd3..9c2541d 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -143,7 +143,7 @@ libwayland_cursor_la_CFLAGS =			\
>  	-I$(top_srcdir)/src			\
>  	-DICONDIR=\"$(ICONDIR)\"
>  
> -
> +if ENABLE_TESTS
>  built_test_programs =				\
>  	array-test				\
>  	client-test				\
> @@ -258,6 +258,7 @@ os_wrappers_test_LDADD = libtest-runner.la
>  
>  exec_fd_leak_checker_SOURCES = tests/exec-fd-leak-checker.c
>  exec_fd_leak_checker_LDADD = libtest-runner.la
> +endif
>  
>  EXTRA_DIST += tests/scanner-test.sh			\
>  	tests/data/example.xml				\
> diff --git a/configure.ac b/configure.ac
> index fc87429..8b022c1 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -87,10 +87,18 @@ AC_ARG_ENABLE([dtd-validation],
>  	      [],
>  	      [enable_dtd_validation=yes])
>  
> +AC_ARG_ENABLE([tests],
> +	      [AC_HELP_STRING([--disable-tests],
> +			      [Disable compilation of test programs])],
> +	      [],
> +	      [enable_tests=yes])
> +
>  AM_CONDITIONAL(USE_HOST_SCANNER, test "x$with_host_scanner" = xyes)
>  
>  AM_CONDITIONAL(ENABLE_LIBRARIES, test "x$enable_libraries" = xyes)
>  
> +AM_CONDITIONAL(ENABLE_TESTS, test "x$enable_tests" = xyes)
> +
>  AC_ARG_WITH(icondir, [  --with-icondir=<dir>    Look for cursor icons here],
>  		     [  ICONDIR=$withval],
>  		     [  ICONDIR=${datadir}/icons])
> -- 
> 2.7.4
>
On 2 April 2017 at 15:12, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Hello,
>
> On 2017-03-08 18:25 +0100, Yann E. MORIN spake thusly:
>> When building for a product, tests are not needed.
>>
>> Besides, one test requires a C++ compiler, which is not always
>> available.
>>
>> So, add an option to configure to disable building tests altogether.
>>
>> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
>> Tested-by: Eric Engestrom <eric.engestrom@imgtec.com>
>
> Ping? ;-)
>
Yes please. Fwiw
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

Personally, I would toggle that to disabled and force-enable via
AM_DISTCHECK_CONFIGURE_FLAGS as mentioned in the other patch.
We really want to folding the the C++ check/test here, IMHO.

-Emil