On 26.02.25 12:47, Christopher Obbard wrote:
> For some builds, e.g. inside a minimal buildroot image, we may not want the
> tests to be built. Add an option --disable-tests to configure to disable
> building the tests.
> 
> Signed-off-by: Christopher Obbard <[email protected]>
> ---
> Changes in v4:
> - Move enable_tests definition to before its use.
> - Link to v3: 
> https://groups.google.com/g/efibootguard-dev/c/tBKE9qT2hSo/m/eeHFlYpsAgAJ
> 
> Changes in v3:
> - Only include libcheck if tests are enabled (thanks Jan).
> - Link to v2: 
> https://groups.google.com/g/efibootguard-dev/c/tBKE9qT2hSo/m/5xVQkMFoAgAJ
> 
> Changes in v2:
> - Remove re-definition of EXTRA_DIST (thanks Jan).
> - Rework confusing comment around SUBDIRS.
> - Link to v1: https://groups.google.com/g/efibootguard-dev/c/tBKE9qT2hSo
> ---
>  Makefile.am             |  8 ++++++--
>  configure.ac            | 17 +++++++++++++++--
>  tools/tests/Makefile.am |  3 +++
>  3 files changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 
> bb97df255dfb9c8a145eba3ed8dcc58ab9bd124b..911112da9d19bc97d248912fe394a89d85732fe4
>  100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -369,8 +369,12 @@ clean-local-completion-pycache:
>  
>  check-valgrind-local: $(GEN_VERSION_H)
>  
> -# Tests depend on libraries being built - start with "."
> -SUBDIRS = . tools/tests
> +SUBDIRS = .
> +
> +# Only include tools/tests if tests are enabled
> +if BUILD_TESTS
> +SUBDIRS += tools/tests
> +endif
>  
>  FORCE:
>  
> diff --git a/configure.ac b/configure.ac
> index 
> 36fc8d55e4190766871b8f9b5ea5bbaff5e24dde..16d25b988a048c49aaefae4ecfa24b5f1d8a2b77
>  100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -261,7 +261,16 @@ AS_IF([test "x$enable_bootloader" != "xno"],
>      ])
>  AM_CONDITIONAL([BOOTLOADER], [test "x$enable_bootloader" != "xno"])
>  
> -PKG_CHECK_MODULES(LIBCHECK, check)
> +AC_ARG_ENABLE([tests],
> +    [AS_HELP_STRING([--disable-tests], [Disable building tests])],
> +    [], [enable_tests=yes])
> +
> +AM_CONDITIONAL([BUILD_TESTS], [test "x$enable_tests" != "xno"])
> +
> +# Only include libcheck if tests are enabled
> +if test "x$enable_tests" != "xno"; then
> +     PKG_CHECK_MODULES(LIBCHECK, check)
> +fi
>  
>  PKG_INSTALLDIR
>  AC_SUBST(LIBEBGENV_VERSION, $(echo $VERSION | cut -dv -f2))
> @@ -290,10 +299,14 @@ AX_VALGRIND_CHECK
>  # 
> ------------------------------------------------------------------------------
>  AC_CONFIG_FILES([
>       Makefile
> -     tools/tests/Makefile
>       libebgenv.pc
>  ])
>  
> +# Only configure tools/tests/Makefile if tests are enabled
> +if test "x$enable_tests" != "xno"; then
> +    AC_CONFIG_FILES([tools/tests/Makefile])
> +fi
> +
>  AC_OUTPUT
>  AC_MSG_RESULT([
>       $PACKAGE_NAME $VERSION
> diff --git a/tools/tests/Makefile.am b/tools/tests/Makefile.am
> index 
> d3fa5368c99f0b484fbb6fd57b848c581957aaef..7e3ac1e74b3456950033daa2586e60bea5913e0b
>  100644
> --- a/tools/tests/Makefile.am
> +++ b/tools/tests/Makefile.am
> @@ -11,6 +11,7 @@
>  #
>  # SPDX-License-Identifier:   GPL-2.0-only
>  #
> +if BUILD_TESTS
>  
>  OBJCOPY ?= objcopy
>  
> @@ -110,3 +111,5 @@ test_fat_LDADD = $(FAT_TESTLIB) $(LIBCHECK_LIBS)
>  TESTS = $(check_PROGRAMS)
>  
>  @VALGRIND_CHECK_RULES@
> +
> +endif
> 
> ---
> base-commit: 452020920b3fe00ae0e2dc9d06f103107ded15c4
> change-id: 20250224-wip-obbardc-disable-tests-fd6857b8ee49
> 
> Best regards,

Thanks, replaced v3 with this one in next.

Jan

-- 
Siemens AG, Foundational Technologies
Linux Expert Center

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/efibootguard-dev/5349d40e-0e59-4572-8fee-d7196eab7389%40siemens.com.

Reply via email to