#! /bin/sh # # Generate a summary report if [ $# -eq 0 ] ; then echo "Takes at least one argument (usually a date)" exit 1 fi handle=$1 include_net="yes" # -e '/warning: .rtems_clock_get. is deprecated/d' # -e '/warning: .rtems_task_get_note. is deprecated/d' # -e '/warning: .rtems_task_set_note. is deprecated/d' # -e '/warning: .notepad. is deprecated/d' # -e '/warning: .Notepads. is deprecated/d' # -e '/warning: .rtems_task_variable_add. is deprecated/d' # -e '/warning: .rtems_task_variable_dtor. is deprecated/d' # -e '/warning: .rtems_task_variable_get. is deprecated/d' # -e '/warning: ._RTEMS_Tasks_Invoke_task_variable_dtor. is deprecated/d' # -e '/hexdump-conv.c:149:/d' # -e '/rtl-mdreloc-mips.c:/d' filter_net_warnings() { if [ ${include_net} = "no" ] ; then sed \ -e '/cpukit\/libnetworking.*warning: /d' \ -e '/cpukit\/librpc.*warning: /d' \ -e '/cpukit\/telnetd.*warning: /d' \ -e '/cpukit\/pppd.*warning: /d' \ -e '/cpukit\/libfs\/src\/nfs.*warning: /d' \ -e '/libchip\/network.*warning: /d' \ -e '/erc32\/erc32sonicn.*warning: /d' \ -e '/warning .implement a proper /d' else cat fi } filter_warnings() { # libtests/math/domath.h FP printf() warning with gcc 4.8.x not >= 4.9 # -e '/testsuites/libtests/math/domath.h:/d' # -e '/testsuites/libtests/complex/docomplex.h:/d' # known: m68k _CPU_Context_Restart_self restoring FPU context not implemented # known: sparc/sparcv8-atomic.c:111: # known: cc1plus command line options not valid for C # known: notepads deprecated in confdefs.h # known: task variables deprecated in confdefs.h # known: Clock skew detected (issue in distributed builds) # what was this pattern for? # -e 's/^log.*\.\.\/rtems\///' grep warning $* | sed \ -e '/Makefile:/d' \ -e '/libtests\/math\/domath.h/d' \ -e '/libtests\/complex\/docomplex.h/d' \ -e '/_CPU_Context_Restart_self restoring FPU context not implemented/d' \ -e '/sparc\/sparcv8-atomic.c:111:/d' \ -e '/cc1plus: warning: command line option.* is valid for C\/ObjC/d' \ -e '/Classic API Notepads are deprecated and will be removed/d' \ -e '/Per-Task Variables are deprecated and will be removed/d' \ -e '/is deprecated (declared at /d' \ -e '/warning: Clock skew detected./d' \ -e '/log\/avr-/d' \ -e '/log\/h8300-/d' \ -e '/log\/m32c-/d' \ | filter_net_warnings } summary() { echo "Unique Warnings : " ${unique} echo "BSPs : " ${bsps} echo "BSPs with Zero : " ${no_warnings} echo "BSPs with only in shared: " ${shared_only} echo echo "====================================" echo " Warnings by Class" echo "====================================" cat ${wdir}/warnings-by-class-${handle}.txt echo echo "====================================" echo " Top Ten BSPs with Warnings" echo "====================================" cat ${wdir}/warnings-per-bsp-${handle}.txt | \ grep -v "shared" | sort -n -k 2 -t '=' | tail -10 } warnings_per_bsp() { for i in $* do BSP=`echo $i | sed -e "s/^....//" -e "s/....$//"` count=`filter_warnings ${i} | sed -e 's/^log.*\.\.\/rtems\///' | wc -l` in_bsp=`filter_warnings ${i} | grep /libbsp/ | wc -l` in_libcpu=`filter_warnings ${i} | grep /libcpu/ | wc -l` #in_tests=`filter_warnings ${i} | grep /testsuites/ | wc -l` # where="(inBSP=${in_bsp} inLibCPU=${in_libcpu} inTests=${in_tests})" where="(inBSP=${in_bsp} inLibCPU=${in_libcpu})" if [ ${in_bsp} -eq 0 -a ${in_libcpu} -eq 0 ] ; then if [ ${count} -eq 0 ] ; then where="(none)" else where="(only shared)" fi fi echo ${count} ${BSP} " ${where}" done | sort -n } if [ -r $1 ] ; then filter_warnings $* exit 0 fi wdir=warnings/warnings-${handle} if [ ! -d warnings ] ; then echo "warnings top directory does not exist" exit 1 fi if [ -d ${wdir} ] ; then echo "${wdir} directory DOES exist." echo "Remove it or pick another directory." exit 1 fi mkdir ${wdir} # -l and -v do not appear to work togheter. :( #logs=`grep -l -v ^ERROR log/*` logs="" for f in log/* do grep ^ERROR ${f} >/dev/null if [ $? -ne 0 ] ; then logs="${logs} ${f}" fi done filter_warnings ${logs} >${wdir}/warnings-all-${handle}.txt filter_warnings ${logs} | cut -d':' -f2- | sort | uniq -c | \ sort -n -r >${wdir}/warnings-${handle}.txt warnings_per_bsp ${logs} >${wdir}/warnings-per-bsp-${handle}.txt grep "\[-W" ${wdir}/warnings-${handle}.txt | \ sed -e 's/^.*\[-W//' -e 's/\]//' | sort | \ uniq -c >${wdir}/warnings-by-class-${handle}.txt bsps=`cat ${wdir}/warnings-per-bsp-${handle}.txt | wc -l` unique=`cat ${wdir}/warnings-${handle}.txt | wc -l` shared_only=`grep shared ${wdir}/warnings-per-bsp-${handle}.txt | wc -l` no_warnings=`grep none ${wdir}/warnings-per-bsp-${handle}.txt | wc -l` summary >${wdir}/warnings-summary-${handle}.txt cat ${wdir}/warnings-summary-${handle}.txt exit 0