<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><span><br></span></div><div></div><div>Hello Joel,</div><div><br></div><div>Updated the contents of the script so that a single file only needs to be run for a bsp. <span style="font-size: 10pt;">I'm sending the attached output of the new script for all bsps. Pls have a look at it.</span></div><div><br></div><div>Can you also check in or review the patch I sent in regarding the addition of PIC API to the documentation ? :-)</div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, clean, sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, clean, sans-serif; background-color: transparent; font-style: normal;">Regards</div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica,
clean, sans-serif; background-color: transparent; font-style: normal;"><span style="background-color:transparent;line-height:1.22;">Vipul Nayyar </span></div><div style="color: rgb(0, 0, 0); font-size: 12.727272033691406px; font-family: arial, helvetica, clean, sans-serif; background-color: transparent; font-style: normal;"><br></div><div><br></div> <div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1"> <font size="2" face="Arial"> <b><span style="font-weight:bold;">From:</span></b> Vipul Nayyar <nayyar_vipul@yahoo.com><br> <b><span style="font-weight: bold;">To:</span></b> rtems-devel@rtems.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Tuesday, 17 September 2013 10:54 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> [PATCH] Bash script to review BSP File Organization<br>
</font> </div> <div class="y_msg_container"><br>---<br> merge-helpers/check_submission | 776 +++++++++++++++++++++++++++++++----------<br> 1 file changed, 590 insertions(+), 186 deletions(-)<br><br>diff --git a/merge-helpers/check_submission b/merge-helpers/check_submission<br>index e838121..90908f1 100755<br>--- a/merge-helpers/check_submission<br>+++ b/merge-helpers/check_submission<br>@@ -1,76 +1,247 @@<br>-#<br>-# Script to test for various things we want in a BSP when it is<br>-# submitted.<br>-#<br>-# Test for:<br>-# - XXX<br>-#<br>+#! /bin/bash<br> <br>-usage()<br>-{<br>-cat <<EOF<br>-check_submission [options] directory<br>- -b - check assuming directory is a BSP<br>- -t - check assuming directory is a test<br>- -v - verbose<br>-EOF<br>-}<br>+# Bash Script to find discrepancies in BSP file organization.<br>+# Author : Vipul Nayyar <<a ymailto="mailto:nayyar_vipul@yahoo.com"
href="mailto:nayyar_vipul@yahoo.com">nayyar_vipul@yahoo.com</a>><br> <br>-fatal()<br>-{<br>- usage<br>- exit 1<br>+<br>+filename="0"<br>+# Passing --verbose turns verbose to 1 & gives the whole story, otherwise '0' to give only important stuff.<br>+verbose="0"<br>+faults="0"<br>+# Passing --warnings turns warnings to 1 & gives all the critical & non-critical bsp file org. problems.<br>+warnings="0"<br>+flag="0"<br>+<br>+calling_path=`pwd`<br>+path=""<br>+<br>+important="1"<br>+rtems_internal=""<br>+internal_done="0"<br>+do_test="0"<br>+format="1"<br>+<br>+<br>+# Finds all rtems internal functions ( name starting with '_' & type specifier)<br>+# that are defined in cpukit & libcpu<br>+function find_rtems_internal(){<br>+ if [[ $internal_done == "1" ]]; then<br>+ return<br>+ fi<br>+ echo "Compiling list of RTEMS Internal functions ..."<br>+ internal_files=""<br>+<br>+ for k in
`find -name *.c`<br>+ do<br>+ for j in `grep -oE "[a-z|A-Z|0-9|_]+[\ |^][_]+[a-z|A-Z|0-9|_]*[\ ]*\(" $k`<br>+ do<br>+ if [[ $j == "_"* ]]; then<br>+ j=${j%%\(}<br>+ internal_files="$j $internal_files"<br>+ fi<br>+<br>+ done<br>+ done<br>+<br>+ for k in `find ../c/src/lib/libcpu/ -name *.c`<br>+ do<br>+ for j in `grep -oE "[a-z|A-Z|0-9|_]+[\ |^][_]+[a-z|A-Z|0-9|_]*[\ ]*\(" $k`<br>+ do<br>+ if [[ $j == "_"* ]]; then<br>+ j=${j%%\(}<br>+ internal_files="$j $internal_files"<br>+ fi<br>+<br>+ done<br>+ done<br>+<br>+ for k in $internal_files<br>+ do<br>+ if echo $rtems_internal |grep -q $k ; then<br>+ echo >
/dev/null<br>+ else<br>+ rtems_internal="$k $rtems_internal"<br>+ fi<br>+ done<br>+<br>+ internal_done="1"<br> }<br> <br>-toggle()<br>-{<br>- case $1 in<br>- no) echo "yes" ;;<br>- yes) echo "no" ;;<br>- *) fatal "Unknown value to toggle ($1)" ;;<br>- esac<br>+# Finds all internal functions common in bsp and (cpukit + libcpu)<br>+function find_bsp_internal(){<br>+ bsp_methods=""<br>+ common_internal_methods=""<br>+<br>+# Searching for internal functions starting with '_' called(i.e ending with a ';')<br>+ for i in `find -name *.c`<br>+ do<br>+ file_contents=`tr -d '\n' < $i | grep -oE "[ |^][_]+[a-z|A-Z|0-9|_]*[ ]*[\n]*\([^;]*\)[ ]*;" | tr -d '\n' `<br>+<br>+ for j in `echo "$file_contents" | grep -oE "[_]+[a-z|A-Z|0-9|_]*[ ]*\("`<br>+ do<br>+ if
`echo "$bsp_methods" |grep -q "${j%%\(}"` ; then<br>+ echo > /dev/null<br>+ else<br>+ bsp_methods="${j%%\(} $bsp_methods"<br>+ fi<br>+ done<br>+ done<br>+<br>+# Identifying common fucntions between $rtems_interval & $bsp_methods<br>+ for i in $rtems_internal<br>+ do<br>+ if [[ $i == "__asm__" || $i == "__attribute__" || $i == "__volatile__" || $i == "__"* ]];then<br>+ continue<br>+ fi<br>+ for j in $bsp_methods<br>+ do<br>+ if [[ $i == $j ]]; then<br>+ common_internal_methods="$j $common_internal_methods"<br>+ fi<br>+ done<br>+ done<br>+<br>+ if [[ $common_internal_methods != "" ]]; then<br>+ echo -e "$bsp : RTEMS Internal functions used :
\c"<br>+ for i in $common_internal_methods<br>+ do<br>+ echo -e "${i}() \c"<br>+ done<br>+ flag="1"<br>+ fi<br> }<br> <br>-verbose="no"<br>-do_bsp="no"<br>-do_test="no"<br>-<br>-while getopts vbt OPT<br>-do<br>- case "$OPT" in<br>- b) do_bsp="yes" ; do_test="no" ;;<br>- t) do_bsp="no" ; do_test="yes" ;;<br>- v) verbose=`toggle ${verbose}` ;;<br>- *) fatal ;;<br>- esac<br>-done<br> <br>-########################### Grab Directory ###########################<br>+# Passing 1 initially to any check function states that the file/method/header<br>+# being checked is of critical nature<br>+function check_file(){<br>+ filename="0"<br>+ if [[ $1 == 1 ]]; then<br>+ important="1"<br>+ shift<br>+
else<br>+ important="0"<br>+ fi<br> <br>-shiftcount=`expr $OPTIND - 1`<br>-shift $shiftcount<br>+#Grabbing the path of file being evaluated from Makefile.am<br>+ if grep -wqE "[ ]*[^\ ]*/($1)" Makefile.am ; then<br>+ file_path=`grep -woE "[ ]*[^\ ]*/($1)" Makefile.am | head --lines=1`<br>+ cd `dirname $file_path`<br>+ filename=$1<br>+ file_path=`pwd`<br>+<br>+ cd - > /dev/null<br>+ shift<br>+<br>+# Checking if file lies in correct directory path<br>+ for i in $*<br>+ do<br>+ if [[ -d $i ]]; then<br>+ cd $i<br>+ else<br>+ continue<br>+ fi<br>+<br>+<br>+ if [[ "$file_path" == `pwd` ]]; then<br>+ filename="$file_path/$filename"<br>+ cd -
>/dev/null<br>+ return<br>+ fi<br>+ cd - > /dev/null<br>+ done<br>+ echo "$bsp : $filename not present in correct path"<br>+ filename="$file_path/$filename"<br>+ return<br>+ else<br>+ if [[ $warnings -eq "1" || $important -eq "1" || $verbose -eq "1" ]]; then<br>+ flag="1"<br>+ echo "$bsp : $1 not compiled"<br>+ fi<br>+ fi<br> <br>-basedir=${1}<br>+ filename="0"<br>+ faults="1"<br>+ return<br>+}<br> <br>-if [ "${basedir}X" = "X" ] ; then<br>- basedir=.<br>-fi<br>+# Checking presence of functions in specific files<br>+function check_methods(){<br>+ if [[ $1 == 1 ]]; then<br>+ important="1"<br>+ shift<br>+ else<br>+ important="0"<br>+ fi<br> <br>-if [ ${do_bsp} = "no" -a
${do_test} = "no" ] ; then<br>- fatal must select test or bsp check mode<br>-fi<br>+ for i in $*<br>+ do<br> <br>-if [ ! -d ${basedir} ] ; then<br>- fatal ${basedir} is not a directory<br>-fi<br>+# When correct file for this function does not exist<br>+ if [[ $filename == "0" ]];then<br>+ if grep -rqlE "[a-z|A-Z|0-9|_]+[ ]*$i[ ]*\(" * ;then<br>+ if [[ $warnings -eq "1" || $important -eq "1" || $verbose -eq "1" ]];then<br>+ echo $bsp : ${i%(*}"()" present in file `grep -rlE "[a-z|A-Z|0-9|_]+[ ]*$i[ ]*\(" *`<br>+ fi<br>+ fi<br>+ else<br>+<br>+# When correct file for this function exists<br>+ if grep -Eq "[a-z|A-Z|0-9|_]+[ ]*$i[ ]*\(" $filename ; then<br>+ if [[ $verbose -eq "1" ]] ;then<br>+ echo
"$bsp : `basename $filename` : ${i%(*}() present in file"<br>+ fi<br>+ else<br>+ if grep -rqlE "[a-z|A-Z|0-9|_]+[ ]*$i[ ]*\(" * ;then<br>+ if [[ $warnings -eq "1" || $important -eq "1" || $verbose -eq "1" ]];then<br>+ echo $bsp : ${i%(*}"()" present in file `grep -rlE "[a-z|A-Z|0-9|_]+[ ]*$i[ ]*\(" *`<br>+ fi<br>+ else<br>+ if [[ $warnings -eq "1" || $important -eq "1" || $verbose -eq "1" ]]; then<br>+ echo "$bsp : `basename $filename` : ${i%(*}() function does not exist in $filename "<br>+ flag="1"<br>+ fi<br>+ faults="1"<br>+
fi<br>+ fi<br>+<br>+ fi<br>+ done<br>+}<br> <br>+# Checking presence of headers installed by bsp<br>+function check_header(){<br>+ if [[ $1 == 1 ]]; then<br>+ important="1"<br>+ shift<br>+ else<br>+ important="0"<br>+ fi<br> <br>-cd ${basedir}<br>-if [ $? -ne 0 ] ; then<br>- echo Unable to cd to ${basedir}<br>- exit 1<br>-fi<br>+ for i in $*<br>+ do<br>+ if grep -wq "$i" Makefile.am ;then<br>+ if [[ ! -f "$i" && ! -f "${i}.in" ]] ;then<br>+ continue<br>+ fi<br>+ if [[ $verbose -eq "1" ]] ;then<br>+ cd `dirname $i`<br>+ echo "$bsp : `basename $i` installed from directory" ${PWD##*/c/src/lib/}<br>+ cd - > /dev/null<br>+
fi<br>+ return<br>+ fi<br>+ done<br>+<br>+ if [[ $warnings -eq "1" || $important -eq "1" || $verbose -eq "1" ]]; then<br>+ echo "${bsp%%[\ ]*} : `basename $1` not installed "<br>+ flag="1"<br>+ fi<br>+ filename="0"<br>+ faults="1"<br>+ return<br> <br>+}<br> <br> test_its_there()<br> {<br>@@ -79,7 +250,7 @@ test_its_there()<br> fi<br> grep ${2} ${1} >/dev/null<br> if [ $? -ne 0 ] ; then<br>- echo "${2} is NOT in ${basedir}/${1}"<br>+ echo "$bsp : ${2} is NOT in ${1##./}"<br> fi<br> <br> }<br>@@ -91,7 +262,7 @@ test_its_there_all_case()<br> fi<br> grep -i ${2} ${1} >/dev/null<br> if [ $? -ne 0 ] ; then<br>- echo "${2} is NOT in ${basedir}/${1} - case independent check"<br>+ echo "$bsp : ${2} is NOT in ${1##./} - case independent check"<br> fi<br>
<br> }<br>@@ -105,7 +276,7 @@ test_its_NOT_there_all_case()<br> shift<br> grep -i "${*}" ${FILE} >/dev/null<br> if [ $? -eq 0 ] ; then<br>- echo "(${*}) SHOULD NOT BE IN ${basedir}/${FILE} - case independent check"<br>+ echo "$bsp : (${*}) SHOULD NOT BE IN ${FILE##./} - case independent check"<br> fi<br> }<br> <br>@@ -118,14 +289,14 @@ test_its_NOT_there()<br> shift<br> grep "${*}" ${FILE} >/dev/null<br> if [ $? -eq 0 ] ; then<br>- echo "(${*}) SHOULD NOT BE IN ${basedir}/${FILE}"<br>+ echo "$bsp : (${*}) SHOULD NOT BE IN ${FILE##./}"<br> fi<br> }<br> <br> find_source()<br> {<br> findArgs=<br>- while getopts "cCm" OPT<br>+ while getopts "cCdm" OPT<br> do<br> case "$OPT" in<br> c) findArgs="${findArgs} -o -name configure.ac" ;;<br>@@ -144,145 +315,378 @@ find_source()<br> find
. -name "*.[chS]" ${findArgs}<br> }<br> <br>-# Verify no lines longer than 80 columns<br>-echo "=== Checking for lines greater than 79 columns"<br>-find_source -m -c -C | while read f<br>-do<br>- grep ".\{80,\}" ${f} >/dev/null<br>- if [ $? -eq 0 ] ; then<br>- echo "*** ${basedir}/${f} has the following lines that are too long"<br>- grep -n '.\{80,\}' ${f}<br>- fi<br>-done<br>-<br>-# really need to make the copyright strings consistent in BSPs<br>-echo "=== Checking for copyright notices"<br>-find_source | while read f<br>-do<br>- test_its_there_all_case ${f} COPYRIGHT<br>-done<br>-<br>-# We want CVS Id strings everywhere possible<br>-echo "=== Checking for CVS Id strings"<br>-find_source -d | while read f<br>-do<br>- test_its_NOT_there ${f} "\$Id"<br>-done<br>-<br>-# We do not want the reformatted license notice<br>-echo "=== Checking for reformatted RTEMS license notices"<br>-find_source
-m -c -C | while read f<br>-do<br>- test_its_NOT_there ${f} "this file may be found in the file"<br>-done<br>-<br>-# We do not want spaces at the end of lines<br>-echo "=== Checking for spaces at the end of lines"<br>-find_source -m -c -C | while read f<br>-do<br>- egrep " +$" $f >/dev/null<br>- test $? -eq 0 && echo "$f has spaces at the end of one or more lines."<br>-done<br>-<br>-# We do not want tabs in source files<br>-echo "=== Checking for tabs in source files"<br>-find_source | while read f<br>-do<br>- grep -P '\t' $f >/dev/null<br>- if [ $? -eq 0 ]; then<br>- echo "*** ${basedir}/${f} has the following lines with tabs"<br>- grep -P '\t' $f<br>- fi<br>-done<br>-<br>-# We do not want GPL code<br>-echo "=== Checking for hints of GPL code"<br>-find_source -m -c -C | while read f<br>-do<br>- test_its_NOT_there ${f} "Free Software Foundation"<br>-
test_its_NOT_there ${f} "program is free software"<br>- test_its_NOT_there ${f} "General Public License"<br>-done<br>-<br>-# We do not want hints that there are things left to do<br>-echo "=== Checking for TODO hints"<br>-find_source -m -c -C | while read f<br>-do<br>- test_its_NOT_there ${f} XXX<br>- test_its_NOT_there ${f} TODO<br>- test_its_NOT_there ${f} TBD<br>-done<br>+function check_format(){<br> <br>-#<br>-# BSP specific checks<br>-#<br>-if [ ${do_bsp} = "yes" ] ; then<br>- # We do not want stdio in a BSP<br>- echo "=== Checking for stdio"<br>+ # Verify no lines longer than 80 columns<br>+ echo "=== Checking for lines greater than 80 columns"<br>+ find_source -m -c -C | while read f<br>+ do<br>+ grep ".\{81,\}" ${f} >/dev/null<br>+ if [ $? -eq 0 ] ; then<br>+ echo -e "\n$bsp : ${f#./} has more than 80 character lines"<br>+
for i in `grep -n '.\{80,\}' ${f} | cut -f1 -d:`<br>+ do<br>+ echo -e "$i \c"<br>+ done<br>+ fi<br>+ done<br>+<br>+ # really need to make the copyright strings consistent in BSPs<br>+ echo -e "\n=== Checking for copyright notices"<br>+ find_source | while read f<br>+ do<br>+ test_its_there_all_case ${f} COPYRIGHT<br>+ done<br>+<br>+ # We want CVS Id strings everywhere possible<br>+ echo "=== Checking for CVS Id strings"<br>+ find_source -d | while read f<br>+ do<br>+ test_its_NOT_there ${f} "\$Id"<br>+ done<br>+<br>+ # We do not want the reformatted license notice<br>+ echo "=== Checking for reformatted RTEMS license notices"<br>+ find_source -m -c -C | while read f<br>+ do<br>+ test_its_NOT_there ${f} "this file may be found in the
file"<br>+ done<br>+<br>+ # We do not want spaces at the end of lines<br>+ echo "=== Checking for spaces at the end of lines"<br>+ find_source -m -c -C | while read f<br>+ do<br>+ egrep " +$" $f >/dev/null<br>+ test $? -eq 0 && echo -e "${f##./} \c"<br>+ done<br>+<br>+ # We do not want tabs in source files<br>+ echo -e "\n=== Checking for tabs in source files"<br>+ find_source | while read f<br>+ do<br>+ grep -P '\t' $f >/dev/null<br>+ test $? -eq 0 && echo -e "${f##./} \c"<br>+ done<br>+<br>+ # We do not want GPL code<br>+ echo -e "\n=== Checking for hints of GPL code"<br> find_source -m -c -C | while read f<br> do<br>- test_its_NOT_there ${f} printf<br>- test_its_NOT_there ${f} "puts("<br>+ test_its_NOT_there ${f} "Free Software
Foundation"<br>+ test_its_NOT_there ${f} "program is free software"<br>+ test_its_NOT_there ${f} "General Public License"<br> done<br> <br>- # BSPs should include RTEMS_BSP_CLEANUP_OPTIONS and maybe<br>- # RTEMS_BSP_BOOTCARD_OPTIONS<br>- if [ -r configure.ac ] ; then<br>- echo "=== Checking for RTEMS_BSP_BOOTCARD_OPTIONS in BSP configure.ac"<br>- test_its_not_there configure.ac RTEMS_BSP_BOOTCARD_OPTIONS<br>- echo "=== Checking for RTEMS_BSP_CLEANUP_OPTIONS in BSP configure.ac"<br>- test_its_there configure.ac RTEMS_BSP_CLEANUP_OPTIONS<br>+ # We do not want hints that there are things left to do<br>+ echo "=== Checking for TODO hints"<br>+ find_source -m -c -C | while read f<br>+ do<br>+ test_its_NOT_there ${f} XXX<br>+ test_its_NOT_there ${f} TODO<br>+ test_its_NOT_there ${f}
TBD<br>+ done<br>+}<br>+<br>+# Reviewing for a BSP Starts<br>+function main(){<br>+<br>+ if [[ $format -eq "1" ]]; then<br>+ check_format<br> fi<br> <br>- # If not using -O2, then we really want to know<br>- # BSPs should normally use -O2<br>- echo "=== Checking for not using -O2"<br>- grep -H "\-O[013456789]" make/custom/*.cfg<br>+ # We do not want stdio in a BSP<br>+ echo "=== Checking for stdio"<br>+ find_source -m -c -C | while read f<br>+ do<br>+ test_its_NOT_there ${f} printf<br>+ test_its_NOT_there ${f} "puts("<br>+ done<br>+<br>+ # BSPs should include RTEMS_BSP_CLEANUP_OPTIONS and maybe<br>+ # RTEMS_BSP_BOOTCARD_OPTIONS<br>+ if [ -r configure.ac ] ; then<br>+ echo "=== Checking for RTEMS_BSP_BOOTCARD_OPTIONS in BSP
configure.ac"<br>+ test_its_NOT_there configure.ac RTEMS_BSP_BOOTCARD_OPTIONS<br>+ echo "=== Checking for RTEMS_BSP_CLEANUP_OPTIONS in BSP configure.ac"<br>+ test_its_there configure.ac RTEMS_BSP_CLEANUP_OPTIONS<br>+ fi<br>+<br>+ # If not using -O2, then we really want to know<br>+ # BSPs should normally use -O2<br>+ echo "=== Checking for not using -O2"<br>+ grep -H "\-O[013456789]" make/custom/*.cfg<br> <br>- # BSPs should not turn on extra warnings<br>- echo "=== Checking for turning on extra GCC warning checks"<br>- grep -H "\-W" make/custom/*.cfg<br>+ # BSPs should not turn on extra warnings<br>+ echo "=== Checking for turning on extra GCC warning checks"<br>+ grep -H "\-W" make/custom/*.cfg<br> <br>- # Hopefully have some output from the tmtests<br>- echo
"=== Checking for timing information"<br>- c=`ls -1 times* 2>/dev/null | wc -l`<br>- if [ ${c} -eq 0 ] ; then<br>- echo "Please run the timing tests and include the results."<br>+ # Hopefully have some output from the tmtests<br>+ echo "=== Checking for timing information"<br>+ c=`ls -1 times* 2>/dev/null | wc -l`<br>+ if [ ${c} -eq 0 ] ; then<br>+ echo "Please run the timing tests and include the results."<br> fi<br>-fi ## END OF IF BSP<br> <br>-#<br>+ echo -e "\n=== Starting BSP Unified way checks"<br>+<br>+ flag="0"<br>+<br>+ check_file 1 start.S ../shared/start/ start/<br>+ if [[ $filename != "0" ]];then<br>+ if grep -wq "start" "$filename" || grep -wq "_start" "$filename"; then<br>+ if [[ $verbose -eq "1" ]] ;then<br>+ echo "$bsp : `basename $filename`
start() present in $filename"<br>+ fi<br>+ else<br>+ echo "$bsp : `basename $filename` start() does not exist in start.S"<br>+ fi<br>+ fi<br>+<br>+ check_file 1 bspstart.c ../../shared/ ../shared/ startup/<br>+ check_methods "bsp_start"<br>+<br>+ check_file 1 bspreset.c ../../shared/ ../shared/ startup/<br>+ check_methods 1 "bsp_reset"<br>+<br>+<br>+ check_file 1 bootcard.c ../../shared/<br>+ check_header ../../shared/include/bootcard.h<br>+<br>+ check_file 1 bspclean.c ../../shared/ startup/<br>+ check_methods "bsp_fatal_extension"<br>+<br>+ check_file 1 bspgetworkarea.c ../../shared/ ../../shared/startup ../shared/ ../shared/startup/ startup/<br>+ check_methods 1 "bsp_work_area_initialize"<br>+<br>+<br>+ check_file 1 bsplibc.c ../../shared/<br>+ check_methods "bsp_libc_init"<br>+<br>+ check_file 1
bsppost.c ../../shared/<br>+ check_methods "bsp_postdriver_hook"<br>+<br>+ check_file 1 bsppredriverhook.c ../../shared/ ../shared/startup/ startup/<br>+ check_methods "bsp_predriver_hook"<br>+<br>+<br>+ check_file gnatinstallhandler.c ../../shared/<br>+<br>+ check_file sbrk.c ../../shared/ ../../shared/ startup/<br>+ check_methods "sbrk"<br>+<br>+<br>+ check_file stackalloc.c ../../shared/src/<br>+ check_methods "bsp_stack_allocate_init" "bsp_stack_allocate" "bsp_stack_free"<br>+<br>+ check_header ../../shared/include/stackalloc.h<br>+<br>+ # Interrupt Files<br>+ check_file 1 irq.c irq/<br>+ check_methods "bsp_interrupt_vector_enable" "bsp_interrupt_vector_disable" "bsp_interrupt_facility_initialize" "bsp_interrupt_dispatch"<br>+ check_header 1 include/irq.h<br>+<br>+ # PIC Support<br>+<br>+ check_file irq-default-handler.c ../../shared/src/<br>+<br>+
check_file 1 irq-generic.c ../../shared/src/<br>+ check_header 1 ../../shared/include/irq-generic.h<br>+<br>+ check_file irq-info.c ../../shared/src/<br>+ check_header ../../shared/include/irq-info.h<br>+<br>+ check_file irq-legacy.c ../../shared/src/<br>+ check_file irq-server.c ../../shared/src/<br>+ check_file irq-shell.c ../../shared/src/<br>+<br>+ # Real Time Clock<br>+ check_file rtc-config.c rtc/<br>+ check_methods "bsp_rtc_initialize" "bsp_rtc_get_time" "bsp_rtc_set_time" "bsp_rtc_probe"<br>+<br>+<br>+ check_file 1 tod.c ../../shared/ tod/<br>+<br>+ # Benchmark Timers<br>+ check_file benchmark_timer.c benchmark_timer/<br>+ check_methods "benchmark_timer_initialize" "benchmark_timer_read" "benchmark_timer_disable_subtracting_average_overhead"<br>+<br>+<br>+ # Standard Headers<br>+<br>+ check_header 1 include/bsp.h<br>+ check_header
include/bspopts.h<br>+ check_header 1 ../../shared/include/coverhd.h include/coverhd.h<br>+ check_header ../../shared/include/utility.h<br>+ check_header 1 ../../shared/include/tm27.h include/tm27.h<br>+<br>+ cd ../../../../../../cpukit<br>+ find_rtems_internal<br>+ cd - > /dev/null<br>+<br>+ # Finding all internal functions being used in a bsp<br>+ find_bsp_internal<br>+<br>+ if [[ $flag == "1" ]]; then<br>+ echo -e "\n"<br>+ fi<br>+<br>+ #<br> # Test specific checks<br> #<br>-if [ ${do_test} = "yes" ] ; then<br>- # find all the Makefile.am's with rtems_tests_PROGRAMS in them<br>- Makefiles=`find . -name Makefile.am | xargs -e grep -l ^rtems_tests`<br>- if [ "X${Makefiles}" = "X" ] ; then<br>- fatal "Unable to locate any test Makefile.am files."<br>- fi<br>- echo "=== Checking for missing test support files"<br>- for m in
${Makefiles}<br>- do<br>- directory=`dirname ${m}`<br>- if [ ${directory} = "." ] ; then<br>- directory=`pwd`<br>+ if [ ${do_test} == "1" ] ; then<br>+<br>+ echo -e "\n=== Starting Test specific checks"<br>+ # find all the Makefile.am's with rtems_tests_PROGRAMS in them<br>+ Makefiles=`find . -name Makefile.am | xargs -e grep -l ^rtems_tests`<br>+ if [ "X${Makefiles}" = "X" ] ; then<br>+ echo -e "Unable to locate any test Makefile.am files.\n"<br>+ return<br> fi<br>- testName=`basename ${directory}`<br>- # Does this test have a .doc file?<br>- if [ ! -r ${directory}/${testName}.doc ] ; then<br>- echo ${testName}.doc is not present<br>+ echo "=== Checking for missing test support files"<br>+ for m in
${Makefiles}<br>+ do<br>+ directory=`dirname ${m}`<br>+ if [ ${directory} = "." ] ; then<br>+ directory=`pwd`<br>+ fi<br>+ testName=`basename ${directory}`<br>+ # Does this test have a .doc file?<br>+ if [ ! -r ${directory}/${testName}.doc ] ; then<br>+ echo ${testName}.doc is not present<br>+ fi<br>+ case ${directory} in<br>+ */*tmtests*) ;;<br>+ *)<br>+ # Does this test have a .scn file?<br>+ if [ ! -r ${directory}/${testName}.scn ] ; then<br>+ echo ${testName}.scn is not present<br>+ fi<br>+
;;<br>+ esac<br>+ done<br>+<br>+ fi<br>+}<br>+<br>+# Verifying if the directory given or pwd is a valid bsp, shared architecture, or libbsp directory<br>+function check_given_dir(){<br>+ if echo $cur_dir | grep -Eq "c/src/lib/libbsp/([^/]+)/([^/]+)/([^/]+)*" ; then<br>+ return 0<br>+<br>+ elif echo $cur_dir | grep -Eq "c/src/lib/libbsp/([^/]+)/([^/]+)" ; then<br>+# BSP given<br>+ bsp=${cur_dir##*/}<br>+<br>+ if [[ $bsp == "shared" || $bsp == "autom4te.cache" || $bsp == "no_bsp" ]]; then<br>+ return 0<br>+ else<br>+ main<br> fi<br>- case ${directory} in<br>- */*tmtests*) ;;<br>- *)<br>- # Does this test have a .scn file?<br>- if [ ! -r ${directory}/${testName}.scn ] ; then<br>-
echo ${testName}.scn is not present<br>+ elif echo $cur_dir | grep -Eq "c/src/lib/libbsp/([^/]+)" ; then<br>+# Shared architecture given<br>+ for i in *<br>+ do<br>+ if [[ -d $i ]]; then<br>+ if [[ $i == "shared" || $i == "autom4te.cache" || $i == "no_bsp" ]]; then<br>+ echo -n<br>+ else<br>+ bsp=$i<br>+<br>+ cd $bsp<br>+ main<br>+ cd .. > /dev/null<br>+ fi<br>+ fi<br>+ done<br>+ elif echo $cur_dir | grep -Eq "c/src/lib/libbsp" ; then<br>+# libbsp given<br>+ for i in */*/Makefile.am<br>+ do<br>+ i=`dirname $i`<br>+ if [[ -d $i
]]; then<br>+ if [[ $i == "shared" || $i == "autom4te.cache" || $i == "no_cpu/no_bsp" ]]; then<br>+ echo -n<br>+ else<br>+ bsp=$i<br>+<br>+ cd $bsp<br>+ main<br>+ cd ../../ > /dev/null<br> fi<br>- ;;<br>+ fi<br>+ done<br>+<br>+ else<br>+ return 0<br>+ fi<br>+}<br>+<br>+# Evaluating Command Line Arguments<br>+function start(){<br>+<br>+ for i in $*<br>+ do<br>+ case $i in<br>+ "--verbose") verbose="1" # The whole story<br>+ ;;<br>+<br>+ "--warnings") warnings="1" # All warnings<br>+
verbose="0"<br>+ ;;<br>+<br>+ "--no_format") format="0" # Disabling format checks<br>+ verbose="0"<br>+ ;;<br>+<br>+ "--tests") do_test="1" # Enabling check of tests<br>+ verbose="0"<br>+ ;;<br>+<br>+ "--help") echo "Help to be provided"<br>+ ;;<br>+<br>+ "--"* | "-"* ) echo "Invalid options provided"<br>+ ;;<br>+<br>+ *) path="$path $i" ;; # If not above options, then assumed to be a path for bsp<br> esac<br> done<br>- <br>-fi<br> <br>-exit 0<br>+# No path given, search for bsp from pwd<br>+ if [[ -z $path ]];then<br>+ path=$PWD<br>+ cur_dir=`pwd`<br>+
check_given_dir<br>+ if [[ $? -eq 1 ]];then<br>+ echo "Current directory does not seem a valid RTEMS directory"<br>+ fi<br>+<br>+ else<br>+ for i in $path<br>+ do<br>+ if [[ -d $i ]]; then<br>+ echo > /dev/null<br>+ else<br>+ echo "$i is an invalid directory."<br>+ continue<br>+ fi<br>+<br>+ cd $i<br>+ cur_dir=`pwd`<br>+ check_given_dir<br>+ if [[ $? -eq 1 ]];then<br>+ echo "$i does not seem a valid RTEMS directory"<br>+ fi<br>+ cd $calling_path<br>+<br>+ done<br>+ fi<br>+}<br>+<br>+# Let the Game begin !!<br>+start $*<br>+<br>+# End of Checks<br>+if [[ $faults -eq "0" ]]
; then<br>+ echo -e "\nNo faults found in BSP organization"<br>+fi<br>-- <br>1.7.11.7<br><br>_______________________________________________<br>rtems-devel mailing list<br><a ymailto="mailto:rtems-devel@rtems.org" href="mailto:rtems-devel@rtems.org">rtems-devel@rtems.org</a><br><a href="http://www.rtems.org/mailman/listinfo/rtems-devel" target="_blank">http://www.rtems.org/mailman/listinfo/rtems-devel</a><br><br><br></div> </div> </div> </div></body></html>