forked from mavlink/mavlink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·63 lines (57 loc) · 1.53 KB
/
test.sh
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
#!/bin/sh
set -e
SRC_DIR=$(pwd)
# NOTE: we must do all testing on the installed python package, not
# on the build tree. Otherwise the testing is invalid and may not
# indicate the code actually works
# check format
sep="##############################################"
echo $sep
echo "FORMAT TEST"
echo $sep
cd "$SRC_DIR"
./scripts/format_xml.sh -c
echo PASS
generate_mavlink() {
echo $sep
echo "GENERATING MAVLINK " \
"protocol:${wire_protocol} language:${lang}"
echo "DEFINITION : " "$msg_def"
echo $sep
outdir="/tmp/mavlink_${wire_protocol}_${lang}"
pymavlink/tools/mavgen.py --lang="${lang}" \
--wire-protocol "${wire_protocol}" \
--strict-units \
--output="${outdir}" "${msg_def}"
echo PASS
}
cd "$SRC_DIR"
for msg_def in message_definitions/v1.0/*.xml
do
[ -e "$msg_def" ] || continue
wire_protocol="1.0"
for lang in Python C CS WLua Java
do
generate_mavlink
done
wire_protocol="2.0"
for lang in Python C C++11 CS WLua Java
do
generate_mavlink
done
done
# Avoid `spurious errors` caused by ~/.npm permission issues
# ref: https://github.com/travis-ci/travis-ci/issues/2244
# ref: https://github.com/npm/npm/issues/4815
# Does it already exist? Who owns? What permissions?
ls -lah ~/.npm || mkdir ~/.npm
# Make sure we own it
# $USER references the current user in Travis env
chown -R "$USER" ~/.npm
if [ -f /usr/bin/nodejs ]
then
mkdir -p ~/bin
ln -sf /usr/bin/nodejs ~/bin/node
. ~/.bashrc
fi
cd "$SRC_DIR/pymavlink/generator/javascript" && npm test