From bff06a4d64d068efe9dea0149692bd97b947e5ec Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 18 Oct 2019 13:51:46 +0200 Subject: [PATCH] tools: add add_insufficient_memory_board.sh script This adds a script that automatically compiles all examples & tests for a given board and updates Makefile.ci if necessary. --- .../tools/insufficient_memory/Makefile.for_sh | 18 ++++++++++++ dist/tools/insufficient_memory/README.md | 9 ++++++ .../add_insufficient_memory_board.sh | 29 +++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 dist/tools/insufficient_memory/Makefile.for_sh create mode 100644 dist/tools/insufficient_memory/README.md create mode 100755 dist/tools/insufficient_memory/add_insufficient_memory_board.sh diff --git a/dist/tools/insufficient_memory/Makefile.for_sh b/dist/tools/insufficient_memory/Makefile.for_sh new file mode 100644 index 0000000000..3c1ed8071d --- /dev/null +++ b/dist/tools/insufficient_memory/Makefile.for_sh @@ -0,0 +1,18 @@ +-include $(DIR)/Makefile.ci + +define create_Makefile.ci + @echo "BOARD_INSUFFICIENT_MEMORY := \\" > $(1) + @for b in $(sort $(BOARD_INSUFFICIENT_MEMORY)); do echo " $$b \\" >> $(1); done + @echo " #" >> $(1) +endef + +BOARD_INSUFFICIENT_MEMORY += $(BOARD) + +.PHONY: Makefile.ci +ifeq ($(BOARD_INSUFFICIENT_MEMORY),) +Makefile.ci: + @echo "skipping empty Makefile.ci" +else +Makefile.ci: + $(call create_Makefile.ci, $(DIR)/Makefile.ci) +endif diff --git a/dist/tools/insufficient_memory/README.md b/dist/tools/insufficient_memory/README.md new file mode 100644 index 0000000000..cee555c2d2 --- /dev/null +++ b/dist/tools/insufficient_memory/README.md @@ -0,0 +1,9 @@ +add_insufficient_memory_board.sh +------------------ + +Usage: `add_insufficient_memory_board.sh ` + +Updates `Makefile.ci` to include `` if the memory of the board is not sufficient for the test/example. + +For this the script will build every test and example to see if the result would fit into the memory of the specified +board. If not the corresponding `Makefile.ci` is updated automatically. diff --git a/dist/tools/insufficient_memory/add_insufficient_memory_board.sh b/dist/tools/insufficient_memory/add_insufficient_memory_board.sh new file mode 100755 index 0000000000..6423bb79e6 --- /dev/null +++ b/dist/tools/insufficient_memory/add_insufficient_memory_board.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# +# Copyright (C) 2019 Benjamin Valentin +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# + +if [ -z $1 ]; then + echo "usage: $0 " + exit 1 +fi + +BOARD=$1 +RIOTBASE=$(dirname $0)/../../.. +PROJECTS+=$RIOTBASE/examples/*/Makefile +PROJECTS+=" " +PROJECTS+=$RIOTBASE/tests/*/Makefile + +for i in $PROJECTS; do + test=$(dirname $(realpath $i)); + if make BOARD=$BOARD -j -C $test 2>&1 >/dev/null | grep -e overflowed -e "not within region" > /dev/null; then + echo $(basename $test) is too big for $BOARD + make -f Makefile.for_sh -C $(dirname $0) DIR=$test BOARD=$BOARD Makefile.ci > /dev/null + else + echo $(basename $test) is OK + fi +done