summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2016-07-11 16:32:59 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-07-12 22:34:58 -0700
commitb6e7520da4fe21f6d9419eb2f248ea676e453dfc (patch)
tree0a5aac81a6d396dc68aaed623081b09dfa861284 /Makefile.rules
parent49312e06cdb93091b20ac3249fccb4dd711996b6 (diff)
downloadchrome-ec-b6e7520da4fe21f6d9419eb2f248ea676e453dfc.tar.gz
cts: Build CTS suites in buildall
We need to (at least) build CTS for all boards & suites supported by CTS. This will prevent our investment from accidentally being broken. BUG=chromium:627252 BRANCH=none TEST=make buildall builds CTS suites Change-Id: Ib7bceaafd5e27ce9285b9d1bf35339bf6b04ba72 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359947
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules39
1 files changed, 39 insertions, 0 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 52b215f337..d2a151205b 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -100,6 +100,7 @@ buildall:
@mkdir $(FAILED_BOARDS_DIR)
@for b in $(boards); do echo 'starting' > $(FAILED_BOARDS_DIR)/$$b; done
$(MAKE) try_buildall
+ $(MAKE) build_cts
$(MAKE) runtests
@touch .tests-passed
@echo "$@ completed successfully!"
@@ -175,6 +176,44 @@ $(run-test-targets): run-%: host-%
hosttests: $(host-test-targets)
runtests: $(run-test-targets)
+# Automatically enumerate all suites.
+cts_excludes := common
+cts_suites := $(filter-out $(cts_excludes), \
+ $(shell find cts -maxdepth 1 -mindepth 1 -type d -printf "%f "))
+
+# Add boards below as CTS is expanded.
+cts_boards := stm32l476g-eval nucleo-f072rb
+
+.PHONY: build_cts
+
+# Create CTS rule automatically for given suite and board
+# $1: suite name
+# $2: board name
+# $3: suite name used in the previous loop
+define make-cts =
+ifneq ($$(filter $(1),$$(cts_suites)),)
+ifneq ($$(filter $(3),$$(cts_suites)),)
+# Serialize builds
+cts-$(1)-$(2): cts-$(3)-$(2)
+endif
+build_cts: cts-$(1)-$(2)
+cts-$(1)-$(2):
+ $$(MAKE) CTS_MODULE=$(1) BOARD=$(2)
+endif
+# Do not remove this blank line
+
+endef
+
+# Create rules for all cts-suite-board combinations. Additionally, we serialize
+# targets per board: cts-x-board -> cts-y-board -> ...
+# If we don't serialize targets, parallel make fails because all suites
+# try to produce ec.bin in the same directory (e.g. build/stm32l476g-eval).
+$(foreach b, $(cts_boards), \
+ $(foreach s, $(cts_suites) none, \
+ $(eval $(call make-cts,$(s),$(b),$(prev)) prev:=$(s)) \
+ ) \
+)
+
cov-test-targets=$(foreach t,$(test-list-host),build/host/$(t).info)
bldversion=$(shell (./util/getversion.sh ; echo VERSION) | $(CPP) -P)