3 if [[ $1 == '-h' || $1 == '-help' || $1 == '--h' || $1 == '--help' ]]; then
5 echo "Usage: $0 [board1 board2 ...]"
7 echo " board1 board2 ... "
8 echo " Boards to build for (optional)"
9 echo " If no boards are given, all boards will be built."
14 EXAMPLE_DIR=${ARC_DIR}/examples/
15 COMPILER_DIR=/opt/compilers/
16 OUTPUT=test_output.xml
17 BUILDOUTTMP=tmp_out.txt
21 echo "<FailedTest id=\"${1}\"> \
23 <Message>${3}</Message> \
24 </FailedTest>" >> $OUTPUT
27 # echo "<File>c:/ArcticStudio/workspace/arc-tests/ComTests/com_test.c</File>"
28 # echo "<Line>444</Line>"
30 # echo "<Message>UPNotificationCalled == getNumberOfSignalsInPdu(IPduId) && 0</Message>"
33 function successfulTest {
34 echo "<Test id=\"${1}\"> \
39 function warningTest {
40 echo "<Test id=\"${1}\"> \
42 <Warning>${3}</Warning>
48 function inArguments {
50 for cl_arg in $cl_args; do
51 if [ "$cl_arg" == "$board" ]; then
58 function shouldBuild {
60 if [ -z "$cl_args" ]; then
64 # Check if told to build for board
65 inArguments "$board"; ret=$?
70 echo "<?xml version=\"1.0\" encoding='utf8' standalone='yes' ?> \
71 <?xml-stylesheet type=\"text/xsl\" href=\"unittests.xsl\" ?> \
74 <CompileExamples>" > $OUTPUT
77 LOGFILE=compile_examples.log
78 if [ -f $LOGFILE ]; then
79 echo "Removing old log"
84 for EXAMPLE in `ls $EXAMPLE_DIR`; do
85 for BOARD in `ls ${EXAMPLE_DIR}${EXAMPLE}/config`; do
86 shouldBuild "$BOARD"; build=$?
87 if [ $build -eq 1 ]; then
88 C=`grep $BOARD compilers.txt`
89 COMPILER=${COMPILER_DIR}${C#$BOARD:}
91 TEST_NAME=${EXAMPLE}-${BOARD}
93 if [ -x "${COMPILER}gcc" ]; then
94 BUILD_FILE=${EXAMPLE}_${BOARD}.elf
96 CROSS_COMPILE=$COMPILER \
98 BDIR=examples/$EXAMPLE \
99 build-exe-y=${BUILD_FILE} \
100 clean all 2>&1 | tee -a $LOGFILE
102 if [ -a ${ARC_DIR}/binaries/${BUILD_FILE} ]; then
103 successfulTest $TEST_ID $TEST_NAME
105 BUILDOUT=`cat $BUILDOUTTMP`
106 failedTest $TEST_ID $TEST_NAME "See console output for information. (compile_examples.log)"
109 warningTest $TEST_ID $TEST_NAME "No compiler found"
111 let TEST_ID=TEST_ID+1
116 echo "</CompileExamples> \
118 </TestRuns>" >> $OUTPUT