-
Notifications
You must be signed in to change notification settings - Fork 8
/
V0p2_primary_CONFIGs_compile_tests.sh
executable file
·88 lines (71 loc) · 2.13 KB
/
V0p2_primary_CONFIGs_compile_tests.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
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
#!/bin/sh
#
# Test all primary configurations of V0p2_Main to be tested during CI.
#
# Copies V0p2_Main to a temporary working area
# and adjusts its generic config header to test all primary configs in turn.
#
# Shows all failures before exiting (no -e flag)
echo Test compilation of primary configs of main Arduino projects.
# Target Arduino board to build for.
BUILD_TARGET=opentrv:avr:opentrv_v0p2
# Name of generic config header which should #define one CONFIG_...
GENERICCONFIGHEADER=V0p2_Generic_Config.h
# Name of main sketch.
SKETCHNAME=V0p2_Main
# Relative path to V0p2_Main sketch.
MAIN=Arduino/$SKETCHNAME
# Path to arduino binary
ARDUINO=arduino
# Target copy of main sketch to update.
# MUST NEVER BE EMPTY!
WORKINGDIR=$PWD/tmp-build-area
if [ -e $WORKINGDIR ]; then
echo Temporary working copy directory $WORKINGDIR exists, aborting.
exit 99
fi
# Create the temporary directory.
mkdir -p $WORKINGDIR
# Copy the main sketch to the working area.
cp -rp $PWD/$MAIN $WORKINGDIR
ls $WORKINGDIR/$SKETCHNAME/
TARGETINO=$WORKINGDIR/$SKETCHNAME/$SKETCHNAME.ino
if [ ! -f $TARGETINO ]; then
echo Missing $TARGETINO
exit 99
fi
# Set status non-zero if a test/compilation fails.
STATUS=0
#echo @@@@@@ Testing default target: $WORKINGDIR/$SKETCHNAME/$SKETCHNAME.ino
#if arduino --verify --board $BUILD_TARGET $WORKINGDIR/$SKETCHNAME/$SKETCHNAME.ino; then
# echo OK
#else
# echo FAILED
# STATUS=1
#fi
# Fetch all primary configs.
CONFIGS="`./V0p2_list_primary_CONFIGs.sh`"
if [ "X" = "X$CONFIGS" ]; then
echo No primary configs found, aborting.
exit 99
fi
echo All primary configs:
echo $CONFIGS
# Test each of the primary configs.
for config in $CONFIGS;
do
echo @@@@@@ Testing config $config
# Overwrite generic config header with single #define for this config.
echo "#define $config" > $WORKINGDIR/$SKETCHNAME/$GENERICCONFIGHEADER
# Compile...
if $ARDUINO --verify --board $BUILD_TARGET $WORKINGDIR/$SKETCHNAME/$SKETCHNAME.ino; then
echo OK
else
echo FAILED $config
STATUS=2
fi
done
# Tidy up: delete the working directory.
rm -rf $WORKINGDIR
echo Final status: $STATUS
exit $STATUS