From a048001e96811e681e5cc5087ea1f97eb0e588c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Wed, 14 Aug 2019 14:58:24 +0200 Subject: [PATCH 1/2] makefiles/buildtest: add a buildtest-indocker Add a 'buildtest-indocker' that forces executing 'buildtest' for loop completely inside the container. It prevents starting one container per compilation wich is slower but it could hide errors where the host toolchain would be used It is currently equivalent to `buildtest` but will change when the `buidtest` handling will be move outside of `BUILD_IN_DOCKER`. Display an error when executed without BUILD_IN_DOCKER=1. --- Makefile.include | 2 +- makefiles/buildtests.inc.mk | 16 +++++++++++++++- makefiles/docker.inc.mk | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile.include b/Makefile.include index d3b2eb8d7c..065326ff07 100644 --- a/Makefile.include +++ b/Makefile.include @@ -110,7 +110,7 @@ include $(RIOTMAKE)/info-nproc.inc.mk # List of boards variables include $(RIOTMAKE)/boards.inc.mk -GLOBAL_GOALS += buildtest info-boards-supported info-boards-features-missing info-buildsizes info-buildsizes-diff +GLOBAL_GOALS += buildtest buildtest-indocker info-boards-supported info-boards-features-missing info-buildsizes info-buildsizes-diff ifneq (, $(filter $(GLOBAL_GOALS), $(MAKECMDGOALS))) BOARD=none endif diff --git a/makefiles/buildtests.inc.mk b/makefiles/buildtests.inc.mk index f980630289..77213c51c7 100644 --- a/makefiles/buildtests.inc.mk +++ b/makefiles/buildtests.inc.mk @@ -1,4 +1,4 @@ -.PHONY: buildtest +.PHONY: buildtest buildtest-indocker BUILDTEST_MAKE_REDIRECT ?= >/dev/null 2>&1 @@ -25,3 +25,17 @@ buildtest: done ; \ $${RESULT} endif # BUILD_IN_DOCKER + +# Define 'buildtest-indocker' completely executed inside the container. +# It prevents starting one container per compilation wich is slower but it +# could hide errors where the host toolchain would be used +ifeq ($(BUILD_IN_DOCKER),1) + buildtest-indocker: ..in-docker-container +else +ifeq ($(INSIDE_DOCKER),1) + buildtest-indocker: buildtest +else + buildtest-indocker: + $(error $@ must be run with `BUILD_IN_DOCKER=1`) +endif # INSIDE_DOCKER +endif # BUILD_IN_DOCKER diff --git a/makefiles/docker.inc.mk b/makefiles/docker.inc.mk index d7249b5f53..d2a8ee5d77 100644 --- a/makefiles/docker.inc.mk +++ b/makefiles/docker.inc.mk @@ -6,6 +6,7 @@ export DOCKER_FLAGS ?= --rm export DOCKER_MAKECMDGOALS_POSSIBLE = \ all \ buildtest \ + buildtest-indocker \ scan-build \ scan-build-analyze \ tests-% \ From 7d10da832a1dab0ac9111bc23a957996419ebde9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Wed, 17 Jul 2019 15:58:09 +0200 Subject: [PATCH 2/2] makefiles/buildtest: always execute 'buildtest' loop on host machine This remove executing buildtest `for` loop in docker. When building completely in docker, 'buildtest' would hide issues when the host toolchain would be used when doing `make all` directly. It has the consequence that it now starts a container for each compilation which is slower. The previous behavior can be reproduced by using BUILD_IN_DOCKER=1 make buildtest-indocker A side effect is also that now `BUILDTEST_MAKE_REDIRECT` would work when doing `buildtest` with docker. --- makefiles/buildtests.inc.mk | 4 ---- makefiles/docker.inc.mk | 1 - 2 files changed, 5 deletions(-) diff --git a/makefiles/buildtests.inc.mk b/makefiles/buildtests.inc.mk index 77213c51c7..0f9a65b052 100644 --- a/makefiles/buildtests.inc.mk +++ b/makefiles/buildtests.inc.mk @@ -2,9 +2,6 @@ BUILDTEST_MAKE_REDIRECT ?= >/dev/null 2>&1 -ifeq ($(BUILD_IN_DOCKER),1) -buildtest: ..in-docker-container -else buildtest: @ \ RESULT=true ; \ @@ -24,7 +21,6 @@ buildtest: fi; \ done ; \ $${RESULT} -endif # BUILD_IN_DOCKER # Define 'buildtest-indocker' completely executed inside the container. # It prevents starting one container per compilation wich is slower but it diff --git a/makefiles/docker.inc.mk b/makefiles/docker.inc.mk index d2a8ee5d77..c620437aaf 100644 --- a/makefiles/docker.inc.mk +++ b/makefiles/docker.inc.mk @@ -5,7 +5,6 @@ export DOCKER_FLAGS ?= --rm # List of Docker-enabled make goals export DOCKER_MAKECMDGOALS_POSSIBLE = \ all \ - buildtest \ buildtest-indocker \ scan-build \ scan-build-analyze \