diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-08-01 14:23:15 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-08-01 14:23:15 +0000 |
commit | edf7492a3606b959b76e418b528213c4472e9188 (patch) | |
tree | 77e2b760838b61e2cb64440657eab9d9e2219b06 /merge-helpers | |
parent | 8c4e65485817e0046c5adff5ede1269fb4fbc9d6 (diff) |
2011-08-01 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile: Enhance to check more than a BSP.
* check_submission: New file.
* check_bsp: Removed.
Diffstat (limited to 'merge-helpers')
-rw-r--r-- | merge-helpers/ChangeLog | 6 | ||||
-rw-r--r-- | merge-helpers/Makefile | 2 | ||||
-rwxr-xr-x | merge-helpers/check_submission (renamed from merge-helpers/check_bsp) | 133 |
3 files changed, 96 insertions, 45 deletions
diff --git a/merge-helpers/ChangeLog b/merge-helpers/ChangeLog index daa1bc1..2044f88 100644 --- a/merge-helpers/ChangeLog +++ b/merge-helpers/ChangeLog @@ -1,3 +1,9 @@ +2011-08-01 Joel Sherrill <joel.sherrill@oarcorp.com> + + * Makefile: Enhance to check more than a BSP. + * check_submission: New file. + * check_bsp: Removed. + 2011-01-24 Joel Sherrill <joel.sherrill@oarcorp.com> * check_bsp: Fix copyright check to allow Copyright. diff --git a/merge-helpers/Makefile b/merge-helpers/Makefile index 5f7a659..26fd792 100644 --- a/merge-helpers/Makefile +++ b/merge-helpers/Makefile @@ -3,7 +3,7 @@ # INSTALL_DIR=../bin -SCRIPTS=check_bsp +SCRIPTS=check_submission all: prep ${SCRIPTS} install diff --git a/merge-helpers/check_bsp b/merge-helpers/check_submission index 0d34c9b..7bb232c 100755 --- a/merge-helpers/check_bsp +++ b/merge-helpers/check_submission @@ -3,28 +3,67 @@ # submitted. # # Test for: -# - presense of BSP_BOOTCARD_OPTIONS -# - XXX # - XXX # # $Id$ # -if [ $# -ne 1 ] ; then - echo Usage: $0 BSPDIR +usage() +{ +cat <<EOF +check_submission [options] directory + -v - verbose +EOF +} + +fatal() +{ + usage exit 1 -fi +} + +toggle() +{ + case $1 in + no) echo "yes" ;; + yes) echo "no" ;; + *) fatal "Unknown value to toggle ($1)" ;; + esac +} -bspdir=${1} +verbose="no" +do_bsp="no" +do_test="no" -if [ ! -d ${bspdir} ] ; then - echo ${bspdir} is not a directory - exit 1 +while getopts vbt OPT +do + case "$OPT" in + b) do_bsp="yes" ; do_test="no" ;; + t) do_bsp="no" ; do_test="yes" ;; + v) verbose=`toggle ${verbose}` ;; + *) fatal ;; + esac +done + +########################### Grab Directory ########################### + +shiftcount=`expr $OPTIND - 1` +shift $shiftcount + +basedir=${1} + +if [ ${do_bsp} = "no" -a ${do_test} = "no" ] ; then + fatal must select test or bsp check mode +fi + +if [ ! -d ${basedir} ] ; then + fatal ${basedir} is not a directory fi -cd ${bspdir} + +cd ${basedir} if [ $? -ne 0 ] ; then - echo Unable to cd to ${bspdir} + echo Unable to cd to ${basedir} exit 1 fi @@ -36,7 +75,7 @@ test_its_there() fi grep ${2} ${1} >/dev/null if [ $? -ne 0 ] ; then - echo "${2} is NOT in ${bspdir}/${1}" + echo "${2} is NOT in ${basedir}/${1}" fi } @@ -48,7 +87,7 @@ test_its_there_all_case() fi grep -i ${2} ${1} >/dev/null if [ $? -ne 0 ] ; then - echo "${2} is NOT in ${bspdir}/${1} - case independent check" + echo "${2} is NOT in ${basedir}/${1} - case independent check" fi } @@ -62,7 +101,7 @@ test_its_NOT_there_all_case() shift grep -i "${*}" ${FILE} >/dev/null if [ $? -eq 0 ] ; then - echo "(${*}) SHOULD NOT BE IN ${bspdir}/${FILE} - case independent check" + echo "(${*}) SHOULD NOT BE IN ${basedir}/${FILE} - case independent check" fi } @@ -75,7 +114,7 @@ test_its_NOT_there() shift grep "${*}" ${FILE} >/dev/null if [ $? -eq 0 ] ; then - echo "(${*}) SHOULD NOT BE IN ${bspdir}/${FILE}" + echo "(${*}) SHOULD NOT BE IN ${basedir}/${FILE}" fi } @@ -100,20 +139,13 @@ find_source() find . -name "*.[chS]" ${findArgs} } -if [ -r configure.ac ] ; then - echo "=== Checking for RTEMS_BSP_BOOTCARD_OPTIONS in BSP configure.ac" - test_its_there configure.ac RTEMS_BSP_BOOTCARD_OPTIONS - echo "=== Checking for RTEMS_BSP_CLEANUP_OPTIONS in BSP configure.ac" - test_its_there configure.ac RTEMS_BSP_CLEANUP_OPTIONS -fi - # Verify no lines longer than 80 columns echo "=== Checking for lines greater than 79 columns" find_source -m -c -C | while read f do grep ".\{80,\}" ${f} >/dev/null if [ $? -eq 0 ] ; then - echo "${bspdir}/${FILE} has the following lines that are too long" + echo "*** ${basedir}/${f} has the following lines that are too long" grep -n '.\{80,\}' ${f} fi done @@ -132,14 +164,6 @@ do test_its_there ${f} "\$Id" done -# We do not want stdio in a BSP -echo "=== Checking for stdio" -find_source -m -c -C | while read f -do - test_its_NOT_there ${f} printf - test_its_NOT_there ${f} puts -done - # We do not want the reformatted license notice echo "=== Checking for reformatted RTEMS license notices" find_source -m -c -C | while read f @@ -166,17 +190,38 @@ do done # If not using -O2, then we really want to know -echo "=== Checking for not using -O2" -grep -H "\-O[013456789]" make/custom/*.cfg - -# BSPs should not turn on extra warnings -echo "=== Checking for turning on extra GCC warning checks" -grep -H "\-W" make/custom/*.cfg - -# Hopefully have some output from the tmtests -echo "=== Checking for timing information" -c=`ls -1 times* 2>/dev/null | wc -l` -if [ ${c} -eq 0 ] ; then - echo "Please run the timing tests and include the results." -fi +if [ ${do_bsp} = "yes" ] ; then + # We do not want stdio in a BSP + echo "=== Checking for stdio" + find_source -m -c -C | while read f + do + test_its_NOT_there ${f} printf + test_its_NOT_there ${f} puts + done + + # BSPs should include RTEMS_BSP_CLEANUP_OPTIONS and maybe + # RTEMS_BSP_BOOTCARD_OPTIONS + if [ -r configure.ac ] ; then + echo "=== Checking for RTEMS_BSP_BOOTCARD_OPTIONS in BSP configure.ac" + test_its_there configure.ac RTEMS_BSP_BOOTCARD_OPTIONS + echo "=== Checking for RTEMS_BSP_CLEANUP_OPTIONS in BSP configure.ac" + test_its_there configure.ac RTEMS_BSP_CLEANUP_OPTIONS + fi + + # BSPs should normally use -O2 + echo "=== Checking for not using -O2" + grep -H "\-O[013456789]" make/custom/*.cfg + + # BSPs should not turn on extra warnings + echo "=== Checking for turning on extra GCC warning checks" + grep -H "\-W" make/custom/*.cfg + + # Hopefully have some output from the tmtests + echo "=== Checking for timing information" + c=`ls -1 times* 2>/dev/null | wc -l` + if [ ${c} -eq 0 ] ; then + echo "Please run the timing tests and include the results." + fi +fi ## END OF IF BSP + exit 0 |