source: rtems-testing/merge-helpers/check_bsp @ fc6caa7

4.11
Last change on this file since fc6caa7 was fc6caa7, checked in by Joel Sherrill <joel.sherrill@…>, on Jan 24, 2011 at 3:33:04 PM

2011-01-24 Joel Sherrill <joel.sherrill@…>

  • check_bsp: Fix copyright check to allow Copyright.
  • Property mode set to 100755
File size: 3.9 KB
Line 
1#
2#  Script to test for various things we want in a BSP when it is
3#  submitted.
4#
5#  Test for:
6#    - presense of BSP_BOOTCARD_OPTIONS
7#    - XXX
8#    - XXX
9#
10#  $Id$
11#
12
13if [ $# -ne 1 ] ; then
14  echo Usage: $0 BSPDIR
15  exit 1
16fi
17
18bspdir=${1}
19
20if [ ! -d ${bspdir} ] ; then
21  echo ${bspdir} is not a directory
22  exit 1
23fi
24
25cd ${bspdir}
26if [ $? -ne 0 ] ; then
27  echo Unable to cd to ${bspdir}
28  exit 1
29fi
30
31
32test_its_there()
33{
34  if [ $# -ne 2 ] ; then
35    echo Usage: $0 FILE pattern
36  fi
37  grep ${2} ${1} >/dev/null
38  if [ $? -ne 0 ] ; then
39    echo "${2} is NOT in ${bspdir}/${1}"
40  fi
41
42}
43
44test_its_there_all_case()
45{
46  if [ $# -ne 2 ] ; then
47    echo Usage: $0 FILE pattern
48  fi
49  grep -i ${2} ${1} >/dev/null
50  if [ $? -ne 0 ] ; then
51    echo "${2} is NOT in ${bspdir}/${1} - case independent check"
52  fi
53
54}
55
56test_its_NOT_there_all_case()
57{
58  if [ $# -lt 2 ] ; then
59    echo Usage: $0 FILE pattern
60  fi
61  FILE=$1
62  shift
63  grep -i "${*}" ${FILE} >/dev/null
64  if [ $? -eq 0 ] ; then
65    echo "(${*}) SHOULD NOT BE IN ${bspdir}/${FILE} - case independent check"
66  fi
67}
68
69test_its_NOT_there()
70{
71  if [ $# -lt 2 ] ; then
72    echo Usage: $0 FILE pattern
73  fi
74  FILE=$1
75  shift
76  grep "${*}" ${FILE} >/dev/null
77  if [ $? -eq 0 ] ; then
78    echo "(${*}) SHOULD NOT BE IN ${bspdir}/${FILE}"
79  fi
80}
81
82find_source()
83{
84  findArgs=
85  while getopts "cCm" OPT
86  do
87   case "$OPT" in
88     c) findArgs="${findArgs} -o -name configure.ac" ;;
89     C) findArgs="${findArgs} -o -name *.cfg" ;;
90     m) findArgs="${findArgs} -o -name Makefile.am" ;;
91     *) echo "bad arg to find_source ($OPT)" ; exit 1 ;;
92   esac
93  done
94
95  shiftcount=`expr $OPTIND - 1`
96  shift $shiftcount
97
98  args=$*
99
100  find . -name "*.[chS]" ${findArgs}
101}
102
103if [ -r configure.ac ] ; then
104  echo "=== Checking for RTEMS_BSP_BOOTCARD_OPTIONS in BSP configure.ac"
105  test_its_there configure.ac RTEMS_BSP_BOOTCARD_OPTIONS
106  echo "=== Checking for RTEMS_BSP_CLEANUP_OPTIONS in BSP configure.ac"
107  test_its_there configure.ac RTEMS_BSP_CLEANUP_OPTIONS
108fi
109
110# Verify no lines longer than 80 columns
111echo "=== Checking for lines greater than 79 columns"
112find_source -m -c -C | while read f
113do
114  grep  ".\{80,\}" ${f} >/dev/null
115  if [ $? -eq 0 ] ; then
116    echo "${bspdir}/${FILE} has the following lines that are too long"
117    grep -n '.\{80,\}' ${f}
118  fi
119done
120
121# really need to make the copyright strings consistent in BSPs
122echo "=== Checking for copyright notices"
123find_source | while read f
124do
125  test_its_there_all_case ${f} COPYRIGHT
126done
127
128# We want CVS Id strings everywhere possible
129echo "=== Checking for CVS Id strings"
130find_source | while read f
131do
132  test_its_there ${f} "\$Id"
133done
134
135# We do not want stdio in a BSP
136echo "=== Checking for stdio"
137find_source -m -c -C | while read f
138do
139  test_its_NOT_there ${f} printf
140  test_its_NOT_there ${f} puts
141done
142
143# We do not want the reformatted license notice
144echo "=== Checking for reformatted RTEMS license notices"
145find_source -m -c -C | while read f
146do
147  test_its_NOT_there ${f} "this file may be found in the file"
148done
149
150# We do not want GPL code
151echo "=== Checking for hints of GPL code"
152find_source -m -c -C | while read f
153do
154  test_its_NOT_there ${f} "Free Software Foundation"
155  test_its_NOT_there ${f} "program is free software"
156  test_its_NOT_there ${f} "General Public License"
157done
158
159# We do not want hints that there are things left to do
160echo "=== Checking for TODO hints"
161find_source -m -c -C | while read f
162do
163  test_its_NOT_there ${f} XXX
164  test_its_NOT_there ${f} TODO
165  test_its_NOT_there ${f} TBD
166done
167
168# If not using -O2, then we really want to know
169echo "=== Checking for not using -O2"
170grep -H "\-O[013456789]" make/custom/*.cfg
171
172# BSPs should not turn on extra warnings
173echo "=== Checking for turning on extra GCC warning checks"
174grep -H "\-W" make/custom/*.cfg
175
176# Hopefully have some output from the tmtests
177echo "=== Checking for timing information"
178c=`ls -1 times* 2>/dev/null | wc -l`
179if [ ${c} -eq 0 ] ; then
180  echo "Please run the timing tests and include the results."
181fi
182exit 0
Note: See TracBrowser for help on using the repository browser.