Test all configuration options.
[bertos.git] / test / nightly_test.sh
1 #!/bin/bash
2 # This file is part of BeRTOS.
3 #
4 # Bertos is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 #
18 # As a special exception, you may use this file as part of a free software
19 # library without restriction.  Specifically, if other files instantiate
20 # templates or use macros or inline functions from this file, or you compile
21 # this file and link it with other files to produce an executable, this
22 # file does not by itself cause the resulting executable to be covered by
23 # the GNU General Public License.  This exception does not however
24 # invalidate any other reasons why the executable file might be covered by
25 # the GNU General Public License.
26 #
27 # Copyright 2008 Develer S.r.l. (http://www.develer.com/)
28 #
29 # Nighlty test for BeRTOS.
30 #
31 # Author Daniele Basile <asterix@develer.com>
32
33 #Makefile test directory
34 MAKEFILE_TEST_DIR="."
35 TEST_DIR="test"
36 BERTOS_DIR="bertos/"
37 BERTOS_DIR_BAK="bertos.saved"
38 OPTS=1
39 if [ $# = 1 ] ; then
40         if [ $1 = "-h" ] ; then
41                 printf "Nightly test help.\n"
42                 printf "\t--no-silent disable the silent of the TODO/FIXME warning messages.\n"
43                 exit 1
44         elif [ $1 = "--no-silent" ] ; then
45                 OPTS=0
46         fi
47 fi
48
49 if [ $OPTS = 1 ] ; then
50 #Copy BeRTOS sources
51 printf "Starting nightlytest..\n"
52         printf "Silent mode enable, removing the TODO/FIXME message warnings.\n"
53         cp -R $BERTOS_DIR $BERTOS_DIR_BAK || exit 1
54
55         #Strip away TODOs and FIXME
56         find $BERTOS_DIR -name "*.[ch]" | xargs perl -p -i -e 's/^\s*#warning\s*(TODO|FIXME).*//g;'
57         CFG_LIST=`find $BERTOS_DIR/cfg -name "cfg_*.h"`
58         for i in $CFG_LIST ;
59         do
60                 $TEST_DIR/enablecfg.py $i
61         done
62 fi
63
64 #Cpu targets that we want to test
65 TRG="avr arm"
66
67 for i in $TRG ;
68 do
69         ${TEST_DIR}/gen_mk_src.sh $i
70 done
71
72 #Clean and launch make on all
73 make -f ${MAKEFILE_TEST_DIR}/Makefile.test clean
74 make -f ${MAKEFILE_TEST_DIR}/Makefile.test
75
76 if [ $OPTS = 1 ] ; then
77         #Restore original sources
78         if [ -d $BERTOS_DIR_BAK ] ; then
79                 printf "Exiting from nightly..\n"
80                 rm -rf $BERTOS_DIR
81                 mv $BERTOS_DIR_BAK $BERTOS_DIR
82         else
83                 printf "Unable to restore backup copy\n"
84                 exit 1
85         fi
86 fi
87
88 printf "Nightly test done.\n\n"
89
90