forked from nanopb/nanopb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_and_test.sh
40 lines (35 loc) · 1.14 KB
/
build_and_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
# ============================================================================
# Copyright 2019 BRAIN Corporation. All rights reserved. This software is
# provided to you under BRAIN Corporation's Beta License Agreement and
# your use of the software is governed by the terms of that Beta License
# Agreement, found at http://www.braincorporation.com/betalicense.
# ============================================================================
# Robust way of locating script folder
# from http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
SOURCE=${BASH_SOURCE:-$0}
DIR="$( dirname "$SOURCE" )"
while [ -h "$SOURCE" ]
do
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
done
WDIR="$( pwd )"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
#set -e
cd $DIR/generator/proto
make
cd $DIR
cd $DIR/tests
scons #run the build/test suite
RETVAL=$?
echo; echo; echo;
if [ $RETVAL == "0" ]; then
echo "Tests passed; nanopb is OK!"
else
echo "Tests failed; nanopb is sad."
exit 1
fi
echo; echo; echo;
scons -c #cleanup
cd $DIR