On 2017-09-12 12:55, [ext] Andreas J. Reichel wrote: > From: Andreas Reichel <[email protected]> > > Per default, tests are now always compiled. > > To run tests, with the main Makefile, issue > * 'make check'. > > The Makefile in `tools/tests` is changed so that: > * `make all` and `make build-tests`: builds the tests > * `make run-tests`: runs the tests > > Mention missing dependency in docs/COMPILE.md for cmocka > > Signed-off-by: Andreas Reichel <[email protected]> > --- > Makefile.am | 12 +++++++++++- > docs/COMPILE.md | 11 +++++++++-- > tools/tests/Makefile | 18 ++++++++++++++---- > 3 files changed, 34 insertions(+), 7 deletions(-) > > diff --git a/Makefile.am b/Makefile.am > index c6ebec4..cb8e238 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -190,6 +190,16 @@ bg_printenvdir = $(top_srcdir) > bg_printenv: $(bg_setenv) > $(LN_S) -f bg_setenv bg_printenv > > -all-local: bg_printenv > +all-local: bg_printenv build_tests > + > +build_tests: > + make -C tools/tests build-tests > + > +.PHONY: check > +check: > + make -C tools/tests run-tests > + > +clean-local: > + make -C tools/tests clean
Sorry, missed this before (as I didn't try to compile): This breaks out-of-tree builds. Please convert the tests build to automake as well. Then this should be resolved automatically. Jan > > CLEANFILES += bg_printenv > diff --git a/docs/COMPILE.md b/docs/COMPILE.md > index 51c2008..0927fd1 100644 > --- a/docs/COMPILE.md > +++ b/docs/COMPILE.md > @@ -5,13 +5,13 @@ > ### Arch Linux ### > > ``` > -pacman -S gnu-efi-libs pciutils > +pacman -S gnu-efi-libs pciutils cmocka > ``` > > ### Debian 8 ### > > ``` > -apt-get install gnu-efi libpci-dev > +apt-get install gnu-efi libpci-dev libcmocka-dev > ``` > > ## Compilation ## > @@ -28,6 +28,13 @@ autoreconf -fi > make > ``` > > +This will also automatically compile internal tests for the environment API. > + > +To run the tests, call > +``` > +make check > +``` > + > 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 > diff --git a/tools/tests/Makefile b/tools/tests/Makefile > index d52deaa..da12a61 100644 > --- a/tools/tests/Makefile > +++ b/tools/tests/Makefile > @@ -78,18 +78,28 @@ define WEAKEN_SYMBOLS = > $(foreach symbol,$(MOCKOBJS_SYMBOLS_$(1)-$(2)),$(call > WEAKEN_SYMBOL,$(symbol),$(1).o)) > endef > > -define TEST_TARGET_TEMPLATE = > +define TEST_TARGET_COMPILE_TEMPLATE = > $(1): $$(OBJS_$(1:.target=)) > $(foreach mockobj,$(MOCKOBJS_$(1:.target=)),$(call > WEAKEN_SYMBOLS,$(mockobj),$(1:.target=))) > $(CC) $$(OBJS_$(1:.target=):O=o) -o $(1:.target=) $(LIBS) > +endef > + > +define TEST_TARGET_RUN_TEMPLATE = > +$(1:.target=.run): $$(OBJS_$(1:.target=)) > ./$(1:.target=) > endef > > -.PHONY: clean all $(TEST_TARGETS) > +.PHONY: clean all $(TEST_TARGETS) build-tests run-tests > + > +all: build-tests > + > +build-tests: $(TEST_TARGETS) > + > +$(foreach test,$(TEST_TARGETS),$(eval $(call > TEST_TARGET_COMPILE_TEMPLATE,$(test)))) > > -all: $(TEST_TARGETS) > +run-tests: $(TEST_TARGETS:.target=.run) > > -$(foreach test,$(TEST_TARGETS),$(eval $(call TEST_TARGET_TEMPLATE,$(test)))) > +$(foreach test,$(TEST_TARGETS),$(eval $(call > TEST_TARGET_RUN_TEMPLATE,$(test)))) > > # Search for source files in current and parent directory > %.O: %.c > -- Siemens AG, Corporate Technology, CT RDA ITP SES-DE Corporate Competence Center Embedded Linux -- 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/50f117b5-7ba7-018c-2a5a-2ca5109de178%40siemens.com. For more options, visit https://groups.google.com/d/optout.
