diff --git a/dist/tools/boards_supported/check.sh b/dist/tools/boards_supported/check.sh new file mode 100755 index 0000000000..e0bfb90686 --- /dev/null +++ b/dist/tools/boards_supported/check.sh @@ -0,0 +1,2 @@ +#!/bin/sh +make --silent -C "$(dirname "$0")"/../../../makefiles/tests/boards_supported diff --git a/dist/tools/ci/static_tests.sh b/dist/tools/ci/static_tests.sh index aef94ff74d..a04c5a9d40 100755 --- a/dist/tools/ci/static_tests.sh +++ b/dist/tools/ci/static_tests.sh @@ -123,6 +123,7 @@ run ./dist/tools/flake8/check.sh run ./dist/tools/headerguards/check.sh run ./dist/tools/buildsystem_sanity_check/check.sh run ./dist/tools/feature_resolution/check.sh +run ./dist/tools/boards_supported/check.sh run ./dist/tools/codespell/check.sh if [ -z "${GITHUB_RUN_ID}" ]; then run ./dist/tools/uncrustify/uncrustify.sh --check diff --git a/makefiles/tests/boards_supported/Makefile b/makefiles/tests/boards_supported/Makefile new file mode 100644 index 0000000000..14823762f2 --- /dev/null +++ b/makefiles/tests/boards_supported/Makefile @@ -0,0 +1,28 @@ +# In order to be able to include info-global.inc.mk, we need to provide some variables +RIOTBASE ?= $(abspath $(CURDIR)/../../..) +RIOTBOARD ?= $(RIOTBASE)/boards +RIOTMAKE ?= $(RIOTBASE)/makefiles +RIOTCPU ?= $(RIOTBASE)/cpu +RIOTTOOLS ?= $(RIOTBASE)/dist/tools +LAST_MAKEFILEDIR = $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) + +# Folders to search: First the external boards, than the official +BOARDSDIRS := $(EXTERNAL_BOARD_DIRS) $(RIOTBOARD) + +# Take the first folder in $(BOARDSDIRS) that contains a folder named $(BOARD) +BOARDDIR := $(word 1,$(foreach dir,$(BOARDSDIRS),$(wildcard $(dir)/$(BOARD)/.))) +# Sanitize folder +BOARDDIR := $(abspath $(BOARDDIR)) + +include $(RIOTMAKE)/utils/strings.mk +include $(RIOTMAKE)/boards.inc.mk +include $(RIOTMAKE)/info-global.inc.mk + +ifneq (,$(BOARDS_WITH_MISSING_FEATURES)) + $(info BOARDS_FEATURES_MISSING=$(BOARDS_FEATURES_MISSING)) + $(error The CI will never build for the following boards: $(BOARDS_WITH_MISSING_FEATURES)) +endif + +.PHONY: all +all: + @echo "Success" diff --git a/makefiles/tests/boards_supported/README.md b/makefiles/tests/boards_supported/README.md new file mode 100644 index 0000000000..ed3a949d7a --- /dev/null +++ b/makefiles/tests/boards_supported/README.md @@ -0,0 +1,15 @@ +Simple Unit Tests for `make info-boards-supported` +================================================== + +This folder contains a Makefile that runs a set of unit tests for the logic that figures out which +boards are supported. In the past there have been some issues with this despite the feature +resolution for a single board worked fine, so it is worth testing this functionality. This is +especially true since this list is used by the CI to check which boards to build for. + +Right now, only a single test case is added: It will run the logic behind +`make info-boards-supported` without any modules used other than the default modules and subtracts +the result from the list of all available boards. The resulting difference is the set of boards +which will never be build by the CI - not even for `examples/hello-world`. If this result is empty, +the test succeeds. Otherwise the list of never build boards will be printed and the test fails. + +It is intended that some more advanced unit tests will be added later on.