forked from RIOT-OS/RIOT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.murdock
executable file
·124 lines (102 loc) · 2.96 KB
/
.murdock
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/sh
export RIOT_CI_BUILD=1
export STATIC_TESTS=${STATIC_TESTS:-1}
export CFLAGS_DBG=""
error() {
echo "$@"
exit 1
}
_greplist() {
if [ $# -eq 0 ]; then
echo cat
else
echo -n "grep -E ($1"
shift
for i in $*; do
echo -n "|$i"
done
echo ")"
fi
}
# get list of all app directories
get_apps() {
find tests/ examples/ \
-mindepth 2 -maxdepth 2 -name Makefile -type f \
| xargs dirname | $(_greplist $APPS) | sort
}
# take app dir as parameter, print all boards that are supported
# Only print for boards in $BOARDS.
get_supported_boards() {
local appdir=$1
for board in $(make --no-print-directory -C$appdir info-boards-supported 2>/dev/null )
do
echo $board
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() {
local appdir=$1
for board in $(get_supported_boards $appdir)
do
echo $appdir $board
done | $(_greplist $BOARDS)
}
# use dwqc to create full "appdir board" compile job list
get_compile_jobs() {
get_apps | \
dwqc -E BOARDS -E APPS -s \
"$0 get_app_board_pairs \${1}" \
| xargs '-d\n' -n 1 echo $0 compile
}
check_workdir() {
[ -d examples/gnrc_tcp_cli -a -d tests/pkg_libcoap ] || {
echo "workdir check failed! pwd=$(pwd)"
echo "--- ls:"
ls -la
exit 1
}
}
# compile one app for one board. delete intermediates.
compile() {
local appdir=$1
local board=$2
[ -n "$DWQ_WORKER" ] && \
echo "$0: compile: running on worker $DWQ_WORKER, build number $DWQ_WORKER_BUILDNUM."
check_workdir
# sanity checks
[ $# -ne 2 ] && error "$0: compile: invalid parameters (expected \$appdir \$board)"
[ ! -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"
CCACHE_BASEDIR="$(pwd)" BOARD=$board RIOT_CI_BUILD=1 \
make -C${appdir} clean all -j${JOBS:-4}
RES=$?
if [ $RES -eq 0 ]; then
if [ "$board" = "native" -a "$appdir" = "tests/unittests" ]; then
make -C${appdir} test
RES=$?
fi
fi
# cleanup
rm -Rf "${appdir}/bin/${board}" "${appdir}/bin/pkg/${board}"
check_workdir
return $RES
}
# execute static tests
static_tests() {
local repo=${CI_BASE_REPO:-https://github.com/RIOT-OS/RIOT}
local branch=${CI_BASE_BRANCH:-master}
OUT="$(git remote add upstream $repo 2>&1 && git fetch upstream ${branch}:${branch} 2>&1)"
RES=$?
if [ $RES -ne 0 ]; then
echo "$OUT"
exit 1
fi
BUILDTEST_MCU_GROUP=static-tests ./dist/tools/ci/build_and_test.sh
}
get_jobs() {
[ "$STATIC_TESTS" = "1" ] && \
echo "$0 static_tests###{ \"jobdir\" : \"exclusive\" }"
get_compile_jobs
}
$*