From 7edeabe7ff840d28a328f3ecdc3298dd63e370ee Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Fri, 22 Jun 2018 10:31:44 +0200 Subject: [PATCH] murdock: also compile with LLVM/clang There are two major reasons for this: 1. clang picks up different errors sometimes than GCC. 2. OSX support is hardened as it is usually the toolchain used there. --- .murdock | 55 +++++++++++++++++++++++++++------------- makefiles/murdock.inc.mk | 2 +- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/.murdock b/.murdock index 1b6b4c22b6d6f..379c80c1f80c1 100755 --- a/.murdock +++ b/.murdock @@ -1,6 +1,9 @@ #!/bin/sh -export TEST_BOARDS_AVAILABLE=${TEST_BOARDS_AVAILABLE:-"samr21-xpro"} +: ${TEST_BOARDS_AVAILABLE:="samr21-xpro"} +# TODO provide make target in similar fashion as the info-boards-supported one? +: ${TEST_BOARDS_LLVM_COMPILE:="iotlab-m3 native nrf52dk samr21-xpro nucleo-f401re slstk3402a"} + export RIOT_CI_BUILD=1 export STATIC_TESTS=${STATIC_TESTS:-1} export CFLAGS_DBG="" @@ -9,7 +12,7 @@ export DLCACHE_DIR=${DLCACHE_DIR:-~/.dlcache} NIGHTLY=${NIGHTLY:-0} RUN_TESTS=${RUN_TESTS:-${NIGHTLY}} -DWQ_ENV="-E BOARDS -E APPS -E NIGHTLY -E RUN_TESTS" +DWQ_ENV="-E BOARDS -E APPS -E NIGHTLY -E RUN_TESTS -E TOOLCHAIN" check_label() { local label="${1}" @@ -92,21 +95,36 @@ get_supported_boards() { done | $(_greplist $BOARDS) } -# given an app dir as parameter, print "$appdir board" for each supported -# board. Only print for boards in $BOARDS. -get_app_board_pairs() { +get_supported_toolchains() { + local appdir=$1 + local board=$2 + local toolchains="gnu" + + if is_in_list "${board}" "${TEST_BOARDS_LLVM_COMPILE}"; then + toolchains="$(make -s --no-print-directory -C${appdir} BOARD=${board} \ + info-toolchains-supported 2> /dev/null | grep -o -e "llvm" -e "gnu")" + fi + echo "${toolchains}" +} + +# given an app dir as parameter, print "$appdir $board:$toolchain" for each +# supported board and toolchain. Only print for boards in $BOARDS. +get_app_board_toolchain_pairs() { local appdir=$1 for board in $(get_supported_boards $appdir) do - echo $appdir $board + for toolchain in $(get_supported_toolchains $appdir $board) + do + echo $appdir $board:$toolchain + done done | $(_greplist $BOARDS) } -# use dwqc to create full "appdir board" compile job list +# use dwqc to create full "appdir board toolchain" compile job list get_compile_jobs() { get_apps | \ dwqc ${DWQ_ENV} -s \ - "$0 get_app_board_pairs \${1}" \ + "$0 get_app_board_toolchain_pairs \${1}" \ | xargs '-d\n' -n 1 echo $0 compile } @@ -115,10 +133,11 @@ print_worker() { echo "-- running on worker ${DWQ_WORKER} thread ${DWQ_WORKER_THREAD}, build number $DWQ_WORKER_BUILDNUM." } -# compile one app for one board. delete intermediates. +# compile one app for one board with one toolchain. delete intermediates. compile() { local appdir=$1 - local board=$2 + local board=$(echo $2 | cut -f 1 -d':') + local toolchain=$(echo $2 | cut -f 2 -d':') [ "$board" = "makefile_broken" ] && error "$0: Makefile in \"$appdir\" seems to be broken!" @@ -132,12 +151,12 @@ compile() { print_worker # sanity checks - [ $# -ne 2 ] && error "$0: compile: invalid parameters (expected \$appdir \$board)" + [ $# -ne 2 ] && error "$0: compile: invalid parameters (expected \$appdir \$board:\$toolchain)" [ ! -d "$appdir" ] && error "$0: compile: error: application directory \"$appdir\" doesn't exist" [ ! -d "boards/$board" ] && error "$0: compile: error: board directory \"boards/$board\" doesn't exist" # compile - CCACHE_BASEDIR="$(pwd)" BOARD=$board RIOT_CI_BUILD=1 \ + CCACHE_BASEDIR="$(pwd)" BOARD=$board TOOLCHAIN=$toolchain RIOT_CI_BUILD=1 \ make -C${appdir} clean all -j${JOBS:-4} RES=$? @@ -169,7 +188,8 @@ compile() { test_job() { local appdir=$1 - local board=$2 + local board=$(echo $2 | cut -f 1 -d':') + local toolchain=$(echo $2 | cut -f 2 -d':') local flashfile="$3" [ ! -f "$flashfile" ] && { @@ -183,16 +203,17 @@ test_job() { --file $flashfile:$appdir/bin/${board}/$(basename $flashfile) \ --queue ${TEST_QUEUE:-$board} \ --maxfail 1 \ - "./.murdock run_test $appdir $board" + "./.murdock run_test $appdir $board:$toolchain" } run_test() { local appdir=$1 - local board=$2 + local board=$(echo $2 | cut -f 1 -d':') + local toolchain=$(echo $2 | cut -f 2 -d':') print_worker - echo "-- executing tests for $appdir on $board:" + echo "-- executing tests for $appdir on $board (compiled with $toolchain toolchain):" hook run_test_pre - BOARD=$board make -C$appdir flash-only test + BOARD=$board TOOLCHAIN=${toolchain} make -C$appdir flash-only test } # execute static tests diff --git a/makefiles/murdock.inc.mk b/makefiles/murdock.inc.mk index 50fb25774f891..f34d8ea15b40e 100644 --- a/makefiles/murdock.inc.mk +++ b/makefiles/murdock.inc.mk @@ -16,7 +16,7 @@ test-murdock: cd $(RIOTBASE) && \ ./.murdock test_job \ $$(realpath --relative-to $(RIOTBASE) $(APPDIR)) \ - $(BOARD) \ + "$(BOARD):$(TOOLCHAIN)" \ $(FLASHFILE) # don't whitelist tests if there's no binary