Refactor to use new protocol module and sipo.
[bertos.git] / test / log_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 LOG_FILE="out"
34 DISPLAY_LINE="0"
35 HIDE_WARNING="TODO"
36 SHOW_MSG='warning|error'
37
38
39 if [ $# = 1 ] ; then
40         printf "Use the default settings.\n"
41 else
42         for i in "$@" ;
43         do
44                 case $i in
45                 "-file")
46                         LOG_FILE=$2
47                         ;;
48
49                 "-hide")
50                         HIDE_WARNING=$2
51                         ;;
52                 "-show")
53                         SHOW_MSG=$2
54                         shift
55                         ;;
56                 "-n")
57                         echo "n" $2
58                         DISPLAY_LINE=$2
59                         ;;
60                 esac
61         
62                 #skip to next srgument
63                 shift
64         done
65
66 fi
67
68 printf "Current settings:\n"
69 printf "Log file: "${LOG_FILE}"\n"
70 printf "Show message: "${SHOW_MSG}"\n"
71 printf "Hide warning message: "${HIDE_WARNING}"\n"
72 printf "Display line around to warning/error message: "${DISPLAY_LINE}"\n" 
73
74 if [ $DISPLAY_LINE = 0 ] ; then
75         GREP_ARGS=""
76 else
77         GREP_ARGS="-n"${DISPLAY_LINE}
78 fi
79
80
81 tail -f ${LOG_FILE} | grep -v ${HIDE_WARNING} | sed -e "s/^/vi /" | sed -e "s/:/ +/" | grep $GREP_ARGS -E ${SHOW_MSG}
82
83