1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

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.
This commit is contained in:
Martine Lenders 2018-06-22 10:31:44 +02:00 committed by Martine Lenders
parent 2db68b600b
commit 9160b9cc0f
2 changed files with 37 additions and 17 deletions

View File

@ -1,6 +1,8 @@
#!/bin/sh #!/bin/sh
export TEST_BOARDS_AVAILABLE=${TEST_BOARDS_AVAILABLE:-"samr21-xpro"} : ${TEST_BOARDS_AVAILABLE:="samr21-xpro"}
: ${TEST_BOARDS_LLVM_COMPILE:="native"}
export RIOT_CI_BUILD=1 export RIOT_CI_BUILD=1
export STATIC_TESTS=${STATIC_TESTS:-1} export STATIC_TESTS=${STATIC_TESTS:-1}
export CFLAGS_DBG="" export CFLAGS_DBG=""
@ -92,21 +94,36 @@ get_supported_boards() {
done | $(_greplist $BOARDS) done | $(_greplist $BOARDS)
} }
# given an app dir as parameter, print "$appdir board" for each supported get_supported_toolchains() {
# board. Only print for boards in $BOARDS. local appdir=$1
get_app_board_pairs() { 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 local appdir=$1
for board in $(get_supported_boards $appdir) for board in $(get_supported_boards $appdir)
do do
echo $appdir $board for toolchain in $(get_supported_toolchains $appdir $board)
do
echo $appdir $board:$toolchain
done
done | $(_greplist $BOARDS) 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_compile_jobs() {
get_apps | \ get_apps | \
dwqc ${DWQ_ENV} -s \ 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 | xargs '-d\n' -n 1 echo $0 compile
} }
@ -115,10 +132,11 @@ print_worker() {
echo "-- running on worker ${DWQ_WORKER} thread ${DWQ_WORKER_THREAD}, build number $DWQ_WORKER_BUILDNUM." 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() { compile() {
local appdir=$1 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!" [ "$board" = "makefile_broken" ] && error "$0: Makefile in \"$appdir\" seems to be broken!"
@ -132,12 +150,12 @@ compile() {
print_worker print_worker
# sanity checks # 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 "$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" [ ! -d "boards/$board" ] && error "$0: compile: error: board directory \"boards/$board\" doesn't exist"
# compile # 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} make -C${appdir} clean all -j${JOBS:-4}
RES=$? RES=$?
@ -169,7 +187,8 @@ compile() {
test_job() { test_job() {
local appdir=$1 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" local flashfile="$3"
[ ! -f "$flashfile" ] && { [ ! -f "$flashfile" ] && {
@ -183,16 +202,17 @@ test_job() {
--file $flashfile:$appdir/bin/${board}/$(basename $flashfile) \ --file $flashfile:$appdir/bin/${board}/$(basename $flashfile) \
--queue ${TEST_QUEUE:-$board} \ --queue ${TEST_QUEUE:-$board} \
--maxfail 1 \ --maxfail 1 \
"./.murdock run_test $appdir $board" "./.murdock run_test $appdir $board:$toolchain"
} }
run_test() { run_test() {
local appdir=$1 local appdir=$1
local board=$2 local board=$(echo $2 | cut -f 1 -d':')
local toolchain=$(echo $2 | cut -f 2 -d':')
print_worker print_worker
echo "-- executing tests for $appdir on $board:" echo "-- executing tests for $appdir on $board (compiled with $toolchain toolchain):"
hook run_test_pre 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 # execute static tests

View File

@ -16,7 +16,7 @@ test-murdock:
cd $(RIOTBASE) && \ cd $(RIOTBASE) && \
./.murdock test_job \ ./.murdock test_job \
$$(realpath --relative-to $(RIOTBASE) $(APPDIR)) \ $$(realpath --relative-to $(RIOTBASE) $(APPDIR)) \
$(BOARD) \ "$(BOARD):$(TOOLCHAIN)" \
$(FLASHFILE) $(FLASHFILE)
# don't whitelist tests if there's no binary # don't whitelist tests if there's no binary