2015-11-18 13:36:51 +01:00
|
|
|
#!/usr/bin/env bash
|
2015-02-24 00:23:34 +01:00
|
|
|
#
|
|
|
|
# Copyright (C) 2015 Philipp Rosenkranz <philipp.rosenkranz@fu-berlin.de>
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2016-07-13 16:04:26 +02:00
|
|
|
CI_BASE_BRANCH=${CI_BASE_BRANCH:-master}
|
|
|
|
|
2015-11-24 06:02:39 +01:00
|
|
|
function print_result {
|
|
|
|
local RED="\033[0;31m"
|
|
|
|
local GREEN="\033[0;32m"
|
|
|
|
local NO_COLOUR="\033[0m"
|
|
|
|
|
|
|
|
if (( "$1" == 0 )); then
|
|
|
|
echo -e "${GREEN}✓$NO_COLOUR"
|
|
|
|
else
|
|
|
|
echo -e "${RED}x$NO_COLOUR"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
RESULT=0
|
|
|
|
set_result() {
|
|
|
|
NEW_RESULT=$1
|
|
|
|
|
|
|
|
if (( $NEW_RESULT != 0))
|
|
|
|
then
|
|
|
|
RESULT=$NEW_RESULT
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function run {
|
|
|
|
echo -n "Running '$@' "
|
|
|
|
OUT=$($@ 2>&1)
|
|
|
|
NEW_RESULT=$?
|
|
|
|
|
|
|
|
print_result $NEW_RESULT
|
|
|
|
set_result $NEW_RESULT
|
|
|
|
|
|
|
|
# Indent command output so that its easily discernable from the rest
|
2017-01-19 14:13:26 +01:00
|
|
|
if [ -n "$OUT" ]; then
|
|
|
|
echo "Command output:"
|
|
|
|
echo ""
|
|
|
|
# Using printf to avoid problems if the command output begins with a -
|
|
|
|
(printf "%s\n" "$OUT" | while IFS= read -r line; do printf "\t%s\n" "$line"; done)
|
2015-11-24 06:02:39 +01:00
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-02-24 00:17:28 +01:00
|
|
|
if [[ $BUILDTEST_MCU_GROUP ]]
|
|
|
|
then
|
2017-04-20 12:15:59 +02:00
|
|
|
export BASE_BRANCH="${CI_BASE_BRANCH}"
|
2015-05-20 14:10:34 +02:00
|
|
|
|
2015-02-28 18:56:48 +01:00
|
|
|
if [ "$BUILDTEST_MCU_GROUP" == "static-tests" ]
|
|
|
|
then
|
2015-02-28 19:16:48 +01:00
|
|
|
RESULT=0
|
2016-03-01 13:54:04 +01:00
|
|
|
RECALL="$1"
|
2015-02-28 19:16:48 +01:00
|
|
|
|
2016-03-01 13:54:04 +01:00
|
|
|
if [ "$RECALL" != "recall" ]; then
|
2016-07-13 16:04:26 +02:00
|
|
|
if git diff ${CI_BASE_BRANCH} HEAD -- "$0" &> /dev/null; then
|
|
|
|
git rebase ${CI_BASE_BRANCH} || git rebase --abort
|
2016-03-01 13:54:04 +01:00
|
|
|
|
|
|
|
"$0" "recall"
|
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2016-03-02 12:10:44 +01:00
|
|
|
trap "RESULT=1" ERR
|
|
|
|
|
2015-11-24 06:02:39 +01:00
|
|
|
git rebase ${CI_BASE_BRANCH}
|
|
|
|
if (( $? != 0 )); then
|
|
|
|
git rebase --abort > /dev/null 2>&1
|
|
|
|
echo "Rebase failed, aborting..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-03-02 12:10:44 +01:00
|
|
|
if [ $RESULT -ne 0 ]; then
|
|
|
|
exit $RESULT
|
|
|
|
fi
|
2015-02-28 18:56:48 +01:00
|
|
|
|
2019-05-24 14:38:48 +02:00
|
|
|
run make print-versions
|
2017-01-17 12:46:04 +01:00
|
|
|
|
2017-12-04 14:25:49 +01:00
|
|
|
run ./dist/tools/commit-msg/check.sh ${CI_BASE_BRANCH}
|
2015-11-24 06:02:39 +01:00
|
|
|
run ./dist/tools/whitespacecheck/check.sh ${CI_BASE_BRANCH}
|
2017-04-20 12:15:59 +02:00
|
|
|
DIFFFILTER="MR" ERROR_EXIT_CODE=0 run ./dist/tools/licenses/check.sh
|
|
|
|
DIFFFILTER="AC" run ./dist/tools/licenses/check.sh
|
|
|
|
run ./dist/tools/doccheck/check.sh
|
|
|
|
run ./dist/tools/externc/check.sh
|
|
|
|
run ./dist/tools/cppcheck/check.sh
|
2015-11-24 06:02:39 +01:00
|
|
|
run ./dist/tools/pr_check/pr_check.sh ${CI_BASE_BRANCH}
|
2017-04-20 21:50:09 +02:00
|
|
|
run ./dist/tools/coccinelle/check.sh
|
2017-11-14 16:57:11 +01:00
|
|
|
run ./dist/tools/flake8/check.sh
|
2018-03-05 13:54:10 +01:00
|
|
|
run ./dist/tools/headerguards/check.sh
|
2018-09-26 17:15:20 +02:00
|
|
|
run ./dist/tools/buildsystem_sanity_check/check.sh
|
2015-02-28 19:16:48 +01:00
|
|
|
exit $RESULT
|
2015-02-28 18:56:48 +01:00
|
|
|
fi
|
|
|
|
|
2016-04-14 16:49:52 +02:00
|
|
|
if [ "$BUILDTEST_MCU_GROUP" == "host" ]; then
|
|
|
|
make -C dist/tools
|
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|
2015-05-26 19:28:44 +02:00
|
|
|
if [ "$BUILDTEST_MCU_GROUP" == "x86" ]
|
|
|
|
then
|
2016-03-23 23:52:00 +01:00
|
|
|
make -C ./tests/unittests all-debug test BOARD=native TERMPROG='gdb -batch -ex r -ex bt $(ELF)' || exit
|
2015-11-24 06:02:39 +01:00
|
|
|
set_result $?
|
2015-02-28 18:56:48 +01:00
|
|
|
fi
|
2015-11-24 06:02:39 +01:00
|
|
|
|
2017-04-20 12:15:59 +02:00
|
|
|
|
2016-03-15 00:08:18 +01:00
|
|
|
./dist/tools/compile_test/compile_test.py $BASE_BRANCH
|
2015-11-24 06:02:39 +01:00
|
|
|
set_result $?
|
2015-02-06 03:36:16 +01:00
|
|
|
fi
|
2015-11-24 06:02:39 +01:00
|
|
|
|
|
|
|
exit $RESULT
|