Hi Jan,

On Wed, 26 Feb 2025 at 06:25, Jan Kiszka <jan.kis...@siemens.com> wrote:
>
> On 25.02.25 20:12, 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 <christopher.obb...@linaro.org>
> > ---
> > 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..fbfcc2c96f1d61ab5aa19e82f952507109160ca1
> >  100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -261,7 +261,10 @@ AS_IF([test "x$enable_bootloader" != "xno"],
> >      ])
> >  AM_CONDITIONAL([BOOTLOADER], [test "x$enable_bootloader" != "xno"])
> >
> > -PKG_CHECK_MODULES(LIBCHECK, check)
> > +# Only include libcheck if tests are enabled
> > +if test "x$enable_tests" != "xno"; then
> > +     PKG_CHECK_MODULES(LIBCHECK, check)
> > +fi

Hm, did I botch this patch ? Should this part come after the
definition of `AC_ARG_ENABLE([tests]` ?

It seems to build fine, but feels wrong to me to use a variable before
its definition ?

Do you want me to send a v4 (and you can revert the applied patch in
the next branch) or would you rather a follow-up with Fixes tag?

Thanks

Chris

> >
> >  PKG_INSTALLDIR
> >  AC_SUBST(LIBEBGENV_VERSION, $(echo $VERSION | cut -dv -f2))
> > @@ -281,6 +284,12 @@ AS_IF([test "x$enable_completion" != "xno"],
> >        ])
> >  AM_CONDITIONAL([COMPLETION], [test "x$enable_completion" != "xno"])
> >
> > +AC_ARG_ENABLE([tests],
> > +    [AS_HELP_STRING([--disable-tests], [Disable building tests])],
> > +    [], [enable_tests=yes])
> > +
> > +AM_CONDITIONAL([BUILD_TESTS], [test "x$enable_tests" != "xno"])
> > +
> >  AX_VALGRIND_DFLT(memcheck, on)
> >  AX_VALGRIND_DFLT(helgrind, off)
> >  AX_VALGRIND_DFLT(drd, off)
> > @@ -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, applied.
>
> 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 efibootguard-dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/efibootguard-dev/CACr-zFBXz3-a-uck5gQZf2jiGq344CGXhpGwy5c3R1B2G_h1QA%40mail.gmail.com.

Reply via email to