Skip to content

Commit c244a45

Browse files
obbardcjan-kiszka
authored andcommitted
configure: allow tools/tests build to be disabled
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]> Signed-off-by: Jan Kiszka <[email protected]>
1 parent e712ca5 commit c244a45

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

Makefile.am

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,12 @@ clean-local-completion-pycache:
417417

418418
check-valgrind-local: $(GEN_VERSION_H)
419419

420-
# Tests depend on libraries being built - start with "."
421-
SUBDIRS = . tools/tests
420+
SUBDIRS = .
421+
422+
# Only include tools/tests if tests are enabled
423+
if BUILD_TESTS
424+
SUBDIRS += tools/tests
425+
endif
422426

423427
FORCE:
424428

configure.ac

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,16 @@ AS_IF([test "x$enable_bootloader" != "xno"],
261261
])
262262
AM_CONDITIONAL([BOOTLOADER], [test "x$enable_bootloader" != "xno"])
263263

264-
PKG_CHECK_MODULES(LIBCHECK, check)
264+
AC_ARG_ENABLE([tests],
265+
[AS_HELP_STRING([--disable-tests], [Disable building tests])],
266+
[], [enable_tests=yes])
267+
268+
AM_CONDITIONAL([BUILD_TESTS], [test "x$enable_tests" != "xno"])
269+
270+
# Only include libcheck if tests are enabled
271+
if test "x$enable_tests" != "xno"; then
272+
PKG_CHECK_MODULES(LIBCHECK, check)
273+
fi
265274

266275
PKG_INSTALLDIR
267276
AC_SUBST(LIBEBGENV_VERSION, $(echo $VERSION | cut -dv -f2))
@@ -290,10 +299,14 @@ AX_VALGRIND_CHECK
290299
# ------------------------------------------------------------------------------
291300
AC_CONFIG_FILES([
292301
Makefile
293-
tools/tests/Makefile
294302
libebgenv.pc
295303
])
296304

305+
# Only configure tools/tests/Makefile if tests are enabled
306+
if test "x$enable_tests" != "xno"; then
307+
AC_CONFIG_FILES([tools/tests/Makefile])
308+
fi
309+
297310
AC_OUTPUT
298311
AC_MSG_RESULT([
299312
$PACKAGE_NAME $VERSION

tools/tests/Makefile.am

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#
1212
# SPDX-License-Identifier: GPL-2.0-only
1313
#
14+
if BUILD_TESTS
1415

1516
OBJCOPY ?= objcopy
1617

@@ -110,3 +111,5 @@ test_fat_LDADD = $(FAT_TESTLIB) $(LIBCHECK_LIBS)
110111
TESTS = $(check_PROGRAMS)
111112

112113
@VALGRIND_CHECK_RULES@
114+
115+
endif

0 commit comments

Comments
 (0)