From: Andreas Reichel <[email protected]>

From: Reichel Andreas <[email protected]>

Per default, tests are now compiled and run during compilation of the
project. To deal with situations where no test runs are wanted or
possible at the moment (for example cross-compilation inside Yocto), the
--disable-tests configure option is added.

Signed-off-by: Andreas Reichel <[email protected]>
---
 Makefile.am     | 11 ++++++++++-
 configure.ac    | 12 ++++++++++++
 docs/COMPILE.md |  6 +++++-
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 2ebc4b1..717ba05 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,6 +36,7 @@ ARFLAGS = cr
 EXTRA_DIST = autogen.sh README LICENSE
 CLEANFILES =
 
+BUILD_TESTS = @build_tests@
 #
 # Static libraries
 #
@@ -188,7 +189,15 @@ $(efi_loadername): $(efi_solib)
 bg_printenv_DATA = bg_printenv
 bg_printenvdir = $(top_srcdir)
 
-bg_printenv: $(bg_setenv)
+bg_printenv: $(bg_setenv) build_tests
        @if [ ! -e bg_printenv ]; then $(LN_S) bg_setenv bg_printenv; fi
 
+build_tests:
+       @if [ "x$(BUILD_TESTS)" = "x1" ]; then\
+               make -C tools/tests;\
+       fi
+
+clean-local:
+       make -C tools/tests clean
+
 CLEANFILES += bg_printenv
diff --git a/configure.ac b/configure.ac
index 80dd365..e3eed7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -134,6 +134,16 @@ AC_TYPE_UINT16_T
 AC_TYPE_UINT32_T
 AC_TYPE_UINT8_T
 
+AC_ARG_ENABLE([tests], AS_HELP_STRING([--disable-tests], [Disable tests]),
+        [enable_tests=$enableval])
+
+AS_IF([test "x$enable_tests" != "xno"], [
+       AC_SUBST([build_tests], 1)
+       AC_MSG_NOTICE([tests enabled])
+       AS_IF([test "x$enable_tests" == "x"],
+               [enable_tests=yes])
+])
+
 # 
------------------------------------------------------------------------------
 AC_CONFIG_FILES([
         Makefile
@@ -153,5 +163,7 @@ AC_MSG_RESULT([
 
         efi libs:                ${GNUEFI_LIBS}
         efi lds:                 ${GNUEFI_LDS_DIR}
+
+       build and run tests:     ${enable_tests}
 ])
 
diff --git a/docs/COMPILE.md b/docs/COMPILE.md
index 51c2008..33faefd 100644
--- a/docs/COMPILE.md
+++ b/docs/COMPILE.md
@@ -28,6 +28,8 @@ autoreconf -fi
 make
 ```
 
+This will also automatically run internal tests for the environment API.
+
 To cross-compile, the environment variables must be set accordingly, i.e.
 `CXX=<compiler-to-use>`. The following example shows how to specify needed
 paths for an out-of-tree build, where cross-compilation environment variables
@@ -41,8 +43,10 @@ autoreconf -fi ..
  --with-gnuefi-sys-dir=<sys-root-dir> \
  --with-gnuefi-include-dir=<sys-root-dir>/usr/include/efi \
  --with-gnuefi-lds-dir=<sys-root-dir>/usr/lib \
- --with-gnuefi-lib-dir=<sys-root-dir>/usr/lib
+ --with-gnuefi-lib-dir=<sys-root-dir>/usr/lib \
+ --disable-tests
 make
 ```
 
 where `<sys-root-dir>` points to the wanted sysroot for cross-compilation.
+The option `--disable-tests` inhibits any test runs during compilation.
-- 
2.13.3

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/20170822161551.12662-3-andreas.reichel.ext%40siemens.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to