Hi,
On 08/22/2017 06:15 PM, [ext] Reichel Andreas wrote:
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.
While Jan might disagree. I would prefer to have tests run separately to
the build per default.
Its pretty standard to have 'make check' in autotools based projects.
@Andreas: How you implement test execution here looks not standard to
how autotools normally does it. Have you looked at [1], and if so, what
is the reason this can be used here?
[1]
https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html#Scripts_002dbased-Testsuites
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
That isn't the right place to ad this.
If you want to build it all the time, then just write
all: build_tests
This line adds the build_tests target to the default 'all' target as a
dependency.
This would be a better way, but I would still prefer 'make check'.
@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
I don't like this. If I configure with 'disable-tests', just that they
aren't called when just using 'make', then I cannot build them later
separately without reconfiguring the project or calling the Makefile in
tools/tests.
Also the name 'build_tests' suggests that the tests are only build, not run.
I also dislike the 'if' here. Normally enabling or disabling should be
done by adding the 'build_tests' target to the dependencies or not.
Claudius
+
+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.
--
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/f14145e7-f268-5f7c-80d6-6cfcb3db456a%40siemens.com.
For more options, visit https://groups.google.com/d/optout.