Skip to content

Commit 421c768

Browse files
committed
Merge branch 'devel'
Conflicts: Makefile
2 parents 139eb9c + 6595b1d commit 421c768

File tree

7 files changed

+115
-41
lines changed

7 files changed

+115
-41
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
*.h.cpp
1414
*.ocxx
1515
*.cxxtest
16+
tmp/
17+
build-uno/
1618

1719
# Packages #
1820
############

.gitmodules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[submodule "submodules/ChibiOS"]
55
path = submodules/ChibiOS
66
url = https://github.com/ChibiOS/ChibiOS
7+
ignore = dirty
78
[submodule "submodules/googletest"]
89
path = submodules/googletest
910
url = https://github.com/google/googletest

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ compiler:
3131

3232
script:
3333
- make check
34+
- make compile
3435

3536
before_install:
3637
- sudo apt-get -qq update

Makefile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,12 @@ TOP = ./
55
# run all unit tests in all folders
66
check:
77
$(TOP)/project_manager.sh -T
8-
$(TOP)/project_manager.sh -k test/
9-
$(TOP)/project_manager.sh -k c-project/
10-
$(TOP)/project_manager.sh -k cpp-project/
11-
$(TOP)/project_manager.sh -k common/
8+
$(TOP)/project_manager.sh -k test c-project cpp-project common
129

1310
# comipile all projects
14-
compile:
11+
compile:
1512
$(TOP)/project_manager.sh -T
16-
$(TOP)/project_manager.sh -m test/
17-
$(TOP)/project_manager.sh -f -m c-project/
18-
$(TOP)/project_manager.sh -f -m cpp-project/
13+
$(TOP)/project_manager.sh -fm test c-project cpp-project
1914

2015
# clean all projects for maintaining purpose
2116
clean:

ReleaseNote.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ RelNote -*- mode : org -*-
2323
*** DONE GPS breakout board to output to softserial
2424
- State "DONE" from "INPROGRESS" [2017-06-11 Sun 22:54]
2525

26-
* INPROGRESS v2.1.0 - Google test support & C sensor library support
26+
* DONE v2.1.0 - Google test support & C sensor library support
27+
- State "DONE" from "FEEDBACK" [2017-07-30 Sun 17:46]
28+
- State "FEEDBACK" from "INPROGRESS" [2017-07-30 Sun 17:46]
2729
** DONE add common/makefiles/gtest.mk
2830
- State "DONE" from "INPROGRESS" [2017-06-12 Mon 20:05]
2931
*** DONE add simple gtest project
3032
- State "DONE" from "INPROGRESS" [2017-06-12 Mon 20:05]
31-
** WAIT full range adc & pin change interrupt C support
3233
** DONE add checking dependency in fresh repo clone
3334
- State "DONE" from "FEEDBACK" [2017-07-29 Sat 20:14]
3435
- State "FEEDBACK" from "INPROGRESS" [2017-07-29 Sat 20:14]
@@ -41,10 +42,14 @@ RelNote -*- mode : org -*-
4142
** DONE integrate Travis CI in project
4243
- State "DONE" from "FEEDBACK" [2017-07-30 Sun 16:39]
4344
- State "FEEDBACK" from "INPROGRESS" [2017-07-30 Sun 16:39]
44-
** TODO motion sensor test code
45-
** TODO hand clap sound detector
45+
** DONE integrate build error code in project_manager.sh
46+
- State "DONE" from "FEEDBACK" [2017-07-30 Sun 17:45]
47+
- State "FEEDBACK" from "INPROGRESS" [2017-07-30 Sun 17:45]
4648
* WAIT v2.2.0 - more integrated module in i2c-console
4749
** LSM303DLHC support: compass & accelerator in test/
4850
*** accelerometer support
4951
*** compass support
5052
*** i2c-console support
53+
** WAIT full range adc & pin change interrupt C support
54+
** TODO hand clap sound detector
55+
** TODO motion sensor test code

common/makefiles/gtest.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ ifneq ($(filter $(BRIEF), $(TRUE)),) # check if compile message should be output
4343
check:
4444
@$(MAKE) TEST_GEN -j4 > /dev/null
4545
@printf "Running test binaries \n\n"
46-
-$(foreach bin, $(TEST_BINARIES), ./$(bin) ; )
46+
$(foreach bin, $(TEST_BINARIES), ./$(bin) ; )
4747
@printf "\nDone running tests\n"
4848
@$(MAKE) cleantest > /dev/null
4949
else
5050
check:
5151
$(MAKE) TEST_GEN -j4
5252
@printf "Running test binaries \n\n"
53-
-$(foreach bin, $(TEST_BINARIES), ./$(bin) ; )
53+
$(foreach bin, $(TEST_BINARIES), ./$(bin) ; )
5454
@printf "\nDone running tests\n"
5555
$(MAKE) cleantest > /dev/null
5656
endif

project_manager.sh

Lines changed: 97 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
#
33
# maintainer script
4+
# essential for travis builder
45
#
56

67
# path to this script file
@@ -9,7 +10,10 @@ SCRIPT_DIR_RELATIVE=$0
910

1011
# global vars
1112
FORCE_CONTINUE=0
12-
FULL_REPORT=0
13+
FULL_REPORT=1
14+
15+
RETVAL_FILE=.retVal.tmp # file contains return value of script, useful for travis
16+
rm -f $RETVAL_FILE # rm retval file first
1317

1418
# print colored title
1519
print_title()
@@ -37,21 +41,48 @@ print_warning()
3741
echo -e "|==============================================${NC}"
3842
}
3943

44+
updateRetval()
45+
{
46+
# add $1 to retVal file
47+
local retVal=0
48+
local incVal=$1
49+
50+
if [ -f $RETVAL_FILE ]; then
51+
# get content of retvalfile to retVal
52+
retVal=$(cat $RETVAL_FILE)
53+
fi
54+
55+
((retVal = retVal + incVal))
56+
echo $retVal > $RETVAL_FILE
57+
}
58+
4059
# run all make check in directory recursively
4160
function checkFolder()
4261
{
43-
local retVal=0
4462
find "$1" -name Makefile | while read line; do
4563
local TEST_DIR=$(dirname $line)/test/
4664
if [ -d "$TEST_DIR" ] ; then
4765
print_title "Checking in $(dirname ${line})"
48-
make -C $(dirname $line) check BRIEF=1 -j4
49-
50-
((retVal = retVal + $?))
66+
make -C $(dirname $line) check BRIEF=1 -j4
67+
updateRetval $?
5168
fi
5269
done
53-
54-
return $retVal
70+
}
71+
72+
# run checkFolder on multiple folders
73+
function checkMultipleFolders()
74+
{
75+
# $* - list of folders
76+
dirList=("$*")
77+
78+
for D in $dirList; do
79+
if [ -d $D ]; then
80+
checkFolder $D
81+
else
82+
print_warning "$D doesn't exist"
83+
updateRetval 1
84+
fi
85+
done
5586
}
5687

5788
# run make clean in dir recursively
@@ -65,19 +96,17 @@ function cleanFolder()
6596
# run make all in dir recursively
6697
function makeFolder()
6798
{
68-
local retVal=0
69-
7099
find "$1" -name Makefile | while read line; do
71100
print_title "Compile in $(dirname ${line})..." ;
72101

73102
if (($FULL_REPORT == 0)) ; then
74-
make -C $(dirname $line) all -j4 > /dev/null
103+
make -C $(dirname $line) all -j4 > /dev/null
75104
else
76-
make -C $(dirname $line) all -j4
105+
make -C $(dirname $line) all -j4
77106
fi
78107

79108
local MK_RESULT=$?
80-
((retVal=retVal + MK_RESULT))
109+
updateRetval $MK_RESULT
81110

82111
if (($MK_RESULT!=0)) ; then
83112
print_warning "Error code $MK_RESULT on compiling $(dirname $line)"
@@ -86,14 +115,26 @@ function makeFolder()
86115
fi
87116
fi
88117
done
89-
90-
return $retVal
91118
}
92119

93-
function checkDependency()
120+
# run makeFolder on multiple folders
121+
function makeMultipleFolders()
94122
{
95-
local retVal=0
123+
# $* - list of folders
124+
dirList=("$*")
96125

126+
for D in $dirList; do
127+
if [ -d $D ]; then
128+
makeFolder $D
129+
else
130+
print_warning "$D doesn't exist"
131+
updateRetval 1
132+
fi
133+
done
134+
}
135+
136+
function checkDependency()
137+
{
97138
# check submodules
98139
# for each dir in submodules
99140
local TOP=$(dirname $(readlink -f $0))
@@ -115,40 +156,49 @@ function checkDependency()
115156
if [ -z "$(which avr-gcc 2>/dev/null)" ] || [ -z "$(which avrdude 2>/dev/null)" ]; then
116157
((retVal=retVal+1))
117158
print_warning "Missing avr package, please install gcc-avr binutils-avr gdb-avr avr-libc avrdude"
118-
fi
119-
120-
return $retVal
159+
fi
121160
}
122161

123162
function showHelp()
124163
{
125164
cat << EOF
126-
usage: $SCRIPT_DIR_RELATIVE option [value]
165+
usage: $SCRIPT_DIR_RELATIVE [option] {value} DIR1 DIR2 ...
127166
128167
OPTION DECRIPTION
129168
-c dir search in dir recursively and run make clean
130-
-k dir search in dir recursively and run make check
131-
-m dir search in dir recursively and run make all
169+
-k search in DIR1 DIR2 ... recursively and run make check
170+
-m search in DIR1 DIR2 ... recursively and run make all
132171
133172
-T check dependency
134173
-f force continue on make error, default: $FORCE_CONTINUE
135-
-l full report, default: $FULL_REPORT
174+
-l set FULL_REPORT=0, default: $FULL_REPORT
136175
-h this menu
137176
EOF
138177
}
139178

179+
function detectBuildFailure()
180+
{
181+
# check if there is .hex and .elf file generated from make
182+
# if not, return number of failures
183+
echo ""
184+
}
185+
140186
# main ##############################################################
187+
CHECK_DIR=0
188+
COMPILE_DIR=0
189+
141190
# getopt
142-
while getopts ":c:k:m:t:flT" o; do
191+
while getopts ":c:kmt:flT" o; do
143192
case "${o}" in
144193
c)
145194
cleanFolder ${OPTARG}
195+
exit $?
146196
;;
147197
k)
148-
checkFolder ${OPTARG}
198+
CHECK_DIR=1
149199
;;
150200
m)
151-
makeFolder ${OPTARG}
201+
COMPILE_DIR=1
152202
;;
153203
t)
154204
print_title ${OPTARG}
@@ -157,7 +207,7 @@ while getopts ":c:k:m:t:flT" o; do
157207
FORCE_CONTINUE=1
158208
;;
159209
l)
160-
FULL_REPORT=1
210+
FULL_REPORT=0
161211
;;
162212
T)
163213
checkDependency
@@ -169,3 +219,23 @@ while getopts ":c:k:m:t:flT" o; do
169219
done
170220
shift $((OPTIND-1))
171221

222+
# make check on a list of dirs recursively
223+
if [ "$CHECK_DIR" -ne "0" ]; then
224+
checkMultipleFolders "$*"
225+
fi
226+
227+
# make all on a list of dirs recursively
228+
if [ "$COMPILE_DIR" -ne "0" ]; then
229+
makeMultipleFolders "$*"
230+
fi
231+
232+
# make all on a list of dirs recursively
233+
234+
# find return value
235+
if [ -f $RETVAL_FILE ]; then
236+
retVal=$(cat $RETVAL_FILE)
237+
rm -f $RETVAL_FILE
238+
exit $retVal
239+
else
240+
exit -1
241+
fi

0 commit comments

Comments
 (0)